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
This commit is contained in:
Hermet Park 2016-01-08 15:11:11 +09:00
parent 579677008f
commit b464395ada
4 changed files with 24 additions and 0 deletions

View File

@ -71,6 +71,13 @@ _ctxpopup_item_new(Evas_Object *obj, const char *label, const char *icon)
return it;
}
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)
{
@ -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");

View File

@ -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

View File

@ -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
*

View File

@ -237,6 +237,7 @@ class Elm.Ctxpopup (Elm.Layout, Elm_Interface_Atspi_Widget_Action)
}
events {
dismissed;
geometry,update;
}
}