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)
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
301 elm_entry_end_visible_set(en, EINA_FALSE); 301 elm_entry_end_visible_set(en, EINA_FALSE);
302} 302}
303 303
304static Eina_Bool
305_context_menu_show_cb(void *data EINA_UNUSED, Eo *obj,
306 const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
307{
308 elm_entry_context_menu_clear(obj);
309 elm_entry_context_menu_item_add(obj, "MenuD1", NULL, ELM_ICON_NONE, _item_cb, NULL);
310 elm_entry_context_menu_item_add(obj, "MenuD2", NULL, ELM_ICON_NONE, _item_cb, NULL);
311 return EO_CALLBACK_CONTINUE;
312}
313
304void 314void
305test_entry_scrolled(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 315test_entry_scrolled(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
306{ 316{
@@ -533,6 +543,7 @@ test_entry_scrolled(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
533 evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en); 543 evas_object_smart_callback_add(en, "anchor,clicked", scrolled_anchor_test, en);
534 evas_object_show(en); 544 evas_object_show(en);
535 elm_box_pack_end(bx, en); 545 elm_box_pack_end(bx, en);
546 eo_do(en, eo_event_callback_add(ELM_ENTRY_EVENT_CONTEXT_OPEN, _context_menu_show_cb, NULL));
536 547
537 bx2 = elm_box_add(win); 548 bx2 = elm_box_add(win);
538 elm_box_horizontal_set(bx2, EINA_TRUE); 549 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)
1454 ELM_ENTRY_DATA_GET(obj, sd); 1454 ELM_ENTRY_DATA_GET(obj, sd);
1455 1455
1456 if (sd->anchor_hover.hover) return; 1456 if (sd->anchor_hover.hover) return;
1457
1458 eo_do(obj, eo_event_callback_call(ELM_ENTRY_EVENT_CONTEXT_OPEN, NULL));
1459
1457 if ((sd->api) && (sd->api->obj_longpress)) 1460 if ((sd->api) && (sd->api->obj_longpress))
1458 { 1461 {
1459 sd->api->obj_longpress(obj); 1462 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,
1232 changed; 1232 changed;
1233 changed,user; 1233 changed,user;
1234 validate; 1234 validate;
1235 context,open;
1235 } 1236 }
1236 1237
1237} 1238}