From b464395ada2958f770d75e3b84849d3595bd4581 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 8 Jan 2016 15:11:11 +0900 Subject: [PATCH] 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 --- legacy/elementary/src/bin/test_ctxpopup.c | 16 ++++++++++++++++ legacy/elementary/src/lib/elc_ctxpopup.c | 4 ++++ legacy/elementary/src/lib/elc_ctxpopup.h | 3 +++ legacy/elementary/src/lib/elm_ctxpopup.eo | 1 + 4 files changed, 24 insertions(+) diff --git a/legacy/elementary/src/bin/test_ctxpopup.c b/legacy/elementary/src/bin/test_ctxpopup.c index 4f807f6..27e5376 100644 --- a/legacy/elementary/src/bin/test_ctxpopup.c +++ b/legacy/elementary/src/bin/test_ctxpopup.c @@ -72,6 +72,13 @@ _ctxpopup_item_new(Evas_Object *obj, const char *label, const char *icon) } static void +_geometry_update(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + Evas_Coord_Rectangle *geom = event_info; + printf("ctxpopup geometry(%d %d %d %d)\n", geom->x, geom->y, geom->w, geom->h); +} + +static void _list_item_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { Evas_Object *ctxpopup; @@ -82,6 +89,7 @@ _list_item_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UN ctxpopup = elm_ctxpopup_add(obj); evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); + evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL); _ctxpopup_item_new(ctxpopup, "Go to home folder", "home"); _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 ctxpopup = elm_ctxpopup_add(obj); evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); + evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL); _ctxpopup_item_new(ctxpopup, NULL, "home"); _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 ctxpopup = elm_ctxpopup_add(obj); evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); + evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL); _ctxpopup_item_new(ctxpopup, "Eina", NULL); _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 ctxpopup = elm_ctxpopup_add(obj); evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); + evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL); elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE); @@ -206,6 +217,7 @@ _list_item_cb5(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U ctxpopup = elm_ctxpopup_add(obj); evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); + evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL); elm_object_content_set(ctxpopup, bx); @@ -273,6 +285,7 @@ _list_item_cb6(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U ctxpopup = elm_ctxpopup_add(obj); evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); + evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL); elm_object_content_set(ctxpopup, bx); @@ -312,6 +325,7 @@ _list_item_cb7(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U if (list_mouse_down > 0) return; ctxpopup = elm_ctxpopup_add(obj); evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); + evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL); elm_ctxpopup_item_append(ctxpopup, "Disable this item", NULL, _ctxpopup_item_disable_cb, ctxpopup); 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 ctxpopup = elm_ctxpopup_add(obj); evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); + evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL); + elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); _ctxpopup_item_new(ctxpopup, "Go to home folder", "home"); diff --git a/legacy/elementary/src/lib/elc_ctxpopup.c b/legacy/elementary/src/lib/elc_ctxpopup.c index f72d62f..96cb033 100644 --- a/legacy/elementary/src/lib/elc_ctxpopup.c +++ b/legacy/elementary/src/lib/elc_ctxpopup.c @@ -20,6 +20,8 @@ EAPI const char ELM_CTXPOPUP_SMART_NAME[] = "elm_ctxpopup"; #define ELM_PRIV_CTXPOPUP_SIGNALS(cmd) \ cmd(SIG_DISMISSED, "dismissed", "") \ + cmd(SIG_GEOMETRY_UPDATE, "geometry,update", "") \ + ELM_PRIV_CTXPOPUP_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE); @@ -672,6 +674,8 @@ _elm_ctxpopup_elm_layout_sizing_eval(Eo *obj, Elm_Ctxpopup_Data *sd) evas_object_resize(wd->resize_obj, rect.w, rect.h); _show_signals_emit(obj, sd->dir); + + eo_do(obj, eo_event_callback_call(ELM_CTXPOPUP_EVENT_GEOMETRY_UPDATE, &rect)); } static void diff --git a/legacy/elementary/src/lib/elc_ctxpopup.h b/legacy/elementary/src/lib/elc_ctxpopup.h index 67cebb1..0cde2b6 100644 --- a/legacy/elementary/src/lib/elc_ctxpopup.h +++ b/legacy/elementary/src/lib/elc_ctxpopup.h @@ -31,6 +31,9 @@ * changed. * - @c "focused" - When the ctxpopup has received focus. (since 1.8) * - @c "unfocused" - When the ctxpopup has lost focus. (since 1.8) + * - @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) + + * * Default content parts of the ctxpopup widget that you can use for are: * @li "default" - A content of the ctxpopup * diff --git a/legacy/elementary/src/lib/elm_ctxpopup.eo b/legacy/elementary/src/lib/elm_ctxpopup.eo index 7dade89..39accbe 100644 --- a/legacy/elementary/src/lib/elm_ctxpopup.eo +++ b/legacy/elementary/src/lib/elm_ctxpopup.eo @@ -237,6 +237,7 @@ class Elm.Ctxpopup (Elm.Layout, Elm_Interface_Atspi_Widget_Action) } events { dismissed; + geometry,update; } } -- 2.7.4