summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-07-02 17:56:35 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-09-17 15:08:42 +0300
commit5a414f40619ca1fe663830dd72a4ca0457c7493a (patch)
treea719331a120b4687b729ed77b4bb2becc44635b2
parent7f8b8b5bb88c7af262d4a891aebd9b5feb9a0dab (diff)
Porting to Eo: Elm Ctxpopup item
-rw-r--r--src/lib/Makefile.am11
-rw-r--r--src/lib/elc_ctxpopup.c172
-rw-r--r--src/lib/elc_ctxpopup_common.h26
-rw-r--r--src/lib/elm_ctxpopup_item.eo59
-rw-r--r--src/lib/elm_widget_ctxpopup.h15
5 files changed, 159 insertions, 124 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 368a3ec60..39bacbe3f 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -859,7 +859,9 @@ BUILT_SOURCES = \
859 elm_flipselector_item.eo.c \ 859 elm_flipselector_item.eo.c \
860 elm_flipselector_item.eo.h \ 860 elm_flipselector_item.eo.h \
861 elm_menu_item.eo.c \ 861 elm_menu_item.eo.c \
862 elm_menu_item.eo.h 862 elm_menu_item.eo.h \
863 elm_ctxpopup_item.eo.c \
864 elm_ctxpopup_item.eo.h
863 865
864elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@ 866elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@
865elementaryeolianfiles_DATA = \ 867elementaryeolianfiles_DATA = \
@@ -961,7 +963,8 @@ elementaryeolianfiles_DATA = \
961 elm_segment_control_item.eo \ 963 elm_segment_control_item.eo \
962 elm_slideshow_item.eo \ 964 elm_slideshow_item.eo \
963 elm_flipselector_item.eo \ 965 elm_flipselector_item.eo \
964 elm_menu_item.eo 966 elm_menu_item.eo \
967 elm_ctxpopup_item.eo
965 968
966EXTRA_DIST += ${elementaryeolianfiles_DATA} 969EXTRA_DIST += ${elementaryeolianfiles_DATA}
967 970
@@ -1064,6 +1067,7 @@ nodist_includesunstable_HEADERS = \
1064 elm_segment_control_item.eo.h \ 1067 elm_segment_control_item.eo.h \
1065 elm_flipselector_item.eo.h \ 1068 elm_flipselector_item.eo.h \
1066 elm_menu_item.eo.h \ 1069 elm_menu_item.eo.h \
1070 elm_ctxpopup_item.eo.h \
1067 elm_slideshow_item.eo.h \ 1071 elm_slideshow_item.eo.h \
1068 elm_layout.eo.legacy.h \ 1072 elm_layout.eo.legacy.h \
1069 elm_frame.eo.legacy.h \ 1073 elm_frame.eo.legacy.h \
@@ -1135,7 +1139,8 @@ nodist_includesunstable_HEADERS = \
1135 elm_segment_control_item.eo.legacy.h \ 1139 elm_segment_control_item.eo.legacy.h \
1136 elm_slideshow_item.eo.legacy.h \ 1140 elm_slideshow_item.eo.legacy.h \
1137 elm_flipselector_item.eo.legacy.h \ 1141 elm_flipselector_item.eo.legacy.h \
1138 elm_menu_item.eo.legacy.h 1142 elm_menu_item.eo.legacy.h \
1143 elm_ctxpopup_item.eo.legacy.h
1139 1144
1140if HAVE_CXX11 1145if HAVE_CXX11
1141 1146
diff --git a/src/lib/elc_ctxpopup.c b/src/lib/elc_ctxpopup.c
index 0974e4bfe..90881ee2c 100644
--- a/src/lib/elc_ctxpopup.c
+++ b/src/lib/elc_ctxpopup.c
@@ -2,6 +2,7 @@
2# include "elementary_config.h" 2# include "elementary_config.h"
3#endif 3#endif
4 4
5#define ELM_WIDGET_ITEM_PROTECTED
5#include <Elementary.h> 6#include <Elementary.h>
6 7
7#include "elm_priv.h" 8#include "elm_priv.h"
@@ -39,10 +40,6 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
39 40
40static Eina_Bool _key_action_move(Evas_Object *obj, const char *params); 41static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
41static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params); 42static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
42static Elm_Ctxpopup_Item* _item_new(Eo *obj,
43 Elm_Ctxpopup_Data *sd,
44 Evas_Smart_Cb func,
45 const void *data);
46 43
47static const Elm_Action key_actions[] = { 44static const Elm_Action key_actions[] = {
48 {"move", _key_action_move}, 45 {"move", _key_action_move},
@@ -54,12 +51,12 @@ EOLIAN static Eina_Bool
54_elm_ctxpopup_elm_widget_translate(Eo *obj, Elm_Ctxpopup_Data *sd) 51_elm_ctxpopup_elm_widget_translate(Eo *obj, Elm_Ctxpopup_Data *sd)
55{ 52{
56 Eina_List *l; 53 Eina_List *l;
57 Elm_Ctxpopup_Item *it; 54 Elm_Object_Item *it;
58 55
59 if (sd->auto_hide) evas_object_hide(obj); 56 if (sd->auto_hide) evas_object_hide(obj);
60 57
61 EINA_LIST_FOREACH(sd->items, l, it) 58 EINA_LIST_FOREACH(sd->items, l, it)
62 elm_widget_item_translate(it); 59 eo_do((Eo *)it, elm_wdg_item_translate());
63 60
64 eo_do_super(obj, MY_CLASS, elm_obj_widget_translate()); 61 eo_do_super(obj, MY_CLASS, elm_obj_widget_translate());
65 62
@@ -854,17 +851,14 @@ _elm_ctxpopup_elm_container_content_unset(Eo *obj, Elm_Ctxpopup_Data *sd, const
854 return content; 851 return content;
855} 852}
856 853
857static void 854EOLIAN static void
858_item_text_set_hook(Elm_Object_Item *it, 855_elm_ctxpopup_item_elm_widget_item_part_text_set(Eo *eo_ctxpopup_it EINA_UNUSED,
859 const char *part, 856 Elm_Ctxpopup_Item_Data *ctxpopup_it,
860 const char *label) 857 const char *part,
858 const char *label)
861{ 859{
862 Elm_Ctxpopup_Item *ctxpopup_it;
863
864 if ((part) && (strcmp(part, "default"))) return; 860 if ((part) && (strcmp(part, "default"))) return;
865 861
866 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
867
868 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd); 862 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
869 863
870 elm_object_item_part_text_set(ctxpopup_it->list_item, "default", label); 864 elm_object_item_part_text_set(ctxpopup_it->list_item, "default", label);
@@ -873,31 +867,26 @@ _item_text_set_hook(Elm_Object_Item *it,
873 if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it)); 867 if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
874} 868}
875 869
876static const char * 870EOLIAN static const char *
877_item_text_get_hook(const Elm_Object_Item *it, 871_elm_ctxpopup_item_elm_widget_item_part_text_get(Eo *eo_ctxpopup_it EINA_UNUSED,
878 const char *part) 872 Elm_Ctxpopup_Item_Data *ctxpopup_it,
873 const char *part)
879{ 874{
880 Elm_Ctxpopup_Item *ctxpopup_it;
881
882 if (part && strcmp(part, "default")) return NULL; 875 if (part && strcmp(part, "default")) return NULL;
883 876
884 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
885 return elm_object_item_part_text_get(ctxpopup_it->list_item, "default"); 877 return elm_object_item_part_text_get(ctxpopup_it->list_item, "default");
886} 878}
887 879
888static void 880EOLIAN static void
889_item_content_set_hook(Elm_Object_Item *it, 881_elm_ctxpopup_item_elm_widget_item_part_content_set(Eo *eo_ctxpopup_it EINA_UNUSED,
890 const char *part, 882 Elm_Ctxpopup_Item_Data *ctxpopup_it,
891 Evas_Object *content) 883 const char *part,
884 Evas_Object *content)
892{ 885{
893 Elm_Ctxpopup_Item *ctxpopup_it;
894
895 if ((part) && (strcmp(part, "icon")) 886 if ((part) && (strcmp(part, "icon"))
896 && (strcmp(part, "start")) 887 && (strcmp(part, "start"))
897 && (strcmp(part, "end"))) return; 888 && (strcmp(part, "end"))) return;
898 889
899 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
900
901 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd); 890 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
902 891
903 if ((part) && (!strcmp(part, "end"))) 892 if ((part) && (!strcmp(part, "end")))
@@ -911,39 +900,35 @@ _item_content_set_hook(Elm_Object_Item *it,
911 if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it)); 900 if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
912} 901}
913 902
914static Evas_Object * 903EOLIAN static Evas_Object *
915_item_content_get_hook(const Elm_Object_Item *it, 904_elm_ctxpopup_item_elm_widget_item_part_content_get(Eo *eo_ctxpopup_it EINA_UNUSED,
916 const char *part) 905 Elm_Ctxpopup_Item_Data *ctxpopup_it,
906 const char *part)
917{ 907{
918 Elm_Ctxpopup_Item *ctxpopup_it;
919
920 if (part && strcmp(part, "icon") && strcmp(part, "start") 908 if (part && strcmp(part, "icon") && strcmp(part, "start")
921 && strcmp(part, "end")) return NULL; 909 && strcmp(part, "end")) return NULL;
922 910
923 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
924
925 if (part && !strcmp(part, "end")) 911 if (part && !strcmp(part, "end"))
926 return elm_object_item_part_content_get(ctxpopup_it->list_item, "end"); 912 return elm_object_item_part_content_get(ctxpopup_it->list_item, "end");
927 else 913 else
928 return elm_object_item_part_content_get(ctxpopup_it->list_item, "start"); 914 return elm_object_item_part_content_get(ctxpopup_it->list_item, "start");
929} 915}
930 916
931static void 917EOLIAN static void
932_item_disable_hook(Elm_Object_Item *it) 918_elm_ctxpopup_item_elm_widget_item_disable(Eo *eo_ctxpopup_it,
919 Elm_Ctxpopup_Item_Data *ctxpopup_it)
933{ 920{
934 Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
935 921
936 elm_object_item_disabled_set 922 elm_object_item_disabled_set
937 (ctxpopup_it->list_item, elm_widget_item_disabled_get(ctxpopup_it)); 923 (ctxpopup_it->list_item, eo_do(eo_ctxpopup_it, elm_wdg_item_disabled_get()));
938} 924}
939 925
940static void 926EOLIAN static void
941_item_signal_emit_hook(Elm_Object_Item *it, 927_elm_ctxpopup_item_elm_widget_item_signal_emit(Eo *eo_ctxpopup_it EINA_UNUSED,
942 const char *emission, 928 Elm_Ctxpopup_Item_Data *ctxpopup_it,
943 const char *source) 929 const char *emission,
930 const char *source)
944{ 931{
945 Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
946
947 elm_object_item_signal_emit(ctxpopup_it->list_item, emission, source); 932 elm_object_item_signal_emit(ctxpopup_it->list_item, emission, source);
948} 933}
949 934
@@ -1050,11 +1035,11 @@ _list_del(Elm_Ctxpopup_Data *sd)
1050 ELM_SAFE_FREE(sd->list, evas_object_del); 1035 ELM_SAFE_FREE(sd->list, evas_object_del);
1051} 1036}
1052 1037
1053static Eina_Bool 1038EOLIAN static Eina_Bool
1054_item_del_pre_hook(Elm_Object_Item *it) 1039_elm_ctxpopup_item_elm_widget_item_del_pre(Eo *eo_ctxpopup_it,
1040 Elm_Ctxpopup_Item_Data *ctxpopup_it)
1055{ 1041{
1056 Evas_Object *list; 1042 Evas_Object *list;
1057 Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
1058 1043
1059 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd); 1044 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
1060 1045
@@ -1065,16 +1050,16 @@ _item_del_pre_hook(Elm_Object_Item *it)
1065 if (eina_list_count(elm_list_items_get(list)) < 2) 1050 if (eina_list_count(elm_list_items_get(list)) < 2)
1066 { 1051 {
1067 if (ctxpopup_it->list_item) 1052 if (ctxpopup_it->list_item)
1068 elm_widget_item_del(ctxpopup_it->list_item); 1053 elm_object_item_del(ctxpopup_it->list_item);
1069 sd->items = eina_list_remove(sd->items, ctxpopup_it); 1054 sd->items = eina_list_remove(sd->items, eo_ctxpopup_it);
1070 evas_object_hide(WIDGET(ctxpopup_it)); 1055 evas_object_hide(WIDGET(ctxpopup_it));
1071 1056
1072 return EINA_TRUE; 1057 return EINA_TRUE;
1073 } 1058 }
1074 1059
1075 if (ctxpopup_it->list_item) 1060 if (ctxpopup_it->list_item)
1076 elm_widget_item_del(ctxpopup_it->list_item); 1061 elm_object_item_del(ctxpopup_it->list_item);
1077 sd->items = eina_list_remove(sd->items, ctxpopup_it); 1062 sd->items = eina_list_remove(sd->items, eo_ctxpopup_it);
1078 if (sd->list_visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it)); 1063 if (sd->list_visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
1079 1064
1080 return EINA_TRUE; 1065 return EINA_TRUE;
@@ -1151,7 +1136,7 @@ _elm_ctxpopup_evas_object_smart_add(Eo *obj, Elm_Ctxpopup_Data *priv)
1151EOLIAN static void 1136EOLIAN static void
1152_elm_ctxpopup_evas_object_smart_del(Eo *obj, Elm_Ctxpopup_Data *sd) 1137_elm_ctxpopup_evas_object_smart_del(Eo *obj, Elm_Ctxpopup_Data *sd)
1153{ 1138{
1154 Elm_Ctxpopup_Item *it; 1139 Elm_Object_Item *it;
1155 1140
1156 evas_object_event_callback_del_full 1141 evas_object_event_callback_del_full
1157 (sd->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj); 1142 (sd->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj);
@@ -1162,7 +1147,7 @@ _elm_ctxpopup_evas_object_smart_del(Eo *obj, Elm_Ctxpopup_Data *sd)
1162 ELM_SAFE_FREE(sd->bg, evas_object_del); 1147 ELM_SAFE_FREE(sd->bg, evas_object_del);
1163 1148
1164 EINA_LIST_FREE(sd->items, it) 1149 EINA_LIST_FREE(sd->items, it)
1165 elm_widget_item_free(it); 1150 eo_del((Eo *)it);
1166 1151
1167 eo_do_super(obj, MY_CLASS, evas_obj_smart_del()); 1152 eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
1168} 1153}
@@ -1263,26 +1248,35 @@ _elm_ctxpopup_horizontal_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
1263static void 1248static void
1264_item_wrap_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 1249_item_wrap_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1265{ 1250{
1266 Elm_Ctxpopup_Item *item = data; 1251 Elm_Ctxpopup_Item_Data *item = data;
1267 if (!item->wcb.org_func_cb) return; 1252 if (!item->wcb.org_func_cb) return;
1268 item->wcb.org_func_cb((void *)item->wcb.org_data, item->wcb.cobj, item); 1253 item->wcb.org_func_cb((void *)item->wcb.org_data, item->wcb.cobj, EO_OBJ(item));
1254}
1255
1256EOLIAN static void
1257_elm_ctxpopup_item_eo_base_constructor(Eo *obj, Elm_Ctxpopup_Item_Data *it)
1258{
1259 eo_do_super(obj, ELM_CTXPOPUP_ITEM_CLASS, eo_constructor());
1260 it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
1269} 1261}
1270 1262
1271EOLIAN static Elm_Object_Item* 1263EOLIAN static Elm_Object_Item*
1272_elm_ctxpopup_item_append(Eo *obj, Elm_Ctxpopup_Data *sd, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) 1264_elm_ctxpopup_item_append(Eo *obj, Elm_Ctxpopup_Data *sd, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data)
1273{ 1265{
1274 Elm_Ctxpopup_Item *item; 1266 Eo *eo_item;
1267
1268 eo_item = eo_add(ELM_CTXPOPUP_ITEM_CLASS, obj, elm_obj_ctxpopup_item_init(func, data));
1269 if (!eo_item) return NULL;
1275 1270
1276 item = _item_new(obj, sd, func, data); 1271 ELM_CTXPOPUP_ITEM_DATA_GET(eo_item, item);
1277 if (!item) return NULL;
1278 1272
1279 item->list_item = 1273 item->list_item =
1280 elm_list_item_append(sd->list, label, icon, NULL, _item_wrap_cb, item); 1274 elm_list_item_append(sd->list, label, icon, NULL, _item_wrap_cb, item);
1281 sd->items = eina_list_append(sd->items, item); 1275 sd->items = eina_list_append(sd->items, eo_item);
1282 1276
1283 if (sd->visible) elm_layout_sizing_eval(obj); 1277 if (sd->visible) elm_layout_sizing_eval(obj);
1284 1278
1285 return (Elm_Object_Item *)item; 1279 return (Elm_Object_Item *)eo_item;
1286} 1280}
1287 1281
1288EOLIAN static void 1282EOLIAN static void
@@ -1362,32 +1356,38 @@ _elm_ctxpopup_last_item_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
1362EOLIAN static Elm_Object_Item* 1356EOLIAN static Elm_Object_Item*
1363_elm_ctxpopup_item_prepend(Eo *obj, Elm_Ctxpopup_Data *sd, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) 1357_elm_ctxpopup_item_prepend(Eo *obj, Elm_Ctxpopup_Data *sd, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data)
1364{ 1358{
1365 Elm_Ctxpopup_Item *item; 1359 Eo *eo_item;
1366 1360
1367 item = _item_new(obj, sd, func, data); 1361 eo_item = eo_add(ELM_CTXPOPUP_ITEM_CLASS, obj, elm_obj_ctxpopup_item_init(func, data));
1368 if (!item) return NULL; 1362 if (!eo_item) return NULL;
1363
1364 ELM_CTXPOPUP_ITEM_DATA_GET(eo_item, item);
1369 1365
1370 item->list_item = 1366 item->list_item =
1371 elm_list_item_prepend(sd->list, label, icon, NULL, _item_wrap_cb, item); 1367 elm_list_item_prepend(sd->list, label, icon, NULL, _item_wrap_cb, item);
1372 sd->items = eina_list_prepend(sd->items, item); 1368 sd->items = eina_list_prepend(sd->items, eo_item);
1373 1369
1374 if (sd->visible) elm_layout_sizing_eval(obj); 1370 if (sd->visible) elm_layout_sizing_eval(obj);
1375 1371
1376 return (Elm_Object_Item *)item; 1372 return (Elm_Object_Item *)eo_item;
1377} 1373}
1378 1374
1379EAPI Elm_Object_Item * 1375EAPI Elm_Object_Item *
1380elm_ctxpopup_item_prev_get(const Elm_Object_Item *it) 1376elm_ctxpopup_item_prev_get(const Elm_Object_Item *it)
1381{ 1377{
1378 return eo_do((Eo *)it, elm_obj_ctxpopup_item_prev_get());
1379}
1380
1381EOLIAN static Elm_Object_Item *
1382_elm_ctxpopup_item_prev_get(Eo *eo_item EINA_UNUSED, Elm_Ctxpopup_Item_Data *item)
1383{
1382 Eina_List *l; 1384 Eina_List *l;
1383 Elm_Ctxpopup_Item *item = (Elm_Ctxpopup_Item *)it;
1384 1385
1385 ELM_CTXPOPUP_ITEM_CHECK_OR_RETURN(it, NULL);
1386 ELM_CTXPOPUP_DATA_GET(WIDGET(item), sd); 1386 ELM_CTXPOPUP_DATA_GET(WIDGET(item), sd);
1387 1387
1388 if (!sd->items) return NULL; 1388 if (!sd->items) return NULL;
1389 1389
1390 l = eina_list_data_find_list(sd->items, it); 1390 l = eina_list_data_find_list(sd->items, eo_item);
1391 if (l && l->prev) return eina_list_data_get(l->prev); 1391 if (l && l->prev) return eina_list_data_get(l->prev);
1392 1392
1393 return NULL; 1393 return NULL;
@@ -1396,39 +1396,32 @@ elm_ctxpopup_item_prev_get(const Elm_Object_Item *it)
1396EAPI Elm_Object_Item * 1396EAPI Elm_Object_Item *
1397elm_ctxpopup_item_next_get(const Elm_Object_Item *it) 1397elm_ctxpopup_item_next_get(const Elm_Object_Item *it)
1398{ 1398{
1399 return eo_do((Eo *)it, elm_obj_ctxpopup_item_next_get());
1400}
1401
1402EOLIAN static Elm_Object_Item *
1403_elm_ctxpopup_item_next_get(Eo *eo_item EINA_UNUSED, Elm_Ctxpopup_Item_Data *item)
1404{
1399 Eina_List *l; 1405 Eina_List *l;
1400 Elm_Ctxpopup_Item *item = (Elm_Ctxpopup_Item *)it;
1401 1406
1402 ELM_CTXPOPUP_ITEM_CHECK_OR_RETURN(it, NULL);
1403 ELM_CTXPOPUP_DATA_GET(WIDGET(item), sd); 1407 ELM_CTXPOPUP_DATA_GET(WIDGET(item), sd);
1404 1408
1405 if (!sd->items) return NULL; 1409 if (!sd->items) return NULL;
1406 1410
1407 l = eina_list_data_find_list(sd->items, it); 1411 l = eina_list_data_find_list(sd->items, eo_item);
1408 if (l && l->next) return eina_list_data_get(l->next); 1412 if (l && l->next) return eina_list_data_get(l->next);
1409 1413
1410 return NULL; 1414 return NULL;
1411} 1415}
1412 1416
1413static Elm_Ctxpopup_Item* 1417EOLIAN static void
1414_item_new(Eo *obj, 1418_elm_ctxpopup_item_init(Eo *eo_item,
1415 Elm_Ctxpopup_Data *sd, 1419 Elm_Ctxpopup_Item_Data *item,
1416 Evas_Smart_Cb func, 1420 Evas_Smart_Cb func,
1417 const void *data) 1421 const void *data)
1418{ 1422{
1419 Elm_Ctxpopup_Item *item; 1423 Eo *obj = eo_do(eo_item, eo_parent_get());
1420 1424 Elm_Ctxpopup_Data *sd = eo_data_scope_get(obj, ELM_CTXPOPUP_CLASS);
1421 item = elm_widget_item_new(obj, Elm_Ctxpopup_Item);
1422 if (!item) return NULL;
1423
1424 elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
1425 elm_widget_item_disable_hook_set(item, _item_disable_hook);
1426 elm_widget_item_text_set_hook_set(item, _item_text_set_hook);
1427 elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
1428 elm_widget_item_content_set_hook_set(item, _item_content_set_hook);
1429 elm_widget_item_content_get_hook_set(item, _item_content_get_hook);
1430 elm_widget_item_signal_emit_hook_set(item, _item_signal_emit_hook);
1431
1432 if (!sd->list) 1425 if (!sd->list)
1433 { 1426 {
1434 sd->list = elm_list_add(obj); 1427 sd->list = elm_list_add(obj);
@@ -1447,8 +1440,6 @@ _item_new(Eo *obj,
1447 item->wcb.cobj = obj; 1440 item->wcb.cobj = obj;
1448 1441
1449 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; 1442 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1450
1451 return item;
1452} 1443}
1453 1444
1454EOLIAN static const Elm_Atspi_Action* 1445EOLIAN static const Elm_Atspi_Action*
@@ -1466,4 +1457,5 @@ _elm_ctxpopup_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNU
1466 return &atspi_actions[0]; 1457 return &atspi_actions[0];
1467} 1458}
1468 1459
1460#include "elm_ctxpopup_item.eo.c"
1469#include "elm_ctxpopup.eo.c" 1461#include "elm_ctxpopup.eo.c"
diff --git a/src/lib/elc_ctxpopup_common.h b/src/lib/elc_ctxpopup_common.h
index 9f658e07a..df72a93b2 100644
--- a/src/lib/elc_ctxpopup_common.h
+++ b/src/lib/elc_ctxpopup_common.h
@@ -7,33 +7,7 @@ typedef enum
7 ELM_CTXPOPUP_DIRECTION_UNKNOWN, /**< ctxpopup does not determine it's direction yet*/ 7 ELM_CTXPOPUP_DIRECTION_UNKNOWN, /**< ctxpopup does not determine it's direction yet*/
8} Elm_Ctxpopup_Direction; /**< Direction in which to show the popup */ 8} Elm_Ctxpopup_Direction; /**< Direction in which to show the popup */
9 9
10/**
11 * Get the item before @p it in a ctxpopup widget's internal list of
12 * items.
13 *
14 * @param it The item to fetch previous from
15 * @return The item before the @p it in its parent's list. If there is no
16 * previous item for @p it or there's an error, @c NULL is returned.
17 *
18 * @see elm_ctxpopup_item_next_get()
19 *
20 * @since 1.11
21 * @ingroup Ctxpopup
22 */
23EAPI Elm_Object_Item *elm_ctxpopup_item_prev_get(const Elm_Object_Item *it); 10EAPI Elm_Object_Item *elm_ctxpopup_item_prev_get(const Elm_Object_Item *it);
24 11
25/**
26 * Get the item after @p it in a ctxpopup widget's
27 * internal list of items.
28 *
29 * @param it The item to fetch next from
30 * @return The item after the @p it in its parent's list. If there is no next
31 * item for @p it or there's an error, @c NULL is returned.
32 *
33 * @see elm_ctxpopup_item_prev_get()
34 *
35 * @since 1.11
36 * @ingroup Ctxpopup
37 */
38EAPI Elm_Object_Item *elm_ctxpopup_item_next_get(const Elm_Object_Item *it); 12EAPI Elm_Object_Item *elm_ctxpopup_item_next_get(const Elm_Object_Item *it);
39 13
diff --git a/src/lib/elm_ctxpopup_item.eo b/src/lib/elm_ctxpopup_item.eo
new file mode 100644
index 000000000..d51526402
--- /dev/null
+++ b/src/lib/elm_ctxpopup_item.eo
@@ -0,0 +1,59 @@
1class Elm_Ctxpopup_Item(Elm_Widget_Item)
2{
3 legacy_prefix: null;
4 eo_prefix: elm_obj_ctxpopup_item;
5 properties {
6 prev {
7 get {
8 /*@
9 Get the item before @p it in a ctxpopup widget's internal list of
10 items.
11
12 @see elm_ctxpopup_item_next_get()
13
14 @since 1.11
15 @ingroup Ctxpopup
16 */
17 }
18 values {
19 Elm_Object_Item *item; /*@ The item before the object in its parent's list. If there is no
20 previous item for @p it or there's an error, @c NULL is returned. */
21 }
22 }
23 next {
24 get {
25 /*@
26 Get the item after @p it in a ctxpopup widget's
27 internal list of items.
28
29 @see elm_ctxpopup_item_prev_get()
30
31 @since 1.11
32 @ingroup Ctxpopup
33 */
34 }
35 values {
36 Elm_Object_Item *item; /*@ The item after the object in its parent's list. If there is no
37 previous item for @p it or there's an error, @c NULL is returned. */
38 }
39 }
40 }
41 methods {
42 init {
43 params {
44 Evas_Smart_Cb func;
45 const(void) * data;
46 }
47 }
48 }
49 implements {
50 Eo.Base.constructor;
51 Elm_Widget_Item.del_pre;
52 Elm_Widget_Item.disable;
53 Elm_Widget_Item.signal_emit;
54 Elm_Widget_Item.part_text.get;
55 Elm_Widget_Item.part_text.set;
56 Elm_Widget_Item.part_content.get;
57 Elm_Widget_Item.part_content.set;
58 }
59}
diff --git a/src/lib/elm_widget_ctxpopup.h b/src/lib/elm_widget_ctxpopup.h
index cde2f1b90..608707bd0 100644
--- a/src/lib/elm_widget_ctxpopup.h
+++ b/src/lib/elm_widget_ctxpopup.h
@@ -2,6 +2,7 @@
2#define ELM_WIDGET_CTXPOPUP_H 2#define ELM_WIDGET_CTXPOPUP_H
3 3
4#include "elm_widget_layout.h" 4#include "elm_widget_layout.h"
5#include "elm_ctxpopup_item.eo.h"
5 6
6/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR 7/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
7 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT 8 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
@@ -9,6 +10,7 @@
9 * IT AT RUNTIME. 10 * IT AT RUNTIME.
10 */ 11 */
11 12
13#include "elm_object_item_migration_temp.h"
12/** 14/**
13 * @addtogroup Widget 15 * @addtogroup Widget
14 * @{ 16 * @{
@@ -20,15 +22,15 @@
20 * widgets which are a ctxpopup with some more logic on top. 22 * widgets which are a ctxpopup with some more logic on top.
21 */ 23 */
22 24
23typedef struct _Elm_Ctxpopup_Item Elm_Ctxpopup_Item; 25typedef struct _Elm_Ctxpopup_Item_Data Elm_Ctxpopup_Item_Data;
24 26
25/** 27/**
26 * Base widget smart data extended with ctxpopup instance data. 28 * Base widget smart data extended with ctxpopup instance data.
27 */ 29 */
28typedef struct _Elm_Ctxpopup_Data Elm_Ctxpopup_Data; 30typedef struct _Elm_Ctxpopup_Data Elm_Ctxpopup_Data;
29struct _Elm_Ctxpopup_Item 31struct _Elm_Ctxpopup_Item_Data
30{ 32{
31 ELM_WIDGET_ITEM; 33 Elm_Widget_Item_Data *base;
32 34
33 Elm_Object_Item *list_item; 35 Elm_Object_Item *list_item;
34 36
@@ -92,7 +94,10 @@ struct _Elm_Ctxpopup_Data
92 return 94 return
93 95
94#define ELM_CTXPOPUP_ITEM_CHECK_OR_RETURN(it, ...) \ 96#define ELM_CTXPOPUP_ITEM_CHECK_OR_RETURN(it, ...) \
95 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item_Data *)it, __VA_ARGS__); \ 97 ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, __VA_ARGS__); \
96 ELM_CTXPOPUP_CHECK(it->base.widget) __VA_ARGS__; 98 ELM_CTXPOPUP_CHECK(it->base->widget) __VA_ARGS__;
99
100#define ELM_CTXPOPUP_ITEM_DATA_GET(o, sd) \
101 Elm_Ctxpopup_Item_Data *sd = eo_data_scope_get((Eo *)o, ELM_CTXPOPUP_ITEM_CLASS)
97 102
98#endif 103#endif