summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/elementary/efl_ui_popup.c53
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll.c24
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll_private.h1
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_text.c24
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_text_private.h1
-rw-r--r--src/lib/elementary/efl_ui_popup_private.h12
6 files changed, 69 insertions, 46 deletions
diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c
index 3143a25fef..f8134d285b 100644
--- a/src/lib/elementary/efl_ui_popup.c
+++ b/src/lib/elementary/efl_ui_popup.c
@@ -79,13 +79,24 @@ EOLIAN static void
79_efl_ui_popup_efl_gfx_size_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eina_Size2D size) 79_efl_ui_popup_efl_gfx_size_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eina_Size2D size)
80{ 80{
81 efl_gfx_size_set(efl_super(obj, MY_CLASS), size); 81 efl_gfx_size_set(efl_super(obj, MY_CLASS), size);
82 _calc_align(obj); 82
83 //Add align calc only
84 Eina_Bool needs_size_calc = pd->needs_size_calc;
85 elm_layout_sizing_eval(obj);
86 pd->needs_size_calc = needs_size_calc;
83} 87}
84 88
85static void 89static void
86_parent_geom_cb(void *data, const Efl_Event *ev EINA_UNUSED) 90_parent_geom_cb(void *data, const Efl_Event *ev EINA_UNUSED)
87{ 91{
88 _calc_align(data); 92 Eo *obj = data;
93
94 EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, pd);
95
96 //Add align calc only
97 Eina_Bool needs_size_calc = pd->needs_size_calc;
98 elm_layout_sizing_eval(obj);
99 pd->needs_size_calc = needs_size_calc;
89} 100}
90 101
91EOLIAN static void 102EOLIAN static void
@@ -111,7 +122,11 @@ EOLIAN static void
111_efl_ui_popup_align_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd, Efl_Ui_Popup_Align type) 122_efl_ui_popup_align_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd, Efl_Ui_Popup_Align type)
112{ 123{
113 pd->align = type; 124 pd->align = type;
114 _calc_align(obj); 125
126 //Add align calc only
127 Eina_Bool needs_size_calc = pd->needs_size_calc;
128 elm_layout_sizing_eval(obj);
129 pd->needs_size_calc = needs_size_calc;
115} 130}
116 131
117EOLIAN static Efl_Ui_Popup_Align 132EOLIAN static Efl_Ui_Popup_Align
@@ -240,7 +255,7 @@ _efl_ui_popup_efl_object_destructor(Eo *obj, Efl_Ui_Popup_Data *pd)
240} 255}
241 256
242static void 257static void
243_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED) 258_sizing_eval(Eo *obj)
244{ 259{
245 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 260 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
246 Evas_Coord minw = -1, minh = -1; 261 Evas_Coord minw = -1, minh = -1;
@@ -256,15 +271,24 @@ _sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
256 new_size.w = (minw > size.w ? minw : size.w); 271 new_size.w = (minw > size.w ? minw : size.w);
257 new_size.h = (minh > size.h ? minh : size.h); 272 new_size.h = (minh > size.h ? minh : size.h);
258 efl_gfx_size_set(obj, new_size); 273 efl_gfx_size_set(obj, new_size);
259
260 _calc_align(obj);
261} 274}
262 275
263EOLIAN static void 276EOLIAN static void
264_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd) 277_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd)
265{ 278{
266 if (pd->needs_size_calc) return; 279 if (pd->needs_group_calc) return;
280 pd->needs_group_calc = EINA_TRUE;
281
282 /* These flags can be modified by sub classes not to calculate size or align
283 * their super classes.
284 * e.g. Efl.Ui.Popup.Alert.Scroll class sets the flag as follows not to
285 * calculate size by its super class.
286 *
287 * ppd->needs_size_calc = EINA_FALSE;
288 * efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
289 */
267 pd->needs_size_calc = EINA_TRUE; 290 pd->needs_size_calc = EINA_TRUE;
291 pd->needs_align_calc = EINA_TRUE;
268 292
269 evas_object_smart_changed(obj); 293 evas_object_smart_changed(obj);
270} 294}
@@ -276,10 +300,19 @@ _efl_ui_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Data *pd)
276 * calculation. 300 * calculation.
277 * The actual size calculation is done here when the object is rendered to 301 * The actual size calculation is done here when the object is rendered to
278 * avoid duplicate size calculations. */ 302 * avoid duplicate size calculations. */
279 if (pd->needs_size_calc) 303 if (pd->needs_group_calc)
280 { 304 {
281 _sizing_eval(obj, pd); 305 if (pd->needs_size_calc)
282 pd->needs_size_calc = EINA_FALSE; 306 {
307 _sizing_eval(obj);
308 pd->needs_size_calc = EINA_FALSE;
309 }
310 if (pd->needs_align_calc)
311 {
312 _calc_align(obj);
313 pd->needs_align_calc = EINA_FALSE;
314 }
315 pd->needs_group_calc = EINA_FALSE;
283 } 316 }
284} 317}
285 318
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll.c b/src/lib/elementary/efl_ui_popup_alert_scroll.c
index 72a875cc25..dc6ef7e83c 100644
--- a/src/lib/elementary/efl_ui_popup_alert_scroll.c
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll.c
@@ -7,6 +7,7 @@
7#include <Elementary.h> 7#include <Elementary.h>
8 8
9#include "elm_priv.h" 9#include "elm_priv.h"
10#include "efl_ui_popup_private.h"
10#include "efl_ui_popup_alert_scroll_private.h" 11#include "efl_ui_popup_alert_scroll_private.h"
11#include "efl_ui_popup_alert_scroll_part.eo.h" 12#include "efl_ui_popup_alert_scroll_part.eo.h"
12#include "elm_part_helper.h" 13#include "elm_part_helper.h"
@@ -130,26 +131,21 @@ _sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
130} 131}
131 132
132EOLIAN static void 133EOLIAN static void
133_efl_ui_popup_alert_scroll_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
134{
135 if (pd->needs_size_calc) return;
136 pd->needs_size_calc = EINA_TRUE;
137
138 evas_object_smart_changed(obj);
139}
140
141EOLIAN static void
142_efl_ui_popup_alert_scroll_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd) 134_efl_ui_popup_alert_scroll_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
143{ 135{
144 /* When elm_layout_sizing_eval() is called, just flag is set instead of size 136 /* When elm_layout_sizing_eval() is called, just flag is set instead of size
145 * calculation. 137 * calculation.
146 * The actual size calculation is done here when the object is rendered to 138 * The actual size calculation is done here when the object is rendered to
147 * avoid duplicate size calculations. */ 139 * avoid duplicate size calculations. */
148 if (pd->needs_size_calc) 140 EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, ppd);
141
142 if (ppd->needs_group_calc)
149 { 143 {
150 _sizing_eval(obj, pd); 144 _sizing_eval(obj, pd);
151 145
152 pd->needs_size_calc = EINA_FALSE; 146 //Not to calculate size by super class
147 ppd->needs_size_calc = EINA_FALSE;
148 efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
153 } 149 }
154} 150}
155 151
@@ -281,7 +277,6 @@ _efl_ui_popup_alert_scroll_efl_object_constructor(Eo *obj,
281 277
282 pd->size = EINA_SIZE2D(0, 0); 278 pd->size = EINA_SIZE2D(0, 0);
283 pd->max_size = EINA_SIZE2D(-1, -1); 279 pd->max_size = EINA_SIZE2D(-1, -1);
284 pd->needs_size_calc = EINA_FALSE;
285 280
286 return obj; 281 return obj;
287} 282}
@@ -298,9 +293,4 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert_scroll, EFL_UI_POPUP_ALERT_SCROLL,
298 293
299/* Efl.Part end */ 294/* Efl.Part end */
300 295
301/* Internal EO APIs and hidden overrides */
302
303#define EFL_UI_POPUP_ALERT_SCROLL_EXTRA_OPS \
304 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup_alert_scroll)
305
306#include "efl_ui_popup_alert_scroll.eo.c" 296#include "efl_ui_popup_alert_scroll.eo.c"
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll_private.h b/src/lib/elementary/efl_ui_popup_alert_scroll_private.h
index 290eaa75ad..9e3bb550a3 100644
--- a/src/lib/elementary/efl_ui_popup_alert_scroll_private.h
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll_private.h
@@ -10,7 +10,6 @@ struct _Efl_Ui_Popup_Alert_Scroll_Data
10 Eo *content; 10 Eo *content;
11 Eina_Size2D size; 11 Eina_Size2D size;
12 Eina_Size2D max_size; 12 Eina_Size2D max_size;
13 Eina_Bool needs_size_calc : 1;
14}; 13};
15 14
16#endif 15#endif
diff --git a/src/lib/elementary/efl_ui_popup_alert_text.c b/src/lib/elementary/efl_ui_popup_alert_text.c
index e74b448ab7..4bad668fab 100644
--- a/src/lib/elementary/efl_ui_popup_alert_text.c
+++ b/src/lib/elementary/efl_ui_popup_alert_text.c
@@ -5,6 +5,7 @@
5#include <Elementary.h> 5#include <Elementary.h>
6 6
7#include "elm_priv.h" 7#include "elm_priv.h"
8#include "efl_ui_popup_private.h"
8#include "efl_ui_popup_alert_text_private.h" 9#include "efl_ui_popup_alert_text_private.h"
9#include "efl_ui_popup_alert_text_part.eo.h" 10#include "efl_ui_popup_alert_text_part.eo.h"
10#include "elm_part_helper.h" 11#include "elm_part_helper.h"
@@ -148,26 +149,21 @@ _sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
148} 149}
149 150
150EOLIAN static void 151EOLIAN static void
151_efl_ui_popup_alert_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
152{
153 if (pd->needs_size_calc) return;
154 pd->needs_size_calc = EINA_TRUE;
155
156 evas_object_smart_changed(obj);
157}
158
159EOLIAN static void
160_efl_ui_popup_alert_text_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd) 152_efl_ui_popup_alert_text_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
161{ 153{
162 /* When elm_layout_sizing_eval() is called, just flag is set instead of size 154 /* When elm_layout_sizing_eval() is called, just flag is set instead of size
163 * calculation. 155 * calculation.
164 * The actual size calculation is done here when the object is rendered to 156 * The actual size calculation is done here when the object is rendered to
165 * avoid duplicate size calculations. */ 157 * avoid duplicate size calculations. */
166 if (pd->needs_size_calc) 158 EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, ppd);
159
160 if (ppd->needs_group_calc)
167 { 161 {
168 _sizing_eval(obj, pd); 162 _sizing_eval(obj, pd);
169 163
170 pd->needs_size_calc = EINA_FALSE; 164 //Not to calculate size by super class
165 ppd->needs_size_calc = EINA_FALSE;
166 efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
171 } 167 }
172} 168}
173 169
@@ -287,7 +283,6 @@ _efl_ui_popup_alert_text_efl_object_constructor(Eo *obj,
287 283
288 pd->size = EINA_SIZE2D(0, 0); 284 pd->size = EINA_SIZE2D(0, 0);
289 pd->max_size = EINA_SIZE2D(-1, -1); 285 pd->max_size = EINA_SIZE2D(-1, -1);
290 pd->needs_size_calc = EINA_FALSE;
291 286
292 return obj; 287 return obj;
293} 288}
@@ -304,9 +299,4 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl
304 299
305/* Efl.Part end */ 300/* Efl.Part end */
306 301
307/* Internal EO APIs and hidden overrides */
308
309#define EFL_UI_POPUP_ALERT_TEXT_EXTRA_OPS \
310 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup_alert_text)
311
312#include "efl_ui_popup_alert_text.eo.c" 302#include "efl_ui_popup_alert_text.eo.c"
diff --git a/src/lib/elementary/efl_ui_popup_alert_text_private.h b/src/lib/elementary/efl_ui_popup_alert_text_private.h
index 5820425189..fb4cdd731c 100644
--- a/src/lib/elementary/efl_ui_popup_alert_text_private.h
+++ b/src/lib/elementary/efl_ui_popup_alert_text_private.h
@@ -10,7 +10,6 @@ struct _Efl_Ui_Popup_Alert_Text_Data
10 Eo *message; 10 Eo *message;
11 Eina_Size2D size; 11 Eina_Size2D size;
12 Eina_Size2D max_size; 12 Eina_Size2D max_size;
13 Eina_Bool needs_size_calc : 1;
14}; 13};
15 14
16#endif 15#endif
diff --git a/src/lib/elementary/efl_ui_popup_private.h b/src/lib/elementary/efl_ui_popup_private.h
index f018812389..3cf0eee24a 100644
--- a/src/lib/elementary/efl_ui_popup_private.h
+++ b/src/lib/elementary/efl_ui_popup_private.h
@@ -9,7 +9,19 @@ struct _Efl_Ui_Popup_Data
9 Efl_Ui_Popup_Align align; 9 Efl_Ui_Popup_Align align;
10 Ecore_Timer *timer; 10 Ecore_Timer *timer;
11 double timeout; 11 double timeout;
12 Eina_Bool needs_group_calc : 1;
12 Eina_Bool needs_size_calc : 1; 13 Eina_Bool needs_size_calc : 1;
14 Eina_Bool needs_align_calc : 1;
13}; 15};
14 16
17#define EFL_UI_POPUP_DATA_GET_OR_RETURN(o, ptr, ...) \
18 Efl_Ui_Popup_Data *ptr; \
19 ptr = efl_data_scope_get(o, EFL_UI_POPUP_CLASS); \
20 if (EINA_UNLIKELY(!ptr)) \
21 { \
22 CRI("no ui popup data for object %p (%s)", \
23 o, evas_object_type_get(o)); \
24 return __VA_ARGS__; \
25 }
26
15#endif 27#endif