eunue pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=74c48f029632d2260816b4cb3de6dbb40a29f040
commit 74c48f029632d2260816b4cb3de6dbb40a29f040 Author: Jaeun Choi <jaeun12.c...@samsung.com> Date: Fri Mar 29 19:48:58 2019 +0900 efl_ui_pager: implement unpack_all/clear function --- src/lib/elementary/efl_page_indicator.c | 13 ++++++- src/lib/elementary/efl_page_indicator_icon.c | 20 +++++++++- src/lib/elementary/efl_page_transition.c | 11 ++++++ src/lib/elementary/efl_page_transition_scroll.c | 20 ++++++++++ src/lib/elementary/efl_ui_pager.c | 51 ++++++++++++++++++++++--- src/lib/elementary/elm_priv.h | 2 + 6 files changed, 109 insertions(+), 8 deletions(-) diff --git a/src/lib/elementary/efl_page_indicator.c b/src/lib/elementary/efl_page_indicator.c index 57cd2bf9f9..6b0be267b2 100644 --- a/src/lib/elementary/efl_page_indicator.c +++ b/src/lib/elementary/efl_page_indicator.c @@ -42,6 +42,14 @@ _efl_page_indicator_unpack(Eo *obj EINA_UNUSED, pd->curr_idx--; } +EOLIAN static void +_efl_page_indicator_unpack_all(Eo *obj EINA_UNUSED, + Efl_Page_Indicator_Data *pd) +{ + pd->cnt = 0; + pd->curr_idx = -1; +} + EOLIAN static void _efl_page_indicator_bind(Eo *obj EINA_UNUSED, Efl_Page_Indicator_Data *pd, @@ -72,6 +80,7 @@ EOAPI EFL_VOID_FUNC_BODYV(efl_page_indicator_pack, EFL_FUNC_CALL(index), int index) EOAPI EFL_VOID_FUNC_BODYV(efl_page_indicator_unpack, EFL_FUNC_CALL(index), int index) +EOAPI EFL_VOID_FUNC_BODY(efl_page_indicator_unpack_all) #define EFL_PAGE_INDICATOR_EXTRA_OPS \ EFL_OBJECT_OP_FUNC(efl_page_indicator_update, \ @@ -79,6 +88,8 @@ EOAPI EFL_VOID_FUNC_BODYV(efl_page_indicator_unpack, EFL_OBJECT_OP_FUNC(efl_page_indicator_pack, \ _efl_page_indicator_pack), \ EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack, \ - _efl_page_indicator_unpack) + _efl_page_indicator_unpack), \ + EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack_all, \ + _efl_page_indicator_unpack_all) #include "efl_page_indicator.eo.c" diff --git a/src/lib/elementary/efl_page_indicator_icon.c b/src/lib/elementary/efl_page_indicator_icon.c index 3c9c54e75e..55326cfdd6 100644 --- a/src/lib/elementary/efl_page_indicator_icon.c +++ b/src/lib/elementary/efl_page_indicator_icon.c @@ -109,6 +109,22 @@ _efl_page_indicator_icon_unpack(Eo *obj, } } +EOLIAN static void +_efl_page_indicator_icon_unpack_all(Eo *obj, + Efl_Page_Indicator_Icon_Data *pd) +{ + Eo *item; + + EINA_LIST_FREE(pd->items, item) + { + efl_del(item); + } + + pd->curr = NULL; + + efl_page_indicator_unpack_all(efl_super(obj, MY_CLASS)); +} + EOLIAN static void _efl_page_indicator_icon_efl_page_indicator_bind(Eo *obj, Efl_Page_Indicator_Icon_Data *pd, @@ -168,6 +184,8 @@ _efl_page_indicator_icon_efl_page_indicator_bind(Eo *obj, EFL_OBJECT_OP_FUNC(efl_page_indicator_pack, \ _efl_page_indicator_icon_pack), \ EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack, \ - _efl_page_indicator_icon_unpack) + _efl_page_indicator_icon_unpack), \ + EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack_all, \ + _efl_page_indicator_icon_unpack_all) #include "efl_page_indicator_icon.eo.c" diff --git a/src/lib/elementary/efl_page_transition.c b/src/lib/elementary/efl_page_transition.c index 3740a6996d..f6d73a2c10 100644 --- a/src/lib/elementary/efl_page_transition.c +++ b/src/lib/elementary/efl_page_transition.c @@ -71,6 +71,14 @@ _efl_page_transition_pack(Eo *obj EINA_UNUSED, } +EOLIAN static void +_efl_page_transition_unpack_all(Eo *obj EINA_UNUSED, + Efl_Page_Transition_Data *pd EINA_UNUSED, + int index EINA_UNUSED) +{ + +} + EOLIAN static void _efl_page_transition_curr_page_change(Eo *obj EINA_UNUSED, Efl_Page_Transition_Data *pd EINA_UNUSED, @@ -94,6 +102,7 @@ EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_update, EFL_FUNC_CALL(move), double move) EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_pack, EFL_FUNC_CALL(index), int index) +EOAPI EFL_VOID_FUNC_BODY(efl_page_transition_unpack_all) EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_curr_page_change, EFL_FUNC_CALL(diff), int diff) EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_page_size_set, @@ -109,6 +118,8 @@ EOAPI EFL_FUNC_BODYV(efl_page_transition_loop_set, Eina_Bool, 0, _efl_page_transition_update), \ EFL_OBJECT_OP_FUNC(efl_page_transition_pack, \ _efl_page_transition_pack), \ + EFL_OBJECT_OP_FUNC(efl_page_transition_unpack_all, \ + _efl_page_transition_unpack_all), \ EFL_OBJECT_OP_FUNC(efl_page_transition_curr_page_change, \ _efl_page_transition_curr_page_change), \ EFL_OBJECT_OP_FUNC(efl_page_transition_page_size_set, \ diff --git a/src/lib/elementary/efl_page_transition_scroll.c b/src/lib/elementary/efl_page_transition_scroll.c index 5c5cb9aa11..ac3c6dab1d 100644 --- a/src/lib/elementary/efl_page_transition_scroll.c +++ b/src/lib/elementary/efl_page_transition_scroll.c @@ -412,6 +412,24 @@ _efl_page_transition_scroll_pack(Eo *obj, _efl_page_transition_scroll_update(obj, pd, 0.0); } +EOLIAN static void +_efl_page_transition_scroll_unpack_all(Eo *obj EINA_UNUSED, + Efl_Page_Transition_Scroll_Data *pd) +{ + Eina_List *list; + Page_Info *pi; + + EINA_LIST_FOREACH(pd->page_infos, list, pi) + { + efl_pack_unpack(pi->obj, pi->content); + + pi->content_num = -1; + pi->content = NULL; + pi->visible = EINA_FALSE; + } + return EINA_TRUE; +} + EOLIAN static void _efl_page_transition_scroll_curr_page_change(Eo *obj EINA_UNUSED, Efl_Page_Transition_Scroll_Data *pd, @@ -656,6 +674,8 @@ _efl_page_transition_scroll_efl_object_invalidate(Eo *obj, _efl_page_transition_scroll_update), \ EFL_OBJECT_OP_FUNC(efl_page_transition_pack, \ _efl_page_transition_scroll_pack), \ + EFL_OBJECT_OP_FUNC(efl_page_transition_unpack_all, \ + _efl_page_transition_scroll_unpack_all), \ EFL_OBJECT_OP_FUNC(efl_page_transition_curr_page_change, \ _efl_page_transition_scroll_curr_page_change), \ EFL_OBJECT_OP_FUNC(efl_page_transition_page_size_set, \ diff --git a/src/lib/elementary/efl_ui_pager.c b/src/lib/elementary/efl_ui_pager.c index 520398941c..0ce1488d8c 100644 --- a/src/lib/elementary/efl_ui_pager.c +++ b/src/lib/elementary/efl_ui_pager.c @@ -784,20 +784,59 @@ _efl_ui_pager_loop_mode_get(const Eo *obj EINA_UNUSED, return pd->loop; } +static void +_unpack_all(Efl_Ui_Pager_Data *pd, + Eina_Bool clear) +{ + Eo *subobj; + + pd->cnt = 0; + pd->curr.page = -1; + pd->curr.pos = 0.0; + + if (pd->transition) + { + efl_page_transition_unpack_all(pd->transition); + } + else + { + subobj = eina_list_nth(pd->content_list, pd->curr.page); + efl_pack_unpack(pd->page_box, subobj); + } + + if (clear) + { + EINA_LIST_FREE(pd->content_list, subobj) + evas_object_del(subobj); + } + else + { + EINA_LIST_FREE(pd->content_list, subobj) + efl_canvas_object_clipper_set(subobj, NULL); + } + + if (pd->indicator) + { + efl_page_indicator_unpack_all(pd->indicator); + } +} + EOLIAN static Eina_Bool _efl_ui_pager_efl_pack_pack_clear(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd EINA_UNUSED) + Efl_Ui_Pager_Data *pd) { - ERR("Soon to be implemented"); - return EINA_FALSE; + _unpack_all(pd, EINA_TRUE); + + return EINA_TRUE; } EOLIAN static Eina_Bool _efl_ui_pager_efl_pack_unpack_all(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd EINA_UNUSED) + Efl_Ui_Pager_Data *pd) { - ERR("Soon to be implemented"); - return EINA_FALSE; + _unpack_all(pd, EINA_FALSE); + + return EINA_TRUE; } static void diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 54c32cf9a6..a1bd8be552 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -875,12 +875,14 @@ EOAPI void efl_page_transition_page_size_set(Eo *obj, Eina_Size2D sz); EOAPI void efl_page_transition_padding_size_set(Eo *obj, int padding); EOAPI void efl_page_transition_update(Eo *obj, double pos); EOAPI void efl_page_transition_pack(Eo *obj, int index); +EOAPI void efl_page_transition_unpack_all(Eo *obj); EOAPI void efl_page_transition_curr_page_change(Eo *obj, int diff); EOAPI Eina_Bool efl_page_transition_loop_set(Eo *obj, Efl_Ui_Pager_Loop loop); EOAPI void efl_page_indicator_update(Eo *obj, double pos); EOAPI void efl_page_indicator_pack(Eo *obj, int index); EOAPI void efl_page_indicator_unpack(Eo *obj, int index); +EOAPI void efl_page_indicator_unpack_all(Eo *obj); Eina_Bool _elm_config_accel_preference_parse(const char *pref, Eina_Stringshare **accel, int *gl_depth, int *gl_stencil, int *gl_msaa); --