summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermet@hermet.pe.kr>2016-01-08 15:11:11 +0900
committerHermet Park <hermet@hermet.pe.kr>2016-01-08 15:11:11 +0900
commitdfcdcb9af747289818b3d95ab3c689abbf2543dd (patch)
treee61f2b21546e1c96f2d5da97c96a5729b4c79841
parenta6fb564f38278f83fb14291357c1902a80970ca0 (diff)
ctxpopup: add geometry,update smart callback.
conceptually, ctxpopup won't give any geometry information of the container. this event is a way for returning the information of the container for user scenarios. @feature. fix @T2042
-rw-r--r--src/bin/test_ctxpopup.c16
-rw-r--r--src/lib/elc_ctxpopup.c4
-rw-r--r--src/lib/elc_ctxpopup.h3
-rw-r--r--src/lib/elm_ctxpopup.eo1
4 files changed, 24 insertions, 0 deletions
diff --git a/src/bin/test_ctxpopup.c b/src/bin/test_ctxpopup.c
index 4f807f6a7..27e5376a2 100644
--- a/src/bin/test_ctxpopup.c
+++ b/src/bin/test_ctxpopup.c
@@ -72,6 +72,13 @@ _ctxpopup_item_new(Evas_Object *obj, const char *label, const char *icon)
72} 72}
73 73
74static void 74static void
75_geometry_update(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
76{
77 Evas_Coord_Rectangle *geom = event_info;
78 printf("ctxpopup geometry(%d %d %d %d)\n", geom->x, geom->y, geom->w, geom->h);
79}
80
81static void
75_list_item_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 82_list_item_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
76{ 83{
77 Evas_Object *ctxpopup; 84 Evas_Object *ctxpopup;
@@ -82,6 +89,7 @@ _list_item_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UN
82 89
83 ctxpopup = elm_ctxpopup_add(obj); 90 ctxpopup = elm_ctxpopup_add(obj);
84 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); 91 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
92 evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
85 93
86 _ctxpopup_item_new(ctxpopup, "Go to home folder", "home"); 94 _ctxpopup_item_new(ctxpopup, "Go to home folder", "home");
87 _ctxpopup_item_new(ctxpopup, "Save file", "file"); 95 _ctxpopup_item_new(ctxpopup, "Save file", "file");
@@ -110,6 +118,7 @@ _list_item_cb2(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U
110 118
111 ctxpopup = elm_ctxpopup_add(obj); 119 ctxpopup = elm_ctxpopup_add(obj);
112 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); 120 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
121 evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
113 122
114 _ctxpopup_item_new(ctxpopup, NULL, "home"); 123 _ctxpopup_item_new(ctxpopup, NULL, "home");
115 _ctxpopup_item_new(ctxpopup, NULL, "file"); 124 _ctxpopup_item_new(ctxpopup, NULL, "file");
@@ -137,6 +146,7 @@ _list_item_cb3(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U
137 146
138 ctxpopup = elm_ctxpopup_add(obj); 147 ctxpopup = elm_ctxpopup_add(obj);
139 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); 148 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
149 evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
140 150
141 _ctxpopup_item_new(ctxpopup, "Eina", NULL); 151 _ctxpopup_item_new(ctxpopup, "Eina", NULL);
142 _ctxpopup_item_new(ctxpopup, "Eet", NULL); 152 _ctxpopup_item_new(ctxpopup, "Eet", NULL);
@@ -162,6 +172,7 @@ _list_item_cb4(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U
162 172
163 ctxpopup = elm_ctxpopup_add(obj); 173 ctxpopup = elm_ctxpopup_add(obj);
164 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); 174 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
175 evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
165 176
166 elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE); 177 elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE);
167 178
@@ -206,6 +217,7 @@ _list_item_cb5(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U
206 217
207 ctxpopup = elm_ctxpopup_add(obj); 218 ctxpopup = elm_ctxpopup_add(obj);
208 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); 219 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
220 evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
209 221
210 elm_object_content_set(ctxpopup, bx); 222 elm_object_content_set(ctxpopup, bx);
211 223
@@ -273,6 +285,7 @@ _list_item_cb6(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U
273 285
274 ctxpopup = elm_ctxpopup_add(obj); 286 ctxpopup = elm_ctxpopup_add(obj);
275 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); 287 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
288 evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
276 289
277 elm_object_content_set(ctxpopup, bx); 290 elm_object_content_set(ctxpopup, bx);
278 291
@@ -312,6 +325,7 @@ _list_item_cb7(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U
312 if (list_mouse_down > 0) return; 325 if (list_mouse_down > 0) return;
313 ctxpopup = elm_ctxpopup_add(obj); 326 ctxpopup = elm_ctxpopup_add(obj);
314 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); 327 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
328 evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
315 329
316 elm_ctxpopup_item_append(ctxpopup, "Disable this item", NULL, _ctxpopup_item_disable_cb, ctxpopup); 330 elm_ctxpopup_item_append(ctxpopup, "Disable this item", NULL, _ctxpopup_item_disable_cb, ctxpopup);
317 elm_ctxpopup_item_append(ctxpopup, "Delete this ctxpopup", NULL, _ctxpopup_item_delete_cb, ctxpopup); 331 elm_ctxpopup_item_append(ctxpopup, "Delete this ctxpopup", NULL, _ctxpopup_item_delete_cb, ctxpopup);
@@ -335,6 +349,8 @@ _list_item_cb8(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U
335 349
336 ctxpopup = elm_ctxpopup_add(obj); 350 ctxpopup = elm_ctxpopup_add(obj);
337 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); 351 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
352 evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
353
338 elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); 354 elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE);
339 355
340 _ctxpopup_item_new(ctxpopup, "Go to home folder", "home"); 356 _ctxpopup_item_new(ctxpopup, "Go to home folder", "home");
diff --git a/src/lib/elc_ctxpopup.c b/src/lib/elc_ctxpopup.c
index f72d62fee..96cb033b1 100644
--- a/src/lib/elc_ctxpopup.c
+++ b/src/lib/elc_ctxpopup.c
@@ -20,6 +20,8 @@ EAPI const char ELM_CTXPOPUP_SMART_NAME[] = "elm_ctxpopup";
20 20
21#define ELM_PRIV_CTXPOPUP_SIGNALS(cmd) \ 21#define ELM_PRIV_CTXPOPUP_SIGNALS(cmd) \
22 cmd(SIG_DISMISSED, "dismissed", "") \ 22 cmd(SIG_DISMISSED, "dismissed", "") \
23 cmd(SIG_GEOMETRY_UPDATE, "geometry,update", "") \
24
23 25
24ELM_PRIV_CTXPOPUP_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE); 26ELM_PRIV_CTXPOPUP_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
25 27
@@ -672,6 +674,8 @@ _elm_ctxpopup_elm_layout_sizing_eval(Eo *obj, Elm_Ctxpopup_Data *sd)
672 evas_object_resize(wd->resize_obj, rect.w, rect.h); 674 evas_object_resize(wd->resize_obj, rect.w, rect.h);
673 675
674 _show_signals_emit(obj, sd->dir); 676 _show_signals_emit(obj, sd->dir);
677
678 eo_do(obj, eo_event_callback_call(ELM_CTXPOPUP_EVENT_GEOMETRY_UPDATE, &rect));
675} 679}
676 680
677static void 681static void
diff --git a/src/lib/elc_ctxpopup.h b/src/lib/elc_ctxpopup.h
index 67cebb150..0cde2b6db 100644
--- a/src/lib/elc_ctxpopup.h
+++ b/src/lib/elc_ctxpopup.h
@@ -31,6 +31,9 @@
31 * changed. 31 * changed.
32 * - @c "focused" - When the ctxpopup has received focus. (since 1.8) 32 * - @c "focused" - When the ctxpopup has received focus. (since 1.8)
33 * - @c "unfocused" - When the ctxpopup has lost focus. (since 1.8) 33 * - @c "unfocused" - When the ctxpopup has lost focus. (since 1.8)
34 * - @c "geometry,update" - When the ctxpopup geometry is updated. This smart event passes the ctxpopup geometry information with the given event_info argument which type is Evas_Coord_Rectangle. (since 1.18)
35
36 *
34 * Default content parts of the ctxpopup widget that you can use for are: 37 * Default content parts of the ctxpopup widget that you can use for are:
35 * @li "default" - A content of the ctxpopup 38 * @li "default" - A content of the ctxpopup
36 * 39 *
diff --git a/src/lib/elm_ctxpopup.eo b/src/lib/elm_ctxpopup.eo
index 7dade898c..39accbec2 100644
--- a/src/lib/elm_ctxpopup.eo
+++ b/src/lib/elm_ctxpopup.eo
@@ -237,6 +237,7 @@ class Elm.Ctxpopup (Elm.Layout, Elm_Interface_Atspi_Widget_Action)
237 } 237 }
238 events { 238 events {
239 dismissed; 239 dismissed;
240 geometry,update;
240 } 241 }
241 242
242} 243}