summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshilpa.singh <shilpa.singh@samsung.com>2015-06-03 10:41:13 +0100
committerTom Hacohen <tom@stosb.com>2015-06-03 10:41:13 +0100
commit46a33339c3c626253e5c1abccd5b7259b98c61fb (patch)
tree24101abd65c56dc24f0a9113483f704845bae2ac
parent06e10f97b19b5a316697463e2f78d53a3516d70f (diff)
downloadelementary-46a33339c3c626253e5c1abccd5b7259b98c61fb.tar.gz
Elm: Add context,open signal in elm_entry.
Summary: When context,open signal is sent from elm_entry before showing context menu, dynamic addition of context menu items to entry becomes easier. @feature Test Plan: Run elementary_test Launch Entry Scrolled test Right Click on Multiline Markup entry Reviewers: tasn Reviewed By: tasn Subscribers: subodh6129, poornima.srinivasan Differential Revision: https://phab.enlightenment.org/D2580
-rw-r--r--src/bin/test_entry.c11
-rw-r--r--src/lib/elm_entry.c3
-rw-r--r--src/lib/elm_entry.eo1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/bin/test_entry.c b/src/bin/test_entry.c
index 07550f4c1..6abf1eca7 100644
--- a/src/bin/test_entry.c
+++ b/src/bin/test_entry.c
@@ -301,6 +301,16 @@ _end_hide_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNU
elm_entry_end_visible_set(en, EINA_FALSE);
}
+static Eina_Bool
+_context_menu_show_cb(void *data EINA_UNUSED, Eo *obj,
+ const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ elm_entry_context_menu_clear(obj);
+ elm_entry_context_menu_item_add(obj, "MenuD1", NULL, ELM_ICON_NONE, _item_cb, NULL);
+ elm_entry_context_menu_item_add(obj, "MenuD2", NULL, ELM_ICON_NONE, _item_cb, NULL);
+ return EO_CALLBACK_CONTINUE;
+}
+
void
test_entry_scrolled(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@@ -533,6 +543,7 @@ test_entry_scrolled(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en);
evas_object_show(en);
elm_box_pack_end(bx, en);
+ eo_do(en, eo_event_callback_add(ELM_ENTRY_EVENT_CONTEXT_OPEN, _context_menu_show_cb, NULL));
bx2 = elm_box_add(win);
elm_box_horizontal_set(bx2, EINA_TRUE);
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 5ab7fd1c7..c20582e69 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -1454,6 +1454,9 @@ _menu_call(Evas_Object *obj)
ELM_ENTRY_DATA_GET(obj, sd);
if (sd->anchor_hover.hover) return;
+
+ eo_do(obj, eo_event_callback_call(ELM_ENTRY_EVENT_CONTEXT_OPEN, NULL));
+
if ((sd->api) && (sd->api->obj_longpress))
{
sd->api->obj_longpress(obj);
diff --git a/src/lib/elm_entry.eo b/src/lib/elm_entry.eo
index 4c63d9f59..c60e84850 100644
--- a/src/lib/elm_entry.eo
+++ b/src/lib/elm_entry.eo
@@ -1232,6 +1232,7 @@ class Elm.Entry (Elm.Layout, Elm_Interface_Scrollable, Evas.Clickable_Interface,
changed;
changed,user;
validate;
+ context,open;
}
}