* @skipline _del_cb(
* @until }
*
- * To delete an item we simple need to call elm_list_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
{
iit = elm_index_item_find(gui->id, list_it);
if (iit) elm_object_item_del(iit);
- elm_list_item_del(list_it);
+ elm_object_item_del(list_it);
return;
}
else
elm_object_item_del(iit);
- elm_list_item_del(list_it);
+ elm_object_item_del(list_it);
}
void
Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
- elm_list_item_del(data);
+ elm_object_item_del(data);
}
static void
data == elm_index_item_data_get(event_info) ? "OK" :
"FAIL, something went wrong");
- elm_list_item_del(data);
+ elm_object_item_del(data);
}
/* delete an index item */
printf("Error adding item\n");
return;
}
- elm_list_item_del_cb_set(list_it, _free_data);
+ elm_object_item_del_cb_set(list_it, _free_data);
}
static void
Evas_Object *li = data;
selected_item = elm_list_selected_item_get(li);
- elm_list_item_del(selected_item);
+ elm_object_item_del(selected_item);
}
static void
EINA_DEPRECATED EAPI Eina_Bool elm_list_item_cursor_engine_only_get(const Elm_Object_Item *it);
/**
+ * Delete the item from the list.
+ *
+ * @param it The item of list to be deleted.
+ *
+ * If deleting all list items is required, elm_list_clear()
+ * should be used instead of getting items list and deleting each one.
+ *
+ * @see elm_list_clear()
+ * @see elm_list_item_append()
+ * @see elm_widget_item_del_cb_set()
+ * @deprecated Use elm_object_item_del() instead
+ *
+ * @ingroup List
+ */
+EINA_DEPRECATED EAPI void elm_list_item_del(Elm_Object_Item *it);
+
+/**
* Set the shrink state of toolbar @p obj.
*
* @param obj The toolbar object.
if (it->long_timer) ecore_timer_del(it->long_timer);
if (it->icon) evas_object_del(it->icon);
if (it->end) evas_object_del(it->end);
-
- elm_widget_item_del(it);
}
static Eina_Bool
EINA_LIST_FREE(wd->to_delete, it)
{
- elm_widget_item_pre_notify_del(it);
-
wd->items = eina_list_remove_list(wd->items, it->node);
_elm_list_item_free(it);
+ elm_widget_item_free(it);
}
wd->walking--;
if (wd->to_delete)
ERR("ERROR: leaking nodes!\n");
- EINA_LIST_FREE(wd->items, it) _elm_list_item_free(it);
+ EINA_LIST_FREE(wd->items, it)
+ {
+ _elm_list_item_free(it);
+ elm_widget_item_free(it);
+ }
eina_list_free(wd->selected);
free(wd);
}
return ((Elm_List_Item *) it)->label;
}
+static Eina_Bool
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+ ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
+
+ Evas_Object *obj = WIDGET(it);
+ Elm_List_Item *item = (Elm_List_Item *) it;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+
+ if (item->selected) _item_unselect(item);
+
+ if (wd->walking > 0)
+ {
+ if (item->deleted) return EINA_FALSE;
+ item->deleted = EINA_TRUE;
+ wd->to_delete = eina_list_append(wd->to_delete, item);
+ return EINA_FALSE;
+ }
+
+ wd->items = eina_list_remove_list(wd->items, item->node);
+
+ evas_object_ref(obj);
+ _elm_list_walk(wd);
+
+ _elm_list_item_free(item);
+
+ _elm_list_unwalk(wd);
+ evas_object_unref(obj);
+
+ return EINA_TRUE;
+}
+
static Elm_List_Item *
_item_new(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
{
elm_widget_item_content_unset_hook_set(it, _item_content_unset);
elm_widget_item_text_set_hook_set(it, _item_text_set);
elm_widget_item_text_get_hook_set(it, _item_text_get);
+ elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
return it;
}
EINA_LIST_FREE(wd->items, it)
{
- elm_widget_item_pre_notify_del(it);
_elm_list_item_free(it);
+ elm_widget_item_free(it);
}
_elm_list_unwalk(wd);
if (wd->scr) elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h);
}
-EAPI void
-elm_list_item_del(Elm_Object_Item *it)
-{
- ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
- Evas_Object *obj = WIDGET(it);
- Elm_List_Item *item = (Elm_List_Item *) it;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (item->selected) _item_unselect(item);
-
- if (wd->walking > 0)
- {
- if (item->deleted) return;
- item->deleted = EINA_TRUE;
- wd->to_delete = eina_list_append(wd->to_delete, item);
- return;
- }
-
- wd->items = eina_list_remove_list(wd->items, item->node);
-
- evas_object_ref(obj);
- _elm_list_walk(wd);
-
- elm_widget_item_pre_notify_del(item);
- _elm_list_item_free(item);
-
- _elm_list_unwalk(wd);
- evas_object_unref(obj);
-}
-
EAPI Evas_Object *
elm_list_item_object_get(const Elm_Object_Item *it)
{
else return NULL;
}
+EINA_DEPRECATED EAPI void
+elm_list_item_del(Elm_Object_Item *it)
+{
+ elm_object_item_del(it);
+}
+
EINA_DEPRECATED EAPI Evas_Object *
elm_list_item_base_get(const Elm_Object_Item *it)
{
* A new item will be created and appended to the list, i.e., will
* be set as @b last item.
*
- * Items created with this method can be deleted with
- * elm_list_item_del().
+ * Items created with this method can be deleted with elm_object_item_del().
*
* Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_widget_item_del_cb_set().
* @endcode
*
* @see elm_list_always_select_mode_set()
- * @see elm_list_item_del()
+ * @see elm_object_item_del()
* @see elm_widget_item_del_cb_set()
* @see elm_list_clear()
* @see elm_icon_add()
* A new item will be created and prepended to the list, i.e., will
* be set as @b first item.
*
- * Items created with this method can be deleted with
- * elm_list_item_del().
+ * Items created with this method can be deleted with elm_object_item_del().
*
* Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_widget_item_del_cb_set().
*
* @see elm_list_item_append() for a simple code example.
* @see elm_list_always_select_mode_set()
- * @see elm_list_item_del()
+ * @see elm_object_item_del()
* @see elm_widget_item_del_cb_set()
* @see elm_list_clear()
* @see elm_icon_add()
* A new item will be created and added to the list. Its position in
* this list will be just before item @p before.
*
- * Items created with this method can be deleted with
- * elm_list_item_del().
+ * Items created with this method can be deleted with elm_object_item_del().
*
* Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_widget_item_del_cb_set().
*
* @see elm_list_item_append() for a simple code example.
* @see elm_list_always_select_mode_set()
- * @see elm_list_item_del()
+ * @see elm_object_item_del()
* @see elm_widget_item_del_cb_set()
* @see elm_list_clear()
* @see elm_icon_add()
* A new item will be created and added to the list. Its position in
* this list will be just after item @p after.
*
- * Items created with this method can be deleted with
- * elm_list_item_del().
+ * Items created with this method can be deleted with elm_object_item_del().
*
* Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_widget_item_del_cb_set().
*
* @see elm_list_item_append() for a simple code example.
* @see elm_list_always_select_mode_set()
- * @see elm_list_item_del()
+ * @see elm_object_item_del()
* @see elm_widget_item_del_cb_set()
* @see elm_list_clear()
* @see elm_icon_add()
* this list will be found comparing the new item with previously inserted
* items using function @p cmp_func.
*
- * Items created with this method can be deleted with
- * elm_list_item_del().
+ * Items created with this method can be deleted with elm_object_item_del().
*
* Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_widget_item_del_cb_set().
*
* @see elm_list_item_append() for a simple code example.
* @see elm_list_always_select_mode_set()
- * @see elm_list_item_del()
+ * @see elm_object_item_del()
* @see elm_widget_item_del_cb_set()
* @see elm_list_clear()
* @see elm_icon_add()
*
* @param obj The list object
*
- * @see elm_list_item_del()
+ * @see elm_object_item_del()
* @see elm_list_item_append()
*
* @ingroup List
* or @c NULL on failure.
*
* @see elm_list_item_append()
- * @see elm_list_item_del()
+ * @see elm_object_item_del()
* @see elm_list_clear()
*
* @ingroup List
EAPI void elm_list_item_bring_in(Elm_Object_Item *it);
/**
- * Delete the item from the list.
- *
- * @param it The item of list to be deleted.
- *
- * If deleting all list items is required, elm_list_clear()
- * should be used instead of getting items list and deleting each one.
- *
- * @see elm_list_clear()
- * @see elm_list_item_append()
- * @see elm_widget_item_del_cb_set()
- *
- * @ingroup List
- */
-EAPI void elm_list_item_del(Elm_Object_Item *it);
-
-/**
* Gets the base object of the item.
*
* @param it The list item