efl_page_indicator: add unpack function
authorJaeun Choi <jaeun12.choi@samsung.com>
Thu, 24 Jan 2019 09:42:24 +0000 (18:42 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Thu, 31 Jan 2019 01:53:51 +0000 (10:53 +0900)
src/lib/elementary/efl_page_indicator.c
src/lib/elementary/efl_page_indicator_icon.c
src/lib/elementary/elm_priv.h

index 9f8aeeb..57cd2bf 100644 (file)
@@ -30,6 +30,19 @@ _efl_page_indicator_pack(Eo *obj EINA_UNUSED,
 }
 
 EOLIAN static void
+_efl_page_indicator_unpack(Eo *obj EINA_UNUSED,
+                           Efl_Page_Indicator_Data *pd,
+                           int index)
+{
+   pd->cnt--;
+
+   if ((pd->cnt == 0) ||
+       ((index == pd->curr_idx) && (index != 0)) ||
+       (index < pd->curr_idx))
+     pd->curr_idx--;
+}
+
+EOLIAN static void
 _efl_page_indicator_bind(Eo *obj EINA_UNUSED,
                          Efl_Page_Indicator_Data *pd,
                          Eo *pager,
@@ -57,11 +70,15 @@ EOAPI EFL_VOID_FUNC_BODYV(efl_page_indicator_update,
                           EFL_FUNC_CALL(pos), double pos)
 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)
 
 #define EFL_PAGE_INDICATOR_EXTRA_OPS \
    EFL_OBJECT_OP_FUNC(efl_page_indicator_update, \
                       _efl_page_indicator_update), \
    EFL_OBJECT_OP_FUNC(efl_page_indicator_pack, \
-                      _efl_page_indicator_pack)
+                      _efl_page_indicator_pack), \
+   EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack, \
+                      _efl_page_indicator_unpack)
 
 #include "efl_page_indicator.eo.c"
index 993ddfd..0c7f939 100644 (file)
@@ -80,6 +80,31 @@ _efl_page_indicator_icon_pack(Eo *obj,
 }
 
 EOLIAN static void
+_efl_page_indicator_icon_unpack(Eo *obj,
+                                Efl_Page_Indicator_Icon_Data *pd,
+                                int index)
+{
+   EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
+   Eo *item;
+
+   item = eina_list_nth(pd->items, index);
+   pd->items = eina_list_remove(pd->items, item);
+   efl_pack_unpack(spd->idbox, item);
+   efl_del(item);
+
+   if (index == spd->curr_idx) pd->curr = NULL;
+
+   efl_page_indicator_unpack(efl_super(obj, MY_CLASS), index);
+
+   if ((pd->curr == NULL) && (spd->curr_idx != -1))
+     {
+        pd->curr = eina_list_nth(pd->items, spd->curr_idx);
+        eina_value_set(pd->v, 1.0);
+        efl_layout_signal_message_send(pd->curr, 1, *(pd->v));
+     }
+}
+
+EOLIAN static void
 _efl_page_indicator_icon_efl_page_indicator_bind(Eo *obj,
                                                  Efl_Page_Indicator_Icon_Data *pd,
                                                  Eo *pager,
@@ -135,6 +160,8 @@ _efl_page_indicator_icon_efl_page_indicator_bind(Eo *obj,
    EFL_OBJECT_OP_FUNC(efl_page_indicator_update, \
                       _efl_page_indicator_icon_update), \
    EFL_OBJECT_OP_FUNC(efl_page_indicator_pack, \
-                      _efl_page_indicator_icon_pack)
+                      _efl_page_indicator_icon_pack), \
+   EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack, \
+                      _efl_page_indicator_icon_unpack)
 
 #include "efl_page_indicator_icon.eo.c"
index 835ed2a..7788f6a 100644 (file)
@@ -808,6 +808,7 @@ 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);
 
 Eina_Bool _elm_config_accel_preference_parse(const char *pref, Eina_Stringshare **accel, int *gl_depth, int *gl_stencil, int *gl_msaa);