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)
downloadelementary-dfcdcb9af747289818b3d95ab3c689abbf2543dd.tar.gz
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)
}
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/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";
#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/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 @@
* 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/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)
}
events {
dismissed;
+ geometry,update;
}
}