eagleeye pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c4ae2be68588c58459d7eb9b0435ab2f02550575
commit c4ae2be68588c58459d7eb9b0435ab2f02550575 Author: Hosang Kim <hosang12....@samsung.com> Date: Wed Nov 28 14:32:39 2018 +0900 efl_ui_scrollable: implement efl_ui_scrollable_content_pos_get method. Summary: Applications want to know current position on scroller. Also, it is necessary when calculate position of focusable object. Reviewers: herdsman, akanad, YOhoho, bu5hm4n Reviewed By: bu5hm4n Subscribers: bu5hm4n, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7251 --- src/bin/elementary/test_ui_scroller.c | 6 +- src/lib/elementary/efl_ui_image_zoomable.c | 1 + src/lib/elementary/efl_ui_list.c | 90 +----------------------------- src/lib/elementary/efl_ui_list.eo | 7 --- src/lib/elementary/efl_ui_list_view.c | 28 +--------- src/lib/elementary/efl_ui_list_view.eo | 3 - src/lib/elementary/efl_ui_scroller.c | 90 +----------------------------- src/lib/elementary/efl_ui_scroller.eo | 7 --- src/lib/elementary/efl_ui_widget.c | 16 +++++- 9 files changed, 21 insertions(+), 227 deletions(-) diff --git a/src/bin/elementary/test_ui_scroller.c b/src/bin/elementary/test_ui_scroller.c index 3edc6868bf..a1f8cbd2f8 100644 --- a/src/bin/elementary/test_ui_scroller.c +++ b/src/bin/elementary/test_ui_scroller.c @@ -13,13 +13,15 @@ _bt_clicked(void *data EINA_UNUSED, const Efl_Event *ev) static void _scroll_start_cb(void *data EINA_UNUSED, const Efl_Event *ev) { - printf("scroll start: %p\n", ev->object); + Eina_Position2D pos = efl_ui_scrollable_content_pos_get(ev->object); + printf("scroll start: %p x: %d y: %d\n", ev->object, pos.x, pos.y); } static void _scroll_stop_cb(void *data EINA_UNUSED, const Efl_Event *ev) { - printf("scroll stop: %p\n", ev->object); + Eina_Position2D pos = efl_ui_scrollable_content_pos_get(ev->object); + printf("scroll stop: %p x: %d y: %d\n", ev->object, pos.x, pos.y); } void diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 2a565067fd..2a46ddb29b 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -1847,6 +1847,7 @@ _efl_ui_image_zoomable_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Zoomable elm_widget_can_focus_set(obj, EINA_TRUE); priv->smanager = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj); + efl_composite_attach(obj, priv->smanager); efl_ui_mirrored_set(priv->smanager, efl_ui_mirrored_get(obj)); efl_ui_scrollable_bounce_enabled_set(priv->smanager, bounce, bounce); diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c index 0184234724..045346ceee 100644 --- a/src/lib/elementary/efl_ui_list.c +++ b/src/lib/elementary/efl_ui_list.c @@ -433,6 +433,7 @@ _efl_ui_list_efl_object_finalize(Eo *obj, pd->smanager = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj); efl_ui_mirrored_set(pd->smanager, efl_ui_mirrored_get(obj)); + efl_composite_attach(obj, pd->smanager); pd->pan = efl_add(EFL_UI_PAN_CLASS, obj); @@ -914,68 +915,6 @@ _efl_ui_list_efl_pack_pack_padding_get(const Eo *obj EINA_UNUSED, */ /* Scroll APIs */ -EOLIAN static Eina_Size2D -_efl_ui_list_efl_ui_scrollable_interactive_content_size_get(const Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd) -{ - return efl_ui_scrollable_content_size_get(pd->smanager); -} - -EOLIAN static Eina_Rect -_efl_ui_list_efl_ui_scrollable_interactive_viewport_geometry_get(const Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd) -{ - return efl_ui_scrollable_viewport_geometry_get(pd->smanager); -} - -EOLIAN static void -_efl_ui_list_efl_ui_scrollable_interactive_bounce_enabled_set(Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd, - Eina_Bool horiz, - Eina_Bool vert) -{ - efl_ui_scrollable_bounce_enabled_set(pd->smanager, horiz, vert); -} - -EOLIAN static void -_efl_ui_list_efl_ui_scrollable_interactive_bounce_enabled_get(const Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd, - Eina_Bool *horiz, - Eina_Bool *vert) -{ - efl_ui_scrollable_bounce_enabled_get(pd->smanager, horiz, vert); -} - -EOLIAN static Eina_Bool -_efl_ui_list_efl_ui_scrollable_interactive_scroll_hold_get(const Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd) -{ - return efl_ui_scrollable_scroll_hold_get(pd->smanager); -} - -EOLIAN static void -_efl_ui_list_efl_ui_scrollable_interactive_scroll_hold_set(Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd, - Eina_Bool hold) -{ - efl_ui_scrollable_scroll_hold_set(pd->smanager, hold); -} - -EOLIAN static Eina_Bool -_efl_ui_list_efl_ui_scrollable_interactive_scroll_freeze_get(const Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd) -{ - return efl_ui_scrollable_scroll_freeze_get(pd->smanager); -} - -EOLIAN static void -_efl_ui_list_efl_ui_scrollable_interactive_scroll_freeze_set(Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd, - Eina_Bool freeze) -{ - efl_ui_scrollable_scroll_freeze_set(pd->smanager, freeze); -} - EOLIAN static void _efl_ui_list_efl_ui_scrollable_interactive_match_content_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, @@ -990,33 +929,6 @@ _efl_ui_list_efl_ui_scrollable_interactive_match_content_set(Eo *obj EINA_UNUSED elm_layout_sizing_eval(obj); } -EOLIAN static void -_efl_ui_list_efl_ui_scrollbar_bar_mode_set(Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd, - Efl_Ui_Scrollbar_Mode hmode, - Efl_Ui_Scrollbar_Mode vmode) -{ - efl_ui_scrollbar_bar_mode_set(pd->smanager, hmode, vmode); -} - -EOLIAN static void -_efl_ui_list_efl_ui_scrollbar_bar_mode_get(const Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd, - Efl_Ui_Scrollbar_Mode *hmode, - Efl_Ui_Scrollbar_Mode *vmode) -{ - efl_ui_scrollbar_bar_mode_get(pd->smanager, hmode, vmode); -} - -EOLIAN static void -_efl_ui_list_efl_ui_scrollable_interactive_scroll(Eo *obj EINA_UNUSED, - Efl_Ui_List_Data *pd, - Eina_Rect rc, - Eina_Bool animation) -{ - efl_ui_scrollable_scroll(pd->smanager, rc, animation); -} - EOLIAN static void _efl_ui_list_efl_ui_multi_selectable_select_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, diff --git a/src/lib/elementary/efl_ui_list.eo b/src/lib/elementary/efl_ui_list.eo index f6fb19cef6..00e60d6f69 100644 --- a/src/lib/elementary/efl_ui_list.eo +++ b/src/lib/elementary/efl_ui_list.eo @@ -78,14 +78,7 @@ class Efl.Ui.List (Efl.Ui.Layout, //Efl.Pack.pack_align { get; set; } //Efl.Ui.Scrollable - Efl.Ui.Scrollable_Interactive.scroll; - Efl.Ui.Scrollable_Interactive.content_size{ get; } - Efl.Ui.Scrollable_Interactive.viewport_geometry{ get; } - Efl.Ui.Scrollable_Interactive.bounce_enabled { set; get; } - Efl.Ui.Scrollable_Interactive.scroll_freeze { get; set; } - Efl.Ui.Scrollable_Interactive.scroll_hold { get; set; } Efl.Ui.Scrollable_Interactive.match_content { set; } - Efl.Ui.Scrollbar.bar_mode { get; set; } //Efl.Ui.Multi_Selectable Efl.Ui.Multi_Selectable.select_mode {get; set;} diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c index 690ac43960..94e9fdbf94 100644 --- a/src/lib/elementary/efl_ui_list_view.c +++ b/src/lib/elementary/efl_ui_list_view.c @@ -111,33 +111,6 @@ _efl_ui_list_view_pan_efl_object_destructor(Eo *obj, Efl_Ui_List_View_Pan_Data * #include "efl_ui_list_view_pan.eo.c" -EOLIAN static void -_efl_ui_list_view_efl_ui_scrollable_interactive_content_pos_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *psd, Eina_Position2D pos) -{ - efl_ui_scrollable_content_pos_set(psd->scrl_mgr, pos); -} - -EOLIAN static Eina_Position2D -_efl_ui_list_view_efl_ui_scrollable_interactive_content_pos_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *psd) -{ - Eina_Position2D pos = efl_ui_scrollable_content_pos_get(psd->scrl_mgr); - return pos; -} - -EOLIAN static Eina_Size2D -_efl_ui_list_view_efl_ui_scrollable_interactive_content_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *psd) -{ - Eina_Size2D size = efl_ui_scrollable_content_size_get(psd->scrl_mgr); - return size; -} - -EOLIAN static Eina_Rect -_efl_ui_list_view_efl_ui_scrollable_interactive_viewport_geometry_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *psd) -{ - Eina_Rect gmt = efl_ui_scrollable_viewport_geometry_get(psd->scrl_mgr); - return gmt; -} - static Eina_Bool _efl_model_properties_has(Efl_Model *model, Eina_Stringshare *propfind) { @@ -610,6 +583,7 @@ _efl_ui_list_view_efl_canvas_group_group_add(Eo *obj, Efl_Ui_List_View_Data *pd) pd->scrl_mgr = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj, efl_ui_mirrored_set(efl_added, efl_ui_mirrored_get(obj))); + efl_composite_attach(obj, pd->scrl_mgr); pd->pan_obj = efl_add(MY_PAN_CLASS, obj); pan_data = efl_data_scope_get(pd->pan_obj, MY_PAN_CLASS); pan_data->wobj = obj; diff --git a/src/lib/elementary/efl_ui_list_view.eo b/src/lib/elementary/efl_ui_list_view.eo index aec3a58b51..971a0187c8 100644 --- a/src/lib/elementary/efl_ui_list_view.eo +++ b/src/lib/elementary/efl_ui_list_view.eo @@ -83,9 +83,6 @@ class Efl.Ui.List_View (Efl.Ui.Layout, Efl.Ui.Scrollable_Interactive, Efl.Ui.Scr Efl.Ui.Focus.Composition.prepare; Efl.Ui.View.model { get; set; } - Efl.Ui.Scrollable_Interactive.viewport_geometry { get; } - Efl.Ui.Scrollable_Interactive.content_pos { get; set; } - Efl.Ui.Scrollable_Interactive.content_size { get; } // Efl.Ui.Scrollable_Interactive.scroll; Efl.Layout.Signal.signal_callback_add; Efl.Layout.Signal.signal_callback_del; diff --git a/src/lib/elementary/efl_ui_scroller.c b/src/lib/elementary/efl_ui_scroller.c index 8ad0466f08..0c750ef301 100644 --- a/src/lib/elementary/efl_ui_scroller.c +++ b/src/lib/elementary/efl_ui_scroller.c @@ -406,6 +406,7 @@ _efl_ui_scroller_efl_object_finalize(Eo *obj, sd->smanager = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj); efl_ui_mirrored_set(sd->smanager, efl_ui_mirrored_get(obj)); + efl_composite_attach(obj, sd->smanager); sd->pan_obj = efl_add(EFL_UI_PAN_CLASS, obj); @@ -527,68 +528,6 @@ _efl_ui_scroller_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Scroller_Data *sd) return int_ret; } -EOLIAN static Eina_Size2D -_efl_ui_scroller_efl_ui_scrollable_interactive_content_size_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd) -{ - return efl_ui_scrollable_content_size_get(sd->smanager); -} - -EOLIAN static Eina_Rect -_efl_ui_scroller_efl_ui_scrollable_interactive_viewport_geometry_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd) -{ - return efl_ui_scrollable_viewport_geometry_get(sd->smanager); -} - -EOLIAN static void -_efl_ui_scroller_efl_ui_scrollable_interactive_bounce_enabled_set(Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd, - Eina_Bool horiz, - Eina_Bool vert) -{ - efl_ui_scrollable_bounce_enabled_set(sd->smanager, horiz, vert); -} - -EOLIAN static void -_efl_ui_scroller_efl_ui_scrollable_interactive_bounce_enabled_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd, - Eina_Bool *horiz, - Eina_Bool *vert) -{ - efl_ui_scrollable_bounce_enabled_get(sd->smanager, horiz, vert); -} - -EOLIAN static Eina_Bool -_efl_ui_scroller_efl_ui_scrollable_interactive_scroll_hold_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd) -{ - return efl_ui_scrollable_scroll_hold_get(sd->smanager); -} - -EOLIAN static void -_efl_ui_scroller_efl_ui_scrollable_interactive_scroll_hold_set(Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd, - Eina_Bool hold) -{ - efl_ui_scrollable_scroll_hold_set(sd->smanager, hold); -} - -EOLIAN static Eina_Bool -_efl_ui_scroller_efl_ui_scrollable_interactive_scroll_freeze_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd) -{ - return efl_ui_scrollable_scroll_freeze_get(sd->smanager); -} - -EOLIAN static void -_efl_ui_scroller_efl_ui_scrollable_interactive_scroll_freeze_set(Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd, - Eina_Bool freeze) -{ - efl_ui_scrollable_scroll_freeze_set(sd->smanager, freeze); -} - EOLIAN static void _efl_ui_scroller_efl_ui_scrollable_interactive_match_content_set(Eo *obj EINA_UNUSED, Efl_Ui_Scroller_Data *sd, @@ -603,33 +542,6 @@ _efl_ui_scroller_efl_ui_scrollable_interactive_match_content_set(Eo *obj EINA_UN elm_layout_sizing_eval(obj); } -EOLIAN static void -_efl_ui_scroller_efl_ui_scrollbar_bar_mode_set(Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd, - Efl_Ui_Scrollbar_Mode hmode, - Efl_Ui_Scrollbar_Mode vmode) -{ - efl_ui_scrollbar_bar_mode_set(sd->smanager, hmode, vmode); -} - -EOLIAN static void -_efl_ui_scroller_efl_ui_scrollbar_bar_mode_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd, - Efl_Ui_Scrollbar_Mode *hmode, - Efl_Ui_Scrollbar_Mode *vmode) -{ - efl_ui_scrollbar_bar_mode_get(sd->smanager, hmode, vmode); -} - -EOLIAN static void -_efl_ui_scroller_efl_ui_scrollable_interactive_scroll(Eo *obj EINA_UNUSED, - Efl_Ui_Scroller_Data *sd, - Eina_Rect rc, - Eina_Bool animation) -{ - efl_ui_scrollable_scroll(sd->smanager, rc, animation); -} - /* Internal EO APIs and hidden overrides */ #define EFL_UI_SCROLLER_EXTRA_OPS \ diff --git a/src/lib/elementary/efl_ui_scroller.eo b/src/lib/elementary/efl_ui_scroller.eo index 8444294757..c037fe787e 100644 --- a/src/lib/elementary/efl_ui_scroller.eo +++ b/src/lib/elementary/efl_ui_scroller.eo @@ -10,13 +10,6 @@ class Efl.Ui.Scroller (Efl.Ui.Layout, Efl.Object.destructor; Efl.Content.content { set; } Efl.Ui.Widget.theme_apply; - Efl.Ui.Scrollable_Interactive.content_size{ get; } - Efl.Ui.Scrollable_Interactive.viewport_geometry{ get; } - Efl.Ui.Scrollable_Interactive.bounce_enabled { set; get; } - Efl.Ui.Scrollable_Interactive.scroll_freeze { get; set; } - Efl.Ui.Scrollable_Interactive.scroll_hold { get; set; } Efl.Ui.Scrollable_Interactive.match_content { set; } - Efl.Ui.Scrollbar.bar_mode { get; set; } - Efl.Ui.Scrollable_Interactive.scroll; } } diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index d4a253191d..ecc9b5f2c0 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -2547,9 +2547,19 @@ _efl_ui_widget_show_region_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Rect sr, if (_elm_scrollable_is(obj)) { - elm_interface_scrollable_content_pos_get(obj, &nx, &ny); - sr.x -= nx; - sr.y -= ny; + if (elm_widget_is_legacy(obj)) + { + elm_interface_scrollable_content_pos_get(obj, &nx, &ny); + sr.x -= nx; + sr.y -= ny; + } + else + { + Eina_Position2D pos; + pos = efl_ui_scrollable_content_pos_get(obj); + sr.x -= pos.x; + sr.y -= pos.y; + } } } --