elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry...
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 10 Jan 2012 05:02:11 +0000 (05:02 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 10 Jan 2012 05:02:11 +0000 (05:02 +0000)
But instead,  made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@67010 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

35 files changed:
doc/examples.dox
src/bin/test_index.c
src/bin/test_naviframe.c
src/examples/diskselector_example_02.c
src/examples/flipselector_example.c
src/examples/hoversel_example_01.c
src/examples/index_example_01.c
src/examples/menu_example_01.c
src/examples/segment_control_example.c
src/examples/web_example.c
src/lib/elc_ctxpopup.c
src/lib/elc_ctxpopup.h
src/lib/elc_hoversel.c
src/lib/elc_hoversel.h
src/lib/elc_multibuttonentry.c
src/lib/elc_multibuttonentry.h
src/lib/elc_naviframe.c
src/lib/elc_naviframe.h
src/lib/elm_deprecated.h
src/lib/elm_diskselector.c
src/lib/elm_diskselector.h
src/lib/elm_flipselector.c
src/lib/elm_flipselector.h
src/lib/elm_index.c
src/lib/elm_index.h
src/lib/elm_menu.c
src/lib/elm_menu.h
src/lib/elm_segment_control.c
src/lib/elm_segment_control.h
src/lib/elm_slideshow.c
src/lib/elm_slideshow.h
src/lib/elm_toolbar.c
src/lib/elm_toolbar.h
src/lib/elm_widget.c
src/lib/elm_widget.h

index 37a73b6..94f2e59 100644 (file)
  * @skipline _del_cb
  * @until }
  *
- * To delete an item we simple need to call elm_diskselector_item_del() with
+ * To delete an item we simple need to call elm_object_item_del() with
  * a pointer for such item.
  *
  * If you need, you can get selected item with
index f8dcd3e..118c7af 100644 (file)
@@ -168,7 +168,7 @@ test_index2_it_del(void *data, Evas_Object *obj, void *event_info __UNUSED__)
    if (!it_next)
      {
         iit = elm_index_item_find(gui->id, it);
-        if (iit) elm_index_item_del(gui->id, iit);
+        if (iit) elm_object_item_del(iit);
         elm_list_item_del(it);
         return;
      }
@@ -180,7 +180,7 @@ test_index2_it_del(void *data, Evas_Object *obj, void *event_info __UNUSED__)
    if (label[0] == label_next[0])
      elm_object_item_data_set(iit, it_next);
    else
-     elm_index_item_del(gui->id, iit);
+     elm_object_item_del(iit);
 
    elm_list_item_del(it);
 }
index 9740c27..6213d5a 100644 (file)
@@ -34,7 +34,7 @@ _navi_pop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 void
 _navi_it_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   elm_naviframe_item_del(data);
+   elm_object_item_del(data);
 }
 
 void
index 36f0fed..7f32aa7 100644 (file)
@@ -112,7 +112,7 @@ _del_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
    Evas_Object *ds = data;
 
    selected_ds_it = elm_diskselector_selected_item_get(ds);
-   elm_diskselector_item_del(selected_ds_it);
+   elm_object_item_del(selected_ds_it);
 }
 
 static void
index a6a8bc9..e720bf3 100644 (file)
@@ -54,7 +54,7 @@ _del_cb(void        *data,
    Evas_Object *fp = data;
 
    it = elm_flipselector_selected_item_get(fp);
-   if (it) elm_flipselector_item_del(it);
+   if (it) elm_object_item_del(it);
 }
 
 void /* underflow callback */
index eb3038e..cf70461 100644 (file)
@@ -80,7 +80,7 @@ static void
 _sel(void *data, Evas_Object *obj, void *event_info)
 {
    if(!elm_hoversel_expanded_get(obj) && event_info != data)
-     elm_hoversel_item_del(event_info);
+     elm_object_item_del(event_info);
 }
 
 static void
index 13f6a38..284717c 100644 (file)
@@ -60,7 +60,7 @@ _item_del(void        *data __UNUSED__,
            " %s (pointing to %s)\n", elm_index_item_letter_get(iit),
            elm_object_item_text_get(lit));
 
-   elm_index_item_del(d.index, lit);
+   elm_object_item_del(lit);
 }
 
 static void
index 6446c13..2dfd89d 100644 (file)
@@ -13,7 +13,7 @@ _del_it(void *data, Evas_Object *obj, void *event_info)
    Elm_Object_Item *menu_it = elm_menu_first_item_get(data);
    menu_it = elm_menu_item_next_get(menu_it);
    l = elm_menu_item_subitems_get(menu_it);
-   elm_menu_item_del(eina_list_data_get(l));
+   elm_object_item_del(eina_list_data_get(l));
 }
 
 static void
index 185aa7b..bf29367 100644 (file)
@@ -63,7 +63,7 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__)
    elm_segment_control_item_insert_at(sc, NULL, "Inserted at", count - 1);
 
    seg_it = elm_segment_control_item_insert_at(sc, NULL, "To be deleted", 2);
-   elm_segment_control_item_del(seg_it);
+   elm_object_item_del(seg_it);
 
    elm_segment_control_item_insert_at(sc, NULL, "To be deleted", 2);
    elm_segment_control_item_del_at(sc, 2);
index bc7059d..abbf434 100644 (file)
@@ -118,7 +118,7 @@ _web_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *
    Tab_Data *td = data;
 
    if (td->tab)
-     elm_toolbar_item_del(td->tab);
+     elm_object_item_del(td->tab);
 
    free(td);
 }
index be168fd..4816eaa 100644 (file)
@@ -1225,12 +1225,44 @@ _remove_items(Widget_Data *wd)
         if (item->icon)
           evas_object_del(item->icon);
         wd->items = eina_list_remove(wd->items, item);
-        free(item);
+        elm_widget_item_free(item);
      }
 
    wd->items = NULL;
 }
 
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+
+   Widget_Data *wd;
+   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
+
+   wd = elm_widget_data_get(WIDGET(ctxpopup_it));
+   if (!wd) return;
+
+   if (ctxpopup_it->icon)
+     evas_object_del(ctxpopup_it->icon);
+   if (VIEW(ctxpopup_it))
+     evas_object_del(VIEW(ctxpopup_it));
+
+   eina_stringshare_del(ctxpopup_it->label);
+
+   wd->items = eina_list_remove(wd->items, ctxpopup_it);
+
+   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+
+   if (eina_list_count(wd->items) < 1)
+     {
+        evas_object_hide(WIDGET(ctxpopup_it));
+        return;
+     }
+
+   if (wd->visible)
+     _sizing_eval(WIDGET(ctxpopup_it));
+}
+
 EAPI Evas_Object *
 elm_ctxpopup_add(Evas_Object *parent)
 {
@@ -1450,6 +1482,7 @@ elm_ctxpopup_item_append(Evas_Object *obj, const char *label,
    item = elm_widget_item_new(obj, Elm_Ctxpopup_Item);
    if (!item) return NULL;
 
+   elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
    elm_widget_item_disable_hook_set(item, _item_disable_hook);
    elm_widget_item_text_set_hook_set(item, _item_text_set_hook);
    elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
@@ -1492,36 +1525,7 @@ elm_ctxpopup_item_append(Evas_Object *obj, const char *label,
 EAPI void
 elm_ctxpopup_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
-   Widget_Data *wd;
-   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-
-   wd = elm_widget_data_get(WIDGET(ctxpopup_it));
-   if (!wd) return;
-
-   if (ctxpopup_it->icon)
-     evas_object_del(ctxpopup_it->icon);
-   if (VIEW(ctxpopup_it))
-     evas_object_del(VIEW(ctxpopup_it));
-
-   eina_stringshare_del(ctxpopup_it->label);
-
-   wd->items = eina_list_remove(wd->items, ctxpopup_it);
-
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
-
-   elm_widget_item_del(ctxpopup_it);
-
-   if (eina_list_count(wd->items) < 1)
-     {
-        evas_object_hide(WIDGET(ctxpopup_it));
-        return;
-     }
-
-   if (wd->visible)
-     _sizing_eval(WIDGET(ctxpopup_it));
-
+   elm_object_item_del(it);
 }
 
 EAPI void
index 09e6b5e..fef41e4 100644 (file)
@@ -145,17 +145,6 @@ EAPI Eina_Bool                    elm_ctxpopup_horizontal_get(const Evas_Object
 EAPI Elm_Object_Item             *elm_ctxpopup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data);
 
 /**
- * @brief Delete the given item in a ctxpopup object.
- *
- * @param it Ctxpopup item to be deleted
- *
- * @see elm_ctxpopup_item_append()
- *
- * @ingroup Ctxpopup
- */
-EAPI void                         elm_ctxpopup_item_del(Elm_Object_Item *it);
-
-/**
  * @brief Set the direction priority of a ctxpopup.
  *
  * @param obj Ctxpopup object
index 0fb3500..2540d85 100644 (file)
@@ -56,11 +56,10 @@ _del_pre_hook(Evas_Object *obj)
    elm_hoversel_hover_parent_set(obj, NULL);
    EINA_LIST_FREE(wd->items, item)
      {
-        elm_widget_item_pre_notify_del(item);
         eina_stringshare_del(item->label);
         eina_stringshare_del(item->icon_file);
         eina_stringshare_del(item->icon_group);
-        elm_widget_item_del(item);
+        elm_widget_item_free(item);
      }
 }
 
@@ -310,6 +309,21 @@ _item_text_get_hook(const Elm_Object_Item *it, const char *part)
    return ((Elm_Hoversel_Item *) it)->label;
 }
 
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   Widget_Data *wd;
+   Elm_Hoversel_Item *item = (Elm_Hoversel_Item *) it;
+   wd = elm_widget_data_get(WIDGET(item));
+   if (!wd) return;
+   elm_hoversel_hover_end(WIDGET(item));
+   wd->items = eina_list_remove(wd->items, item);
+   eina_stringshare_del(item->label);
+   eina_stringshare_del(item->icon_file);
+   eina_stringshare_del(item->icon_group);
+}
+
 EAPI Evas_Object *
 elm_hoversel_add(Evas_Object *parent)
 {
@@ -465,7 +479,11 @@ elm_hoversel_clear(Evas_Object *obj)
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
-   EINA_LIST_FOREACH_SAFE(wd->items, l, ll, it) elm_hoversel_item_del(it);
+   EINA_LIST_FOREACH_SAFE(wd->items, l, ll, it)
+     {
+        _item_del_pre_hook(it);
+        elm_widget_item_free(it);
+     }
 }
 
 EAPI const Eina_List *
@@ -485,6 +503,7 @@ elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file
    if (!wd) return NULL;
    Elm_Hoversel_Item *item = elm_widget_item_new(obj, Elm_Hoversel_Item);
    if (!item) return NULL;
+   elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
    elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
    wd->items = eina_list_append(wd->items, item);
    item->label = eina_stringshare_add(label);
@@ -498,18 +517,7 @@ elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file
 EAPI void
 elm_hoversel_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   Widget_Data *wd;
-   Elm_Hoversel_Item *item = (Elm_Hoversel_Item *) it;
-   wd = elm_widget_data_get(WIDGET(item));
-   if (!wd) return;
-   elm_hoversel_hover_end(WIDGET(item));
-   wd->items = eina_list_remove(wd->items, item);
-   elm_widget_item_pre_notify_del(item);
-   eina_stringshare_del(item->label);
-   eina_stringshare_del(item->icon_file);
-   eina_stringshare_del(item->icon_group);
-   elm_widget_item_del(item);
+   elm_object_item_del(it);
 }
 
 EAPI void
index 6d708b0..43a0993 100644 (file)
@@ -123,7 +123,7 @@ EAPI Eina_Bool                    elm_hoversel_expanded_get(const Evas_Object *o
  * @warning Should @b not be called while the hoversel is active; use
  * elm_hoversel_expanded_get() to check first.
  *
- * @see elm_hoversel_item_del()
+ * @see elm_object_item_del()
  */
 EAPI void                         elm_hoversel_clear(Evas_Object *obj);
 
@@ -160,18 +160,6 @@ EAPI const Eina_List             *elm_hoversel_items_get(const Evas_Object *obj)
 EAPI Elm_Object_Item             *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data);
 
 /**
- * @brief Delete an item from the hoversel
- *
- * @param it The item to delete
- *
- * This deletes the item from the hoversel (should not be called while the
- * hoversel is active; use elm_hoversel_expanded_get() to check first).
- *
- * @see elm_hoversel_item_add()
- */
-EAPI void                         elm_hoversel_item_del(Elm_Object_Item *it);
-
-/**
  * @brief This sets the icon for the given hoversel item.
  *
  * @param it The item to set the icon
index 3aed8d1..f7fa77b 100644 (file)
@@ -692,7 +692,6 @@ _del_button_item(Elm_Multibuttonentry_Item *item)
 
              _del_button_obj(obj, _item->button);
 
-             free(_item);
              if (wd->current == l)
                wd->current = NULL;
              break;
@@ -760,6 +759,13 @@ _resize_button(Evas_Object *btn, Evas_Coord *realw, Evas_Coord *vieww)
    if (vieww) *vieww = vw;
 }
 
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   _del_button_item((Elm_Multibuttonentry_Item *) it);
+}
+
 static Elm_Multibuttonentry_Item*
 _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, const Elm_Multibuttonentry_Item *reference, void *data)
 {
@@ -799,6 +805,7 @@ _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, co
    item = elm_widget_item_new(obj, Elm_Multibuttonentry_Item);
    if (item)
      {
+        elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
         elm_widget_item_text_set_hook_set(item, _item_text_set_hook);
         elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
         elm_widget_item_data_set(item, data);
@@ -954,6 +961,7 @@ _evas_mbe_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
              if (item)
                {
                   _del_button_item(item);
+                  elm_widget_item_free(item);
                   elm_object_focus_set(wd->entry, EINA_TRUE);
                }
           }
@@ -1586,8 +1594,7 @@ elm_multibuttonentry_clear(Evas_Object *obj)
 EAPI void
 elm_multibuttonentry_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   _del_button_item((Elm_Multibuttonentry_Item *) it);
+   elm_object_item_del(it);
 }
 
 EAPI const char *
index c9e5415..9b46207 100644 (file)
@@ -200,14 +200,6 @@ EAPI void                       elm_multibuttonentry_item_select(Elm_Object_Item
 EAPI void                       elm_multibuttonentry_item_unselect_all(Evas_Object *obj);
 
 /**
- * Delete a given item
- *
- * @param it The item
- *
- */
-EAPI void                       elm_multibuttonentry_item_del(Elm_Object_Item *it);
-
-/**
  * Remove all items in the multibuttonentry.
  *
  * @param obj The multibuttonentry object
index b33a1c5..2b23cdd 100644 (file)
@@ -131,6 +131,7 @@ static Evas_Object * _title_icon_unset(Elm_Naviframe_Item *it);
 static Evas_Object * _title_content_unset(Elm_Naviframe_Item *it,
                                           const char *part);
 static void _item_del(Elm_Naviframe_Item *it);
+static void _item_del_pre_hook(Elm_Object_Item *it);
 static void _pushed_finished(void *data,
                              Evas_Object *obj,
                              const char *emission,
@@ -175,6 +176,7 @@ _del_hook(Evas_Object *obj)
                                             Elm_Naviframe_Item);
              wd->stack = eina_inlist_remove(wd->stack, wd->stack->last);
              _item_del(it);
+             elm_widget_item_free(it);
              if (!wd->stack) break;
           }
      }
@@ -867,8 +869,38 @@ _item_del(Elm_Naviframe_Item *it)
      }
 
    eina_stringshare_del(it->style);
+}
+
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   Elm_Naviframe_Item *navi_it;
+   Widget_Data *wd;
 
-   elm_widget_item_del(it);
+   navi_it =(Elm_Naviframe_Item *) it;
+   wd = elm_widget_data_get(WIDGET(navi_it));
+   if (!wd) return;
+
+   if (it == elm_naviframe_top_item_get(WIDGET(navi_it)))
+     {
+        wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
+        _item_del(navi_it);
+        elm_widget_item_free(navi_it);
+        //If the item is only one, the stack will be empty
+        if (!wd->stack) return;
+        navi_it = EINA_INLIST_CONTAINER_GET(wd->stack->last,
+                                            Elm_Naviframe_Item);
+        evas_object_show(VIEW(navi_it));
+        evas_object_raise(VIEW(navi_it));
+        edje_object_signal_emit(VIEW(navi_it), "elm,state,visible", "elm");
+     }
+   else
+     {
+        wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
+        _item_del(navi_it);
+        elm_widget_item_free(navi_it);
+     }
 }
 
 static void
@@ -904,6 +936,7 @@ _popped_finished(void *data,
                                    SIG_POP_FINISHED,
                                    data);
    _item_del(data);
+   elm_widget_item_free(data);
 }
 
 static void
@@ -1061,6 +1094,7 @@ _item_new(Evas_Object *obj,
         return NULL;
      }
 
+   elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
    elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
    elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
    elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
@@ -1278,7 +1312,10 @@ elm_naviframe_item_pop(Evas_Object *obj)
         edje_object_message_signal_process(VIEW(prev_it));
      }
    else
-     _item_del(it);
+     {
+        _item_del(it);
+        elm_widget_item_free(it);
+     }
 
    return content;
 }
@@ -1306,6 +1343,8 @@ elm_naviframe_item_pop_to(Elm_Object_Item *it)
         prev_l = l->prev;
         wd->stack = eina_inlist_remove(wd->stack, l);
         _item_del(EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item));
+        elm_widget_item_free(EINA_INLIST_CONTAINER_GET(l,
+                                                       Elm_Naviframe_Item));
         l = prev_l;
      }
    elm_naviframe_item_pop(WIDGET(navi_it));
@@ -1347,31 +1386,7 @@ elm_naviframe_item_promote(Elm_Object_Item *it)
 EAPI void
 elm_naviframe_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   Elm_Naviframe_Item *navi_it;
-   Widget_Data *wd;
-
-   navi_it =(Elm_Naviframe_Item *) it;
-   wd = elm_widget_data_get(WIDGET(navi_it));
-   if (!wd) return;
-
-   if (it == elm_naviframe_top_item_get(WIDGET(navi_it)))
-     {
-        wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
-        _item_del(navi_it);
-        //If the item is only one, the stack will be empty
-        if (!wd->stack) return;
-        navi_it = EINA_INLIST_CONTAINER_GET(wd->stack->last,
-                                            Elm_Naviframe_Item);
-        evas_object_show(VIEW(navi_it));
-        evas_object_raise(VIEW(navi_it));
-        edje_object_signal_emit(VIEW(navi_it), "elm,state,visible", "elm");
-     }
-   else
-     {
-        wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
-        _item_del(navi_it);
-     }
+   elm_object_item_del(it);
 }
 
 EAPI void
index 70a48d4..348cabe 100644 (file)
@@ -189,19 +189,6 @@ EAPI void             elm_naviframe_item_pop_to(Elm_Object_Item *it);
 EAPI void             elm_naviframe_item_promote(Elm_Object_Item *it);
 
 /**
- * @brief Delete the given item instantly.
- *
- * @param it The naviframe item
- *
- * This just deletes the given item from the naviframe item list instantly.
- * So this would not emit any signals for view transitions but just change
- * the current view if the given item is a top one.
- *
- * @ingroup Naviframe
- */
-EAPI void             elm_naviframe_item_del(Elm_Object_Item *it);
-
-/**
  * @brief preserve the content objects when items are popped.
  *
  * @param obj The naviframe object
index 84fec50..b0da20e 100644 (file)
@@ -434,6 +434,18 @@ EINA_DEPRECATED EAPI void         elm_ctxpopup_content_set(Evas_Object *obj, Eva
 EINA_DEPRECATED EAPI Evas_Object *elm_ctxpopup_content_unset(Evas_Object *obj);
 
 /**
+ * @brief Delete the given item in a ctxpopup object.
+ *
+ * @param it Ctxpopup item to be deleted
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @see elm_ctxpopup_item_append()
+ *
+ * @ingroup Ctxpopup
+ */
+EINA_DEPRECATED EAPI void                         elm_ctxpopup_item_del(Elm_Object_Item *it);
+
+/**
  * Set the label for a given file selector button widget
  *
  * @param obj The file selector button widget
@@ -730,6 +742,19 @@ EINA_DEPRECATED EAPI const char  *elm_hoversel_item_label_get(const Elm_Object_I
 EINA_DEPRECATED EAPI void                         elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
 
 /**
+ * @brief Delete an item from the hoversel
+ *
+ * @param it The item to delete
+ *
+ * This deletes the item from the hoversel (should not be called while the
+ * hoversel is active; use elm_hoversel_expanded_get() to check first).
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @see elm_hoversel_item_add()
+ */
+EINA_DEPRECATED EAPI void                         elm_hoversel_item_del(Elm_Object_Item *it);
+
+/**
  * Set actionslider labels.
  *
  * @param obj The actionslider object
@@ -1429,6 +1454,22 @@ EINA_DEPRECATED EAPI const char            *elm_diskselector_item_label_get(cons
  */
 EINA_DEPRECATED EAPI void                   elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
 
+/**
+ * Delete them item from the diskselector.
+ *
+ * @param it The item of diskselector to be deleted.
+ *
+ * If deleting all diskselector items is required, elm_diskselector_clear()
+ * should be used instead of getting items list and deleting each one.
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @see elm_diskselector_clear()
+ * @see elm_diskselector_item_append()
+ *
+ * @ingroup Diskselector
+ */
+EINA_DEPRECATED EAPI void                   elm_diskselector_item_del(Elm_Object_Item *it);
+
 EINA_DEPRECATED EAPI void         elm_factory_content_set(Evas_Object *obj, Evas_Object *content);
 EINA_DEPRECATED EAPI Evas_Object *elm_factory_content_get(const Evas_Object *obj);
 
@@ -1459,6 +1500,16 @@ EINA_DEPRECATED EAPI const char *elm_flipselector_item_label_get(const Elm_Objec
 EINA_DEPRECATED EAPI void        elm_flipselector_item_label_set(Elm_Object_Item *it, const char *label);
 
 /**
+ * Delete a given item from a flip selector widget.
+ *
+ * @param it The item to delete
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @ingroup Flipselector
+ */
+EINA_DEPRECATED EAPI void       elm_flipselector_item_del(Elm_Object_Item *it);
+
+/**
  * Make a given Elementary object the focused one.
  *
  * @param obj The Elementary object to make focused.
@@ -1601,6 +1652,21 @@ EINA_DEPRECATED EAPI void  elm_index_item_data_set(Elm_Object_Item *it, const vo
 EINA_DEPRECATED EAPI void                  elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
 
 /**
+ * Remove an item from a given index widget, <b>to be referenced by
+ * it's data value</b>.
+ *
+ * @param obj The index object
+ * @param item The item to be removed from @p obj
+ *
+ * If a deletion callback is set, via elm_object_item_del_cb_set(),
+ * that callback function will be called by this one.
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @ingroup Index
+ */
+EINA_DEPRECATED EAPI void                  elm_index_item_del(Evas_Object *obj, Elm_Object_Item *item);
+
+/**
 * @brief Set the label on the label object
  *
  * @param obj The label object
@@ -1880,6 +1946,16 @@ EINA_DEPRECATED EAPI void                         elm_menu_item_del_cb_set(Elm_O
 EINA_DEPRECATED EAPI void         elm_menu_item_data_set(Elm_Object_Item *it, const void *data);
 
 /**
+ * @brief Deletes an item from the menu.
+ *
+ * @param it The item to delete.
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @see elm_menu_item_add()
+ */
+EINA_DEPRECATED EAPI void                         elm_menu_item_del(Elm_Object_Item *it);
+
+/**
  * @brief Set the content of the notify widget
  *
  * @param obj The notify object
@@ -2537,6 +2613,16 @@ EINA_DEPRECATED EAPI Evas_Object *elm_slider_end_get(const Evas_Object *obj);
 EINA_DEPRECATED EAPI void *elm_slideshow_item_data_get(const Elm_Object_Item *it);
 
 /**
+ * Delete a given item from a slideshow widget.
+ *
+ * @param it The slideshow item
+ *
+ * @deprecated Use elm_object_item_de() instead
+ * @ingroup Slideshow
+ */
+EINA_DEPRECATED EAPI void                  elm_slideshow_item_del(Elm_Object_Item *it);
+
+/**
  * Get the toolbar object from an item.
  *
  * @param it The item.
@@ -2688,6 +2774,18 @@ EINA_DEPRECATED EAPI Eina_Bool    elm_toolbar_orientation_get(const Evas_Object
 EINA_DEPRECATED EAPI void                         elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
 
 /**
+ * Delete them item from the toolbar.
+ *
+ * @param it The item of toolbar to be deleted.
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @see elm_toolbar_item_append()
+ *
+ * @ingroup Toolbar
+ */
+EINA_DEPRECATED EAPI void                         elm_toolbar_item_del(Elm_Object_Item *it);
+
+/**
  * @brief Link a Elm_Payer with an Elm_Video object.
  *
  * @param player the Elm_Player object.
@@ -2754,6 +2852,19 @@ EINA_DEPRECATED EAPI void              elm_segment_control_item_label_set(Elm_Ob
 EINA_DEPRECATED EAPI void              elm_segment_control_item_icon_set(Elm_Object_Item *it, Evas_Object *icon);
 
 /**
+ * Remove a segment control item from its parent, deleting it.
+ *
+ * @param it The item to be removed.
+ *
+ * Items can be added with elm_segment_control_item_add() or
+ * elm_segment_control_item_insert_at().
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @ingroup SegmentControl
+ */
+EINA_DEPRECATED EAPI void              elm_segment_control_item_del(Elm_Object_Item *it);
+
+/**
  * Get the label
  *
  * @param obj The multibuttonentry object
@@ -2797,6 +2908,32 @@ EINA_DEPRECATED EAPI const char                *elm_multibuttonentry_item_label_
 EINA_DEPRECATED EAPI void                       elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str);
 
 /**
+ * Delete a given item
+ *
+ * @param it The item
+ * 
+ * @deprecated Use elm_object_item_del() instead 
+ *
+ */
+EINA_DEPRECATED EAPI void                       elm_multibuttonentry_item_del(Elm_Object_Item *it);
+
+/**
+ * @brief Delete the given item instantly.
+ *
+ * @param it The naviframe item
+ *
+ * This just deletes the given item from the naviframe item list instantly.
+ * So this would not emit any signals for view transitions but just change
+ * the current view if the given item is a top one.
+ *
+ * @deprecated Use elm_object_item_del() instead
+ * @ingroup Naviframe
+ */
+EINA_DEPRECATED EAPI void             elm_naviframe_item_del(Elm_Object_Item *it);
+
+
+
+/**
  * Sets the disabled/enabled state of a list item.
  *
  * @param it The item.
index 1f232a1..75c25d1 100644 (file)
@@ -112,6 +112,223 @@ _diskselector_object_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, vo
      wd->idler = ecore_idle_enterer_before_add(_move_scroller, data);
 }
 
+static void
+_item_del(Elm_Diskselector_Item *item)
+{
+   if (!item) return;
+   eina_stringshare_del(item->label);
+   if (item->icon)
+     evas_object_del(item->icon);
+}
+
+static int
+_count_letter(const char *str)
+{
+   int pos = 0;
+   int code = 0, chnum;
+
+   for (chnum = 0; ; chnum++)
+     {
+        pos = evas_string_char_next_get(str, pos, &code);
+        if (code == 0) break;
+     }
+   return chnum;
+}
+
+static int
+_check_letter(const char *str, int length)
+{
+   int pos = 0;
+   int code = 0, chnum;
+
+   for (chnum = 0; ; chnum++)
+     {
+        if (chnum == length) break;
+        pos = evas_string_char_next_get(str, pos, &code);
+        if (code == 0) break;
+     }
+   return pos;
+}
+
+static Eina_Bool
+_check_string(void *data)
+{
+   int mid, steps, length, diff;
+   Elm_Diskselector_Item *it;
+   Eina_List *list, *l;
+   Evas_Coord ox, ow;
+   char buf[1024];
+   Widget_Data *wd = data;
+
+   evas_object_geometry_get(wd->scroller, &ox, NULL, &ow, NULL);
+   if (ow <= 0)
+     return EINA_FALSE;
+   if (!wd->init)
+     return EINA_FALSE;
+   if (!wd->round)
+     list = wd->items;
+   else
+     list = wd->r_items;
+
+   EINA_LIST_FOREACH(list, l, it)
+     {
+        Evas_Coord x, w;
+        int len;
+        evas_object_geometry_get(VIEW(it), &x, NULL, &w, NULL);
+        /* item not visible */
+        if ((x + w <= ox) || (x >= ox + ow))
+          continue;
+
+        len = _count_letter(it->label);
+//        // FIXME: len should be # of ut8f letters. ie count using utf8 string walk, not stringshare len
+//        len = eina_stringshare_strlen(it->label);
+
+        if (x <= ox + 5)
+          edje_object_signal_emit(VIEW(it), "elm,state,left_side",
+                                  "elm");
+        else if (x + w >= ox + ow - 5)
+          edje_object_signal_emit(VIEW(it), "elm,state,right_side",
+                                  "elm");
+        else
+          {
+             if ((wd->len_threshold) && (len > wd->len_threshold))
+               edje_object_signal_emit(VIEW(it), "elm,state,center_small",
+                                       "elm");
+             else
+               edje_object_signal_emit(VIEW(it), "elm,state,center",
+                                       "elm");
+          }
+
+        // if len is les that the limit len, skip anyway
+        if (len <= wd->len_side)
+          continue;
+
+        steps = len - wd->len_side + 1;
+        mid = x + w / 2;
+        if (mid <= ox + ow / 2)
+          diff = (ox + ow / 2) - mid;
+        else
+          diff = mid - (ox + ow / 2);
+
+        length = len - (int)(diff * steps / (ow / 3));
+        length = MAX(length, wd->len_side);
+        // limit string len to "length" ut8f chars
+        length = _check_letter(it->label, length);
+        // cut it off at byte mark returned form _check_letter
+        strncpy(buf, it->label, length);
+        buf[length] = '\0';
+        edje_object_part_text_set(VIEW(it), "elm.text", buf);
+     }
+
+   if (wd->check_idler)
+     ecore_idle_enterer_del(wd->check_idler);
+   wd->check_idler = NULL;
+   return EINA_FALSE;
+}
+
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   Elm_Diskselector_Item *item, *item2, *dit;
+   Eina_List *l;
+   int i = 0;
+   Widget_Data *wd;
+   item = (Elm_Diskselector_Item *) it;
+   wd = elm_widget_data_get(WIDGET(item));
+   if (!wd) return;
+
+   elm_box_unpack(wd->main_box, VIEW(item));
+
+   if (wd->round)
+     wd->r_items = eina_list_remove(wd->r_items, item);
+
+   wd->items = eina_list_remove(wd->items, item);
+
+   if (wd->selected_item == item)
+     {
+        dit = (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0);
+        if (dit != item)
+          wd->selected_item = dit;
+        else
+          wd->selected_item = eina_list_nth(wd->items, 1);
+
+        _selected_item_indicate(wd->selected_item);
+     }
+
+   _item_del(item);
+   wd->item_count -= 1;
+
+   if (wd->round)
+     {
+        if (!wd->item_count)
+          {
+             evas_object_hide(wd->VIEW(first));
+             evas_object_hide(wd->VIEW(second));
+             evas_object_hide(wd->VIEW(last));
+             evas_object_hide(wd->VIEW(s_last));
+
+             EINA_LIST_FOREACH(wd->under_items, l, item2)
+               evas_object_hide(VIEW(item2));
+
+             EINA_LIST_FOREACH(wd->over_items, l, item2)
+               evas_object_hide(VIEW(item2));
+          }
+        else
+          {
+             dit = eina_list_nth(wd->items, 0);
+             if (dit)
+               {
+                  eina_stringshare_replace(&wd->first->label, dit->label);
+                  edje_object_part_text_set(wd->VIEW(first), "elm.text",
+                                            wd->first->label);
+               }
+             dit = eina_list_nth(wd->items, 1);
+             if (dit)
+               {
+                  eina_stringshare_replace(&wd->second->label, dit->label);
+                  edje_object_part_text_set(wd->VIEW(second), "elm.text",
+                                            wd->second->label);
+               }
+             // if more than 3 itmes should be displayed
+             for (i = 2; i < CEIL(wd->display_item_num); i++)
+               {
+                  dit = eina_list_nth(wd->items, i);
+                  item2 = eina_list_nth(wd->over_items, i - 2);
+                  eina_stringshare_replace(&item2->label, dit->label);
+                  edje_object_part_text_set(VIEW(item2), "elm.text", item2->label);
+               }
+
+             dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 1);
+             if (dit)
+               {
+                  eina_stringshare_replace(&wd->last->label, dit->label);
+                  edje_object_part_text_set(wd->VIEW(last), "elm.text",
+                                            wd->last->label);
+               }
+             dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 2);
+             if (dit)
+               {
+                  eina_stringshare_replace(&wd->s_last->label, dit->label);
+                  edje_object_part_text_set(wd->VIEW(s_last), "elm.text",
+                                            wd->s_last->label);
+               }
+             // if more than 3 itmes should be displayed
+             for (i = 3; i <= CEIL(wd->display_item_num); i++)
+               {
+                  dit = eina_list_nth(wd->items, wd->item_count - i);
+                  item2 = eina_list_nth(wd->under_items, i - 3);
+                  eina_stringshare_replace(&item2->label, dit->label);
+                  edje_object_part_text_set(VIEW(item2), "elm.text",
+                                            item2->label);
+               }
+          }
+     }
+   wd->check_idler = ecore_idle_enterer_before_add(_check_string, wd);
+   _sizing_eval(wd->self);
+
+}
+
 static Elm_Diskselector_Item *
 _item_new(Evas_Object *obj, Evas_Object *icon, const char *label, Evas_Smart_Cb func, const void *data)
 {
@@ -121,6 +338,7 @@ _item_new(Evas_Object *obj, Evas_Object *icon, const char *label, Evas_Smart_Cb
    it = elm_widget_item_new(obj, Elm_Diskselector_Item);
    if (!it) return NULL;
 
+   elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
    elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
    elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
    elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
@@ -155,16 +373,6 @@ _item_new(Evas_Object *obj, Evas_Object *icon, const char *label, Evas_Smart_Cb
 }
 
 static void
-_item_del(Elm_Diskselector_Item *item)
-{
-   if (!item) return;
-   eina_stringshare_del(item->label);
-   if (item->icon)
-     evas_object_del(item->icon);
-   elm_widget_item_del(item);
-}
-
-static void
 _theme_data_get(Widget_Data *wd)
 {
    const char* str;
@@ -254,7 +462,11 @@ _del_pre_hook(Evas_Object * obj)
         }
    }
 
-   EINA_LIST_FREE(wd->items, it) _item_del(it);
+   EINA_LIST_FREE(wd->items, it)
+     {
+        _item_del(it);
+        elm_widget_item_free(it);
+     }
    eina_list_free(wd->r_items);
 }
 
@@ -409,111 +621,6 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
    return EINA_TRUE;
 }
 
-static int
-_count_letter(const char *str)
-{
-   int pos = 0;
-   int code = 0, chnum;
-
-   for (chnum = 0; ; chnum++)
-     {
-        pos = evas_string_char_next_get(str, pos, &code);
-        if (code == 0) break;
-     }
-   return chnum;
-}
-
-static int
-_check_letter(const char *str, int length)
-{
-   int pos = 0;
-   int code = 0, chnum;
-
-   for (chnum = 0; ; chnum++)
-     {
-        if (chnum == length) break;
-        pos = evas_string_char_next_get(str, pos, &code);
-        if (code == 0) break;
-     }
-   return pos;
-}
-
-static Eina_Bool
-_check_string(void *data)
-{
-   int mid, steps, length, diff;
-   Elm_Diskselector_Item *it;
-   Eina_List *list, *l;
-   Evas_Coord ox, ow;
-   char buf[1024];
-   Widget_Data *wd = data;
-
-   evas_object_geometry_get(wd->scroller, &ox, NULL, &ow, NULL);
-   if (ow <= 0)
-     return EINA_FALSE;
-   if (!wd->init)
-     return EINA_FALSE;
-   if (!wd->round)
-     list = wd->items;
-   else
-     list = wd->r_items;
-
-   EINA_LIST_FOREACH(list, l, it)
-     {
-        Evas_Coord x, w;
-        int len;
-        evas_object_geometry_get(VIEW(it), &x, NULL, &w, NULL);
-        /* item not visible */
-        if ((x + w <= ox) || (x >= ox + ow))
-          continue;
-
-        len = _count_letter(it->label);
-//        // FIXME: len should be # of ut8f letters. ie count using utf8 string walk, not stringshare len
-//        len = eina_stringshare_strlen(it->label);
-
-        if (x <= ox + 5)
-          edje_object_signal_emit(VIEW(it), "elm,state,left_side",
-                                  "elm");
-        else if (x + w >= ox + ow - 5)
-          edje_object_signal_emit(VIEW(it), "elm,state,right_side",
-                                  "elm");
-        else
-          {
-             if ((wd->len_threshold) && (len > wd->len_threshold))
-               edje_object_signal_emit(VIEW(it), "elm,state,center_small",
-                                       "elm");
-             else
-               edje_object_signal_emit(VIEW(it), "elm,state,center",
-                                       "elm");
-          }
-
-        // if len is les that the limit len, skip anyway
-        if (len <= wd->len_side)
-          continue;
-
-        steps = len - wd->len_side + 1;
-        mid = x + w / 2;
-        if (mid <= ox + ow / 2)
-          diff = (ox + ow / 2) - mid;
-        else
-          diff = mid - (ox + ow / 2);
-
-        length = len - (int)(diff * steps / (ow / 3));
-        length = MAX(length, wd->len_side);
-        // limit string len to "length" ut8f chars
-        length = _check_letter(it->label, length);
-        // cut it off at byte mark returned form _check_letter
-        strncpy(buf, it->label, length);
-        buf[length] = '\0';
-        edje_object_part_text_set(VIEW(it), "elm.text", buf);
-     }
-
-   if (wd->check_idler)
-     ecore_idle_enterer_del(wd->check_idler);
-   wd->check_idler = NULL;
-   return EINA_FALSE;
-}
-
 static void
 _selected_item_indicate(Elm_Diskselector_Item *it)
 {
@@ -664,8 +771,7 @@ _round_item_del(Widget_Data *wd, Elm_Diskselector_Item *it)
    elm_box_unpack(wd->main_box, VIEW(it));
    wd->r_items = eina_list_remove(wd->r_items, it);
    eina_stringshare_del(it->label);
-   evas_object_del(VIEW(it));
-   free(it);
+   elm_widget_item_free(it);
 }
 
 static void
@@ -873,6 +979,7 @@ _item_content_get_hook(const Elm_Object_Item *it, const char *part)
    return ((Elm_Diskselector_Item *) it)->icon;
 }
 
+
 EAPI Evas_Object *
 elm_diskselector_add(Evas_Object *parent)
 {
@@ -1107,7 +1214,11 @@ elm_diskselector_clear(Evas_Object *obj)
    if (!wd->items) return;
 
    wd->selected_item = NULL;
-   EINA_LIST_FREE(wd->items, it) _item_del(it);
+   EINA_LIST_FREE(wd->items, it)
+     {
+        _item_del(it);
+        elm_widget_item_free(it);
+     }
    _round_items_del(wd);
    _sizing_eval(obj);
 }
@@ -1165,103 +1276,7 @@ elm_diskselector_item_append(Evas_Object *obj, const char *label, Evas_Object *i
 EAPI void
 elm_diskselector_item_del(Elm_Object_Item * it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   Elm_Diskselector_Item *item, *item2, *dit;
-   Eina_List *l;
-   int i = 0;
-   Widget_Data *wd;
-   item = (Elm_Diskselector_Item *) it;
-   wd = elm_widget_data_get(WIDGET(item));
-   if (!wd) return;
-
-   elm_box_unpack(wd->main_box, VIEW(item));
-
-   if (wd->round)
-     wd->r_items = eina_list_remove(wd->r_items, item);
-
-   wd->items = eina_list_remove(wd->items, item);
-
-   if (wd->selected_item == item)
-     {
-        dit = (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0);
-        if (dit != item)
-          wd->selected_item = dit;
-        else
-          wd->selected_item = eina_list_nth(wd->items, 1);
-
-        _selected_item_indicate(wd->selected_item);
-     }
-
-   _item_del(item);
-   wd->item_count -= 1;
-
-   if (wd->round)
-     {
-        if (!wd->item_count)
-          {
-             evas_object_hide(wd->VIEW(first));
-             evas_object_hide(wd->VIEW(second));
-             evas_object_hide(wd->VIEW(last));
-             evas_object_hide(wd->VIEW(s_last));
-
-             EINA_LIST_FOREACH(wd->under_items, l, item2)
-               evas_object_hide(VIEW(item2));
-
-             EINA_LIST_FOREACH(wd->over_items, l, item2)
-               evas_object_hide(VIEW(item2));
-          }
-        else
-          {
-             dit = eina_list_nth(wd->items, 0);
-             if (dit)
-               {
-                  eina_stringshare_replace(&wd->first->label, dit->label);
-                  edje_object_part_text_set(wd->VIEW(first), "elm.text",
-                                            wd->first->label);
-               }
-             dit = eina_list_nth(wd->items, 1);
-             if (dit)
-               {
-                  eina_stringshare_replace(&wd->second->label, dit->label);
-                  edje_object_part_text_set(wd->VIEW(second), "elm.text",
-                                            wd->second->label);
-               }
-             // if more than 3 itmes should be displayed
-             for (i = 2; i < CEIL(wd->display_item_num); i++)
-               {
-                  dit = eina_list_nth(wd->items, i);
-                  item2 = eina_list_nth(wd->over_items, i - 2);
-                  eina_stringshare_replace(&item2->label, dit->label);
-                  edje_object_part_text_set(VIEW(item2), "elm.text", item2->label);
-               }
-
-             dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 1);
-             if (dit)
-               {
-                  eina_stringshare_replace(&wd->last->label, dit->label);
-                  edje_object_part_text_set(wd->VIEW(last), "elm.text",
-                                            wd->last->label);
-               }
-             dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 2);
-             if (dit)
-               {
-                  eina_stringshare_replace(&wd->s_last->label, dit->label);
-                  edje_object_part_text_set(wd->VIEW(s_last), "elm.text",
-                                            wd->s_last->label);
-               }
-             // if more than 3 itmes should be displayed
-             for (i = 3; i <= CEIL(wd->display_item_num); i++)
-               {
-                  dit = eina_list_nth(wd->items, wd->item_count - i);
-                  item2 = eina_list_nth(wd->under_items, i - 3);
-                  eina_stringshare_replace(&item2->label, dit->label);
-                  edje_object_part_text_set(VIEW(item2), "elm.text",
-                                            item2->label);
-               }
-          }
-     }
-   wd->check_idler = ecore_idle_enterer_before_add(_check_string, wd);
-   _sizing_eval(wd->self);
+   elm_object_item_del(it);
 }
 
 EAPI const char *
index 727192f..58eceb2 100644 (file)
@@ -227,7 +227,7 @@ EAPI void                   elm_diskselector_scroller_policy_set(Evas_Object *ob
  *
  * @param obj The diskselector object.
  *
- * @see elm_diskselector_item_del()
+ * @see elm_object_item_del()
  * @see elm_diskselector_item_append()
  *
  * @ingroup Diskselector
@@ -242,7 +242,7 @@ EAPI void                   elm_diskselector_clear(Evas_Object *obj);
  * or @c NULL on failure.
  *
  * @see elm_diskselector_item_append()
- * @see elm_diskselector_item_del()
+ * @see elm_object_item_del()
  * @see elm_diskselector_clear()
  *
  * @ingroup Diskselector
@@ -271,7 +271,7 @@ EAPI const Eina_List       *elm_diskselector_items_get(const Evas_Object *obj);
  * to the right.
  *
  * Items created with this method can be deleted with
- * elm_diskselector_item_del().
+ * elm_object_item_del().
  *
  * Associated @p data can be properly freed when item is deleted if a
  * callback function is set with elm_object_item_del_cb_set().
@@ -290,7 +290,7 @@ EAPI const Eina_List       *elm_diskselector_items_get(const Evas_Object *obj);
  * elm_diskselector_item_append(disk, "label", ic, NULL, NULL);
  * @endcode
  *
- * @see elm_diskselector_item_del()
+ * @see elm_object_item_del()
  * @see elm_diskselector_clear()
  * @see elm_icon_add()
  *
@@ -298,22 +298,6 @@ EAPI const Eina_List       *elm_diskselector_items_get(const Evas_Object *obj);
  */
 EAPI Elm_Object_Item *elm_diskselector_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data);
 
-
-/**
- * Delete them item from the diskselector.
- *
- * @param it The item of diskselector to be deleted.
- *
- * If deleting all diskselector items is required, elm_diskselector_clear()
- * should be used instead of getting items list and deleting each one.
- *
- * @see elm_diskselector_clear()
- * @see elm_diskselector_item_append()
- *
- * @ingroup Diskselector
- */
-EAPI void                   elm_diskselector_item_del(Elm_Object_Item *it);
-
 /**
  * Get the selected item.
  *
index f0788e4..72702a7 100644 (file)
@@ -57,6 +57,7 @@ static void _update_view(Evas_Object *obj);
 static void _callbacks_set(Evas_Object *obj);
 static void _flip_up(Widget_Data *wd);
 static void _flip_down(Widget_Data *wd);
+static void _item_del_pre_hook(Elm_Object_Item *it);
 
 static const char SIG_SELECTED[] = "selected";
 static const char SIG_UNDERFLOWED[] = "underflowed";
@@ -143,6 +144,7 @@ _item_new(Evas_Object *obj, const char *label, Evas_Smart_Cb func, const void *d
    it = elm_widget_item_new(obj, Elm_Flipselector_Item);
    if (!it) return NULL;
 
+   elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
    elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
    elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
    elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
@@ -164,7 +166,7 @@ static inline void
 _item_free(Elm_Flipselector_Item *it)
 {
    eina_stringshare_del(it->label);
-   elm_widget_item_del(it);
+   elm_widget_item_free(it);
 }
 
 static void
@@ -574,6 +576,51 @@ _callbacks_set(Evas_Object *obj)
                                    "", _signal_val_change_stop, obj);
 }
 
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   Widget_Data *wd;
+   Elm_Flipselector_Item *item, *item2;
+   Eina_List *l;
+
+   item = (Elm_Flipselector_Item *) it;
+   wd = elm_widget_data_get(WIDGET(item));
+   if (!wd) return;
+
+   if (wd->walking > 0)
+     {
+        item->deleted = EINA_TRUE;
+        return;
+     }
+
+   _flipselector_walk(wd);
+
+   EINA_LIST_FOREACH(wd->items, l, item2)
+     {
+        if (item2 == item)
+          {
+             wd->items = eina_list_remove_list(wd->items, l);
+             if (wd->current == l)
+               {
+                  wd->current = l->prev;
+                  if (!wd->current) wd->current = l->next;
+                  if (wd->current)
+                    {
+                       item2 = wd->current->data;
+                       _send_msg(wd, MSG_FLIP_DOWN, (char *)item2->label);
+                    }
+                  else
+                     _send_msg(wd, MSG_FLIP_DOWN, "");
+               }
+             break;
+          }
+     }
+   eina_stringshare_del(item->label);
+   _sentinel_eval(wd);
+   _flipselector_unwalk(wd);
+}
+
 EAPI Evas_Object *
 elm_flipselector_add(Evas_Object *parent)
 {
@@ -836,46 +883,7 @@ elm_flipselector_item_selected_get(const Elm_Object_Item *it)
 EAPI void
 elm_flipselector_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   Widget_Data *wd;
-   Elm_Flipselector_Item *item, *item2;
-   Eina_List *l;
-
-   item = (Elm_Flipselector_Item *) it;
-   wd = elm_widget_data_get(WIDGET(item));
-   if (!wd) return;
-
-   if (wd->walking > 0)
-     {
-        item->deleted = EINA_TRUE;
-        return;
-     }
-
-   _flipselector_walk(wd);
-
-   EINA_LIST_FOREACH(wd->items, l, item2)
-     {
-        if (item2 == item)
-          {
-             wd->items = eina_list_remove_list(wd->items, l);
-             if (wd->current == l)
-               {
-                  wd->current = l->prev;
-                  if (!wd->current) wd->current = l->next;
-                  if (wd->current)
-                    {
-                       item2 = wd->current->data;
-                       _send_msg(wd, MSG_FLIP_DOWN, (char *)item2->label);
-                    }
-                  else
-                     _send_msg(wd, MSG_FLIP_DOWN, "");
-               }
-             break;
-          }
-     }
-   _item_free(item);
-   _sentinel_eval(wd);
-   _flipselector_unwalk(wd);
+   elm_object_item_del(it);
 }
 
 EAPI const char *
index 9f40d81..7ccf4a5 100644 (file)
@@ -145,7 +145,7 @@ EAPI Elm_Object_Item            *elm_flipselector_item_prepend(Evas_Object *obj,
  * freed. Use the list members with functions like
  * elm_object_item_text_set(),
  * elm_object_item_text_get(),
- * elm_flipselector_item_del(),
+ * elm_object_item_del(),
  * elm_flipselector_item_selected_get(),
  * elm_flipselector_item_selected_set().
  *
@@ -232,15 +232,6 @@ EAPI void                        elm_flipselector_item_selected_set(Elm_Object_I
 EAPI Eina_Bool                   elm_flipselector_item_selected_get(const Elm_Object_Item *it);
 
 /**
- * Delete a given item from a flip selector widget.
- *
- * @param it The item to delete
- *
- * @ingroup Flipselector
- */
-EAPI void                        elm_flipselector_item_del(Elm_Object_Item *it);
-
-/**
  * Gets the item before @p item in a flip selector widget's
  * internal list of items.
  *
index 16927f7..9cb0cb3 100644 (file)
@@ -55,10 +55,16 @@ static void
 _del_pre_hook(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
+   Elm_Index_Item *it;
    if (!wd) return;
    _index_box_clear(obj, wd->bx[wd->level], wd->level);
    _index_box_clear(obj, wd->bx[0], 0);
-   while (wd->items) _item_free(wd->items->data);
+   while (wd->items)
+     {
+        it = wd->items->data;
+        _item_free(it);
+        elm_widget_item_free(it);
+     }
    if (wd->delay) ecore_timer_del(wd->delay);
 }
 
@@ -183,6 +189,16 @@ _sizing_eval(Evas_Object *obj)
    evas_object_size_hint_max_set(obj, maxw, maxh);
 }
 
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   Widget_Data *wd = elm_widget_data_get(WIDGET(it));
+   if (!wd) return;
+   _item_free((Elm_Index_Item *) it);
+   _index_box_clear(WIDGET(it), wd->bx[wd->level], wd->level);
+}
+
 static Elm_Index_Item *
 _item_new(Evas_Object *obj, const char *letter, const void *item)
 {
@@ -191,6 +207,7 @@ _item_new(Evas_Object *obj, const char *letter, const void *item)
    if (!wd) return NULL;
    it = elm_widget_item_new(obj, Elm_Index_Item);
    if (!it) return NULL;
+   elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
    it->letter = eina_stringshare_add(letter);
    it->base.data = item;
    it->level = wd->level;
@@ -215,9 +232,7 @@ _item_free(Elm_Index_Item *it)
    Widget_Data *wd = elm_widget_data_get(WIDGET(it));
    if (!wd) return;
    wd->items = eina_list_remove(wd->items, it);
-   elm_widget_item_pre_notify_del(it);
    eina_stringshare_del(it->letter);
-   elm_widget_item_del(it);
 }
 
 // FIXME: always have index filled
@@ -743,6 +758,7 @@ elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *i
              if (cmp_data_func(p_it->base.data, it->base.data) >= 0)
                p_it->base.data = it->base.data;
              _item_free(it);
+             elm_widget_item_free(it);
           }
      }
 
@@ -750,14 +766,9 @@ elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *i
 }
 
 EAPI void
-elm_index_item_del(Evas_Object *obj, Elm_Object_Item *it)
+elm_index_item_del(Evas_Object *obj __UNUSED__, Elm_Object_Item *it)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return;
-   _item_free((Elm_Index_Item *) it);
-   _index_box_clear(obj, wd->bx[wd->level], wd->level);
+   elm_object_item_del(it);
 }
 
 EAPI Elm_Object_Item *
@@ -783,7 +794,11 @@ elm_index_item_clear(Evas_Object *obj)
         if (it->level != wd->level) continue;
         clear = eina_list_append(clear, it);
      }
-   EINA_LIST_FREE(clear, it) _item_free(it);
+   EINA_LIST_FREE(clear, it)
+     {
+        _item_free(it);
+        elm_widget_item_free(it);
+     }
 }
 
 EAPI void
index e312027..a327d04 100644 (file)
@@ -240,20 +240,6 @@ EAPI void                  elm_index_item_prepend_relative(Evas_Object *obj, con
 EAPI void                  elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *item, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func);
 
 /**
- * Remove an item from a given index widget, <b>to be referenced by
- * it's data value</b>.
- *
- * @param obj The index object
- * @param item The item to be removed from @p obj
- *
- * If a deletion callback is set, via elm_object_item_del_cb_set(),
- * that callback function will be called by this one.
- *
- * @ingroup Index
- */
-EAPI void                  elm_index_item_del(Evas_Object *obj, Elm_Object_Item *item);
-
-/**
  * Find a given index widget's item, <b>using item data</b>.
  *
  * @param obj The index object
index 814c645..f4ef091 100644 (file)
@@ -58,8 +58,6 @@ _del_item(Elm_Menu_Item *item)
 {
    Elm_Menu_Item *child;
 
-   elm_widget_item_pre_notify_del(item);
-
    EINA_LIST_FREE(item->submenu.items, child)
      _del_item(child);
 
@@ -67,7 +65,7 @@ _del_item(Elm_Menu_Item *item)
    if (item->submenu.hv) evas_object_del(item->submenu.hv);
    if (item->submenu.location) evas_object_del(item->submenu.location);
    if (item->icon_str) eina_stringshare_del(item->icon_str);
-   elm_widget_item_del(item);
+   elm_widget_item_free(item);
 }
 
 static void
@@ -81,7 +79,7 @@ _del_pre_hook(Evas_Object *obj)
    evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL, _parent_del, wd);
 
    EINA_LIST_FREE(wd->items, item)
-      _del_item(item);
+     _del_item(item);
 
    if (wd->hv) evas_object_del(wd->hv);
    if (wd->location) evas_object_del(wd->location);
@@ -692,6 +690,28 @@ _elm_menu_item_add_helper(Evas_Object *obj, Elm_Menu_Item *parent, Elm_Menu_Item
    _sizing_eval(obj);
 }
 
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   Elm_Menu_Item *item = (Elm_Menu_Item *) it;
+   Elm_Object_Item *_item;
+
+   EINA_LIST_FREE(item->submenu.items, _item) elm_object_item_del(_item);
+   if (item->label) eina_stringshare_del(item->label);
+   if (item->content) evas_object_del(item->content);
+   if (item->submenu.hv) evas_object_del(item->submenu.hv);
+   if (item->submenu.location) evas_object_del(item->submenu.location);
+
+   if (item->parent)
+     item->parent->submenu.items = eina_list_remove(item->parent->submenu.items, item);
+   else
+     {
+        Widget_Data *wd = elm_widget_data_get(WIDGET(item));
+        wd->items = eina_list_remove(wd->items, item);
+     }
+}
+
 EAPI Elm_Object_Item *
 elm_menu_item_add(Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
 {
@@ -710,6 +730,7 @@ elm_menu_item_add(Evas_Object *obj, Elm_Object_Item *parent, const char *icon, c
         return NULL;
      }
 
+   elm_widget_item_del_pre_hook_set(subitem, _item_del_pre_hook);
    elm_widget_item_disable_hook_set(subitem, _item_disable_hook);
    elm_widget_item_text_set_hook_set(subitem, _item_text_set_hook);
    elm_widget_item_text_get_hook_set(subitem, _item_text_get_hook);
@@ -745,6 +766,7 @@ elm_menu_item_add_object(Evas_Object *obj, Elm_Object_Item *parent, Evas_Object
    subitem = elm_widget_item_new(obj, Elm_Menu_Item);
    if (!subitem) return NULL;
 
+   elm_widget_item_del_pre_hook_set(subitem, _item_del_pre_hook);
    elm_widget_item_disable_hook_set(subitem, _item_disable_hook);
    elm_widget_item_text_set_hook_set(subitem, _item_text_set_hook);
    elm_widget_item_text_get_hook_set(subitem, _item_text_get_hook);
@@ -840,6 +862,7 @@ elm_menu_item_separator_add(Evas_Object *obj, Elm_Object_Item *parent)
    subitem = elm_widget_item_new(obj, Elm_Menu_Item);
    if (!subitem) return NULL;
 
+   elm_widget_item_del_pre_hook_set(subitem, _item_del_pre_hook);
    elm_widget_item_disable_hook_set(subitem, _item_disable_hook);
    elm_widget_item_text_set_hook_set(subitem, _item_text_set_hook);
    elm_widget_item_text_get_hook_set(subitem, _item_text_get_hook);
@@ -894,27 +917,7 @@ elm_menu_item_is_separator(Elm_Object_Item *it)
 EAPI void
 elm_menu_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   Elm_Menu_Item *item = (Elm_Menu_Item *) it;
-   Elm_Object_Item *_item;
-
-   elm_widget_item_pre_notify_del(item);
-
-   EINA_LIST_FREE(item->submenu.items, _item) elm_menu_item_del(_item);
-   if (item->label) eina_stringshare_del(item->label);
-   if (item->content) evas_object_del(item->content);
-   if (item->submenu.hv) evas_object_del(item->submenu.hv);
-   if (item->submenu.location) evas_object_del(item->submenu.location);
-
-   if (item->parent)
-     item->parent->submenu.items = eina_list_remove(item->parent->submenu.items, item);
-   else
-     {
-        Widget_Data *wd = elm_widget_data_get(WIDGET(item));
-        wd->items = eina_list_remove(wd->items, item);
-     }
-
-   elm_widget_item_del(item);
+   elm_object_item_del(it);
 }
 
 EAPI void
index 2371928..a79c69f 100644 (file)
@@ -186,15 +186,6 @@ EAPI Elm_Object_Item             *elm_menu_item_separator_add(Evas_Object *obj,
 EAPI Eina_Bool                    elm_menu_item_is_separator(Elm_Object_Item *it);
 
 /**
- * @brief Deletes an item from the menu.
- *
- * @param it The item to delete.
- *
- * @see elm_menu_item_add()
- */
-EAPI void                         elm_menu_item_del(Elm_Object_Item *it);
-
-/**
  * @brief Returns a list of @p item's subitems.
  *
  * @param it The item
index b8d88b1..1cd7dbf 100644 (file)
@@ -79,7 +79,11 @@ _del_hook(Evas_Object *obj)
    wd = elm_widget_data_get(obj);
    if (!wd) return;
 
-   EINA_LIST_FREE(wd->seg_items, it) _item_free(it);
+   EINA_LIST_FREE(wd->seg_items, it)
+     {
+        _item_free(it);
+        elm_widget_item_free(it);
+     }
 
    free(wd);
 }
@@ -180,12 +184,8 @@ _item_free(Elm_Segment_Item *it)
    if (wd->selected_item == it) wd->selected_item = NULL;
    if (wd->seg_items) wd->seg_items = eina_list_remove(wd->seg_items, it);
 
-   elm_widget_item_pre_notify_del(it);
-
    if (it->icon) evas_object_del(it->icon);
    if (it->label) eina_stringshare_del(it->label);
-
-   elm_widget_item_del(it);
 }
 
 static void
@@ -503,6 +503,20 @@ _item_content_get_hook(const Elm_Object_Item *it, const char *part)
    return ((Elm_Segment_Item *) it)->icon;
 }
 
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   Widget_Data *wd;
+   Elm_Segment_Item *item = (Elm_Segment_Item *) it;
+
+   wd = elm_widget_item_data_get(item);
+   if (!wd) return;
+
+   _item_free(item);
+   _update_list(wd);
+}
+
 static Elm_Segment_Item*
 _item_new(Evas_Object *obj, Evas_Object *icon, const char *label)
 {
@@ -515,6 +529,7 @@ _item_new(Evas_Object *obj, Evas_Object *icon, const char *label)
    it = elm_widget_item_new(obj, Elm_Segment_Item);
    if (!it) return NULL;
    elm_widget_item_data_set(it, wd);
+   elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
    elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
    elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
    elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
@@ -640,15 +655,7 @@ elm_segment_control_item_insert_at(Evas_Object *obj, Evas_Object *icon,
 EAPI void
 elm_segment_control_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-   Widget_Data *wd;
-   Elm_Segment_Item *item = (Elm_Segment_Item *) it;
-
-   wd = elm_widget_item_data_get(item);
-   if (!wd) return;
-
-   _item_free(item);
-   _update_list(wd);
+   elm_object_item_del(it);
 }
 
 EAPI void
@@ -663,8 +670,7 @@ elm_segment_control_item_del_at(Evas_Object *obj, int idx)
 
    it = _item_find(obj, idx);
    if (!it) return;
-   _item_free(it);
-   _update_list(wd);
+   elm_object_item_del((Elm_Object_Item *) it);
 }
 
 EAPI const char*
index 50f3e37..c5d0aa4 100644 (file)
@@ -83,7 +83,7 @@ EAPI Evas_Object      *elm_segment_control_add(Evas_Object *parent);
  * elm_segment_control_item_insert_at() should be used instead.
  *
  * Items created with this function can be deleted with function
- * elm_segment_control_item_del() or elm_segment_control_item_del_at().
+ * elm_object_item_del() or elm_segment_control_item_del_at().
  *
  * @note @p label set to @c NULL is different from empty string "".
  * If an item
@@ -102,7 +102,7 @@ EAPI Evas_Object      *elm_segment_control_add(Evas_Object *parent);
  * @endcode
  *
  * @see elm_segment_control_item_insert_at()
- * @see elm_segment_control_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup SegmentControl
  */
@@ -125,7 +125,7 @@ EAPI Elm_Object_Item *elm_segment_control_item_add(Evas_Object *obj, Evas_Object
  * to segment control, just like elm_segment_control_item_add().
  *
  * Items created with this function can be deleted with function
- * elm_segment_control_item_del() or elm_segment_control_item_del_at().
+ * elm_object_item_del() or elm_segment_control_item_del_at().
  *
  * @note @p label set to @c NULL is different from empty string "".
  * If an item
@@ -135,25 +135,13 @@ EAPI Elm_Object_Item *elm_segment_control_item_add(Evas_Object *obj, Evas_Object
  *
  * @see elm_segment_control_item_add()
  * @see elm_segment_control_item_count_get()
- * @see elm_segment_control_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup SegmentControl
  */
 EAPI Elm_Object_Item *elm_segment_control_item_insert_at(Evas_Object *obj, Evas_Object *icon, const char *label, int index);
 
 /**
- * Remove a segment control item from its parent, deleting it.
- *
- * @param it The item to be removed.
- *
- * Items can be added with elm_segment_control_item_add() or
- * elm_segment_control_item_insert_at().
- *
- * @ingroup SegmentControl
- */
-EAPI void              elm_segment_control_item_del(Elm_Object_Item *it);
-
-/**
  * Remove a segment control item at given index from its parent,
  * deleting it.
  *
index 7009b83..1563c08 100644 (file)
@@ -348,6 +348,38 @@ _timer_cb(void *data)
    return ECORE_CALLBACK_CANCEL;
 }
 
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+
+   Elm_Slideshow_Item *item = (Elm_Slideshow_Item *) it;
+   Widget_Data *wd = elm_widget_data_get(WIDGET(item));
+   if (!wd) return;
+   if (wd->previous == item) wd->previous = NULL;
+   if (wd->current == item)
+     {
+        Eina_List *l = eina_list_data_find_list(wd->items, item);
+        Eina_List *l2 = eina_list_next(l);
+        wd->current = NULL;
+        if (!l2)
+          {
+             l2 = eina_list_prev(l);
+             if (l2)
+               elm_slideshow_show(eina_list_data_get(l2));
+
+          }
+        else
+          elm_slideshow_show(eina_list_data_get(l2));
+     }
+
+   wd->items = eina_list_remove_list(wd->items, item->l);
+   wd->items_built = eina_list_remove_list(wd->items_built, item->l_built);
+
+   if ((VIEW(item)) && (item->itc->func.del))
+     item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
+}
+
 EAPI Evas_Object *
 elm_slideshow_add(Evas_Object *parent)
 {
@@ -409,7 +441,7 @@ elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, co
    if (!wd) return NULL;
    item = elm_widget_item_new(obj, Elm_Slideshow_Item);
    if (!item) return NULL;
-
+   elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
    item->itc = itc;
    item->l = eina_list_append(item->l, item);
    elm_widget_item_data_set(item, data);
@@ -431,7 +463,7 @@ elm_slideshow_item_sorted_insert(Evas_Object *obj, const Elm_Slideshow_Item_Clas
 
    item = elm_widget_item_new(obj, Elm_Slideshow_Item);
    if (!item) return NULL;
-
+   elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
    item->itc = itc;
    item->l = eina_list_append(item->l, item);
    elm_widget_item_data_set(item, data);
@@ -648,49 +680,16 @@ elm_slideshow_clear(Evas_Object *obj)
      {
         if (item->itc->func.del)
           item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
-        evas_object_del(VIEW(item));
-        VIEW(item) = NULL;
      }
 
    EINA_LIST_FREE(wd->items, item)
-     {
-        elm_widget_item_del(item);
-     }
+     elm_widget_item_free(item);
 }
 
 EAPI void
 elm_slideshow_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
-   Elm_Slideshow_Item *item = (Elm_Slideshow_Item *) it;
-   Widget_Data *wd = elm_widget_data_get(WIDGET(item));
-   if (!wd) return;
-   if (wd->previous == item) wd->previous = NULL;
-   if (wd->current == item)
-     {
-        Eina_List *l = eina_list_data_find_list(wd->items, item);
-        Eina_List *l2 = eina_list_next(l);
-        wd->current = NULL;
-        if (!l2)
-          {
-             l2 = eina_list_prev(l);
-             if (l2)
-               elm_slideshow_show(eina_list_data_get(l2));
-
-          }
-        else
-          elm_slideshow_show(eina_list_data_get(l2));
-     }
-
-   wd->items = eina_list_remove_list(wd->items, item->l);
-   wd->items_built = eina_list_remove_list(wd->items_built, item->l_built);
-
-   if ((VIEW(item)) && (item->itc->func.del))
-     item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
-   if (VIEW(item))
-     evas_object_del(VIEW(item));
-   free(item);
+   elm_object_item_del(it);
 }
 
 EAPI const Eina_List *
index 4b94870..5545b96 100644 (file)
@@ -333,7 +333,7 @@ EAPI Eina_Bool             elm_slideshow_loop_get(const Evas_Object *obj);
  * This removes (and deletes) all items in @p obj, leaving it
  * empty.
  *
- * @see elm_slideshow_item_del(), to remove just one item.
+ * @see elm_object_item_del(), to remove just one item.
  *
  * @ingroup Slideshow
  */
@@ -348,7 +348,7 @@ EAPI void                  elm_slideshow_clear(Evas_Object *obj);
  *
  * This list is @b not to be modified in any way and must not be
  * freed. Use the list members with functions like
- * elm_slideshow_item_del(), elm_slideshow_item_data_get().
+ * elm_object_item_del(), elm_slideshow_item_data_get().
  *
  * @warning This list is only valid until @p obj object's internal
  * items list is changed. It should be fetched again with another
@@ -359,15 +359,6 @@ EAPI void                  elm_slideshow_clear(Evas_Object *obj);
 EAPI const Eina_List      *elm_slideshow_items_get(const Evas_Object *obj);
 
 /**
- * Delete a given item from a slideshow widget.
- *
- * @param it The slideshow item
- *
- * @ingroup Slideshow
- */
-EAPI void                  elm_slideshow_item_del(Elm_Object_Item *it);
-
-/**
  * Returns the currently displayed item, in a given slideshow widget
  *
  * @param obj The slideshow object
index e534548..b31285a 100644 (file)
@@ -244,7 +244,6 @@ _item_del(Elm_Toolbar_Item *it)
 {
    Elm_Toolbar_Item_State *it_state;
    _item_unselect(it);
-   elm_widget_item_pre_notify_del(it);
    EINA_LIST_FREE(it->states, it_state)
      {
         if (it->icon == it_state->icon)
@@ -259,7 +258,6 @@ _item_del(Elm_Toolbar_Item *it)
    if (it->icon) evas_object_del(it->icon);
    //TODO: See if checking for wd->menu_parent is necessary before deleting menu
    if (it->o_menu) evas_object_del(it->o_menu);
-   elm_widget_item_del(it);
 }
 
 static void
@@ -274,10 +272,14 @@ _del_pre_hook(Evas_Object *obj)
      {
         next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
         _item_del(it);
+        elm_widget_item_free(it);
         it = next;
      }
    if (wd->more_item)
-     _item_del(wd->more_item);
+     {
+        _item_del(wd->more_item);
+        elm_widget_item_free(wd->more_item);
+     }
    if (wd->long_timer)
      {
         ecore_timer_del(wd->long_timer);
@@ -762,6 +764,28 @@ _access_state_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Widget_
    return NULL;
 }
 
+static void
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+
+   Widget_Data *wd;
+   Evas_Object *obj2;
+   Elm_Toolbar_Item *item, *next;
+   item = (Elm_Toolbar_Item *) it;
+
+   wd = elm_widget_data_get(WIDGET(item));
+   if (!wd) return;
+   obj2 = WIDGET(item);
+   next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next);
+   wd->items = eina_inlist_remove(wd->items, EINA_INLIST_GET(item));
+   wd->item_count--;
+   if (!next) next = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items);
+   if (wd->always_select && item->selected && next) _item_select(next);
+   _item_del(item);
+   _theme_hook(obj2);
+}
+
 static Elm_Toolbar_Item *
 _item_new(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
 {
@@ -780,6 +804,7 @@ _item_new(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb f
         return NULL;
      }
 
+   elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
    elm_widget_item_disable_hook_set(it, _item_disable_hook);
    elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
    elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
@@ -1450,23 +1475,7 @@ elm_toolbar_item_icon_file_set(Elm_Object_Item *it, const char *file, const char
 EAPI void
 elm_toolbar_item_del(Elm_Object_Item *it)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
-   Widget_Data *wd;
-   Evas_Object *obj2;
-   Elm_Toolbar_Item *item, *next;
-   item = (Elm_Toolbar_Item *) it;
-
-   wd = elm_widget_data_get(WIDGET(item));
-   if (!wd) return;
-   obj2 = WIDGET(item);
-   next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next);
-   wd->items = eina_inlist_remove(wd->items, EINA_INLIST_GET(item));
-   wd->item_count--;
-   if (!next) next = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items);
-   if (wd->always_select && item->selected && next) _item_select(next);
-   _item_del(item);
-   _theme_hook(obj2);
+   elm_object_item_del(it);
 }
 
 EAPI void
@@ -1524,6 +1533,7 @@ elm_toolbar_shrink_mode_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mod
    if (wd->more_item)
      {
         _item_del(wd->more_item);
+        elm_widget_item_free(wd->more_item);
         wd->more_item = NULL;
      }
 
index e344c43..ff27139 100644 (file)
@@ -216,7 +216,7 @@ EAPI Eina_Bool                    elm_toolbar_no_select_mode_get(const Evas_Obje
  * be set as @b last item.
  *
  * Items created with this method can be deleted with
- * elm_toolbar_item_del().
+ * elm_object_item_del().
  *
  * Associated @p data can be properly freed when item is deleted if a
  * callback function is set with elm_object_item_del_cb_set().
@@ -231,7 +231,7 @@ EAPI Eina_Bool                    elm_toolbar_no_select_mode_get(const Evas_Obje
  * If an absolute path is provided it will load it direct from a file.
  *
  * @see elm_toolbar_item_icon_set()
- * @see elm_toolbar_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup Toolbar
  */
@@ -251,7 +251,7 @@ EAPI Elm_Object_Item             *elm_toolbar_item_append(Evas_Object *obj, cons
  * be set as @b first item.
  *
  * Items created with this method can be deleted with
- * elm_toolbar_item_del().
+ * elm_object_item_del().
  *
  * Associated @p data can be properly freed when item is deleted if a
  * callback function is set with elm_object_item_del_cb_set().
@@ -266,7 +266,7 @@ EAPI Elm_Object_Item             *elm_toolbar_item_append(Evas_Object *obj, cons
  * If an absolute path is provided it will load it direct from a file.
  *
  * @see elm_toolbar_item_icon_set()
- * @see elm_toolbar_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup Toolbar
  */
@@ -287,7 +287,7 @@ EAPI Elm_Object_Item             *elm_toolbar_item_prepend(Evas_Object *obj, con
  * this toolbar will be just before item @p before.
  *
  * Items created with this method can be deleted with
- * elm_toolbar_item_del().
+ * elm_object_item_del().
  *
  * Associated @p data can be properly freed when item is deleted if a
  * callback function is set with elm_object_item_del_cb_set().
@@ -302,7 +302,7 @@ EAPI Elm_Object_Item             *elm_toolbar_item_prepend(Evas_Object *obj, con
  * If an absolute path is provided it will load it direct from a file.
  *
  * @see elm_toolbar_item_icon_set()
- * @see elm_toolbar_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup Toolbar
  */
@@ -323,7 +323,7 @@ EAPI Elm_Object_Item             *elm_toolbar_item_insert_before(Evas_Object *ob
  * this toolbar will be just after item @p after.
  *
  * Items created with this method can be deleted with
- * elm_toolbar_item_del().
+ * elm_object_item_del().
  *
  * Associated @p data can be properly freed when item is deleted if a
  * callback function is set with elm_object_item_del_cb_set().
@@ -338,7 +338,7 @@ EAPI Elm_Object_Item             *elm_toolbar_item_insert_before(Evas_Object *ob
  * If an absolute path is provided it will load it direct from a file.
  *
  * @see elm_toolbar_item_icon_set()
- * @see elm_toolbar_item_del()
+ * @see elm_object_item_del()
  *
  * @ingroup Toolbar
  */
@@ -587,18 +587,6 @@ EAPI Eina_Bool                    elm_toolbar_item_icon_memfile_set(Elm_Object_I
 EAPI Eina_Bool                    elm_toolbar_item_icon_file_set(Elm_Object_Item *it, const char *file, const char *key);
 
 /**
- * Delete them item from the toolbar.
- *
- * @param it The item of toolbar to be deleted.
- *
- * @see elm_toolbar_item_append()
- *
- * @ingroup Toolbar
- */
-EAPI void                         elm_toolbar_item_del(Elm_Object_Item *it);
-
-
-/**
  * Set or unset item as a separator.
  *
  * @param it The toolbar item.
index 4c3e291..3ed1668 100644 (file)
@@ -2803,6 +2803,33 @@ _elm_widget_item_new(Evas_Object *widget,
    return item;
 }
 
+void
+_elm_widget_item_free(Elm_Widget_Item *item)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+
+   if (item->del_func)
+     item->del_func((void *)item->data, item->widget, item);
+
+   if (item->view)
+     evas_object_del(item->view);
+
+   if (item->access)
+     {
+        _elm_access_clear(item->access);
+        free(item->access);
+        item->access = NULL;
+     }
+   if (item->access_info)
+     {
+        eina_stringshare_del(item->access_info);
+        item->access_info = NULL;
+     }
+
+   EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
+   free(item);
+}
+
 /**
  * @internal
  *
@@ -2826,29 +2853,11 @@ _elm_widget_item_del(Elm_Widget_Item *item)
 {
    ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
 
-   if (item->del_func)
-     item->del_func((void *)item->data, item->widget, item);
-
+   //Widget delete callback
    if (item->del_pre_func)
      item->del_pre_func((Elm_Object_Item *) item);
 
-   if (item->view)
-     evas_object_del(item->view);
-
-   if (item->access)
-     {
-        _elm_access_clear(item->access);
-        free(item->access);
-        item->access = NULL;
-     }
-   if (item->access_info)
-     {
-        eina_stringshare_del(item->access_info);
-        item->access_info = NULL;
-     }
-
-   EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
-   free(item);
+   _elm_widget_item_free(item);
 }
 
 /**
index aebc725..919a826 100644 (file)
@@ -262,10 +262,11 @@ struct _Elm_Widget_Item
    Evas_Object                   *widget;
    /**< the base view object */
    Evas_Object                   *view;
-   /**< item specific data. used for del callback*/
+   /**< item specific data. used for del callback */
    const void                    *data;
+   /**< user delete callback function */
    Evas_Smart_Cb                  del_func;
-   /**< don't expose this callback call */
+   /**< widget delete callback function. don't expose this callback call */
    Elm_Widget_Del_Pre_Cb          del_pre_func;
 
    Elm_Widget_Content_Set_Cb      content_set_func;
@@ -441,6 +442,7 @@ EAPI Evas_Object     *elm_widget_content_part_unset(Evas_Object *obj, const char
 EAPI void             elm_widget_access_info_set(Evas_Object *obj, const char *txt);
 EAPI const char      *elm_widget_access_info_get(Evas_Object *obj);
 EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
+EAPI void             _elm_widget_item_free(Elm_Widget_Item *item);
 EAPI void             _elm_widget_item_del(Elm_Widget_Item *item);
 EAPI void             _elm_widget_item_pre_notify_del(Elm_Widget_Item *item);
 EAPI void             _elm_widget_item_del_cb_set(Elm_Widget_Item *item, Evas_Smart_Cb del_cb);
@@ -492,6 +494,14 @@ EAPI void             elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out
 #define elm_widget_item_new(parent, type) \
   (type *)_elm_widget_item_new((parent), sizeof(type))
 /**
+ * Convenience macro to free widget item, doing casts for you.
+ * @see _elm_widget_item_free()
+ * @param item a valid item.
+ */
+#define elm_widget_item_free(item) \
+  _elm_widget_item_free((Elm_Widget_Item *)item)
+
+/**
  * Convenience macro to delete widget item, doing casts for you.
  * @see _elm_widget_item_del()
  * @param item a valid item.