summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/lib/elm_menu.c16
-rw-r--r--src/lib/elm_menu_common.h15
4 files changed, 33 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 42f9639a4..947f1beba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1644,3 +1644,7 @@
16442013-09-21 Daniel Juyung Seo (SeoZ) 16442013-09-21 Daniel Juyung Seo (SeoZ)
1645 1645
1646 * menu: added "dismissed" callback. 1646 * menu: added "dismissed" callback.
1647
16482013-09-21 Daniel Juyung Seo (SeoZ)
1649
1650 * menu: added elm_menu_item_subitems_clear.
diff --git a/NEWS b/NEWS
index 2295473b5..e7747edd2 100644
--- a/NEWS
+++ b/NEWS
@@ -93,6 +93,7 @@ Additions:
93 * Add elm_widget_item_part_text_custom_set(), elm_widget_item_part_text_custom_get(), elm_widget_item_part_text_custom_update(). 93 * Add elm_widget_item_part_text_custom_set(), elm_widget_item_part_text_custom_get(), elm_widget_item_part_text_custom_update().
94 * Add "dismissed" smart callback for hover. 94 * Add "dismissed" smart callback for hover.
95 * Add "dismissed" smart callback for menu. 95 * Add "dismissed" smart callback for menu.
96 * Add elm_menu_item_subitems_clear().
96 97
97Improvements: 98Improvements:
98 99
diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c
index 7572473df..0d02169c3 100644
--- a/src/lib/elm_menu.c
+++ b/src/lib/elm_menu.c
@@ -897,12 +897,10 @@ static Eina_Bool
897_item_del_pre_hook(Elm_Object_Item *it) 897_item_del_pre_hook(Elm_Object_Item *it)
898{ 898{
899 Elm_Menu_Item *item = (Elm_Menu_Item *)it; 899 Elm_Menu_Item *item = (Elm_Menu_Item *)it;
900 Elm_Object_Item *_item;
901 900
902 ELM_MENU_DATA_GET(WIDGET(item), sd); 901 ELM_MENU_DATA_GET(WIDGET(item), sd);
903 902
904 EINA_LIST_FREE(item->submenu.items, _item) 903 elm_menu_item_subitems_clear(it);
905 elm_object_item_del(_item);
906 if (item->label) eina_stringshare_del(item->label); 904 if (item->label) eina_stringshare_del(item->label);
907 if (item->content) evas_object_del(item->content); 905 if (item->content) evas_object_del(item->content);
908 if (item->submenu.hv) evas_object_del(item->submenu.hv); 906 if (item->submenu.hv) evas_object_del(item->submenu.hv);
@@ -1114,6 +1112,18 @@ elm_menu_item_subitems_get(const Elm_Object_Item *it)
1114 return ((Elm_Menu_Item *)it)->submenu.items; 1112 return ((Elm_Menu_Item *)it)->submenu.items;
1115} 1113}
1116 1114
1115EAPI void
1116elm_menu_item_subitems_clear(Elm_Object_Item *it)
1117{
1118 Elm_Object_Item *sub_it;
1119 Eina_List *l, *l_next;
1120
1121 ELM_MENU_ITEM_CHECK_OR_RETURN(it);
1122 EINA_LIST_FOREACH_SAFE(((Elm_Menu_Item *)it)->submenu.items,
1123 l, l_next, sub_it)
1124 elm_object_item_del(sub_it);
1125}
1126
1117EAPI const Eina_List * 1127EAPI const Eina_List *
1118elm_menu_items_get(const Evas_Object *obj) 1128elm_menu_items_get(const Evas_Object *obj)
1119{ 1129{
diff --git a/src/lib/elm_menu_common.h b/src/lib/elm_menu_common.h
index c91212444..e00793e3e 100644
--- a/src/lib/elm_menu_common.h
+++ b/src/lib/elm_menu_common.h
@@ -83,6 +83,21 @@ EAPI Eina_Bool elm_menu_item_is_separator(Elm_Object_Item *it
83EAPI const Eina_List *elm_menu_item_subitems_get(const Elm_Object_Item *it); 83EAPI const Eina_List *elm_menu_item_subitems_get(const Elm_Object_Item *it);
84 84
85/** 85/**
86 * Remove all sub-items (children) of the given item
87 * @since 1.8
88 *
89 * @param it The item
90 *
91 * This removes all items that are children (and their descendants) of the
92 * given item @p it.
93 *
94 * @see elm_object_item_del()
95 *
96 * @ingroup Menu
97 */
98EAPI void elm_menu_item_subitems_clear(Elm_Object_Item *it);
99
100/**
86 * @brief Get the position of a menu item 101 * @brief Get the position of a menu item
87 * 102 *
88 * @param it The menu item 103 * @param it The menu item