summaryrefslogtreecommitdiff
path: root/src/examples/ctxpopup_example_01.c
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2013-11-20 10:56:31 +0900
committerChunEon Park <hermet@hermet.pe.kr>2013-11-20 10:58:05 +0900
commitf86f394239a92983711f8a161b767f7231fad9d5 (patch)
tree35d8104172673213944661841bbb86001b913b29 /src/examples/ctxpopup_example_01.c
parentf45116c4f78303b9798aa9b4bdc91199532be410 (diff)
elementary/ctxpopup - fix T235 ctxpopup_example_01 can popup many times at once.
I know this is not fundamental fix but there is no solution at this moment unless fixing the evas.
Diffstat (limited to '')
-rw-r--r--src/examples/ctxpopup_example_01.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/examples/ctxpopup_example_01.c b/src/examples/ctxpopup_example_01.c
index 9b998ace4..c0cf1643e 100644
--- a/src/examples/ctxpopup_example_01.c
+++ b/src/examples/ctxpopup_example_01.c
@@ -3,6 +3,8 @@
3 3
4#include <Elementary.h> 4#include <Elementary.h>
5 5
6static int list_mouse_down = 0;
7
6static void 8static void
7_dismissed_cb(void *data, Evas_Object *obj, void *event_info) 9_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
8{ 10{
@@ -30,6 +32,8 @@ _list_item_cb(void *data, Evas_Object *obj, void *event_info)
30 Elm_Object_Item *it; 32 Elm_Object_Item *it;
31 Evas_Coord x,y; 33 Evas_Coord x,y;
32 34
35 if (list_mouse_down > 0) return;
36
33 ctxpopup = elm_ctxpopup_add(obj); 37 ctxpopup = elm_ctxpopup_add(obj);
34 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed_cb, NULL); 38 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed_cb, NULL);
35 39
@@ -56,6 +60,8 @@ _list_item_cb2(void *data, Evas_Object *obj, void *event_info)
56 Elm_Object_Item *it; 60 Elm_Object_Item *it;
57 Evas_Coord x,y; 61 Evas_Coord x,y;
58 62
63 if (list_mouse_down > 0) return;
64
59 ctxpopup = elm_ctxpopup_add(obj); 65 ctxpopup = elm_ctxpopup_add(obj);
60 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed_cb, NULL); 66 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed_cb, NULL);
61 elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE); 67 elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE);
@@ -75,6 +81,24 @@ _list_item_cb2(void *data, Evas_Object *obj, void *event_info)
75 elm_list_item_selected_set(event_info, EINA_FALSE); 81 elm_list_item_selected_set(event_info, EINA_FALSE);
76} 82}
77 83
84static void
85_list_mouse_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
86{
87 list_mouse_down++;
88}
89
90static void
91_list_mouse_up(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
92{
93 list_mouse_down--;
94}
95
96static void
97_win_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
98{
99 list_mouse_down = 0;
100}
101
78EAPI_MAIN int 102EAPI_MAIN int
79elm_main(int argc, char **argv) 103elm_main(int argc, char **argv)
80{ 104{
@@ -83,11 +107,16 @@ elm_main(int argc, char **argv)
83 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 107 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
84 108
85 win = elm_win_util_standard_add("Contextual Popup", "Contextual Popup"); 109 win = elm_win_util_standard_add("Contextual Popup", "Contextual Popup");
110 evas_object_smart_callback_add(win, "delete,request", _win_del, NULL);
86 elm_win_autodel_set(win, EINA_TRUE); 111 elm_win_autodel_set(win, EINA_TRUE);
87 evas_object_resize(win, 400, 400); 112 evas_object_resize(win, 400, 400);
88 evas_object_show(win); 113 evas_object_show(win);
89 114
90 list = elm_list_add(win); 115 list = elm_list_add(win);
116 evas_object_event_callback_add(list, EVAS_CALLBACK_MOUSE_DOWN,
117 _list_mouse_down, NULL);
118 evas_object_event_callback_add(list, EVAS_CALLBACK_MOUSE_UP,
119 _list_mouse_up, NULL);
91 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 120 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
92 elm_win_resize_object_add(win, list); 121 elm_win_resize_object_add(win, list);
93 elm_list_mode_set(list, ELM_LIST_COMPRESS); 122 elm_list_mode_set(list, ELM_LIST_COMPRESS);