summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2016-03-03 14:39:19 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2016-03-03 14:39:19 +0200
commiteb79247c3f763a8aa7bbb7a6ef6345ffeb4aa787 (patch)
tree839a7991d1b2144307c29e59625d1b7d3dcb3054
parent790f8797ba93d2fd917adce0f3d13ea1d4d50e8f (diff)
Support menu item
-rw-r--r--src/lib/steal_preload.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/steal_preload.c b/src/lib/steal_preload.c
index a0c088c..7216b55 100644
--- a/src/lib/steal_preload.c
+++ b/src/lib/steal_preload.c
@@ -724,6 +724,44 @@ EOAPI Elm_Widget_Item * elm_obj_hoversel_item_add(const char * label, const char
724 return it; 724 return it;
725} 725}
726 726
727EOAPI Elm_Widget_Item * elm_obj_menu_item_add(Elm_Widget_Item * parent, const char * icon, const char * label, Evas_Smart_Cb func, const void * data)
728{
729 static Elm_Widget_Item * (*foo)(Elm_Widget_Item *, const char *, const char *, Evas_Smart_Cb, const void *) = NULL;
730 static const Eolian_Class *kl = NULL;
731 if (!kl) kl = eolian_class_get_by_name("Elm.Menu");
732 if (!foo) foo = dlsym(RTLD_NEXT, __func__);
733 _intercept_ref();
734 Elm_Object_Item *it = foo(parent, icon, label, func, data);
735 _intercept_unref();
736 if (_intercept_counter_get() == 1) /* eo_do ref */
737 {
738 const Eolian_Class *it_kl = _class_find_by_name("Elm.Menu_Item");
739 const Eolian_Function *eo_func = FIND_EOLIAN_FUNC("Elm.Menu", "item_add");
740 char *obj_name = _free_name_get("Elm_Menu_Item");
741 Ea *ea_func = ea_function_new(_ea_session, eo_func), *ea_item;
742 Ea *obj_trigger = ea_object_trigger_callback_get(_current_ea_obj);
743 if (_caught_callback == obj_trigger)
744 {
745 Ea *cont = ea_object_container_get(_current_ea_obj);
746 ea_item = ea_object_new(_ea_session, it_kl, _current_ea_obj, obj_name);
747 ea_container_object_attach(cont, ea_item, ea_func);
748 }
749 else
750 {
751 /* We are in a callback but not into the one the parent was created.
752 * We create an orphan whose parent is only known by the callback.
753 * This is done to be sure to separate creations of the object and
754 * its parent. */
755 ea_item = ea_object_new(_ea_session, it_kl, NULL, obj_name);
756 ea_callback_object_create(_caught_callback, ea_item, _current_ea_obj);
757 }
758 eo_do(it, eo_key_data_set("__espion_data", ea_item));
759 _params_register(ea_func, parent, icon, label, NULL, NULL);
760 ea_item_create_function_set(ea_item, ea_func);
761 }
762 return it;
763}
764
727#define ESPION_ELM_OBJ_NAVIFRAME_ITEM_PUSH 765#define ESPION_ELM_OBJ_NAVIFRAME_ITEM_PUSH
728#define ESPION_ELM_OBJ_TOOLBAR_ITEM_APPEND 766#define ESPION_ELM_OBJ_TOOLBAR_ITEM_APPEND
729#define ESPION_ELM_OBJ_HOVERSEL_ITEM_ADD 767#define ESPION_ELM_OBJ_HOVERSEL_ITEM_ADD