summaryrefslogtreecommitdiff
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-28 17:15:42 +0900
commit0365bf1e139f704be2fef79506cd4c732a31b12a (patch)
treefbe374fc68a6d4392167322bb6b45db6f9ff4776
parent3dccf133bbfa3869217578219870e65687f4092c (diff)
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 7de893e..a81ff67 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
30} 30}
31 31
32static void 32static void
33_calc_align(Efl_Ui_Popup_Data *pd) 33_calc_align(Evas_Object *obj)
34{ 34{
35 Efl_Ui_Popup_Data *pd = efl_data_scope_get(obj, MY_CLASS);
36
35 Evas_Coord x, y, w, h; 37 Evas_Coord x, y, w, h;
36 evas_object_geometry_get(pd->win_parent, &x, &y, &w, &h); 38 evas_object_geometry_get(pd->win_parent, &x, &y, &w, &h);
37 39
@@ -42,39 +44,37 @@ _calc_align(Efl_Ui_Popup_Data *pd)
42 evas_object_resize(pd->event_bg, w, h); 44 evas_object_resize(pd->event_bg, w, h);
43 45
44 Evas_Coord pw, ph; 46 Evas_Coord pw, ph;
45 evas_object_geometry_get(pd->self, NULL, NULL, &pw, &ph); 47 evas_object_geometry_get(obj, NULL, NULL, &pw, &ph);
46 48
47 Efl_Ui_Popup_Align align; 49 Efl_Ui_Popup_Align align;
48 align = efl_ui_popup_align_get(pd->self); 50 align = efl_ui_popup_align_get(obj);
49 51
50 switch (align) 52 switch (align)
51 { 53 {
52 case EFL_UI_POPUP_ALIGN_CENTER: 54 case EFL_UI_POPUP_ALIGN_CENTER:
53 evas_object_move(pd->self, x + ((w - pw ) / 2), y + ((h - ph) / 2)); 55 evas_object_move(obj, x + ((w - pw ) / 2), y + ((h - ph) / 2));
54 break; 56 break;
55 case EFL_UI_POPUP_ALIGN_LEFT: 57 case EFL_UI_POPUP_ALIGN_LEFT:
56 evas_object_move(pd->self, x, y + ((h - ph) / 2)); 58 evas_object_move(obj, x, y + ((h - ph) / 2));
57 break; 59 break;
58 case EFL_UI_POPUP_ALIGN_RIGHT: 60 case EFL_UI_POPUP_ALIGN_RIGHT:
59 evas_object_move(pd->self, x + (w - pw), ((h - ph) / 2)); 61 evas_object_move(obj, x + (w - pw), ((h - ph) / 2));
60 break; 62 break;
61 case EFL_UI_POPUP_ALIGN_TOP: 63 case EFL_UI_POPUP_ALIGN_TOP:
62 evas_object_move(pd->self, x + ((w - pw) / 2), y); 64 evas_object_move(obj, x + ((w - pw) / 2), y);
63 break; 65 break;
64 case EFL_UI_POPUP_ALIGN_BOTTOM: 66 case EFL_UI_POPUP_ALIGN_BOTTOM:
65 evas_object_move(pd->self, x + ((w - pw) / 2), y + (h - ph)); 67 evas_object_move(obj, x + ((w - pw) / 2), y + (h - ph));
66 break; 68 break;
67 default: 69 default:
68 break; 70 break;
69 } 71 }
70} 72}
71 73
72
73static void 74static void
74_parent_geom_cb(void *data, const Efl_Event *ev EINA_UNUSED) 75_parent_geom_cb(void *data, const Efl_Event *ev EINA_UNUSED)
75{ 76{
76 Efl_Ui_Popup_Data *pd = data; 77 _calc_align(data);
77 _calc_align(pd);
78} 78}
79 79
80EOLIAN static void 80EOLIAN static void
@@ -92,8 +92,8 @@ _efl_ui_popup_elm_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_U
92 evas_object_move(pd->event_bg, x, y); 92 evas_object_move(pd->event_bg, x, y);
93 evas_object_resize(pd->event_bg, w, h); 93 evas_object_resize(pd->event_bg, w, h);
94 94
95 efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, pd); 95 efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, obj);
96 efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, pd); 96 efl_event_callback_add(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, obj);
97} 97}
98 98
99EOLIAN static Eina_Bool 99EOLIAN static Eina_Bool
@@ -131,7 +131,7 @@ EOLIAN static void
131_efl_ui_popup_align_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd, Efl_Ui_Popup_Align type) 131_efl_ui_popup_align_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd, Efl_Ui_Popup_Align type)
132{ 132{
133 pd->align = type; 133 pd->align = type;
134 _calc_align(pd); 134 _calc_align(obj);
135} 135}
136 136
137EOLIAN static Efl_Ui_Popup_Align 137EOLIAN static Efl_Ui_Popup_Align
@@ -148,8 +148,6 @@ _efl_ui_popup_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Popup_Data *pd)
148 efl_canvas_group_add(efl_super(obj, MY_CLASS)); 148 efl_canvas_group_add(efl_super(obj, MY_CLASS));
149 elm_widget_sub_object_parent_add(obj); 149 elm_widget_sub_object_parent_add(obj);
150 150
151 pd->self = obj;
152
153 elm_widget_can_focus_set(obj, EINA_TRUE); 151 elm_widget_can_focus_set(obj, EINA_TRUE);
154 elm_layout_theme_set(obj, "popup", "base", "view"); 152 elm_layout_theme_set(obj, "popup", "base", "view");
155 153
@@ -167,8 +165,8 @@ EOLIAN static void
167_efl_ui_popup_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Popup_Data *pd) 165_efl_ui_popup_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Popup_Data *pd)
168{ 166{
169 ELM_SAFE_FREE(pd->event_bg, evas_object_del); 167 ELM_SAFE_FREE(pd->event_bg, evas_object_del);
170 efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, pd); 168 efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_RESIZE, _parent_geom_cb, obj);
171 efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, pd); 169 efl_event_callback_del(pd->win_parent, EFL_GFX_EVENT_MOVE, _parent_geom_cb, obj);
172 170
173 efl_canvas_group_del(efl_super(obj, MY_CLASS)); 171 efl_canvas_group_del(efl_super(obj, MY_CLASS));
174} 172}
diff --git a/src/lib/elementary/efl_ui_popup_private.h b/src/lib/elementary/efl_ui_popup_private.h
index dd979b3..e87151e 100644
--- a/src/lib/elementary/efl_ui_popup_private.h
+++ b/src/lib/elementary/efl_ui_popup_private.h
@@ -4,7 +4,6 @@
4typedef struct _Efl_Ui_Popup_Data Efl_Ui_Popup_Data; 4typedef struct _Efl_Ui_Popup_Data Efl_Ui_Popup_Data;
5struct _Efl_Ui_Popup_Data 5struct _Efl_Ui_Popup_Data
6{ 6{
7 Evas_Object *self;
8 Evas_Object *win_parent; 7 Evas_Object *win_parent;
9 Evas_Object *event_bg; 8 Evas_Object *event_bg;
10 Efl_Ui_Popup_Align align; 9 Efl_Ui_Popup_Align align;