elementary - Added 1 more API elm_object_item_del_cb_set()

also deprecated below APIs  

   elm_hoversel_item_del_cb_set()
   elm_diskselector_item_del_cb_set()
   elm_toolbar_item_del_cb_set()
   elm_index_item_del_cb_set()
   elm_menu_item_del_cb_set()                  



SVN revision: 66748
This commit is contained in:
ChunEon Park 2012-01-02 11:46:32 +00:00
parent eee1749191
commit 569e56e904
18 changed files with 122 additions and 109 deletions

View File

@ -2208,7 +2208,7 @@
* *
* If you want to free this data, or handle that the way you need when the * If you want to free this data, or handle that the way you need when the
* item is deleted, set a callback function for that, with * item is deleted, set a callback function for that, with
* elm_diskselector_item_del_cb_set(). * elm_object_item_del_cb_set().
* *
* As you can see we check if @c it is not @c NULL after appending it. * As you can see we check if @c it is not @c NULL after appending it.
* If an error happens, we won't try to set a function for it. * If an error happens, we won't try to set a function for it.

View File

@ -102,7 +102,7 @@ _add_data_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED_
printf("Error adding item\n"); printf("Error adding item\n");
return; return;
} }
elm_diskselector_item_del_cb_set(ds_it, _free_data); elm_object_item_del_cb_set(ds_it, _free_data);
} }
static void static void

View File

@ -94,7 +94,7 @@ _add_item(void *data, Evas_Object *obj, void *event_info)
hoversel_it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL, hoversel_it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL,
str); str);
elm_hoversel_item_del_cb_set(hoversel_it, _free); elm_object_item_del_cb_set(hoversel_it, _free);
} }
static void static void

View File

@ -164,7 +164,7 @@ elm_main(int argc __UNUSED__,
elm_index_item_append(d.index, buf, it); elm_index_item_append(d.index, buf, it);
index_it = elm_index_item_find(d.index, it); index_it = elm_index_item_find(d.index, it);
elm_index_item_del_cb_set(index_it, _index_item_del); elm_object_item_del_cb_set(index_it, _index_item_del);
} }
} }

View File

@ -156,7 +156,7 @@ tab_add(App_Data *ad)
td->app = ad; td->app = ad;
td->tab = elm_toolbar_item_append(td->app->tabs, NULL, "New tab", td->tab = elm_toolbar_item_append(td->app->tabs, NULL, "New tab",
_tab_clicked_cb, td); _tab_clicked_cb, td);
elm_toolbar_item_del_cb_set(td->tab, _tb_item_del_cb); elm_object_item_del_cb_set(td->tab, _tb_item_del_cb);
evas_object_data_set(td->web, "tab_data", td); evas_object_data_set(td->web, "tab_data", td);

View File

@ -515,8 +515,7 @@ elm_hoversel_item_del(Elm_Object_Item *it)
EAPI void EAPI void
elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it); elm_object_item_del_cb_set(it, func);
elm_widget_item_del_cb_set(it, func);
} }
EAPI void * EAPI void *

View File

@ -127,7 +127,6 @@ EAPI Eina_Bool elm_hoversel_expanded_get(const Evas_Object *o
* @warning Should @b not be called while the hoversel is active; use * @warning Should @b not be called while the hoversel is active; use
* elm_hoversel_expanded_get() to check first. * elm_hoversel_expanded_get() to check first.
* *
* @see elm_hoversel_item_del_cb_set()
* @see elm_hoversel_item_del() * @see elm_hoversel_item_del()
*/ */
EAPI void elm_hoversel_clear(Evas_Object *obj); EAPI void elm_hoversel_clear(Evas_Object *obj);
@ -173,26 +172,9 @@ EAPI Elm_Object_Item *elm_hoversel_item_add(Evas_Object *obj, const
* hoversel is active; use elm_hoversel_expanded_get() to check first). * hoversel is active; use elm_hoversel_expanded_get() to check first).
* *
* @see elm_hoversel_item_add() * @see elm_hoversel_item_add()
* @see elm_hoversel_item_del_cb_set()
*/ */
EAPI void elm_hoversel_item_del(Elm_Object_Item *it); EAPI void elm_hoversel_item_del(Elm_Object_Item *it);
/**
* @brief Set the function to be called when an item from the hoversel is
* freed.
*
* @param it The item to set the callback on
* @param func The function called
*
* That function will receive these parameters:
* @li void * item data
* @li Evas_Object * hoversel object
* @li Elm_Object_Item * hoversel item
*
* @see elm_hoversel_item_add()
*/
EAPI void elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
/** /**
* @brief This sets the icon for the given hoversel item. * @brief This sets the icon for the given hoversel item.
* *

View File

@ -565,6 +565,23 @@ EINA_DEPRECATED EAPI void *elm_hoversel_item_data_get(const Elm_Object_It
*/ */
EINA_DEPRECATED EAPI const char *elm_hoversel_item_label_get(const Elm_Object_Item *it); EINA_DEPRECATED EAPI const char *elm_hoversel_item_label_get(const Elm_Object_Item *it);
/**
* @brief Set the function to be called when an item from the hoversel is
* freed.
*
* @param it The item to set the callback on
* @param func The function called
*
* That function will receive these parameters:
* @li void * item data
* @li Evas_Object * hoversel object
* @li Elm_Object_Item * hoversel item
*
* @see elm_hoversel_item_add()
* @deprecated Use elm_object_item_del_cb_set() instead
*/
EINA_DEPRECATED EAPI void elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
/** /**
* Set actionslider labels. * Set actionslider labels.
* *
@ -1245,6 +1262,26 @@ EINA_DEPRECATED EAPI void elm_diskselector_item_label_set(Elm_
*/ */
EINA_DEPRECATED EAPI const char *elm_diskselector_item_label_get(const Elm_Object_Item *it); EINA_DEPRECATED EAPI const char *elm_diskselector_item_label_get(const Elm_Object_Item *it);
/**
* Set the function called when a diskselector item is freed.
*
* @param it The item to set the callback on
* @param func The function called
*
* If there is a @p func, then it will be called prior item's memory release.
* That will be called with the following arguments:
* @li item's data;
* @li item's Evas object;
* @li item itself;
*
* This way, a data associated to a diskselector item could be properly
* freed.
* @deprecated Use elm_object_item_del_cb_set() instead
*
* @ingroup Diskselector
*/
EINA_DEPRECATED EAPI void elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
EINA_DEPRECATED EAPI void elm_factory_content_set(Evas_Object *obj, Evas_Object *content); 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); EINA_DEPRECATED EAPI Evas_Object *elm_factory_content_get(const Evas_Object *obj);
@ -1402,7 +1439,22 @@ EINA_DEPRECATED EAPI void *elm_index_item_data_get(const Elm_Object_Item *item);
EINA_DEPRECATED EAPI void elm_index_item_data_set(Elm_Object_Item *it, const void *data); EINA_DEPRECATED EAPI void elm_index_item_data_set(Elm_Object_Item *it, const void *data);
/** /**
* @brief Set the label on the label object * Set the function to be called when a given index widget item is freed.
*
* @param it The item to set the callback on
* @param func The function to call on the item's deletion
*
* When called, @p func will have both @c data and @c event_info
* arguments with the @p it item's data value and, naturally, the
* @c obj argument with a handle to the parent index widget.
*
* @deprecated Use elm_object_item_del_cb_set() instead
* @ingroup Index
*/
EINA_DEPRECATED EAPI void elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
/**
* @brief Set the label on the label object
* *
* @param obj The label object * @param obj The label object
* @param label The label will be used on the label object * @param label The label will be used on the label object
@ -1658,6 +1710,18 @@ EINA_DEPRECATED EAPI Eina_Bool elm_menu_item_disabled_get(const Elm_Object_It
*/ */
EINA_DEPRECATED EAPI void *elm_menu_item_data_get(const Elm_Object_Item *it); EINA_DEPRECATED EAPI void *elm_menu_item_data_get(const Elm_Object_Item *it);
/**
* @brief Set the function called when a menu item is deleted.
*
* @param it The item to set the callback on
* @param func The function called
*
* @see elm_menu_item_add()
* @see elm_menu_item_del()
* @deprecated Use elm_object_item_del_cb_set() instead
*/
EINA_DEPRECATED EAPI void elm_menu_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
/** /**
* @brief Sets the data to be associated with menu item @p item. * @brief Sets the data to be associated with menu item @p item.
* *
@ -2457,6 +2521,25 @@ EINA_DEPRECATED EAPI void elm_toolbar_orientation_set(Evas_Object *obj,
*/ */
EINA_DEPRECATED EAPI Eina_Bool elm_toolbar_orientation_get(const Evas_Object *obj); EINA_DEPRECATED EAPI Eina_Bool elm_toolbar_orientation_get(const Evas_Object *obj);
/**
* Set the function called when a toolbar item is freed.
*
* @param it The item to set the callback on.
* @param func The function called.
*
* If there is a @p func, then it will be called prior item's memory release.
* That will be called with the following arguments:
* @li item's data;
* @li item's Evas object;
* @li item itself;
*
* This way, a data associated to a toolbar item could be properly freed.
*
* @deprecated Use elm_object_item_del_cb_set() instead
* @ingroup Toolbar
*/
EINA_DEPRECATED EAPI void elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
/** /**
* @brief Link a Elm_Payer with an Elm_Video object. * @brief Link a Elm_Payer with an Elm_Video object.
* *

View File

@ -1321,8 +1321,7 @@ elm_diskselector_item_selected_get(const Elm_Object_Item *it)
EAPI void EAPI void
elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it); elm_object_item_del_cb_set(it, func);
elm_widget_item_del_cb_set(it, func);
} }
EAPI void * EAPI void *

View File

@ -268,7 +268,7 @@ EAPI const Eina_List *elm_diskselector_items_get(const Evas_Object *obj);
* elm_diskselector_item_del(). * elm_diskselector_item_del().
* *
* Associated @p data can be properly freed when item is deleted if a * Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_diskselector_item_del_cb_set(). * callback function is set with elm_object_item_del_cb_set().
* *
* If a function is passed as argument, it will be called everytime this item * If a function is passed as argument, it will be called everytime this item
* is selected, i.e., the user stops the diskselector with this * is selected, i.e., the user stops the diskselector with this
@ -285,7 +285,6 @@ EAPI const Eina_List *elm_diskselector_items_get(const Evas_Object *obj);
* @endcode * @endcode
* *
* @see elm_diskselector_item_del() * @see elm_diskselector_item_del()
* @see elm_diskselector_item_del_cb_set()
* @see elm_diskselector_clear() * @see elm_diskselector_clear()
* @see elm_icon_add() * @see elm_icon_add()
* *
@ -304,31 +303,11 @@ EAPI Elm_Object_Item *elm_diskselector_item_append(Evas_Object *obj, const char
* *
* @see elm_diskselector_clear() * @see elm_diskselector_clear()
* @see elm_diskselector_item_append() * @see elm_diskselector_item_append()
* @see elm_diskselector_item_del_cb_set()
* *
* @ingroup Diskselector * @ingroup Diskselector
*/ */
EAPI void elm_diskselector_item_del(Elm_Object_Item *it); EAPI void elm_diskselector_item_del(Elm_Object_Item *it);
/**
* Set the function called when a diskselector item is freed.
*
* @param it The item to set the callback on
* @param func The function called
*
* If there is a @p func, then it will be called prior item's memory release.
* That will be called with the following arguments:
* @li item's data;
* @li item's Evas object;
* @li item itself;
*
* This way, a data associated to a diskselector item could be properly
* freed.
*
* @ingroup Diskselector
*/
EAPI void elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
/** /**
* Get the selected item. * Get the selected item.
* *

View File

@ -811,8 +811,7 @@ elm_index_item_data_set(Elm_Object_Item *it, const void *data)
EAPI void EAPI void
elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it); elm_object_item_del_cb_set(it, func);
elm_widget_item_del_cb_set(it, func);
} }
EAPI const char * EAPI const char *

View File

@ -246,7 +246,7 @@ EAPI void elm_index_item_sorted_insert(Evas_Object *obj, const
* @param obj The index object * @param obj The index object
* @param item The item to be removed from @p obj * @param item The item to be removed from @p obj
* *
* If a deletion callback is set, via elm_index_item_del_cb_set(), * If a deletion callback is set, via elm_object_item_del_cb_set(),
* that callback function will be called by this one. * that callback function will be called by this one.
* *
* @ingroup Index * @ingroup Index
@ -269,7 +269,7 @@ EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *ite
* *
* @param obj The index object. * @param obj The index object.
* *
* If deletion callbacks are set, via elm_index_item_del_cb_set(), * If deletion callbacks are set, via elm_object_item_del_cb_set(),
* that callback function will be called for each item in @p obj. * that callback function will be called for each item in @p obj.
* *
* @ingroup Index * @ingroup Index
@ -286,20 +286,6 @@ EAPI void elm_index_item_clear(Evas_Object *obj);
*/ */
EAPI void elm_index_item_go(Evas_Object *obj, int level); EAPI void elm_index_item_go(Evas_Object *obj, int level);
/**
* Set the function to be called when a given index widget item is freed.
*
* @param it The item to set the callback on
* @param func The function to call on the item's deletion
*
* When called, @p func will have both @c data and @c event_info
* arguments with the @p it item's data value and, naturally, the
* @c obj argument with a handle to the parent index widget.
*
* @ingroup Index
*/
EAPI void elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
/** /**
* Get the letter (string) set on a given index widget item. * Get the letter (string) set on a given index widget item.
* *

View File

@ -2129,3 +2129,7 @@ EAPI Eina_Bool elm_object_item_disabled_get(const Elm_Object_Item *it)
return _elm_widget_item_disabled_get((Elm_Widget_Item *) it); return _elm_widget_item_disabled_get((Elm_Widget_Item *) it);
} }
EAPI void elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb)
{
_elm_widget_item_del_cb_set((Elm_Widget_Item *) it, del_cb);
}

View File

@ -920,8 +920,7 @@ elm_menu_item_del(Elm_Object_Item *it)
EAPI void EAPI void
elm_menu_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) elm_menu_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it); elm_object_item_del_cb_set(it, func);
elm_widget_item_del_cb_set(it, func);
} }
EAPI void * EAPI void *

View File

@ -186,17 +186,6 @@ EAPI Eina_Bool elm_menu_item_is_separator(Elm_Object_Item *it
*/ */
EAPI void elm_menu_item_del(Elm_Object_Item *it); EAPI void elm_menu_item_del(Elm_Object_Item *it);
/**
* @brief Set the function called when a menu item is deleted.
*
* @param it The item to set the callback on
* @param func The function called
*
* @see elm_menu_item_add()
* @see elm_menu_item_del()
*/
EAPI void elm_menu_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
/** /**
* @brief Returns a list of @p item's subitems. * @brief Returns a list of @p item's subitems.
* *

View File

@ -158,3 +158,20 @@ EAPI void elm_object_item_disabled_set(Elm_Object_Item *
* @ingroup Styles * @ingroup Styles
*/ */
EAPI Eina_Bool elm_object_item_disabled_get(const Elm_Object_Item *it); EAPI Eina_Bool elm_object_item_disabled_get(const Elm_Object_Item *it);
/**
* @brief Set the function to be called when an item from the widget is
* freed.
*
* @param it The item to set the callback on
* @param func The function called
*
* That function will receive these parameters:
* @li void * item data
* @li Evas_Object * widget object
* @li Elm_Object_Item * widget item
*
* @see elm_object_item_del()
* @ingroup General
*/
EAPI void elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb);

View File

@ -1472,8 +1472,7 @@ elm_toolbar_item_del(Elm_Object_Item *it)
EAPI void EAPI void
elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it); elm_object_item_del_cb_set(it, func);
elm_widget_item_del_cb_set(it, func);
} }
EAPI Eina_Bool EAPI Eina_Bool

View File

@ -220,7 +220,7 @@ EAPI Eina_Bool elm_toolbar_no_select_mode_get(const Evas_Obje
* elm_toolbar_item_del(). * elm_toolbar_item_del().
* *
* Associated @p data can be properly freed when item is deleted if a * Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_toolbar_item_del_cb_set(). * callback function is set with elm_object_item_del_cb_set().
* *
* If a function is passed as argument, it will be called everytime this item * If a function is passed as argument, it will be called everytime this item
* is selected, i.e., the user clicks over an unselected item. * is selected, i.e., the user clicks over an unselected item.
@ -233,7 +233,6 @@ EAPI Eina_Bool elm_toolbar_no_select_mode_get(const Evas_Obje
* *
* @see elm_toolbar_item_icon_set() * @see elm_toolbar_item_icon_set()
* @see elm_toolbar_item_del() * @see elm_toolbar_item_del()
* @see elm_toolbar_item_del_cb_set()
* *
* @ingroup Toolbar * @ingroup Toolbar
*/ */
@ -256,7 +255,7 @@ EAPI Elm_Object_Item *elm_toolbar_item_append(Evas_Object *obj, cons
* elm_toolbar_item_del(). * elm_toolbar_item_del().
* *
* Associated @p data can be properly freed when item is deleted if a * Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_toolbar_item_del_cb_set(). * callback function is set with elm_object_item_del_cb_set().
* *
* If a function is passed as argument, it will be called everytime this item * If a function is passed as argument, it will be called everytime this item
* is selected, i.e., the user clicks over an unselected item. * is selected, i.e., the user clicks over an unselected item.
@ -269,7 +268,6 @@ EAPI Elm_Object_Item *elm_toolbar_item_append(Evas_Object *obj, cons
* *
* @see elm_toolbar_item_icon_set() * @see elm_toolbar_item_icon_set()
* @see elm_toolbar_item_del() * @see elm_toolbar_item_del()
* @see elm_toolbar_item_del_cb_set()
* *
* @ingroup Toolbar * @ingroup Toolbar
*/ */
@ -293,7 +291,7 @@ EAPI Elm_Object_Item *elm_toolbar_item_prepend(Evas_Object *obj, con
* elm_toolbar_item_del(). * elm_toolbar_item_del().
* *
* Associated @p data can be properly freed when item is deleted if a * Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_toolbar_item_del_cb_set(). * callback function is set with elm_object_item_del_cb_set().
* *
* If a function is passed as argument, it will be called everytime this item * If a function is passed as argument, it will be called everytime this item
* is selected, i.e., the user clicks over an unselected item. * is selected, i.e., the user clicks over an unselected item.
@ -306,7 +304,6 @@ EAPI Elm_Object_Item *elm_toolbar_item_prepend(Evas_Object *obj, con
* *
* @see elm_toolbar_item_icon_set() * @see elm_toolbar_item_icon_set()
* @see elm_toolbar_item_del() * @see elm_toolbar_item_del()
* @see elm_toolbar_item_del_cb_set()
* *
* @ingroup Toolbar * @ingroup Toolbar
*/ */
@ -330,7 +327,7 @@ EAPI Elm_Object_Item *elm_toolbar_item_insert_before(Evas_Object *ob
* elm_toolbar_item_del(). * elm_toolbar_item_del().
* *
* Associated @p data can be properly freed when item is deleted if a * Associated @p data can be properly freed when item is deleted if a
* callback function is set with elm_toolbar_item_del_cb_set(). * callback function is set with elm_object_item_del_cb_set().
* *
* If a function is passed as argument, it will be called everytime this item * If a function is passed as argument, it will be called everytime this item
* is selected, i.e., the user clicks over an unselected item. * is selected, i.e., the user clicks over an unselected item.
@ -343,7 +340,6 @@ EAPI Elm_Object_Item *elm_toolbar_item_insert_before(Evas_Object *ob
* *
* @see elm_toolbar_item_icon_set() * @see elm_toolbar_item_icon_set()
* @see elm_toolbar_item_del() * @see elm_toolbar_item_del()
* @see elm_toolbar_item_del_cb_set()
* *
* @ingroup Toolbar * @ingroup Toolbar
*/ */
@ -597,29 +593,11 @@ EAPI Eina_Bool elm_toolbar_item_icon_file_set(Elm_Object_Item
* @param it The item of toolbar to be deleted. * @param it The item of toolbar to be deleted.
* *
* @see elm_toolbar_item_append() * @see elm_toolbar_item_append()
* @see elm_toolbar_item_del_cb_set()
* *
* @ingroup Toolbar * @ingroup Toolbar
*/ */
EAPI void elm_toolbar_item_del(Elm_Object_Item *it); EAPI void elm_toolbar_item_del(Elm_Object_Item *it);
/**
* Set the function called when a toolbar item is freed.
*
* @param it The item to set the callback on.
* @param func The function called.
*
* If there is a @p func, then it will be called prior item's memory release.
* That will be called with the following arguments:
* @li item's data;
* @li item's Evas object;
* @li item itself;
*
* This way, a data associated to a toolbar item could be properly freed.
*
* @ingroup Toolbar
*/
EAPI void elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func);
/** /**
* Set or unset item as a separator. * Set or unset item as a separator.