aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJinYong Park <j4939.park@samsung.com>2017-08-31 15:21:04 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-21 14:01:48 +0900
commitae70088364f37f658c4a8375468d0dc6da35b129 (patch)
treebf63497d7fdc3cd1cb64d51a85afabe9327973e9
parentefl_ui_popup_alert_text: add Efl.Ui.Popup.Alert.Text Class (diff)
downloadefl-ae70088364f37f658c4a8375468d0dc6da35b129.tar.gz
efl_ui_popup: use efl_data_scope_get instead of using 'self' object
Summary: Use efl_data_scope_get to get Efl_Ui_Popup_Data structure. There is no reason using "self" object in Efl_Ui_Popup_Data. Reviewers: Jaehyun_Cho, herb, thiepha, woohyun, jpeg, cedric Reviewed By: cedric Differential Revision: https://phab.enlightenment.org/D5128
-rw-r--r--src/lib/elementary/efl_ui_popup.c34
-rw-r--r--src/lib/elementary/efl_ui_popup_private.h1
2 files changed, 16 insertions, 19 deletions
diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c
index 7de893e5de..a81ff67909 100644
--- a/src/lib/elementary/efl_ui_popup.c
+++ b/src/lib/elementary/efl_ui_popup.c
@@ -30,8 +30,10 @@ _efl_ui_popup_efl_gfx_position_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, E
}
static void
-_calc_align(Efl_Ui_Popup_Data *pd)
+_calc_align(Evas_Object *obj)
{
+ Efl_Ui_Popup_Data *pd = efl_data_scope_get(obj, MY_CLASS);
+
Evas_Coord x, y, w, h;
evas_object_geometry_get(pd->win_parent, &x, &y, &w, &h);
@@ -42,39 +44,37 @@ _calc_align(Efl_Ui_Popup_Data *pd)
evas_object_resize(pd->event_bg, w, h);
Evas_Coord pw, ph;
- evas_object_geometry_get(pd->self, NULL, NULL, &pw, &ph);
+ evas_object_geometry_get(obj, NULL, NULL, &pw, &ph);
Efl_Ui_Popup_Align align;
- align = efl_ui_popup_align_get(pd->self);
+ align = efl_ui_popup_align_get(obj);
switch (align)
{
case EFL_UI_POPUP_ALIGN_CENTER:
- evas_object_move(pd->self, x + ((w - pw ) / 2), y + ((h - ph) / 2));
+ evas_object_move(obj, x + ((w - pw ) / 2), y + ((h - ph) / 2));
break;
case EFL_UI_POPUP_ALIGN_LEFT:
- evas_object_move(pd->self, x, y + ((h - ph) / 2));
+ evas_object_move(obj, x, y + ((h - ph) / 2));
break;
case EFL_UI_POPUP_ALIGN_RIGHT:
- evas_object_move(pd->self, x + (w - pw), ((h - ph) / 2));
+ evas_object_move(obj, x + (w - pw), ((h - ph) / 2));
break;
case EFL_UI_POPUP_ALIGN_TOP:
- evas_object_move(pd->self, x + ((w - pw) / 2), y);
+ evas_object_move(obj, x + ((w - pw) / 2), y);
break;
case EFL_UI_POPUP_ALIGN_BOTTOM:
- evas_object_move(pd->self, x + ((w - pw) / 2), y + (h - ph));
+ evas_object_move(obj, x + ((w - pw) / 2), y + (h - ph));
break;
default:
break;
}
}
-
static void
_parent_geom_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
- Efl_Ui_Popup_Data *pd = data;
- _calc_align(pd);
+ _calc_align(data);
}
EOLIAN static void
@@ -92,8 +92,8 @@ _efl_ui_popup_elm_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_U
evas_object_move(pd->event_bg, x, y);
evas_object_resize(pd->event_bg, w, h);
- efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, pd);
- efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, pd);
+ efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, obj);
+ efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, obj);
}
EOLIAN static Eina_Bool
@@ -131,7 +131,7 @@ EOLIAN static void
_efl_ui_popup_align_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd, Efl_Ui_Popup_Align type)
{
pd->align = type;
- _calc_align(pd);
+ _calc_align(obj);
}
EOLIAN static Efl_Ui_Popup_Align
@@ -148,8 +148,6 @@ _efl_ui_popup_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Popup_Data *pd)
efl_canvas_group_add(efl_super(obj, MY_CLASS));
elm_widget_sub_object_parent_add(obj);
- pd->self = obj;
-
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_layout_theme_set(obj, "popup", "base", "view");
@@ -167,8 +165,8 @@ EOLIAN static void
_efl_ui_popup_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Popup_Data *pd)
{
ELM_SAFE_FREE(pd->event_bg, evas_object_del);
- efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, pd);
- efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, pd);
+ efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, obj);
+ efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, obj);
efl_canvas_group_del(efl_super(obj, MY_CLASS));
}
diff --git a/src/lib/elementary/efl_ui_popup_private.h b/src/lib/elementary/efl_ui_popup_private.h
index dd979b318e..e87151edd1 100644
--- a/src/lib/elementary/efl_ui_popup_private.h
+++ b/src/lib/elementary/efl_ui_popup_private.h
@@ -4,7 +4,6 @@
typedef struct _Efl_Ui_Popup_Data Efl_Ui_Popup_Data;
struct _Efl_Ui_Popup_Data
{
- Evas_Object *self;
Evas_Object *win_parent;
Evas_Object *event_bg;
Efl_Ui_Popup_Align align;