summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJee-Yong Um <conr2d@gmail.com>2015-03-10 16:21:16 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-03-10 16:21:16 +0900
commit25c3ed233591eda0e76cf0453de221b295bfe842 (patch)
treef8b94a76a5b98e8388d8ca1b5a7c6df75af536b5
parent9f90c55aa9a0192de17cb42c1e018114590d6a78 (diff)
elc_popup: Adjust popup size when its parent is resized
Summary: When parent is resized, popup keeps its original size. This patch makes popup have proper size in proportion to parent's size. T2082 Test Plan: You can check the effect of this patch in "elementary_test popup". Reviewers: seoz, Hermet Subscribers: stefan_schmidt, J5lx, seoz Differential Revision: https://phab.enlightenment.org/D2121
-rw-r--r--src/lib/elc_popup.c17
-rw-r--r--src/lib/elm_widget_popup.h1
2 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c
index 6683f4b2a..86963106b 100644
--- a/src/lib/elc_popup.c
+++ b/src/lib/elc_popup.c
@@ -43,6 +43,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
43}; 43};
44 44
45static Eina_Bool _key_action_move(Evas_Object *obj, const char *params); 45static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
46static void _parent_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED);
46 47
47static const Elm_Action key_actions[] = { 48static const Elm_Action key_actions[] = {
48 {"move", _key_action_move}, 49 {"move", _key_action_move},
@@ -194,6 +195,7 @@ _elm_popup_evas_object_smart_del(Eo *obj, Elm_Popup_Data *sd)
194{ 195{
195 unsigned int i; 196 unsigned int i;
196 197
198 evas_object_event_callback_del_full(sd->parent, EVAS_CALLBACK_RESIZE, _parent_resize_cb, obj);
197 199
198 evas_object_smart_callback_del 200 evas_object_smart_callback_del
199 (sd->notify, "block,clicked", _block_clicked_cb); 201 (sd->notify, "block,clicked", _block_clicked_cb);
@@ -1416,8 +1418,18 @@ _elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv)
1416 _visuals_set(obj); 1418 _visuals_set(obj);
1417} 1419}
1418 1420
1421static void
1422_parent_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
1423{
1424 Evas_Coord w, h;
1425 Evas_Object *popup = data;
1426
1427 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1428 evas_object_resize(popup, w, h);
1429}
1430
1419EOLIAN static void 1431EOLIAN static void
1420_elm_popup_elm_widget_parent_set(Eo *obj, Elm_Popup_Data *sd EINA_UNUSED, Evas_Object *parent) 1432_elm_popup_elm_widget_parent_set(Eo *obj, Elm_Popup_Data *sd, Evas_Object *parent)
1421{ 1433{
1422 Evas_Coord x, y, w, h; 1434 Evas_Coord x, y, w, h;
1423 evas_object_geometry_get(parent, &x, &y, &w, &h); 1435 evas_object_geometry_get(parent, &x, &y, &w, &h);
@@ -1429,6 +1441,9 @@ _elm_popup_elm_widget_parent_set(Eo *obj, Elm_Popup_Data *sd EINA_UNUSED, Evas_O
1429 } 1441 }
1430 evas_object_move(obj, x, y); 1442 evas_object_move(obj, x, y);
1431 evas_object_resize(obj, w, h); 1443 evas_object_resize(obj, w, h);
1444
1445 sd->parent = parent;
1446 evas_object_event_callback_add(parent, EVAS_CALLBACK_RESIZE, _parent_resize_cb, obj);
1432} 1447}
1433 1448
1434EOLIAN static void 1449EOLIAN static void
diff --git a/src/lib/elm_widget_popup.h b/src/lib/elm_widget_popup.h
index 04c044d11..6ffee43a3 100644
--- a/src/lib/elm_widget_popup.h
+++ b/src/lib/elm_widget_popup.h
@@ -42,6 +42,7 @@ struct _Elm_Popup_Data
42 Evas_Object *spacer; 42 Evas_Object *spacer;
43 Evas_Object *scr; 43 Evas_Object *scr;
44 Evas_Object *content; 44 Evas_Object *content;
45 Evas_Object *parent; /**< Pointer to remove _parent_resize_cb when popup is deleted. */
45 Eina_List *items; 46 Eina_List *items;
46 const char *title_text; 47 const char *title_text;
47 Action_Area_Data *buttons[ELM_POPUP_ACTION_BUTTON_MAX]; 48 Action_Area_Data *buttons[ELM_POPUP_ACTION_BUTTON_MAX];