summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-06-30 19:37:10 +0300
committerYossi Kantor <yossi.kantor@samsung.com>2014-08-03 14:50:41 +0300
commitf399fee1cd37ad0faf91d7f64aa2f769da42c350 (patch)
treeedbb1f0307b96eb7818a04dc6c30634a9ea55d53
parent8ad175beb60397299c90aadce8d2dfd4450f1524 (diff)
Integration of Menu Item
-rw-r--r--src/lib/Makefile.am7
-rw-r--r--src/lib/elm_dbus_menu.c63
-rw-r--r--src/lib/elm_menu.c558
-rw-r--r--src/lib/elm_menu_item.eo139
-rw-r--r--src/lib/elm_widget_menu.h27
5 files changed, 524 insertions, 270 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 15bd7cd83..c95782055 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -788,7 +788,9 @@ BUILT_SOURCES = \
788 elm_slideshow_item.eo.c \ 788 elm_slideshow_item.eo.c \
789 elm_slideshow_item.eo.h \ 789 elm_slideshow_item.eo.h \
790 elm_flipselector_item.eo.c \ 790 elm_flipselector_item.eo.c \
791 elm_flipselector_item.eo.h 791 elm_flipselector_item.eo.h \
792 elm_menu_item.eo.c \
793 elm_menu_item.eo.h
792 794
793elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@ 795elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@
794elementaryeolianfiles_DATA = \ 796elementaryeolianfiles_DATA = \
@@ -887,7 +889,8 @@ elementaryeolianfiles_DATA = \
887 elm_hoversel_item.eo \ 889 elm_hoversel_item.eo \
888 elm_segment_control_item.eo \ 890 elm_segment_control_item.eo \
889 elm_slideshow_item.eo \ 891 elm_slideshow_item.eo \
890 elm_flipselector_item.eo 892 elm_flipselector_item.eo \
893 elm_menu_item.eo
891 894
892EXTRA_DIST += \ 895EXTRA_DIST += \
893 ${elementaryeolianfiles_DATA} 896 ${elementaryeolianfiles_DATA}
diff --git a/src/lib/elm_dbus_menu.c b/src/lib/elm_dbus_menu.c
index 021ee3b9d..b52ec6cb7 100644
--- a/src/lib/elm_dbus_menu.c
+++ b/src/lib/elm_dbus_menu.c
@@ -59,19 +59,20 @@ struct _Callback_Data
59}; 59};
60 60
61static Eina_Bool 61static Eina_Bool
62_menu_add_recursive(Elm_DBus_Menu *dbus_menu, Elm_Menu_Item *item) 62_menu_add_recursive(Elm_DBus_Menu *dbus_menu, Elm_Widobj_Item *item)
63{ 63{
64 int32_t id; 64 int32_t id;
65 Eina_List *l; 65 Eina_List *l;
66 Elm_Menu_Item *subitem; 66 Elm_Widobj_Item *subitem;
67 67
68 id = ++dbus_menu->timestamp; 68 id = ++dbus_menu->timestamp;
69 if (!eina_hash_add(dbus_menu->elements, &id, item)) 69 if (!eina_hash_add(dbus_menu->elements, &id, item))
70 return EINA_FALSE; 70 return EINA_FALSE;
71 71
72 item->dbus_idx = id; 72 ELM_MENU_ITEM_DATA_GET(item, item_data);
73 item_data->dbus_idx = id;
73 74
74 EINA_LIST_FOREACH (item->submenu.items, l, subitem) 75 EINA_LIST_FOREACH (item_data->submenu.items, l, subitem)
75 { 76 {
76 if (!_menu_add_recursive(dbus_menu, subitem)) 77 if (!_menu_add_recursive(dbus_menu, subitem))
77 return EINA_FALSE; 78 return EINA_FALSE;
@@ -168,25 +169,27 @@ _str_to_property(const char *str)
168} 169}
169 170
170static Eina_Bool 171static Eina_Bool
171_freedesktop_icon_exists(Elm_Menu_Item *item) 172_freedesktop_icon_exists(Elm_Widobj_Item *item)
172{ 173{
173 if (!item->icon_str) return EINA_FALSE; 174 ELM_MENU_ITEM_DATA_GET(item, item_data);
175 if (!item_data->icon_str) return EINA_FALSE;
174 176
175 ELM_ICON_CHECK(item->content) EINA_FALSE; 177 ELM_ICON_CHECK(item_data->content) EINA_FALSE;
176 178
177 ELM_ICON_DATA_GET(item->content, sd); 179 ELM_ICON_DATA_GET(item_data->content, sd);
178 if (sd->freedesktop.use) return EINA_TRUE; 180 if (sd->freedesktop.use) return EINA_TRUE;
179 181
180 return EINA_FALSE; 182 return EINA_FALSE;
181} 183}
182 184
183static Eina_Bool 185static Eina_Bool
184_property_exists(Elm_Menu_Item *item, 186_property_exists(Elm_Widobj_Item *item,
185 Elm_DBus_Property property) 187 Elm_DBus_Property property)
186{ 188{
187 Elm_Object_Item *item_obj; 189 Elm_Object_Item *item_obj;
188 190
189 if (item->separator) 191 ELM_MENU_ITEM_DATA_GET(item, item_data);
192 if (item_data->separator)
190 { 193 {
191 if (property == ELM_DBUS_PROPERTY_TYPE) return EINA_TRUE; 194 if (property == ELM_DBUS_PROPERTY_TYPE) return EINA_TRUE;
192 return EINA_FALSE; 195 return EINA_FALSE;
@@ -199,7 +202,7 @@ _property_exists(Elm_Menu_Item *item,
199 return EINA_TRUE; 202 return EINA_TRUE;
200 203
201 case ELM_DBUS_PROPERTY_CHILDREN_DISPLAY: 204 case ELM_DBUS_PROPERTY_CHILDREN_DISPLAY:
202 if (eina_list_count(item->submenu.items)) return EINA_TRUE; 205 if (eina_list_count(item_data->submenu.items)) return EINA_TRUE;
203 return EINA_FALSE; 206 return EINA_FALSE;
204 207
205 case ELM_DBUS_PROPERTY_ENABLED: 208 case ELM_DBUS_PROPERTY_ENABLED:
@@ -221,7 +224,7 @@ _property_exists(Elm_Menu_Item *item,
221// Ad-hoc dbusmenu property dictionary subset implementation 224// Ad-hoc dbusmenu property dictionary subset implementation
222// Depends on _property_exists results 225// Depends on _property_exists results
223static void 226static void
224_property_append(Elm_Menu_Item *item, 227_property_append(Elm_Widobj_Item *item,
225 Elm_DBus_Property property, 228 Elm_DBus_Property property,
226 Eldbus_Message_Iter *iter) 229 Eldbus_Message_Iter *iter)
227{ 230{
@@ -229,6 +232,7 @@ _property_append(Elm_Menu_Item *item,
229 Elm_Object_Item *item_obj = (Elm_Object_Item *)item; 232 Elm_Object_Item *item_obj = (Elm_Object_Item *)item;
230 const char *t; 233 const char *t;
231 234
235 ELM_MENU_ITEM_DATA_GET(item, item_data);
232 switch (property) 236 switch (property)
233 { 237 {
234 case ELM_DBUS_PROPERTY_LABEL: 238 case ELM_DBUS_PROPERTY_LABEL:
@@ -236,7 +240,7 @@ _property_append(Elm_Menu_Item *item,
236 t = elm_object_item_part_text_get(item_obj, NULL); 240 t = elm_object_item_part_text_get(item_obj, NULL);
237 if (!t) 241 if (!t)
238 { 242 {
239 t = elm_object_part_text_get(item->content, NULL); 243 t = elm_object_part_text_get(item_data->content, NULL);
240 if (!t) t = ""; 244 if (!t) t = "";
241 } 245 }
242 246
@@ -260,7 +264,7 @@ _property_append(Elm_Menu_Item *item,
260 264
261 case ELM_DBUS_PROPERTY_ICON_NAME: 265 case ELM_DBUS_PROPERTY_ICON_NAME:
262 variant = eldbus_message_iter_container_new(iter, 'v', "s"); 266 variant = eldbus_message_iter_container_new(iter, 'v', "s");
263 eldbus_message_iter_basic_append(variant, 's', item->icon_str); 267 eldbus_message_iter_basic_append(variant, 's', item_data->icon_str);
264 break; 268 break;
265 269
266 case ELM_DBUS_PROPERTY_UNKNOWN: 270 case ELM_DBUS_PROPERTY_UNKNOWN:
@@ -272,7 +276,7 @@ _property_append(Elm_Menu_Item *item,
272} 276}
273 277
274static void 278static void
275_property_dict_build(Elm_Menu_Item *item, 279_property_dict_build(Elm_Widobj_Item *item,
276 Eina_List *property_list, Eldbus_Message_Iter *iter) 280 Eina_List *property_list, Eldbus_Message_Iter *iter)
277{ 281{
278 char *propstr; 282 char *propstr;
@@ -299,22 +303,23 @@ _property_dict_build(Elm_Menu_Item *item,
299} 303}
300 304
301static void 305static void
302_layout_build_recursive(Elm_Menu_Item *item, 306_layout_build_recursive(Elm_Widobj_Item *item,
303 Eina_List *property_list, unsigned recursion_depth, 307 Eina_List *property_list, unsigned recursion_depth,
304 Eldbus_Message_Iter *iter) 308 Eldbus_Message_Iter *iter)
305{ 309{
306 Eina_List *l; 310 Eina_List *l;
307 Elm_Menu_Item *subitem; 311 Elm_Widobj_Item *subitem;
308 Eldbus_Message_Iter *layout, *array, *variant; 312 Eldbus_Message_Iter *layout, *array, *variant;
309 313
314 ELM_MENU_ITEM_DATA_GET(item, item_data);
310 layout = eldbus_message_iter_container_new(iter, 'r', NULL); 315 layout = eldbus_message_iter_container_new(iter, 'r', NULL);
311 eldbus_message_iter_basic_append(layout, 'i', item->dbus_idx); 316 eldbus_message_iter_basic_append(layout, 'i', item_data->dbus_idx);
312 _property_dict_build(item, property_list, layout); 317 _property_dict_build(item, property_list, layout);
313 array = eldbus_message_iter_container_new(layout, 'a', "v"); 318 array = eldbus_message_iter_container_new(layout, 'a', "v");
314 319
315 if (recursion_depth > 0) 320 if (recursion_depth > 0)
316 { 321 {
317 EINA_LIST_FOREACH (item->submenu.items, l, subitem) 322 EINA_LIST_FOREACH (item_data->submenu.items, l, subitem)
318 { 323 {
319 variant = eldbus_message_iter_container_new(array, 'v', 324 variant = eldbus_message_iter_container_new(array, 'v',
320 "(ia{sv}av)"); 325 "(ia{sv}av)");
@@ -337,7 +342,7 @@ _root_layout_build(Elm_DBus_Menu *dbus_menu, Eina_List *property_list,
337 const Eina_List *ret = NULL; 342 const Eina_List *ret = NULL;
338 Eina_List *items; 343 Eina_List *items;
339 Eina_List *l; 344 Eina_List *l;
340 Elm_Menu_Item *item; 345 Elm_Widobj_Item *item;
341 346
342 layout = eldbus_message_iter_container_new(iter, 'r', NULL); 347 layout = eldbus_message_iter_container_new(iter, 'r', NULL);
343 eldbus_message_iter_basic_append(layout, 'i', 0); 348 eldbus_message_iter_basic_append(layout, 'i', 0);
@@ -395,7 +400,7 @@ _empty_properties_handle(Eina_List *property_list)
395static Eina_Bool 400static Eina_Bool
396_event_handle(Elm_DBus_Menu *dbus_menu, Eldbus_Message_Iter *iter, int *error_id) 401_event_handle(Elm_DBus_Menu *dbus_menu, Eldbus_Message_Iter *iter, int *error_id)
397{ 402{
398 Elm_Menu_Item *item; 403 Elm_Widobj_Item *item;
399 const char *event; 404 const char *event;
400 int id; 405 int id;
401 int32_t i; 406 int32_t i;
@@ -424,7 +429,7 @@ _elm_dbus_menu_add(Eo *menu)
424 Elm_DBus_Menu *dbus_menu; 429 Elm_DBus_Menu *dbus_menu;
425 const Eina_List *ret = NULL; 430 const Eina_List *ret = NULL;
426 Eina_List *items, *l; 431 Eina_List *items, *l;
427 Elm_Menu_Item *item; 432 Elm_Widobj_Item *item;
428 433
429 ELM_MENU_CHECK(menu) NULL; 434 ELM_MENU_CHECK(menu) NULL;
430 435
@@ -483,7 +488,7 @@ _method_layout_get(const Eldbus_Service_Interface *iface,
483 Eldbus_Message *reply; 488 Eldbus_Message *reply;
484 Eldbus_Message_Iter *iter, *array; 489 Eldbus_Message_Iter *iter, *array;
485 Elm_DBus_Menu *dbus_menu; 490 Elm_DBus_Menu *dbus_menu;
486 Elm_Menu_Item *item = NULL; 491 Elm_Widobj_Item *item = NULL;
487 492
488 dbus_menu = eldbus_service_object_data_get(iface, DBUS_DATA_KEY); 493 dbus_menu = eldbus_service_object_data_get(iface, DBUS_DATA_KEY);
489 494
@@ -532,7 +537,7 @@ _method_group_properties_get(const Eldbus_Service_Interface *iface,
532 Eldbus_Message_Iter *iter, *array, *tuple; 537 Eldbus_Message_Iter *iter, *array, *tuple;
533 Eina_List *property_list = NULL; 538 Eina_List *property_list = NULL;
534 Elm_DBus_Menu *dbus_menu; 539 Elm_DBus_Menu *dbus_menu;
535 Elm_Menu_Item *item; 540 Elm_Widobj_Item *item;
536 char *property; 541 char *property;
537 int id; 542 int id;
538 int32_t i; 543 int32_t i;
@@ -560,7 +565,8 @@ _method_group_properties_get(const Eldbus_Service_Interface *iface,
560 { 565 {
561 item = data; 566 item = data;
562 tuple = eldbus_message_iter_container_new(array, 'r', NULL); 567 tuple = eldbus_message_iter_container_new(array, 'r', NULL);
563 eldbus_message_iter_basic_append(tuple, 'i', item->dbus_idx); 568 ELM_MENU_ITEM_DATA_GET(item, item_data);
569 eldbus_message_iter_basic_append(tuple, 'i', item_data->dbus_idx);
564 _property_dict_build(item, property_list, tuple); 570 _property_dict_build(item, property_list, tuple);
565 eldbus_message_iter_container_close(array, tuple); 571 eldbus_message_iter_container_close(array, tuple);
566 } 572 }
@@ -575,7 +581,8 @@ _method_group_properties_get(const Eldbus_Service_Interface *iface,
575 if (!item) continue; 581 if (!item) continue;
576 582
577 tuple = eldbus_message_iter_container_new(array, 'r', NULL); 583 tuple = eldbus_message_iter_container_new(array, 'r', NULL);
578 eldbus_message_iter_basic_append(tuple, 'i', item->dbus_idx); 584 ELM_MENU_ITEM_DATA_GET(item, item_data);
585 eldbus_message_iter_basic_append(tuple, 'i', item_data->dbus_idx);
579 _property_dict_build(item, property_list, tuple); 586 _property_dict_build(item, property_list, tuple);
580 eldbus_message_iter_container_close(array, tuple); 587 eldbus_message_iter_container_close(array, tuple);
581 } 588 }
@@ -595,7 +602,7 @@ _method_property_get(const Eldbus_Service_Interface *iface,
595 Eldbus_Message_Iter *iter, *variant; 602 Eldbus_Message_Iter *iter, *variant;
596 Elm_DBus_Property property; 603 Elm_DBus_Property property;
597 Elm_DBus_Menu *dbus_menu; 604 Elm_DBus_Menu *dbus_menu;
598 Elm_Menu_Item *item; 605 Elm_Widobj_Item *item;
599 int id; 606 int id;
600 int32_t i; 607 int32_t i;
601 char *name; 608 char *name;
@@ -996,7 +1003,7 @@ _elm_dbus_menu_app_menu_unregister(Eo *obj)
996int 1003int
997_elm_dbus_menu_item_add(Elm_DBus_Menu *dbus_menu, Elm_Object_Item *item_obj) 1004_elm_dbus_menu_item_add(Elm_DBus_Menu *dbus_menu, Elm_Object_Item *item_obj)
998{ 1005{
999 Elm_Menu_Item *item = (Elm_Menu_Item *)item_obj; 1006 Elm_Widobj_Item *item = (Elm_Widobj_Item *)item_obj;
1000 int32_t id = dbus_menu->timestamp + 1; 1007 int32_t id = dbus_menu->timestamp + 1;
1001 1008
1002 if (!eina_hash_add(dbus_menu->elements, &id, item)) 1009 if (!eina_hash_add(dbus_menu->elements, &id, item))
diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c
index aa4c02582..42c462e09 100644
--- a/src/lib/elm_menu.c
+++ b/src/lib/elm_menu.c
@@ -29,20 +29,21 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
29EOLIAN static Eina_Bool 29EOLIAN static Eina_Bool
30_elm_menu_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd) 30_elm_menu_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
31{ 31{
32 Elm_Menu_Item *it; 32 Elm_Widobj_Item *it;
33 Eina_List *l; 33 Eina_List *l;
34 34
35 EINA_LIST_FOREACH(sd->items, l, it) 35 EINA_LIST_FOREACH(sd->items, l, it)
36 elm_widget_item_translate(it); 36 eo_do (it, elm_wdg_item_translate());
37 37
38 return EINA_TRUE; 38 return EINA_TRUE;
39} 39}
40 40
41static void 41static void
42_item_del(Elm_Menu_Item *item) 42_item_del(Elm_Widobj_Item *eo_item)
43{ 43{
44 Elm_Menu_Item *child; 44 Elm_Widobj_Item *child;
45 45
46 ELM_MENU_ITEM_DATA_GET(eo_item, item);
46 EINA_LIST_FREE(item->submenu.items, child) 47 EINA_LIST_FREE(item->submenu.items, child)
47 _item_del(child); 48 _item_del(child);
48 49
@@ -51,33 +52,33 @@ _item_del(Elm_Menu_Item *item)
51 evas_object_del(item->submenu.location); 52 evas_object_del(item->submenu.location);
52 eina_stringshare_del(item->icon_str); 53 eina_stringshare_del(item->icon_str);
53 54
54 elm_widget_item_free(item); 55 eo_del(eo_item);
55} 56}
56 57
57static void 58static void
58_submenu_hide(Elm_Menu_Item *item) 59_submenu_hide(Elm_Widobj_Item *eo_item)
59{ 60{
60 Eina_List *l; 61 Eina_List *l;
61 Elm_Menu_Item *item2; 62 Elm_Widobj_Item *eo_item2;
62 63
64 ELM_MENU_ITEM_DATA_GET(eo_item, item);
63 evas_object_hide(item->submenu.hv); 65 evas_object_hide(item->submenu.hv);
64 item->submenu.open = EINA_FALSE; 66 item->submenu.open = EINA_FALSE;
65 67
66 EINA_LIST_FOREACH(item->submenu.items, l, item2) 68 EINA_LIST_FOREACH(item->submenu.items, l, eo_item2)
67 { 69 {
68 if (item2->submenu.open) _submenu_hide(item2); 70 ELM_MENU_ITEM_DATA_GET(eo_item2, item2);
71 if (item2->submenu.open) _submenu_hide(eo_item2);
69 } 72 }
70} 73}
71 74
72static void 75static void
73_item_disable_hook(Elm_Object_Item *it) 76_elm_menu_item_elm_widget_item_disable(Eo *eo_item, Elm_Menu_Item_Data *item)
74{ 77{
75 Elm_Menu_Item *item = (Elm_Menu_Item *)it; 78 if (elm_object_item_disabled_get((Elm_Object_Item*)eo_item))
76
77 if (elm_widget_item_disabled_get(item))
78 { 79 {
79 elm_layout_signal_emit(VIEW(item), "elm,state,disabled", "elm"); 80 elm_layout_signal_emit(VIEW(item), "elm,state,disabled", "elm");
80 if (item->submenu.open) _submenu_hide(item); 81 if (item->submenu.open) _submenu_hide(eo_item);
81 } 82 }
82 else 83 else
83 elm_layout_signal_emit(VIEW(item), "elm,state,enabled", "elm"); 84 elm_layout_signal_emit(VIEW(item), "elm,state,enabled", "elm");
@@ -87,16 +88,22 @@ _item_disable_hook(Elm_Object_Item *it)
87} 88}
88 89
89static void 90static void
90_submenu_sizing_eval(Elm_Menu_Item *parent_it) 91_submenu_sizing_eval(Elm_Widobj_Item *eo_parent_it)
91{ 92{
92 Eina_List *l; 93 Eina_List *l;
93 Elm_Menu_Item *item; 94 Elm_Widobj_Item *eo_item;
94 Evas_Coord x_p, y_p, w_p, h_p, x2, y2, w2, 95 Evas_Coord x_p, y_p, w_p, h_p, x2, y2, w2,
95 h2, bx, by, bw, bh, px, py, pw, ph; 96 h2, bx, by, bw, bh, px, py, pw, ph;
97
98 ELM_MENU_ITEM_DATA_GET(eo_parent_it, parent_it);
96 ELM_MENU_DATA_GET_OR_RETURN(WIDGET(parent_it), sd); 99 ELM_MENU_DATA_GET_OR_RETURN(WIDGET(parent_it), sd);
97 100
98 EINA_LIST_FOREACH(parent_it->submenu.items, l, item) 101 EINA_LIST_FOREACH(parent_it->submenu.items, l, eo_item)
99 elm_layout_sizing_eval(VIEW(item)); 102 {
103 ELM_MENU_ITEM_DATA_GET(eo_item, item);
104 elm_layout_sizing_eval(VIEW(item));
105 }
106
100 107
101 evas_object_geometry_get 108 evas_object_geometry_get
102 (parent_it->submenu.location, &x_p, &y_p, &w_p, &h_p); 109 (parent_it->submenu.location, &x_p, &y_p, &w_p, &h_p);
@@ -108,7 +115,7 @@ _submenu_sizing_eval(Elm_Menu_Item *parent_it)
108 px = 0; 115 px = 0;
109 py = 0; 116 py = 0;
110 } 117 }
111 118
112 if (sd->menu_bar && !parent_it->parent) 119 if (sd->menu_bar && !parent_it->parent)
113 { 120 {
114 x_p = x2; 121 x_p = x2;
@@ -142,9 +149,10 @@ _submenu_sizing_eval(Elm_Menu_Item *parent_it)
142 evas_object_size_hint_max_set(parent_it->submenu.location, bw, h_p); 149 evas_object_size_hint_max_set(parent_it->submenu.location, bw, h_p);
143 elm_hover_target_set(parent_it->submenu.hv, parent_it->submenu.location); 150 elm_hover_target_set(parent_it->submenu.hv, parent_it->submenu.location);
144 151
145 EINA_LIST_FOREACH(parent_it->submenu.items, l, item) 152 EINA_LIST_FOREACH(parent_it->submenu.items, l, eo_item)
146 { 153 {
147 if (item->submenu.open) _submenu_sizing_eval(item); 154 ELM_MENU_ITEM_DATA_GET(eo_item, item);
155 if (item->submenu.open) _submenu_sizing_eval(eo_item);
148 } 156 }
149} 157}
150 158
@@ -152,7 +160,7 @@ static void
152_sizing_eval(Evas_Object *obj) 160_sizing_eval(Evas_Object *obj)
153{ 161{
154 Eina_List *l; 162 Eina_List *l;
155 Elm_Menu_Item *item; 163 Elm_Widobj_Item *eo_item;
156 Evas_Coord x_p, y_p, w_p, h_p, x2, y2, w2, h2, bw, bh; 164 Evas_Coord x_p, y_p, w_p, h_p, x2, y2, w2, h2, bw, bh;
157 Elm_Widget_Smart_Data *hover; 165 Elm_Widget_Smart_Data *hover;
158 166
@@ -160,8 +168,11 @@ _sizing_eval(Evas_Object *obj)
160 168
161 if (!sd->parent) return; 169 if (!sd->parent) return;
162 170
163 EINA_LIST_FOREACH(sd->items, l, item) 171 EINA_LIST_FOREACH(sd->items, l, eo_item)
164 elm_layout_sizing_eval(VIEW(item)); 172 {
173 ELM_MENU_ITEM_DATA_GET(eo_item, item);
174 elm_layout_sizing_eval(VIEW(item));
175 }
165 176
166 evas_object_geometry_get(sd->location, NULL, NULL, &w_p, &h_p); 177 evas_object_geometry_get(sd->location, NULL, NULL, &w_p, &h_p);
167 evas_object_geometry_get(sd->parent, &x2, &y2, &w2, &h2); 178 evas_object_geometry_get(sd->parent, &x2, &y2, &w2, &h2);
@@ -194,8 +205,11 @@ _sizing_eval(Evas_Object *obj)
194 NULL, &bw, &bh); 205 NULL, &bw, &bh);
195 evas_object_size_hint_min_set(obj, bw, bh); 206 evas_object_size_hint_min_set(obj, bw, bh);
196 207
197 EINA_LIST_FOREACH(sd->items, l, item) 208 EINA_LIST_FOREACH(sd->items, l, eo_item)
198 if (item->submenu.open) _submenu_sizing_eval(item); 209 {
210 ELM_MENU_ITEM_DATA_GET(eo_item, item);
211 if (item->submenu.open) _submenu_sizing_eval(eo_item);
212 }
199} 213}
200 214
201EOLIAN static Eina_Bool 215EOLIAN static Eina_Bool
@@ -204,7 +218,7 @@ _elm_menu_elm_widget_theme_apply(Eo *obj, Elm_Menu_Data *sd)
204 Eina_Bool int_ret = EINA_FALSE; 218 Eina_Bool int_ret = EINA_FALSE;
205 219
206 Eina_List *l, *_l, *_ll, *ll = NULL; 220 Eina_List *l, *_l, *_ll, *ll = NULL;
207 Elm_Menu_Item *item; 221 Elm_Widobj_Item *eo_item;
208 const char *s; 222 const char *s;
209 char style[1024]; 223 char style[1024];
210 224
@@ -220,8 +234,9 @@ _elm_menu_elm_widget_theme_apply(Eo *obj, Elm_Menu_Data *sd)
220 ll = eina_list_append(ll, sd->items); 234 ll = eina_list_append(ll, sd->items);
221 EINA_LIST_FOREACH(ll, _ll, l) 235 EINA_LIST_FOREACH(ll, _ll, l)
222 { 236 {
223 EINA_LIST_FOREACH(l, _l, item) 237 EINA_LIST_FOREACH(l, _l, eo_item)
224 { 238 {
239 ELM_MENU_ITEM_DATA_GET(eo_item, item);
225 ll = eina_list_append(ll, item->submenu.items); 240 ll = eina_list_append(ll, item->submenu.items);
226 if (item->separator) 241 if (item->separator)
227 { 242 {
@@ -252,13 +267,13 @@ _elm_menu_elm_widget_theme_apply(Eo *obj, Elm_Menu_Data *sd)
252 elm_widget_style_get(obj))) 267 elm_widget_style_get(obj)))
253 CRI("Failed to set layout!"); 268 CRI("Failed to set layout!");
254 269
255 elm_object_item_text_set((Elm_Object_Item *)item, 270 elm_object_item_text_set((Elm_Object_Item *)eo_item,
256 item->label); 271 item->label);
257 if (item->icon_str) 272 if (item->icon_str)
258 elm_menu_item_icon_name_set((Elm_Object_Item *)item, 273 elm_menu_item_icon_name_set((Elm_Object_Item *)eo_item,
259 item->icon_str); 274 item->icon_str);
260 } 275 }
261 _item_disable_hook((Elm_Object_Item *)item); 276 _elm_menu_item_elm_widget_item_disable(eo_item, item);
262 /* SEOZ 277 /* SEOZ
263 edje_object_scale_set 278 edje_object_scale_set
264 (VIEW(item), elm_widget_scale_get(obj) * 279 (VIEW(item), elm_widget_scale_get(obj) *
@@ -274,17 +289,14 @@ _elm_menu_elm_widget_theme_apply(Eo *obj, Elm_Menu_Data *sd)
274 return EINA_TRUE; 289 return EINA_TRUE;
275} 290}
276 291
277static void 292EOLIAN static void
278_item_text_set_hook(Elm_Object_Item *it, 293_elm_menu_item_elm_widget_item_part_text_set(Eo *eo_item EINA_UNUSED,
279 const char *part, 294 Elm_Menu_Item_Data *item,
280 const char *label) 295 const char *part,
296 const char *label)
281{ 297{
282 Elm_Menu_Item *item;
283
284 if (part && strcmp(part, "default")) return; 298 if (part && strcmp(part, "default")) return;
285 299
286 item = (Elm_Menu_Item *)it;
287
288 eina_stringshare_replace(&item->label, label); 300 eina_stringshare_replace(&item->label, label);
289 301
290 if (label) 302 if (label)
@@ -298,25 +310,24 @@ _item_text_set_hook(Elm_Object_Item *it,
298 _sizing_eval(WIDGET(item)); 310 _sizing_eval(WIDGET(item));
299} 311}
300 312
301static const char * 313EOLIAN static const char *
302_item_text_get_hook(const Elm_Object_Item *it, 314_elm_menu_item_elm_widget_item_part_text_get(Eo *eo_item EINA_UNUSED,
303 const char *part) 315 Elm_Menu_Item_Data *it,
316 const char *part)
304{ 317{
305 if (part && strcmp(part, "default")) return NULL; 318 if (part && strcmp(part, "default")) return NULL;
306 319
307 return ((Elm_Menu_Item *)it)->label; 320 return it->label;
308} 321}
309 322
310static void 323EOLIAN static void
311_item_content_set_hook(Elm_Object_Item *it, 324_elm_menu_item_elm_widget_item_part_content_set(Eo *eo_item EINA_UNUSED,
312 const char *part, 325 Elm_Menu_Item_Data *item,
313 Evas_Object *content) 326 const char *part,
327 Evas_Object *content)
314{ 328{
315 Elm_Menu_Item *item;
316
317 if (part && strcmp(part, "default")) return; 329 if (part && strcmp(part, "default")) return;
318 330
319 item = (Elm_Menu_Item *)it;
320 if (content == item->content) return; 331 if (content == item->content) return;
321 332
322 evas_object_del(item->content); 333 evas_object_del(item->content);
@@ -327,13 +338,14 @@ _item_content_set_hook(Elm_Object_Item *it,
327 _sizing_eval(WIDGET(item)); 338 _sizing_eval(WIDGET(item));
328} 339}
329 340
330static Evas_Object * 341EOLIAN static Evas_Object *
331_item_content_get_hook(const Elm_Object_Item *it, 342_elm_menu_item_elm_widget_item_part_content_get(Eo *eo_item EINA_UNUSED,
332 const char *part) 343 Elm_Menu_Item_Data *it,
344 const char *part)
333{ 345{
334 if (part && strcmp(part, "default")) return NULL; 346 if (part && strcmp(part, "default")) return NULL;
335 347
336 return ((Elm_Menu_Item *)it)->content; 348 return it->content;
337} 349}
338 350
339static void 351static void
@@ -374,9 +386,9 @@ _item_move_resize_cb(void *data,
374 Evas_Object *obj EINA_UNUSED, 386 Evas_Object *obj EINA_UNUSED,
375 void *event_info EINA_UNUSED) 387 void *event_info EINA_UNUSED)
376{ 388{
377 Elm_Menu_Item *item = data; 389 Elm_Widobj_Item *eo_item = data;
378 390 ELM_MENU_ITEM_DATA_GET(eo_item, item);
379 if (item->submenu.open) _submenu_sizing_eval(item); 391 if (item->submenu.open) _submenu_sizing_eval(eo_item);
380} 392}
381 393
382static void 394static void
@@ -385,7 +397,7 @@ _menu_hide(void *data,
385 void *event_info EINA_UNUSED) 397 void *event_info EINA_UNUSED)
386{ 398{
387 Eina_List *l; 399 Eina_List *l;
388 Elm_Menu_Item *item2; 400 Elm_Widobj_Item *eo_item2;
389 401
390 ELM_MENU_DATA_GET(data, sd); 402 ELM_MENU_DATA_GET(data, sd);
391 403
@@ -395,9 +407,10 @@ _menu_hide(void *data,
395 evas_object_hide(data); 407 evas_object_hide(data);
396 } 408 }
397 409
398 EINA_LIST_FOREACH(sd->items, l, item2) 410 EINA_LIST_FOREACH(sd->items, l, eo_item2)
399 { 411 {
400 if (item2->submenu.open) _submenu_hide(item2); 412 ELM_MENU_ITEM_DATA_GET(eo_item2, item);
413 if (item->submenu.open) _submenu_hide(eo_item2);
401 } 414 }
402} 415}
403 416
@@ -417,19 +430,21 @@ _submenu_open_cb(void *data,
417 const char *emission EINA_UNUSED, 430 const char *emission EINA_UNUSED,
418 const char *source EINA_UNUSED) 431 const char *source EINA_UNUSED)
419{ 432{
420 Elm_Menu_Item *item = data; 433 Elm_Widobj_Item *eo_item = data;
421 434
435 ELM_MENU_ITEM_DATA_GET(eo_item, item);
422 item->submenu.open = EINA_TRUE; 436 item->submenu.open = EINA_TRUE;
423 evas_object_show(item->submenu.hv); 437 evas_object_show(item->submenu.hv);
424 _submenu_sizing_eval(item); 438 _submenu_sizing_eval(eo_item);
425} 439}
426 440
427void 441void
428_elm_dbus_menu_item_select_cb(Elm_Object_Item *obj_item) 442_elm_dbus_menu_item_select_cb(Elm_Object_Item *obj_item)
429{ 443{
430 Elm_Menu_Item *item = (Elm_Menu_Item *)obj_item; 444 Elm_Widobj_Item *eo_item = (Elm_Widobj_Item *)obj_item;
431 445
432 if (item->func) item->func((void *)(item->base.data), WIDGET(item), item); 446 ELM_MENU_ITEM_DATA_GET(eo_item, item);
447 if (item->func) item->func((void *)(item->base->data), WIDGET(item), eo_item);
433} 448}
434 449
435static void 450static void
@@ -438,16 +453,17 @@ _menu_item_select_cb(void *data,
438 const char *emission EINA_UNUSED, 453 const char *emission EINA_UNUSED,
439 const char *source EINA_UNUSED) 454 const char *source EINA_UNUSED)
440{ 455{
441 Elm_Menu_Item *item = data; 456 Elm_Widobj_Item *eo_item = data;
442 457
458 ELM_MENU_ITEM_DATA_GET(eo_item, item);
443 if (item->submenu.items) 459 if (item->submenu.items)
444 { 460 {
445 if (!item->submenu.open) _submenu_open_cb(item, NULL, NULL, NULL); 461 if (!item->submenu.open) _submenu_open_cb(eo_item, NULL, NULL, NULL);
446 else _submenu_hide(item); 462 else _submenu_hide(eo_item);
447 } 463 }
448 else _menu_hide(WIDGET(item), NULL, NULL); 464 else _menu_hide(WIDGET(item), NULL, NULL);
449 465
450 if (item->func) item->func((void *)(item->base.data), WIDGET(item), item); 466 if (item->func) item->func((void *)(item->base->data), WIDGET(item), eo_item);
451} 467}
452 468
453static void 469static void
@@ -457,15 +473,18 @@ _menu_item_activate_cb(void *data,
457 const char *source EINA_UNUSED) 473 const char *source EINA_UNUSED)
458{ 474{
459 Eina_List *l; 475 Eina_List *l;
460 Elm_Menu_Item *item2; 476 Elm_Widobj_Item *item2;
461 Elm_Menu_Item *item = data; 477 Elm_Widobj_Item *eo_item = data;
462 478
479 ELM_MENU_ITEM_DATA_GET(eo_item, item);
463 item->selected = 1; 480 item->selected = 1;
481
464 if (item->parent) 482 if (item->parent)
465 { 483 {
466 EINA_LIST_FOREACH(item->parent->submenu.items, l, item2) 484 ELM_MENU_ITEM_DATA_GET(item->parent, parent_data);
485 EINA_LIST_FOREACH(parent_data->submenu.items, l, item2)
467 { 486 {
468 if (item2 != item) 487 if (item2 != eo_item)
469 elm_menu_item_selected_set((Elm_Object_Item *)item2, 0); 488 elm_menu_item_selected_set((Elm_Object_Item *)item2, 0);
470 } 489 }
471 } 490 }
@@ -474,7 +493,7 @@ _menu_item_activate_cb(void *data,
474 ELM_MENU_DATA_GET(WIDGET(item), sd); 493 ELM_MENU_DATA_GET(WIDGET(item), sd);
475 EINA_LIST_FOREACH(sd->items, l, item2) 494 EINA_LIST_FOREACH(sd->items, l, item2)
476 { 495 {
477 if (item2 != item) 496 if (item2 != eo_item)
478 elm_menu_item_selected_set((Elm_Object_Item *)item2, 0); 497 elm_menu_item_selected_set((Elm_Object_Item *)item2, 0);
479 } 498 }
480 } 499 }
@@ -486,23 +505,25 @@ _menu_item_inactivate_cb(void *data,
486 const char *emission EINA_UNUSED, 505 const char *emission EINA_UNUSED,
487 const char *source EINA_UNUSED) 506 const char *source EINA_UNUSED)
488{ 507{
489 Elm_Menu_Item *item = data; 508 Elm_Widobj_Item *eo_item = data;
490 509
510 ELM_MENU_ITEM_DATA_GET(eo_item, item);
491 item->selected = 0; 511 item->selected = 0;
492 if (item->submenu.open) _submenu_hide(item); 512 if (item->submenu.open) _submenu_hide(eo_item);
493} 513}
494 514
495static void 515static void
496_block_menu(void *_sd, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 516_block_menu(void *_sd, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
497{ 517{
498 const Eina_List *l; 518 const Eina_List *l;
499 Elm_Menu_Item *current; 519 Elm_Widobj_Item *current;
500 Elm_Menu_Data *sd = _sd; 520 Elm_Menu_Data *sd = _sd;
501 Eina_List *items = sd->items; 521 Eina_List *items = sd->items;
502 EINA_LIST_FOREACH(items, l, current) 522 EINA_LIST_FOREACH(items, l, current)
503 { 523 {
504 if (!current->blocked) current->was_enabled = !elm_widget_item_disabled_get(current); 524 ELM_MENU_ITEM_DATA_GET(current, item);
505 current->blocked = EINA_TRUE; 525 if (!item->blocked) item->was_enabled = !elm_widget_item_disabled_get(current);
526 item->blocked = EINA_TRUE;
506 elm_object_item_disabled_set((Elm_Object_Item *)current, EINA_TRUE); 527 elm_object_item_disabled_set((Elm_Object_Item *)current, EINA_TRUE);
507 } 528 }
508} 529}
@@ -511,13 +532,14 @@ static void
511_unblock_menu(void *_sd, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 532_unblock_menu(void *_sd, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
512{ 533{
513 const Eina_List *l; 534 const Eina_List *l;
514 Elm_Menu_Item *current; 535 Elm_Widobj_Item *eo_current;
515 Elm_Menu_Data *sd = _sd; 536 Elm_Menu_Data *sd = _sd;
516 Eina_List *items = sd->items; 537 Eina_List *items = sd->items;
517 EINA_LIST_FOREACH(items, l, current) 538 EINA_LIST_FOREACH(items, l, eo_current)
518 { 539 {
519 elm_object_item_disabled_set((Elm_Object_Item *)current, !current->was_enabled); 540 ELM_MENU_ITEM_DATA_GET(eo_current, curreny);
520 current->blocked = EINA_FALSE; 541 elm_object_item_disabled_set((Elm_Object_Item *)eo_current, !curreny->was_enabled);
542 curreny->blocked = EINA_FALSE;
521 } 543 }
522} 544}
523 545
@@ -528,8 +550,10 @@ _elm_menu_evas_object_smart_show(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
528} 550}
529 551
530static void 552static void
531_item_obj_create(Elm_Menu_Item *item) 553_item_obj_create(Elm_Widobj_Item *eo_item)
532{ 554{
555 ELM_MENU_ITEM_DATA_GET(eo_item, item);
556
533 VIEW(item) = elm_layout_add(WIDGET(item)); 557 VIEW(item) = elm_layout_add(WIDGET(item));
534 evas_object_size_hint_weight_set 558 evas_object_size_hint_weight_set
535 (VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 559 (VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -540,19 +564,21 @@ _item_obj_create(Elm_Menu_Item *item)
540 else 564 else
541 { 565 {
542 elm_layout_signal_callback_add(VIEW(item), "elm,action,click", "*", 566 elm_layout_signal_callback_add(VIEW(item), "elm,action,click", "*",
543 _menu_item_select_cb, item); 567 _menu_item_select_cb, eo_item);
544 elm_layout_signal_callback_add(VIEW(item), "elm,action,activate", "*", 568 elm_layout_signal_callback_add(VIEW(item), "elm,action,activate", "*",
545 _menu_item_activate_cb, item); 569 _menu_item_activate_cb, eo_item);
546 elm_layout_signal_callback_add(VIEW(item), "elm,action,inactivate", "*", 570 elm_layout_signal_callback_add(VIEW(item), "elm,action,inactivate", "*",
547 _menu_item_inactivate_cb, 571 _menu_item_inactivate_cb,
548 item); 572 eo_item);
549 evas_object_show(VIEW(item)); 573 evas_object_show(VIEW(item));
550 } 574 }
551} 575}
552 576
553static void 577static void
554_item_separator_obj_create(Elm_Menu_Item *item) 578_item_separator_obj_create(Elm_Widobj_Item *eo_item)
555{ 579{
580 ELM_MENU_ITEM_DATA_GET(eo_item, item);
581
556 VIEW(item) = elm_layout_add(WIDGET(item)); 582 VIEW(item) = elm_layout_add(WIDGET(item));
557 evas_object_size_hint_weight_set 583 evas_object_size_hint_weight_set
558 (VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 584 (VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -563,14 +589,16 @@ _item_separator_obj_create(Elm_Menu_Item *item)
563 else 589 else
564 { 590 {
565 elm_layout_signal_callback_add 591 elm_layout_signal_callback_add
566 (VIEW(item), "elm,action,activate", "*", _menu_item_activate_cb, item); 592 (VIEW(item), "elm,action,activate", "*", _menu_item_activate_cb, eo_item);
567 evas_object_show(VIEW(item)); 593 evas_object_show(VIEW(item));
568 } 594 }
569} 595}
570 596
571static void 597static void
572_item_submenu_obj_create(Elm_Menu_Item *item) 598_item_submenu_obj_create(Elm_Widobj_Item *eo_item)
573{ 599{
600 ELM_MENU_ITEM_DATA_GET(eo_item, item);
601
574 ELM_MENU_DATA_GET(WIDGET(item), sd); 602 ELM_MENU_DATA_GET(WIDGET(item), sd);
575 Evas_Object *hv, *bx; 603 Evas_Object *hv, *bx;
576 char style[1024]; 604 char style[1024];
@@ -617,17 +645,17 @@ _item_submenu_obj_create(Elm_Menu_Item *item)
617 CRI("Failed to set layout!"); 645 CRI("Failed to set layout!");
618 } 646 }
619 647
620 elm_object_item_text_set((Elm_Object_Item *)item, item->label); 648 elm_object_item_text_set((Elm_Object_Item *)eo_item, item->label);
621 649
622 if (item->icon_str) 650 if (item->icon_str)
623 elm_menu_item_icon_name_set((Elm_Object_Item *)item, item->icon_str); 651 elm_menu_item_icon_name_set((Elm_Object_Item *)eo_item, item->icon_str);
624 652
625 elm_layout_signal_callback_add(VIEW(item), "elm,action,open", "*", 653 elm_layout_signal_callback_add(VIEW(item), "elm,action,open", "*",
626 _submenu_open_cb, item); 654 _submenu_open_cb, eo_item);
627 evas_object_event_callback_add 655 evas_object_event_callback_add
628 (VIEW(item), EVAS_CALLBACK_MOVE, _item_move_resize_cb, item); 656 (VIEW(item), EVAS_CALLBACK_MOVE, _item_move_resize_cb, eo_item);
629 evas_object_event_callback_add 657 evas_object_event_callback_add
630 (VIEW(item), EVAS_CALLBACK_RESIZE, _item_move_resize_cb, item); 658 (VIEW(item), EVAS_CALLBACK_RESIZE, _item_move_resize_cb, eo_item);
631 659
632 evas_object_event_callback_add(bx, EVAS_CALLBACK_RESIZE, 660 evas_object_event_callback_add(bx, EVAS_CALLBACK_RESIZE,
633 _menu_resize_cb, WIDGET(item)); 661 _menu_resize_cb, WIDGET(item));
@@ -662,7 +690,7 @@ _elm_menu_evas_object_smart_add(Eo *obj, Elm_Menu_Data *priv)
662EOLIAN static void 690EOLIAN static void
663_elm_menu_evas_object_smart_del(Eo *obj, Elm_Menu_Data *sd) 691_elm_menu_evas_object_smart_del(Eo *obj, Elm_Menu_Data *sd)
664{ 692{
665 Elm_Menu_Item *item; 693 Elm_Widobj_Item *eo_item;
666 694
667 _elm_dbus_menu_unregister(obj); 695 _elm_dbus_menu_unregister(obj);
668 696
@@ -671,8 +699,8 @@ _elm_menu_evas_object_smart_del(Eo *obj, Elm_Menu_Data *sd)
671 evas_object_event_callback_del_full 699 evas_object_event_callback_del_full
672 (sd->parent, EVAS_CALLBACK_DEL, _parent_del_cb, obj); 700 (sd->parent, EVAS_CALLBACK_DEL, _parent_del_cb, obj);
673 701
674 EINA_LIST_FREE(sd->items, item) 702 EINA_LIST_FREE(sd->items, eo_item)
675 _item_del(item); 703 _item_del(eo_item);
676 704
677 evas_object_event_callback_del_full 705 evas_object_event_callback_del_full
678 (sd->bx, EVAS_CALLBACK_RESIZE, _menu_resize_cb, obj); 706 (sd->bx, EVAS_CALLBACK_RESIZE, _menu_resize_cb, obj);
@@ -697,7 +725,7 @@ void
697_elm_menu_menu_bar_set(Eo *obj, Eina_Bool menu_bar) 725_elm_menu_menu_bar_set(Eo *obj, Eina_Bool menu_bar)
698{ 726{
699 Eina_List *l; 727 Eina_List *l;
700 Elm_Menu_Item *item; 728 Elm_Widobj_Item *eo_item;
701 char style[1024]; 729 char style[1024];
702 730
703 ELM_MENU_DATA_GET_OR_RETURN(obj, sd); 731 ELM_MENU_DATA_GET_OR_RETURN(obj, sd);
@@ -714,8 +742,9 @@ _elm_menu_menu_bar_set(Eo *obj, Eina_Bool menu_bar)
714 snprintf(style, sizeof(style), "menu/%s", elm_widget_style_get(obj)); 742 snprintf(style, sizeof(style), "menu/%s", elm_widget_style_get(obj));
715 elm_object_style_set(sd->hv, style); 743 elm_object_style_set(sd->hv, style);
716 744
717 EINA_LIST_FOREACH(sd->items, l, item) 745 EINA_LIST_FOREACH(sd->items, l, eo_item)
718 { 746 {
747 ELM_MENU_ITEM_DATA_GET(eo_item, item);
719 if (!item->submenu.bx) continue; 748 if (!item->submenu.bx) continue;
720 749
721 if (menu_bar) 750 if (menu_bar)
@@ -783,7 +812,7 @@ EOLIAN static void
783_elm_menu_elm_widget_parent_set(Eo *obj, Elm_Menu_Data *sd, Evas_Object *parent) 812_elm_menu_elm_widget_parent_set(Eo *obj, Elm_Menu_Data *sd, Evas_Object *parent)
784{ 813{
785 Eina_List *l, *_l, *_ll, *ll = NULL; 814 Eina_List *l, *_l, *_ll, *ll = NULL;
786 Elm_Menu_Item *item; 815 Elm_Widobj_Item *eo_item;
787 816
788 if (sd->parent == parent) return; 817 if (sd->parent == parent) return;
789 if (sd->parent) 818 if (sd->parent)
@@ -806,8 +835,9 @@ _elm_menu_elm_widget_parent_set(Eo *obj, Elm_Menu_Data *sd, Evas_Object *parent)
806 ll = eina_list_append(ll, sd->items); 835 ll = eina_list_append(ll, sd->items);
807 EINA_LIST_FOREACH(ll, _ll, l) 836 EINA_LIST_FOREACH(ll, _ll, l)
808 { 837 {
809 EINA_LIST_FOREACH(l, _l, item) 838 EINA_LIST_FOREACH(l, _l, eo_item)
810 { 839 {
840 ELM_MENU_ITEM_DATA_GET(eo_item, item);
811 if (item->submenu.hv) 841 if (item->submenu.hv)
812 { 842 {
813 elm_hover_parent_set(item->submenu.hv, parent); 843 elm_hover_parent_set(item->submenu.hv, parent);
@@ -850,21 +880,22 @@ _elm_menu_close(Eo *obj, Elm_Menu_Data *sd)
850 _menu_hide(obj, sd->hv, NULL); 880 _menu_hide(obj, sd->hv, NULL);
851} 881}
852 882
853EAPI Evas_Object * 883EOLIAN static Evas_Object *
854elm_menu_item_object_get(const Elm_Object_Item *it) 884_elm_menu_item_object_get(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *item)
855{ 885{
856 return VIEW(((Elm_Menu_Item *)it)); 886 return VIEW(item);
857} 887}
858 888
859static void 889static void
860_item_clone(Evas_Object *obj, 890_item_clone(Evas_Object *obj,
861 Elm_Menu_Item *parent, 891 Elm_Widobj_Item *parent,
862 Elm_Menu_Item *item) 892 Elm_Widobj_Item *eo_item)
863{ 893{
864 Elm_Object_Item *new_item; 894 Elm_Object_Item *new_item;
865 Elm_Menu_Item *subitem; 895 Elm_Widobj_Item *subitem;
866 Eina_List *iter; 896 Eina_List *iter;
867 897
898 ELM_MENU_ITEM_DATA_GET(eo_item, item);
868 if (item->separator) 899 if (item->separator)
869 new_item = elm_menu_item_separator_add(obj, (Elm_Object_Item *)parent); 900 new_item = elm_menu_item_separator_add(obj, (Elm_Object_Item *)parent);
870 else 901 else
@@ -873,13 +904,13 @@ _item_clone(Evas_Object *obj,
873 item->icon_str, 904 item->icon_str,
874 item->label, 905 item->label,
875 item->func, 906 item->func,
876 item->base.data); 907 item->base->data);
877 908
878 elm_object_item_disabled_set 909 elm_object_item_disabled_set
879 (new_item, elm_widget_item_disabled_get(item)); 910 (new_item, elm_widget_item_disabled_get(eo_item));
880 911
881 EINA_LIST_FOREACH(item->submenu.items, iter, subitem) 912 EINA_LIST_FOREACH(item->submenu.items, iter, subitem)
882 _item_clone(obj, (Elm_Menu_Item *)new_item, subitem); 913 _item_clone(obj, (Elm_Widobj_Item *)new_item, subitem);
883} 914}
884 915
885void 916void
@@ -888,59 +919,62 @@ elm_menu_clone(Evas_Object *from_menu,
888 Elm_Object_Item *parent) 919 Elm_Object_Item *parent)
889{ 920{
890 Eina_List *iter; 921 Eina_List *iter;
891 Elm_Menu_Item *item; 922 Elm_Widobj_Item *eo_item;
892 923
893 ELM_MENU_CHECK(from_menu); 924 ELM_MENU_CHECK(from_menu);
894 ELM_MENU_CHECK(to_menu); 925 ELM_MENU_CHECK(to_menu);
895 926
896 ELM_MENU_DATA_GET_OR_RETURN(from_menu, from_sd); 927 ELM_MENU_DATA_GET_OR_RETURN(from_menu, from_sd);
897 928
898 EINA_LIST_FOREACH(from_sd->items, iter, item) 929 EINA_LIST_FOREACH(from_sd->items, iter, eo_item)
899 _item_clone(to_menu, (Elm_Menu_Item *)parent, item); 930 _item_clone(to_menu, (Elm_Widobj_Item *)parent, eo_item);
900} 931}
901 932
902static void 933static void
903_elm_menu_item_add_helper(Evas_Object *obj, 934_elm_menu_item_add_helper(Evas_Object *obj,
904 Elm_Menu_Item *parent, 935 Elm_Widobj_Item *eo_parent,
905 Elm_Menu_Item *subitem, 936 Elm_Widobj_Item *eo_subitem,
906 Elm_Menu_Data *sd) 937 Elm_Menu_Data *sd)
907{ 938{
908 if (parent) 939 ELM_MENU_ITEM_DATA_GET(eo_parent, parent);
940 ELM_MENU_ITEM_DATA_GET(eo_subitem, subitem);
941 if (eo_parent)
909 { 942 {
910 if (!parent->submenu.bx) _item_submenu_obj_create(parent); 943 if (!parent->submenu.bx) _item_submenu_obj_create(eo_parent);
911 elm_box_pack_end(parent->submenu.bx, VIEW(subitem)); 944 elm_box_pack_end(parent->submenu.bx, VIEW(subitem));
912 parent->submenu.items = 945 parent->submenu.items =
913 eina_list_append(parent->submenu.items, subitem); 946 eina_list_append(parent->submenu.items, eo_subitem);
914 subitem->idx = eina_list_count(parent->submenu.items) - 1; 947 subitem->idx = eina_list_count(parent->submenu.items) - 1;
915 } 948 }
916 else 949 else
917 { 950 {
918 elm_box_pack_end(sd->bx, VIEW(subitem)); 951 elm_box_pack_end(sd->bx, VIEW(subitem));
919 sd->items = eina_list_append(sd->items, subitem); 952 sd->items = eina_list_append(sd->items, eo_subitem);
920 subitem->idx = eina_list_count(sd->items) - 1; 953 subitem->idx = eina_list_count(sd->items) - 1;
921 } 954 }
922 955
923 _sizing_eval(obj); 956 _sizing_eval(obj);
924} 957}
925 958
926static Eina_Bool 959EOLIAN static Eina_Bool
927_item_del_pre_hook(Elm_Object_Item *it) 960_elm_menu_item_elm_widget_item_del_pre(Eo *eo_item, Elm_Menu_Item_Data *item)
928{ 961{
929 Elm_Menu_Item *item = (Elm_Menu_Item *)it;
930
931 ELM_MENU_DATA_GET(WIDGET(item), sd); 962 ELM_MENU_DATA_GET(WIDGET(item), sd);
932 963
933 elm_menu_item_subitems_clear(it); 964 elm_menu_item_subitems_clear((Elm_Object_Item*)eo_item);
934 eina_stringshare_del(item->label); 965 eina_stringshare_del(item->label);
935 evas_object_del(item->content); 966 evas_object_del(item->content);
936 evas_object_del(item->submenu.hv); 967 evas_object_del(item->submenu.hv);
937 evas_object_del(item->submenu.location); 968 evas_object_del(item->submenu.location);
938 969
939 if (item->parent) 970 if (item->parent)
940 item->parent->submenu.items = 971 {
941 eina_list_remove(item->parent->submenu.items, item); 972 ELM_MENU_ITEM_DATA_GET(item->parent, parent_data);
973 parent_data->submenu.items =
974 eina_list_remove(parent_data->submenu.items, eo_item);
975 }
942 else 976 else
943 sd->items = eina_list_remove(sd->items, item); 977 sd->items = eina_list_remove(sd->items, eo_item);
944 978
945 if (sd->dbus_menu) 979 if (sd->dbus_menu)
946 _elm_dbus_menu_item_delete(sd->dbus_menu, item->dbus_idx); 980 _elm_dbus_menu_item_delete(sd->dbus_menu, item->dbus_idx);
@@ -948,68 +982,67 @@ _item_del_pre_hook(Elm_Object_Item *it)
948 return EINA_TRUE; 982 return EINA_TRUE;
949} 983}
950 984
985EOLIAN static void
986_elm_menu_item_eo_base_constructor(Eo *obj, Elm_Menu_Item_Data *it)
987{
988 eo_do_super(obj, ELM_MENU_ITEM_CLASS, eo_constructor());
989 it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
990}
991
951EOLIAN static Elm_Object_Item* 992EOLIAN static Elm_Object_Item*
952_elm_menu_item_add(Eo *obj, Elm_Menu_Data *sd, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) 993_elm_menu_item_add(Eo *obj, Elm_Menu_Data *sd, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
953{ 994{
954 Elm_Menu_Item *it; 995 Elm_Widobj_Item *eo_item;
955 Evas_Object *icon_obj; 996 Evas_Object *icon_obj;
956 997
957 icon_obj = elm_icon_add(obj); 998 icon_obj = elm_icon_add(obj);
958 if (!icon_obj) return NULL; 999 if (!icon_obj) return NULL;
959 1000
960 it = elm_widget_item_new(obj, Elm_Menu_Item); 1001 eo_item = eo_add(ELM_MENU_ITEM_CLASS, obj);
961 if (!it) 1002 if (!eo_item)
962 { 1003 {
963 evas_object_del(icon_obj); 1004 evas_object_del(icon_obj);
964 return NULL; 1005 return NULL;
965 } 1006 }
966 1007
967 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); 1008 ELM_MENU_ITEM_DATA_GET(eo_item, it);
968 elm_widget_item_disable_hook_set(it, _item_disable_hook);
969 elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
970 elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
971 elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
972 elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
973 1009
974 it->base.data = data; 1010 it->base->data = data;
975 it->func = func; 1011 it->func = func;
976 it->parent = (Elm_Menu_Item *)parent; 1012 it->parent = (Elm_Widobj_Item *)parent;
977 it->content = icon_obj; 1013 it->content = icon_obj;
978 1014
979 _item_obj_create(it); 1015 _item_obj_create(eo_item);
980 elm_object_item_text_set((Elm_Object_Item *)it, label); 1016 elm_object_item_text_set((Elm_Object_Item *)eo_item, label);
981 1017
982 elm_layout_content_set(VIEW(it), "elm.swallow.content", 1018 elm_layout_content_set(VIEW(it), "elm.swallow.content",
983 it->content); 1019 it->content);
984 1020
985 if (icon) elm_menu_item_icon_name_set((Elm_Object_Item *)it, icon); 1021 if (icon) elm_menu_item_icon_name_set((Elm_Object_Item *)eo_item, icon);
986 1022
987 _elm_menu_item_add_helper(obj, (Elm_Menu_Item *)parent, it, sd); 1023 _elm_menu_item_add_helper(obj, (Elm_Widobj_Item *)parent, eo_item, sd);
988 1024
989 if (sd->dbus_menu) 1025 if (sd->dbus_menu)
990 { 1026 {
991 it->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, (Elm_Object_Item *)it); 1027 it->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, (Elm_Object_Item *)eo_item);
992 it->dbus_menu = sd->dbus_menu; 1028 it->dbus_menu = sd->dbus_menu;
993 } 1029 }
994 return (Elm_Object_Item *)it; 1030 return (Elm_Object_Item *)eo_item;
995} 1031}
996 1032
997EAPI unsigned int 1033EOLIAN static unsigned int
998elm_menu_item_index_get(const Elm_Object_Item *it) 1034_elm_menu_item_index_get(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *item)
999{ 1035{
1000 ELM_MENU_ITEM_CHECK_OR_RETURN(it, 0); 1036 return item->idx;
1001
1002 return ((Elm_Menu_Item *)it)->idx;
1003} 1037}
1004 1038
1005EAPI void 1039EOLIAN static void
1006elm_menu_item_icon_name_set(Elm_Object_Item *it, 1040_elm_menu_item_icon_name_set(Eo *eo_item EINA_UNUSED,
1007 const char *icon) 1041 Elm_Menu_Item_Data *item,
1042 const char *icon)
1008{ 1043{
1009 char icon_tmp[512]; 1044 char icon_tmp[512];
1010 Elm_Menu_Item *item = (Elm_Menu_Item *)it;
1011 1045
1012 ELM_MENU_ITEM_CHECK_OR_RETURN(it);
1013 EINA_SAFETY_ON_NULL_RETURN(icon); 1046 EINA_SAFETY_ON_NULL_RETURN(icon);
1014 1047
1015 if ((icon[0] != '\0') && 1048 if ((icon[0] != '\0') &&
@@ -1030,89 +1063,79 @@ elm_menu_item_icon_name_set(Elm_Object_Item *it,
1030EOLIAN static Elm_Object_Item* 1063EOLIAN static Elm_Object_Item*
1031_elm_menu_item_separator_add(Eo *obj, Elm_Menu_Data *sd, Elm_Object_Item *parent) 1064_elm_menu_item_separator_add(Eo *obj, Elm_Menu_Data *sd, Elm_Object_Item *parent)
1032{ 1065{
1033 Elm_Menu_Item *subitem; 1066 Elm_Widobj_Item *eo_subitem;
1034 Elm_Menu_Item *p_item = (Elm_Menu_Item *)parent; 1067 Elm_Widobj_Item *eo_p_item = (Elm_Widobj_Item *)parent;
1035 1068
1069 ELM_MENU_ITEM_DATA_GET(eo_p_item, p_item);
1036 /* don't add a separator as the first item */ 1070 /* don't add a separator as the first item */
1037 if (!sd->items) return NULL; 1071 if (!sd->items) return NULL;
1038 1072
1039 /* don't allow adding more than one separator in a row */ 1073 /* don't allow adding more than one separator in a row */
1040 if (p_item) 1074 if (eo_p_item)
1041 { 1075 {
1042 if (!p_item->submenu.items) return NULL; 1076 if (!p_item->submenu.items) return NULL;
1043 subitem = eina_list_last(p_item->submenu.items)->data; 1077 eo_subitem = eina_list_last(p_item->submenu.items)->data;
1044 } 1078 }
1045 else subitem = eina_list_last(sd->items)->data; 1079 else eo_subitem = eina_list_last(sd->items)->data;
1046 1080
1047 if (subitem->separator) return NULL; 1081 ELM_MENU_ITEM_DATA_GET(eo_subitem, sitem_data);
1082 if (sitem_data->separator) return NULL;
1048 1083
1049 subitem = elm_widget_item_new(obj, Elm_Menu_Item); 1084 eo_subitem = eo_add(ELM_MENU_ITEM_CLASS, obj);
1050 if (!subitem) return NULL; 1085 if (!eo_subitem) return NULL;
1051 1086
1052 elm_widget_item_del_pre_hook_set(subitem, _item_del_pre_hook); 1087 ELM_MENU_ITEM_DATA_GET(eo_subitem, subitem);
1053 elm_widget_item_disable_hook_set(subitem, _item_disable_hook);
1054 elm_widget_item_text_set_hook_set(subitem, _item_text_set_hook);
1055 elm_widget_item_text_get_hook_set(subitem, _item_text_get_hook);
1056 elm_widget_item_content_set_hook_set(subitem, _item_content_set_hook);
1057 elm_widget_item_content_get_hook_set(subitem, _item_content_get_hook);
1058 1088
1059 subitem->separator = EINA_TRUE; 1089 subitem->separator = EINA_TRUE;
1060 _item_separator_obj_create(subitem); 1090 _item_separator_obj_create(eo_subitem);
1061 if (!p_item) 1091 if (!eo_p_item)
1062 { 1092 {
1063 elm_box_pack_end(sd->bx, VIEW(subitem)); 1093 elm_box_pack_end(sd->bx, VIEW(subitem));
1064 sd->items = eina_list_append(sd->items, subitem); 1094 sd->items = eina_list_append(sd->items, eo_subitem);
1065 } 1095 }
1066 else 1096 else
1067 { 1097 {
1068 if (!p_item->submenu.bx) _item_submenu_obj_create(p_item); 1098 if (!p_item->submenu.bx) _item_submenu_obj_create(eo_p_item);
1069 elm_box_pack_end(p_item->submenu.bx, VIEW(subitem)); 1099 elm_box_pack_end(p_item->submenu.bx, VIEW(subitem));
1070 p_item->submenu.items = eina_list_append 1100 p_item->submenu.items = eina_list_append
1071 (p_item->submenu.items, subitem); 1101 (p_item->submenu.items, eo_subitem);
1072 } 1102 }
1073 1103
1074 _sizing_eval(obj); 1104 _sizing_eval(obj);
1075 1105
1076 if (sd->dbus_menu) 1106 if (sd->dbus_menu)
1077 subitem->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, 1107 subitem->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu,
1078 (Elm_Object_Item *)subitem); 1108 (Elm_Object_Item *)eo_subitem);
1079 return (Elm_Object_Item *)subitem; 1109 return (Elm_Object_Item *)eo_subitem;
1080} 1110}
1081 1111
1082EAPI const char * 1112EOLIAN static const char *
1083elm_menu_item_icon_name_get(const Elm_Object_Item *it) 1113_elm_menu_item_icon_name_get(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *item)
1084{ 1114{
1085 ELM_MENU_ITEM_CHECK_OR_RETURN(it, NULL); 1115 return item->icon_str;
1086
1087 return ((Elm_Menu_Item *)it)->icon_str;
1088} 1116}
1089 1117
1090EAPI Eina_Bool 1118EOLIAN static Eina_Bool
1091elm_menu_item_is_separator(Elm_Object_Item *it) 1119_elm_menu_item_is_separator(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *item)
1092{ 1120{
1093 ELM_MENU_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); 1121 return item->separator;
1094
1095 return ((Elm_Menu_Item *)it)->separator;
1096} 1122}
1097 1123
1098EAPI const Eina_List * 1124EOLIAN static const Eina_List *
1099elm_menu_item_subitems_get(const Elm_Object_Item *it) 1125_elm_menu_item_subitems_get(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *item)
1100{ 1126{
1101 ELM_MENU_ITEM_CHECK_OR_RETURN(it, NULL); 1127 return item->submenu.items;
1102
1103 return ((Elm_Menu_Item *)it)->submenu.items;
1104} 1128}
1105 1129
1106EAPI void 1130EOLIAN static void
1107elm_menu_item_subitems_clear(Elm_Object_Item *it) 1131_elm_menu_item_subitems_clear(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *it)
1108{ 1132{
1109 Elm_Object_Item *sub_it; 1133 Elm_Widobj_Item *sub_it;
1110 Eina_List *l, *l_next; 1134 Eina_List *l, *l_next;
1111 1135
1112 ELM_MENU_ITEM_CHECK_OR_RETURN(it); 1136 EINA_LIST_FOREACH_SAFE(it->submenu.items,
1113 EINA_LIST_FOREACH_SAFE(((Elm_Menu_Item *)it)->submenu.items,
1114 l, l_next, sub_it) 1137 l, l_next, sub_it)
1115 elm_widget_item_del(sub_it); 1138 eo_do(sub_it, elm_wdg_item_del());
1116} 1139}
1117 1140
1118EOLIAN static const Eina_List* 1141EOLIAN static const Eina_List*
@@ -1121,48 +1144,40 @@ _elm_menu_items_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
1121 return sd->items; 1144 return sd->items;
1122} 1145}
1123 1146
1124EAPI void 1147EOLIAN static void
1125elm_menu_item_selected_set(Elm_Object_Item *it, 1148_elm_menu_item_selected_set(Eo *eo_item,
1126 Eina_Bool selected) 1149 Elm_Menu_Item_Data *item,
1150 Eina_Bool selected)
1127{ 1151{
1128 Elm_Menu_Item *item = (Elm_Menu_Item *)it;
1129
1130 ELM_MENU_ITEM_CHECK_OR_RETURN(item);
1131
1132 if (selected == item->selected) return; 1152 if (selected == item->selected) return;
1133 item->selected = selected; 1153 item->selected = selected;
1134 if (selected) 1154 if (selected)
1135 { 1155 {
1136 elm_layout_signal_emit(VIEW(item), "elm,state,selected", "elm"); 1156 elm_layout_signal_emit(VIEW(item), "elm,state,selected", "elm");
1137 _menu_item_activate_cb(item, NULL, NULL, NULL); 1157 _menu_item_activate_cb(eo_item, NULL, NULL, NULL);
1138 } 1158 }
1139 else 1159 else
1140 { 1160 {
1141 elm_layout_signal_emit(VIEW(item), "elm,state,unselected", "elm"); 1161 elm_layout_signal_emit(VIEW(item), "elm,state,unselected", "elm");
1142 _menu_item_inactivate_cb(item, NULL, NULL, NULL); 1162 _menu_item_inactivate_cb(eo_item, NULL, NULL, NULL);
1143 } 1163 }
1144 edje_object_message_signal_process(elm_layout_edje_get(VIEW(item))); 1164 edje_object_message_signal_process(elm_layout_edje_get(VIEW(item)));
1145} 1165}
1146 1166
1147EAPI Eina_Bool 1167EOLIAN static Eina_Bool
1148elm_menu_item_selected_get(const Elm_Object_Item *it) 1168_elm_menu_item_selected_get(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *item)
1149{ 1169{
1150 ELM_MENU_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); 1170 return item->selected;
1151
1152 return ((Elm_Menu_Item *)it)->selected;
1153} 1171}
1154 1172
1155EAPI Elm_Object_Item * 1173EOLIAN static Elm_Widobj_Item *
1156elm_menu_item_prev_get(const Elm_Object_Item *it) 1174_elm_menu_item_prev_get(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *item)
1157{ 1175{
1158 Elm_Menu_Item *item = (Elm_Menu_Item *)it;
1159
1160 ELM_MENU_ITEM_CHECK_OR_RETURN(item, NULL);
1161
1162 if (item->parent) 1176 if (item->parent)
1163 { 1177 {
1178 ELM_MENU_ITEM_DATA_GET(item->parent, parent_data);
1164 Eina_List *l = eina_list_data_find_list 1179 Eina_List *l = eina_list_data_find_list
1165 (item->parent->submenu.items, item); 1180 (parent_data->submenu.items, eo_item);
1166 l = eina_list_prev(l); 1181 l = eina_list_prev(l);
1167 if (!l) return NULL; 1182 if (!l) return NULL;
1168 return l->data; 1183 return l->data;
@@ -1171,7 +1186,7 @@ elm_menu_item_prev_get(const Elm_Object_Item *it)
1171 { 1186 {
1172 ELM_MENU_DATA_GET(WIDGET(item), sd); 1187 ELM_MENU_DATA_GET(WIDGET(item), sd);
1173 if (!sd || !sd->items) return NULL; 1188 if (!sd || !sd->items) return NULL;
1174 Eina_List *l = eina_list_data_find_list(sd->items, item); 1189 Eina_List *l = eina_list_data_find_list(sd->items, eo_item);
1175 l = eina_list_prev(l); 1190 l = eina_list_prev(l);
1176 if (!l) return NULL; 1191 if (!l) return NULL;
1177 return l->data; 1192 return l->data;
@@ -1180,17 +1195,14 @@ elm_menu_item_prev_get(const Elm_Object_Item *it)
1180 return NULL; 1195 return NULL;
1181} 1196}
1182 1197
1183EAPI Elm_Object_Item * 1198EOLIAN static Elm_Widobj_Item *
1184elm_menu_item_next_get(const Elm_Object_Item *it) 1199_elm_menu_item_next_get(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *item)
1185{ 1200{
1186 Elm_Menu_Item *item = (Elm_Menu_Item *)it;
1187
1188 ELM_MENU_ITEM_CHECK_OR_RETURN(item, NULL);
1189
1190 if (item->parent) 1201 if (item->parent)
1191 { 1202 {
1203 ELM_MENU_ITEM_DATA_GET(item->parent, parent_data);
1192 Eina_List *l = 1204 Eina_List *l =
1193 eina_list_data_find_list(item->parent->submenu.items, item); 1205 eina_list_data_find_list(parent_data->submenu.items, eo_item);
1194 l = eina_list_next(l); 1206 l = eina_list_next(l);
1195 if (!l) return NULL; 1207 if (!l) return NULL;
1196 return l->data; 1208 return l->data;
@@ -1199,7 +1211,7 @@ elm_menu_item_next_get(const Elm_Object_Item *it)
1199 { 1211 {
1200 ELM_MENU_DATA_GET(WIDGET(item), sd); 1212 ELM_MENU_DATA_GET(WIDGET(item), sd);
1201 if (!sd || !sd->items) return NULL; 1213 if (!sd || !sd->items) return NULL;
1202 Eina_List *l = eina_list_data_find_list(sd->items, item); 1214 Eina_List *l = eina_list_data_find_list(sd->items, eo_item);
1203 l = eina_list_next(l); 1215 l = eina_list_next(l);
1204 if (!l) return NULL; 1216 if (!l) return NULL;
1205 return l->data; 1217 return l->data;
@@ -1225,11 +1237,12 @@ EOLIAN static Elm_Object_Item*
1225_elm_menu_selected_item_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd) 1237_elm_menu_selected_item_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
1226{ 1238{
1227 Eina_List *l; 1239 Eina_List *l;
1228 Elm_Menu_Item *item; 1240 Elm_Widobj_Item *eo_item;
1229 1241
1230 EINA_LIST_FOREACH(sd->items, l, item) 1242 EINA_LIST_FOREACH(sd->items, l, eo_item)
1231 { 1243 {
1232 if (item->selected) return (Elm_Object_Item *)item; 1244 ELM_MENU_ITEM_DATA_GET(eo_item, item);
1245 if (item->selected) return (Elm_Object_Item *)eo_item;
1233 } 1246 }
1234 1247
1235 return NULL; 1248 return NULL;
@@ -1241,4 +1254,89 @@ _elm_menu_class_constructor(Eo_Class *klass)
1241 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 1254 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
1242} 1255}
1243 1256
1244#include "elm_menu.eo.c" 1257EAPI Evas_Object *
1258elm_menu_item_object_get(const Elm_Object_Item *it)
1259{
1260 Evas_Object *ret = NULL;
1261 eo_do((Eo*)it, ret = elm_obj_menu_item_object_get());
1262 return ret;
1263}
1264
1265EAPI void
1266elm_menu_item_selected_set(Elm_Object_Item *it,
1267 Eina_Bool selected)
1268{
1269 eo_do((Eo*)it, elm_obj_menu_item_selected_set(selected));
1270}
1271
1272EAPI Eina_Bool
1273elm_menu_item_selected_get(const Elm_Object_Item *it)
1274{
1275 Eina_Bool ret;
1276 eo_do((Eo*)it, ret = elm_obj_menu_item_selected_get());
1277 return ret;
1278}
1279
1280EAPI Elm_Object_Item *
1281elm_menu_item_prev_get(const Elm_Object_Item *it)
1282{
1283 Elm_Widobj_Item *ret = NULL;
1284 eo_do((Eo*)it, ret = elm_obj_menu_item_prev_get());
1285 return (Elm_Object_Item*)ret;
1286}
1287
1288EAPI Elm_Object_Item *
1289elm_menu_item_next_get(const Elm_Object_Item *it)
1290{
1291 Elm_Widobj_Item *ret = NULL;
1292 eo_do((Eo*)it, ret = elm_obj_menu_item_next_get());
1293 return (Elm_Object_Item*)ret;
1294}
1295
1296EAPI const char *
1297elm_menu_item_icon_name_get(const Elm_Object_Item *it)
1298{
1299 const char *ret = NULL;
1300 eo_do((Eo*)it, ret = elm_obj_menu_item_icon_name_get());
1301 return ret;
1302}
1303
1304EAPI Eina_Bool
1305elm_menu_item_is_separator(Elm_Object_Item *it)
1306{
1307 Eina_Bool ret;
1308 eo_do((Eo*)it, ret = elm_obj_menu_item_is_separator());
1309 return ret;
1310}
1311
1312EAPI const Eina_List *
1313elm_menu_item_subitems_get(const Elm_Object_Item *it)
1314{
1315 const Eina_List *ret = NULL;
1316 eo_do((Eo*)it, ret = elm_obj_menu_item_subitems_get());
1317 return ret;
1318}
1319
1320EAPI void
1321elm_menu_item_subitems_clear(Elm_Object_Item *it)
1322{
1323 eo_do((Eo*)it, elm_obj_menu_item_subitems_clear());
1324}
1325
1326EAPI unsigned int
1327elm_menu_item_index_get(const Elm_Object_Item *it)
1328{
1329 unsigned int ret;
1330 eo_do((Eo*)it, ret = elm_obj_menu_item_index_get());
1331 return ret;
1332}
1333
1334EAPI void
1335elm_menu_item_icon_name_set(Elm_Object_Item *it,
1336 const char *icon)
1337{
1338 eo_do((Eo*)it, elm_obj_menu_item_icon_name_set(icon));
1339}
1340
1341#include "elm_menu_item.eo.c"
1342#include "elm_menu.eo.c" \ No newline at end of file
diff --git a/src/lib/elm_menu_item.eo b/src/lib/elm_menu_item.eo
new file mode 100644
index 000000000..54fe9d167
--- /dev/null
+++ b/src/lib/elm_menu_item.eo
@@ -0,0 +1,139 @@
1class Elm_Menu_Item(Elm_Widget_Item)
2{
3 legacy_prefix: null;
4 eo_prefix: elm_obj_menu_item;
5 properties {
6 icon_name {
7 get {
8 /*@
9 Get the string representation from the icon of a menu item
10
11 Once this icon is set, any previously set icon will be deleted.
12 To hide icon set it to "".
13
14 @see elm_menu_item_icon_name_set()
15 @ingroup Menu
16 */
17 }
18 set {
19 /*@
20 Set the icon of a menu item to the standard icon with name @p icon
21
22 Once this icon is set, any previously set icon will be deleted.
23 To hide icon set it to "".
24
25 @ingroup Menu
26 */
27 }
28 values {
29 const char* icon; /*@ The name of icon object */
30 }
31 }
32 selected {
33 get {
34 /*@
35 Get the selected state of @p item.
36
37 @see elm_menu_item_selected_set()
38
39 @ingroup Menu
40 */
41 }
42 set {
43 /*@
44 Set the selected state of @p item.
45
46 @ingroup Menu
47 */
48 }
49 values {
50 Eina_Bool selected; /*@ EINA_TRUE if selected EINA_FALSE otherwise */
51 }
52 }
53 }
54 methods {
55 prev_get {
56 /*@
57 Get the previous item in the menu.
58
59 @ingroup Menu
60 */
61 const;
62 return Elm_Widobj_Item*;
63 }
64 next_get {
65 /*@
66 Get the next item in the menu.
67
68 @ingroup Menu
69 */
70 const;
71 return Elm_Widobj_Item*;
72 }
73 index_get {
74 /*@
75 Get the next item in the menu.
76
77 @ingroup Menu
78 */
79 const;
80 return unsigned int;
81 }
82 subitems_clear {
83 /*@
84 Remove all sub-items (children) of the given item
85 @since 1.8
86
87 This removes all items that are children (and their descendants) of the
88 given item @p it.
89
90 @see elm_object_item_del()
91
92 @ingroup Menu
93 */
94 }
95 subitems_get {
96 /*@
97 Returns a list of @p item's subitems.
98
99 @see elm_menu_add()
100
101 @ingroup Menu
102 */
103 const;
104 return const Eina_List *; /*@ An Eina_List* of @p item's subitems */
105 }
106 is_separator {
107 /*@
108 Returns whether @p item is a separator.
109
110 @see elm_menu_item_separator_add()
111
112 @ingroup Menu
113 */
114 const;
115 return Eina_Bool; /*@ If true, @p item is a separator */
116 }
117 object_get {
118 /*@
119 Get the real Evas(Edje) object created to implement the view of a given
120 menu @p item.
121
122 @warning Don't manipulate this object!
123
124 @ingroup Menu
125 */
126 const;
127 return Evas_Object*; /*@ The base Edje object containing the swallowed content associated with@p it. */
128 }
129 }
130 implements {
131 Eo_Base::constructor;
132 Elm_Widget_Item::del_pre;
133 Elm_Widget_Item::disable;
134 Elm_Widget_Item::part_text::get;
135 Elm_Widget_Item::part_text::set;
136 Elm_Widget_Item::part_content::get;
137 Elm_Widget_Item::part_content::set;
138 }
139} \ No newline at end of file
diff --git a/src/lib/elm_widget_menu.h b/src/lib/elm_widget_menu.h
index 21027ed7e..7c912a40d 100644
--- a/src/lib/elm_widget_menu.h
+++ b/src/lib/elm_widget_menu.h
@@ -3,6 +3,9 @@
3 3
4#include "Elementary.h" 4#include "Elementary.h"
5 5
6#include "elm_object_item_migration_temp.h"
7#include "elm_menu_item.eo.h"
8
6/** 9/**
7 * @addtogroup Widget 10 * @addtogroup Widget
8 * @{ 11 * @{
@@ -29,12 +32,12 @@ struct _Elm_Menu_Data
29 Eina_Bool menu_bar : 1; 32 Eina_Bool menu_bar : 1;
30}; 33};
31 34
32typedef struct _Elm_Menu_Item Elm_Menu_Item; 35typedef struct _Elm_Menu_Item_Data Elm_Menu_Item_Data;
33struct _Elm_Menu_Item 36struct _Elm_Menu_Item_Data
34{ 37{
35 ELM_WIDGET_ITEM; 38 Elm_Widget_Item_Data *base;
36 39
37 Elm_Menu_Item *parent; 40 Elm_Widobj_Item *parent;
38 Evas_Object *content; 41 Evas_Object *content;
39 const char *icon_str; 42 const char *icon_str;
40 const char *label; 43 const char *label;
@@ -82,16 +85,20 @@ struct _Elm_Menu_Item
82 return val; \ 85 return val; \
83 } 86 }
84 87
88#define ELM_MENU_ITEM_DATA_GET(o, sd) \
89 Elm_Menu_Item_Data * sd = eo_data_scope_get(o, ELM_MENU_ITEM_CLASS)
90
85#define ELM_MENU_CHECK(obj) \ 91#define ELM_MENU_CHECK(obj) \
86 if (EINA_UNLIKELY(!eo_isa((obj), ELM_MENU_CLASS))) \ 92 if (EINA_UNLIKELY(!eo_isa((obj), ELM_MENU_CLASS))) \
87 return 93 return
88 94
89#define ELM_MENU_ITEM_CHECK(it) \ 95#define ELM_MENU_ITEM_CHECK(obj) \
90 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, ); \ 96 if (EINA_UNLIKELY(!eo_isa((obj), ELM_MENU_ITEM_CLASS))) \
91 ELM_MENU_CHECK(it->base.widget); 97 return
98
99#define ELM_MENU_ITEM_CHECK_OR_RETURN(obj, ...) \
100 if (EINA_UNLIKELY(!eo_isa((obj), ELM_MENU_ITEM_CLASS))) \
101 return __VA_ARGS__;
92 102
93#define ELM_MENU_ITEM_CHECK_OR_RETURN(it, ...) \
94 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
95 ELM_MENU_CHECK(it->base.widget) __VA_ARGS__;
96 103
97#endif 104#endif