summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-24 09:09:40 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-24 09:58:23 +0200
commit2c34c8fe83282913db8593f2fdfdff58696c46b0 (patch)
tree5454d69dadeae0026a7c9adaf3446d2bfddbfcf2
parente6a5adaf4adc8e8659120efbe22b519b2a6f75f0 (diff)
Eolian: Integration of Menu
-rw-r--r--src/lib/Makefile.am10
-rw-r--r--src/lib/elm_menu.c278
-rw-r--r--src/lib/elm_menu.eo130
-rw-r--r--src/lib/elm_menu_eo.h5
-rw-r--r--src/lib/elm_widget_menu.h6
5 files changed, 198 insertions, 231 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 310ca4352..03486e9b0 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -608,7 +608,9 @@ BUILT_SOURCES = \
608 elm_map_pan.eo.c \ 608 elm_map_pan.eo.c \
609 elm_map_pan.eo.h \ 609 elm_map_pan.eo.h \
610 elm_map.eo.c \ 610 elm_map.eo.c \
611 elm_map.eo.h 611 elm_map.eo.h \
612 elm_menu.eo.c \
613 elm_menu.eo.h
612 614
613EXTRA_DIST += \ 615EXTRA_DIST += \
614 elm_widget.eo \ 616 elm_widget.eo \
@@ -652,7 +654,8 @@ EXTRA_DIST += \
652 elm_inwin.eo \ 654 elm_inwin.eo \
653 elm_label.eo \ 655 elm_label.eo \
654 elm_map_pan.eo \ 656 elm_map_pan.eo \
655 elm_map.eo 657 elm_map.eo \
658 elm_menu.eo
656 659
657nodist_includesunstable_HEADERS = \ 660nodist_includesunstable_HEADERS = \
658 elm_widget.eo.h \ 661 elm_widget.eo.h \
@@ -696,5 +699,6 @@ nodist_includesunstable_HEADERS = \
696 elm_inwin.eo.h \ 699 elm_inwin.eo.h \
697 elm_label.eo.h \ 700 elm_label.eo.h \
698 elm_map_pan.eo.h \ 701 elm_map_pan.eo.h \
699 elm_map.eo.h 702 elm_map.eo.h \
703 elm_menu.eo.h
700 704
diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c
index c6ecf8b3e..952255ae8 100644
--- a/src/lib/elm_menu.c
+++ b/src/lib/elm_menu.c
@@ -7,8 +7,6 @@
7#include "elm_priv.h" 7#include "elm_priv.h"
8#include "elm_widget_menu.h" 8#include "elm_widget_menu.h"
9 9
10EAPI Eo_Op ELM_OBJ_MENU_BASE_ID = EO_NOOP;
11
12#define MY_CLASS ELM_OBJ_MENU_CLASS 10#define MY_CLASS ELM_OBJ_MENU_CLASS
13 11
14#define MY_CLASS_NAME "Elm_Menu" 12#define MY_CLASS_NAME "Elm_Menu"
@@ -28,18 +26,16 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
28}; 26};
29#undef ELM_PRIV_MENU_SIGNALS 27#undef ELM_PRIV_MENU_SIGNALS
30 28
31static void 29EOLIAN static Eina_Bool
32_elm_menu_smart_translate(Eo *obj EINA_UNUSED, void *_pd, va_list *list) 30_elm_menu_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
33{ 31{
34 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
35 Elm_Menu_Smart_Data *sd = _pd;
36 Elm_Menu_Item *it; 32 Elm_Menu_Item *it;
37 Eina_List *l; 33 Eina_List *l;
38 34
39 EINA_LIST_FOREACH(sd->items, l, it) 35 EINA_LIST_FOREACH(sd->items, l, it)
40 elm_widget_item_translate(it); 36 elm_widget_item_translate(it);
41 37
42 if (ret) *ret = EINA_TRUE; 38 return EINA_TRUE;
43} 39}
44 40
45static void 41static void
@@ -192,13 +188,10 @@ _sizing_eval(Evas_Object *obj)
192 if (item->submenu.open) _submenu_sizing_eval(item); 188 if (item->submenu.open) _submenu_sizing_eval(item);
193} 189}
194 190
195static void 191EOLIAN static Eina_Bool
196_elm_menu_smart_theme(Eo *obj, void *_pd, va_list *list) 192_elm_menu_elm_widget_theme_apply(Eo *obj, Elm_Menu_Data *sd)
197{ 193{
198 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
199 if (ret) *ret = EINA_FALSE;
200 Eina_Bool int_ret = EINA_FALSE; 194 Eina_Bool int_ret = EINA_FALSE;
201 Elm_Menu_Smart_Data *sd = _pd;
202 195
203 Eina_List *l, *_l, *_ll, *ll = NULL; 196 Eina_List *l, *_l, *_ll, *ll = NULL;
204 Elm_Menu_Item *item; 197 Elm_Menu_Item *item;
@@ -206,7 +199,7 @@ _elm_menu_smart_theme(Eo *obj, void *_pd, va_list *list)
206 char style[1024]; 199 char style[1024];
207 200
208 eo_do_super(obj, MY_CLASS, elm_obj_widget_theme_apply(&int_ret)); 201 eo_do_super(obj, MY_CLASS, elm_obj_widget_theme_apply(&int_ret));
209 if (!int_ret) return; 202 if (!int_ret) return EINA_FALSE;
210 203
211 if (sd->menu_bar) 204 if (sd->menu_bar)
212 snprintf(style, sizeof(style), "main_menu/%s", elm_widget_style_get(obj)); 205 snprintf(style, sizeof(style), "main_menu/%s", elm_widget_style_get(obj));
@@ -268,7 +261,7 @@ _elm_menu_smart_theme(Eo *obj, void *_pd, va_list *list)
268 261
269 _sizing_eval(obj); 262 _sizing_eval(obj);
270 263
271 if (ret) *ret = EINA_TRUE; 264 return EINA_TRUE;
272} 265}
273 266
274static void 267static void
@@ -489,10 +482,9 @@ _menu_item_inactivate_cb(void *data,
489 if (item->submenu.open) _submenu_hide(item); 482 if (item->submenu.open) _submenu_hide(item);
490} 483}
491 484
492static void 485EOLIAN static void
493_elm_menu_smart_show(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED) 486_elm_menu_evas_smart_show(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
494{ 487{
495 Elm_Menu_Smart_Data *sd = _pd;
496 evas_object_show(sd->hv); 488 evas_object_show(sd->hv);
497} 489}
498 490
@@ -602,11 +594,9 @@ _item_submenu_obj_create(Elm_Menu_Item *item)
602 _menu_resize_cb, WIDGET(item)); 594 _menu_resize_cb, WIDGET(item));
603} 595}
604 596
605static void 597EOLIAN static void
606_elm_menu_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) 598_elm_menu_evas_smart_add(Eo *obj, Elm_Menu_Data *priv)
607{ 599{
608 Elm_Menu_Smart_Data *priv = _pd;
609
610 eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); 600 eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
611 elm_widget_sub_object_parent_add(obj); 601 elm_widget_sub_object_parent_add(obj);
612 602
@@ -630,11 +620,10 @@ _elm_menu_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
630 (priv->bx, EVAS_CALLBACK_RESIZE, _menu_resize_cb, obj); 620 (priv->bx, EVAS_CALLBACK_RESIZE, _menu_resize_cb, obj);
631} 621}
632 622
633static void 623EOLIAN static void
634_elm_menu_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) 624_elm_menu_evas_smart_del(Eo *obj, Elm_Menu_Data *sd)
635{ 625{
636 Elm_Menu_Item *item; 626 Elm_Menu_Item *item;
637 Elm_Menu_Smart_Data *sd = _pd;
638 627
639 _elm_dbus_menu_unregister(obj); 628 _elm_dbus_menu_unregister(obj);
640 629
@@ -719,10 +708,9 @@ elm_menu_add(Evas_Object *parent)
719 return obj; 708 return obj;
720} 709}
721 710
722static void 711EOLIAN static void
723_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED) 712_elm_menu_eo_base_constructor(Eo *obj, Elm_Menu_Data *sd)
724{ 713{
725 Elm_Menu_Smart_Data *sd = _pd;
726 Eo *parent; 714 Eo *parent;
727 715
728 eo_do_super(obj, MY_CLASS, eo_constructor()); 716 eo_do_super(obj, MY_CLASS, eo_constructor());
@@ -748,11 +736,9 @@ elm_menu_parent_set(Evas_Object *obj,
748 eo_do(obj, elm_obj_widget_parent_set(parent)); 736 eo_do(obj, elm_obj_widget_parent_set(parent));
749} 737}
750 738
751static void 739EOLIAN static void
752_parent_set(Eo *obj, void *_pd, va_list *list) 740_elm_menu_elm_widget_parent_set(Eo *obj, Elm_Menu_Data *sd, Evas_Object *parent)
753{ 741{
754 Evas_Object *parent = va_arg(*list, Evas_Object *);
755 Elm_Menu_Smart_Data *sd = _pd;
756 Eina_List *l, *_l, *_ll, *ll = NULL; 742 Eina_List *l, *_l, *_ll, *ll = NULL;
757 Elm_Menu_Item *item; 743 Elm_Menu_Item *item;
758 744
@@ -801,46 +787,23 @@ elm_menu_parent_get(const Evas_Object *obj)
801 return ret; 787 return ret;
802} 788}
803 789
804static void 790EOLIAN static Evas_Object*
805_parent_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) 791_elm_menu_elm_widget_parent_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
806{
807 Evas_Object **ret = va_arg(*list, Evas_Object **);
808 Elm_Menu_Smart_Data *sd = _pd;
809 *ret = sd->parent;
810}
811
812EAPI void
813elm_menu_move(Evas_Object *obj,
814 Evas_Coord x,
815 Evas_Coord y)
816{ 792{
817 ELM_MENU_CHECK(obj); 793 return sd->parent;
818 eo_do(obj, elm_obj_menu_move(x, y));
819} 794}
820 795
821static void 796EOLIAN static void
822_move(Eo *obj, void *_pd, va_list *list) 797_elm_menu_move(Eo *obj, Elm_Menu_Data *sd, Evas_Coord x, Evas_Coord y)
823{ 798{
824 Evas_Coord x = va_arg(*list, Evas_Coord);
825 Evas_Coord y = va_arg(*list, Evas_Coord);
826 Elm_Menu_Smart_Data *sd = _pd;
827
828 sd->xloc = x; 799 sd->xloc = x;
829 sd->yloc = y; 800 sd->yloc = y;
830 _sizing_eval(obj); 801 _sizing_eval(obj);
831} 802}
832 803
833EAPI void 804EOLIAN static void
834elm_menu_close(Evas_Object *obj) 805_elm_menu_close(Eo *obj, Elm_Menu_Data *sd)
835{ 806{
836 ELM_MENU_CHECK(obj);
837 eo_do(obj, elm_obj_menu_close());
838}
839
840static void
841_menu_close(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
842{
843 Elm_Menu_Smart_Data *sd = _pd;
844 _menu_hide(obj, sd->hv, NULL); 807 _menu_hide(obj, sd->hv, NULL);
845} 808}
846 809
@@ -897,7 +860,7 @@ static void
897_elm_menu_item_add_helper(Evas_Object *obj, 860_elm_menu_item_add_helper(Evas_Object *obj,
898 Elm_Menu_Item *parent, 861 Elm_Menu_Item *parent,
899 Elm_Menu_Item *subitem, 862 Elm_Menu_Item *subitem,
900 Elm_Menu_Smart_Data *sd) 863 Elm_Menu_Data *sd)
901{ 864{
902 if (parent) 865 if (parent)
903 { 866 {
@@ -942,44 +905,20 @@ _item_del_pre_hook(Elm_Object_Item *it)
942 return EINA_TRUE; 905 return EINA_TRUE;
943} 906}
944 907
945EAPI Elm_Object_Item * 908EOLIAN static Elm_Object_Item*
946elm_menu_item_add(Evas_Object *obj, 909_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)
947 Elm_Object_Item *parent,
948 const char *icon,
949 const char *label,
950 Evas_Smart_Cb func,
951 const void *data)
952{
953 ELM_MENU_CHECK(obj) NULL;
954 Elm_Object_Item *ret = NULL;
955 eo_do(obj, elm_obj_menu_item_add(parent, icon, label, func, data, &ret));
956 return ret;
957}
958
959static void
960_item_add(Eo *obj, void *_pd, va_list *list)
961{ 910{
962 Elm_Object_Item *parent = va_arg(*list, Elm_Object_Item *);
963 const char *icon = va_arg(*list, const char *);
964 const char *label = va_arg(*list, const char *);
965 Evas_Smart_Cb func = va_arg(*list, Evas_Smart_Cb);
966 const void *data = va_arg(*list, const void *);
967 Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
968 if (ret) *ret = NULL;
969
970 Elm_Menu_Item *it; 911 Elm_Menu_Item *it;
971 Evas_Object *icon_obj; 912 Evas_Object *icon_obj;
972 913
973 Elm_Menu_Smart_Data *sd = _pd;
974
975 icon_obj = elm_icon_add(obj); 914 icon_obj = elm_icon_add(obj);
976 if (!icon_obj) return; 915 if (!icon_obj) return NULL;
977 916
978 it = elm_widget_item_new(obj, Elm_Menu_Item); 917 it = elm_widget_item_new(obj, Elm_Menu_Item);
979 if (!it) 918 if (!it)
980 { 919 {
981 evas_object_del(icon_obj); 920 evas_object_del(icon_obj);
982 return; 921 return NULL;
983 } 922 }
984 923
985 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); 924 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
@@ -1009,7 +948,7 @@ _item_add(Eo *obj, void *_pd, va_list *list)
1009 it->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, (Elm_Object_Item *)it); 948 it->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, (Elm_Object_Item *)it);
1010 it->dbus_menu = sd->dbus_menu; 949 it->dbus_menu = sd->dbus_menu;
1011 } 950 }
1012 if (ret) *ret = (Elm_Object_Item *)it; 951 return (Elm_Object_Item *)it;
1013} 952}
1014 953
1015EAPI unsigned int 954EAPI unsigned int
@@ -1045,43 +984,27 @@ elm_menu_item_icon_name_set(Elm_Object_Item *it,
1045 _sizing_eval(WIDGET(item)); 984 _sizing_eval(WIDGET(item));
1046} 985}
1047 986
1048EAPI Elm_Object_Item * 987EOLIAN static Elm_Object_Item*
1049elm_menu_item_separator_add(Evas_Object *obj, 988_elm_menu_item_separator_add(Eo *obj, Elm_Menu_Data *sd, Elm_Object_Item *parent)
1050 Elm_Object_Item *parent)
1051{
1052 ELM_MENU_CHECK(obj) NULL;
1053 Elm_Object_Item *ret = NULL;
1054 eo_do(obj, elm_obj_menu_item_separator_add(parent, &ret));
1055 return ret;
1056}
1057
1058static void
1059_item_separator_add(Eo *obj, void *_pd, va_list *list)
1060{ 989{
1061 Elm_Object_Item *parent = va_arg(*list, Elm_Object_Item *);
1062 Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
1063 *ret = NULL;
1064
1065 Elm_Menu_Item *subitem; 990 Elm_Menu_Item *subitem;
1066 Elm_Menu_Item *p_item = (Elm_Menu_Item *)parent; 991 Elm_Menu_Item *p_item = (Elm_Menu_Item *)parent;
1067 992
1068 Elm_Menu_Smart_Data *sd = _pd;
1069
1070 /* don't add a separator as the first item */ 993 /* don't add a separator as the first item */
1071 if (!sd->items) return; 994 if (!sd->items) return NULL;
1072 995
1073 /* don't allow adding more than one separator in a row */ 996 /* don't allow adding more than one separator in a row */
1074 if (p_item) 997 if (p_item)
1075 { 998 {
1076 if (!p_item->submenu.items) return; 999 if (!p_item->submenu.items) return NULL;
1077 subitem = eina_list_last(p_item->submenu.items)->data; 1000 subitem = eina_list_last(p_item->submenu.items)->data;
1078 } 1001 }
1079 else subitem = eina_list_last(sd->items)->data; 1002 else subitem = eina_list_last(sd->items)->data;
1080 1003
1081 if (subitem->separator) return; 1004 if (subitem->separator) return NULL;
1082 1005
1083 subitem = elm_widget_item_new(obj, Elm_Menu_Item); 1006 subitem = elm_widget_item_new(obj, Elm_Menu_Item);
1084 if (!subitem) return; 1007 if (!subitem) return NULL;
1085 1008
1086 elm_widget_item_del_pre_hook_set(subitem, _item_del_pre_hook); 1009 elm_widget_item_del_pre_hook_set(subitem, _item_del_pre_hook);
1087 elm_widget_item_disable_hook_set(subitem, _item_disable_hook); 1010 elm_widget_item_disable_hook_set(subitem, _item_disable_hook);
@@ -1110,7 +1033,7 @@ _item_separator_add(Eo *obj, void *_pd, va_list *list)
1110 if (sd->dbus_menu) 1033 if (sd->dbus_menu)
1111 subitem->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, 1034 subitem->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu,
1112 (Elm_Object_Item *)subitem); 1035 (Elm_Object_Item *)subitem);
1113 *ret = (Elm_Object_Item *)subitem; 1036 return (Elm_Object_Item *)subitem;
1114} 1037}
1115 1038
1116EAPI const char * 1039EAPI const char *
@@ -1149,21 +1072,10 @@ elm_menu_item_subitems_clear(Elm_Object_Item *it)
1149 elm_object_item_del(sub_it); 1072 elm_object_item_del(sub_it);
1150} 1073}
1151 1074
1152EAPI const Eina_List * 1075EOLIAN static const Eina_List*
1153elm_menu_items_get(const Evas_Object *obj) 1076_elm_menu_items_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
1154{
1155 ELM_MENU_CHECK(obj) NULL;
1156 const Eina_List *ret = NULL;
1157 eo_do((Eo *) obj, elm_obj_menu_items_get(&ret));
1158 return ret;
1159}
1160
1161static void
1162_items_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1163{ 1077{
1164 const Eina_List **ret = va_arg(*list, const Eina_List **); 1078 return sd->items;
1165 Elm_Menu_Smart_Data *sd = _pd;
1166 *ret = sd->items;
1167} 1079}
1168 1080
1169EAPI void 1081EAPI void
@@ -1253,121 +1165,37 @@ elm_menu_item_next_get(const Elm_Object_Item *it)
1253 return NULL; 1165 return NULL;
1254} 1166}
1255 1167
1256EAPI Elm_Object_Item * 1168EOLIAN static Elm_Object_Item*
1257elm_menu_first_item_get(const Evas_Object *obj) 1169_elm_menu_first_item_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
1258{
1259 ELM_MENU_CHECK(obj) NULL;
1260 Elm_Object_Item *ret = NULL;
1261 eo_do((Eo *) obj, elm_obj_menu_first_item_get(&ret));
1262 return ret;
1263}
1264
1265static void
1266_first_item_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1267{
1268 Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
1269 Elm_Menu_Smart_Data *sd = _pd;
1270 *ret = (sd->items ? sd->items->data : NULL);
1271}
1272
1273EAPI Elm_Object_Item *
1274elm_menu_last_item_get(const Evas_Object *obj)
1275{ 1170{
1276 ELM_MENU_CHECK(obj) NULL; 1171 return (sd->items ? sd->items->data : NULL);
1277 Elm_Object_Item *ret = NULL;
1278 eo_do((Eo *) obj, elm_obj_menu_last_item_get(&ret));
1279 return ret;
1280} 1172}
1281 1173
1282static void 1174EOLIAN static Elm_Object_Item*
1283_last_item_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) 1175_elm_menu_last_item_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
1284{ 1176{
1285 Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
1286 Elm_Menu_Smart_Data *sd = _pd;
1287
1288 Eina_List *l = eina_list_last(sd->items); 1177 Eina_List *l = eina_list_last(sd->items);
1289 *ret = (l ? l->data : NULL); 1178 return (l ? l->data : NULL);
1290}
1291
1292EAPI Elm_Object_Item *
1293elm_menu_selected_item_get(const Evas_Object *obj)
1294{
1295 ELM_MENU_CHECK(obj) NULL;
1296 Elm_Object_Item *ret = NULL;
1297 eo_do((Eo *) obj, elm_obj_menu_selected_item_get(&ret));
1298 return ret;
1299} 1179}
1300 1180
1301static void 1181EOLIAN static Elm_Object_Item*
1302_selected_item_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) 1182_elm_menu_selected_item_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
1303{ 1183{
1304 Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
1305 *ret = NULL;
1306 Eina_List *l; 1184 Eina_List *l;
1307 Elm_Menu_Item *item; 1185 Elm_Menu_Item *item;
1308 1186
1309 Elm_Menu_Smart_Data *sd = _pd;
1310
1311 EINA_LIST_FOREACH(sd->items, l, item) 1187 EINA_LIST_FOREACH(sd->items, l, item)
1312 { 1188 {
1313 if (item->selected) 1189 if (item->selected) return (Elm_Object_Item *)item;
1314 {
1315 *ret = (Elm_Object_Item *)item;
1316 return;
1317 }
1318 } 1190 }
1191
1192 return NULL;
1319} 1193}
1320 1194
1321static void 1195static void
1322_class_constructor(Eo_Class *klass) 1196_elm_menu_class_constructor(Eo_Class *klass)
1323{ 1197{
1324 const Eo_Op_Func_Description func_desc[] = {
1325 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
1326
1327 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_menu_smart_add),
1328 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_menu_smart_del),
1329 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_SHOW), _elm_menu_smart_show),
1330
1331 EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_THEME_APPLY), _elm_menu_smart_theme),
1332 EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_TRANSLATE), _elm_menu_smart_translate),
1333 EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_PARENT_SET), _parent_set),
1334 EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_PARENT_GET), _parent_get),
1335
1336 EO_OP_FUNC(ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_MOVE), _move),
1337 EO_OP_FUNC(ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_CLOSE), _menu_close),
1338 EO_OP_FUNC(ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_ITEM_ADD), _item_add),
1339 EO_OP_FUNC(ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_ITEM_SEPARATOR_ADD), _item_separator_add),
1340 EO_OP_FUNC(ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_ITEMS_GET), _items_get),
1341 EO_OP_FUNC(ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_FIRST_ITEM_GET), _first_item_get),
1342 EO_OP_FUNC(ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_LAST_ITEM_GET), _last_item_get),
1343 EO_OP_FUNC(ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_SELECTED_ITEM_GET), _selected_item_get),
1344 EO_OP_FUNC_SENTINEL
1345 };
1346 eo_class_funcs_set(klass, func_desc);
1347
1348 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 1198 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
1349} 1199}
1350 1200
1351static const Eo_Op_Description op_desc[] = { 1201#include "elm_menu.eo.c"
1352 EO_OP_DESCRIPTION(ELM_OBJ_MENU_SUB_ID_MOVE, "Move the menu to a new position."),
1353 EO_OP_DESCRIPTION(ELM_OBJ_MENU_SUB_ID_CLOSE, "Close a opened menu."),
1354 EO_OP_DESCRIPTION(ELM_OBJ_MENU_SUB_ID_ITEM_ADD, "Add an item at the end of the given menu widget."),
1355 EO_OP_DESCRIPTION(ELM_OBJ_MENU_SUB_ID_ITEM_SEPARATOR_ADD, "Add a separator item to menu obj under parent."),
1356 EO_OP_DESCRIPTION(ELM_OBJ_MENU_SUB_ID_ITEMS_GET, "Returns a list of item's items."),
1357 EO_OP_DESCRIPTION(ELM_OBJ_MENU_SUB_ID_FIRST_ITEM_GET, "Get the first item in the menu."),
1358 EO_OP_DESCRIPTION(ELM_OBJ_MENU_SUB_ID_LAST_ITEM_GET, "Get the last item in the menu."),
1359 EO_OP_DESCRIPTION(ELM_OBJ_MENU_SUB_ID_SELECTED_ITEM_GET, "Get the selected item in the menu."),
1360 EO_OP_DESCRIPTION_SENTINEL
1361};
1362
1363static const Eo_Class_Description class_desc = {
1364 EO_VERSION,
1365 MY_CLASS_NAME,
1366 EO_CLASS_TYPE_REGULAR,
1367 EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_MENU_BASE_ID, op_desc, ELM_OBJ_MENU_SUB_ID_LAST),
1368 NULL,
1369 sizeof(Elm_Menu_Smart_Data),
1370 _class_constructor,
1371 NULL
1372};
1373EO_DEFINE_CLASS(elm_obj_menu_class_get, &class_desc, ELM_OBJ_WIDGET_CLASS, EVAS_SMART_CLICKABLE_INTERFACE, NULL);
diff --git a/src/lib/elm_menu.eo b/src/lib/elm_menu.eo
new file mode 100644
index 000000000..4dba00703
--- /dev/null
+++ b/src/lib/elm_menu.eo
@@ -0,0 +1,130 @@
1class Elm_Menu (Elm_Widget, Evas_Clickable_Interface)
2{
3 eo_prefix: elm_obj_menu;
4 properties {
5 selected_item {
6 get {
7 /*@
8 @brief Get the selected item in the menu
9
10 @return The selected item, or NULL if none
11
12 @see elm_menu_item_selected_get()
13 @see elm_menu_item_selected_set()
14
15 @ingroup Menu */
16 return Elm_Object_Item *;
17 }
18 }
19 items {
20 get {
21 /*@
22 @brief Returns a list of @p item's items.
23
24 @return An Eina_List* of @p item's items
25
26 @ingroup Menu */
27 return const Eina_List *;
28 }
29 }
30 first_item {
31 get {
32 /*@
33 @brief Get the first item in the menu
34
35 @return The first item, or NULL if none
36
37 @ingroup Menu */
38 return Elm_Object_Item *;
39 }
40 }
41 last_item {
42 get {
43 /*@
44 @brief Get the last item in the menu
45
46 @return The last item, or NULL if none
47
48 @ingroup Menu */
49 return Elm_Object_Item *;
50 }
51 }
52 }
53 methods {
54 move {
55 /*@
56 @brief Move the menu to a new position
57
58 Sets the top-left position of the menu to (@p x,@p y).
59
60 @note @p x and @p y coordinates are relative to parent.
61
62 @ingroup Menu */
63
64 params {
65 @in Evas_Coord x; /*@ The new position. */
66 @in Evas_Coord y; /*@ The new position. */
67 }
68 }
69 item_add {
70 /*@
71 @brief Add an item at the end of the given menu widget
72
73 @return Returns the new item.
74
75 @note This function does not accept relative icon path.
76
77 @ingroup Menu */
78
79 return Elm_Object_Item *;
80 params {
81 @in Elm_Object_Item *parent; /*@ The parent menu item (optional) */
82 @in const char *icon; /*@ An icon display on the item. The icon will be destroyed by the menu. */
83 @in const char *label; /*@ The label of the item. */
84 @in Evas_Smart_Cb func; /*@ Function called when the user select the item. */
85 @in const void *data; /*@ Data sent by the callback. */
86 }
87 }
88 close {
89 /*@
90 @brief Close a opened menu
91
92 @return void
93
94 Hides the menu and all it's sub-menus.
95
96 @ingroup Menu */
97
98 }
99 item_separator_add {
100 /*@
101 @brief Add a separator item to menu @p obj under @p parent.
102
103 @return The created item or NULL on failure
104
105 This is item is a @ref Separator.
106
107 @ingroup Menu */
108
109 return Elm_Object_Item *;
110 params {
111 @in Elm_Object_Item *parent; /*@ The item to add the separator under */
112 }
113 }
114 }
115 implements {
116 class::constructor;
117 Eo_Base::constructor;
118 Evas_Smart::show;
119 Evas_Smart::add;
120 Evas_Smart::del;
121 Elm_Widget::parent;
122 Elm_Widget::theme_apply;
123 Elm_Widget::translate;
124 }
125 events {
126 language,changed;
127 access,changed;
128 }
129
130}
diff --git a/src/lib/elm_menu_eo.h b/src/lib/elm_menu_eo.h
index e6c8a77e1..475c3dd67 100644
--- a/src/lib/elm_menu_eo.h
+++ b/src/lib/elm_menu_eo.h
@@ -1,3 +1,6 @@
1#include "elm_menu.eo.h"
2
3#if 0
1#define ELM_OBJ_MENU_CLASS elm_obj_menu_class_get() 4#define ELM_OBJ_MENU_CLASS elm_obj_menu_class_get()
2 5
3const Eo_Class *elm_obj_menu_class_get(void) EINA_CONST; 6const Eo_Class *elm_obj_menu_class_get(void) EINA_CONST;
@@ -137,3 +140,5 @@ enum
137 * @ingroup Menu 140 * @ingroup Menu
138 */ 141 */
139#define elm_obj_menu_selected_item_get(ret) ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_SELECTED_ITEM_GET), EO_TYPECHECK(Elm_Object_Item **, ret) 142#define elm_obj_menu_selected_item_get(ret) ELM_OBJ_MENU_ID(ELM_OBJ_MENU_SUB_ID_SELECTED_ITEM_GET), EO_TYPECHECK(Elm_Object_Item **, ret)
143#endif
144
diff --git a/src/lib/elm_widget_menu.h b/src/lib/elm_widget_menu.h
index 22cac8fc3..04fe2448b 100644
--- a/src/lib/elm_widget_menu.h
+++ b/src/lib/elm_widget_menu.h
@@ -17,8 +17,8 @@
17/** 17/**
18 * Base widget smart data extended with menu instance data. 18 * Base widget smart data extended with menu instance data.
19 */ 19 */
20typedef struct _Elm_Menu_Smart_Data Elm_Menu_Smart_Data; 20typedef struct _Elm_Menu_Data Elm_Menu_Data;
21struct _Elm_Menu_Smart_Data 21struct _Elm_Menu_Data
22{ 22{
23 Evas_Object *hv, *bx, *location, *parent; 23 Evas_Object *hv, *bx, *location, *parent;
24 24
@@ -60,7 +60,7 @@ struct _Elm_Menu_Item
60 */ 60 */
61 61
62#define ELM_MENU_DATA_GET(o, sd) \ 62#define ELM_MENU_DATA_GET(o, sd) \
63 Elm_Menu_Smart_Data * sd = eo_data_scope_get(o, ELM_OBJ_MENU_CLASS) 63 Elm_Menu_Data * sd = eo_data_scope_get(o, ELM_OBJ_MENU_CLASS)
64 64
65#define ELM_MENU_DATA_GET_OR_RETURN(o, ptr) \ 65#define ELM_MENU_DATA_GET_OR_RETURN(o, ptr) \
66 ELM_MENU_DATA_GET(o, ptr); \ 66 ELM_MENU_DATA_GET(o, ptr); \