summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-08-01 18:15:34 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-04 11:52:16 +0900
commit6df17b2ed00bb8cfc3ec414d452253d39d22b075 (patch)
tree870ca84d1b8827d914e492787225e5264555c4da /src/lib/edje
parent796d4b138ba3c1b0064b2260b6626a682dc9a30f (diff)
edje: Split off calc APIs to an interface (EO)
Those APIs can then be used by Elm.Layout, hopefully simplifying the API. I wonder if the APIs should be prefixed "calc_" (as is) or "layout_calc_". The extra "layout_" prefix would make it common with other layout APIs (eg. signals, data, size min/max, ...). Ref T5315
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/Edje_Eo.h1
-rw-r--r--src/lib/edje/Edje_Legacy.h149
-rw-r--r--src/lib/edje/edje_legacy.c50
-rw-r--r--src/lib/edje/edje_object.eo136
-rw-r--r--src/lib/edje/edje_private.h1
-rw-r--r--src/lib/edje/edje_smart.c1
-rw-r--r--src/lib/edje/edje_util.c16
-rw-r--r--src/lib/edje/efl_canvas_layout_calc.eo131
8 files changed, 349 insertions, 136 deletions
diff --git a/src/lib/edje/Edje_Eo.h b/src/lib/edje/Edje_Eo.h
index 23d836646c..44dd896db0 100644
--- a/src/lib/edje/Edje_Eo.h
+++ b/src/lib/edje/Edje_Eo.h
@@ -1,5 +1,6 @@
1#include <Efl.h> 1#include <Efl.h>
2 2
3#include "efl_canvas_layout_calc.eo.h"
3#include "edje_object.eo.h" 4#include "edje_object.eo.h"
4#include "edje_edit.eo.h" 5#include "edje_edit.eo.h"
5 6
diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h
index c37c9068e7..2adee590bf 100644
--- a/src/lib/edje/Edje_Legacy.h
+++ b/src/lib/edje/Edje_Legacy.h
@@ -214,6 +214,155 @@ EAPI const char *edje_object_part_state_get(const Edje_Object *obj, const char *
214EAPI const Efl_Canvas_Object *edje_object_part_object_get(const Edje_Object *obj, const char * part); 214EAPI const Efl_Canvas_Object *edje_object_part_object_get(const Edje_Object *obj, const char * part);
215 215
216/** 216/**
217 * @brief Whether this object updates its size hints automatically.
218 *
219 * By default edje doesn't set size hints on itself. If this property is set to
220 * @c true, size hints will be updated after recalculation. Be careful, as
221 * recalculation may happen often, enabling this property may have a
222 * considerable performance impact as other widgets will be notified of the
223 * size hints changes.
224 *
225 * A layout recalculation can be triggered by @ref edje_object_size_min_calc(),
226 * @ref edje_object_size_min_restricted_calc(),
227 * @ref edje_object_parts_extends_calc() or even any other internal event.
228 *
229 * Enable or disable auto-update of size hints.
230 *
231 * @param[in] update Whether or not update the size hints.
232 *
233 * @ingroup Edje_Object
234 */
235EAPI void edje_object_update_hints_set(Edje_Object *obj, Eina_Bool update);
236
237/**
238 * @brief Whether this object updates its size hints automatically.
239 *
240 * By default edje doesn't set size hints on itself. If this property is set to
241 * @c true, size hints will be updated after recalculation. Be careful, as
242 * recalculation may happen often, enabling this property may have a
243 * considerable performance impact as other widgets will be notified of the
244 * size hints changes.
245 *
246 * A layout recalculation can be triggered by @ref edje_object_size_min_calc(),
247 * @ref edje_object_size_min_restricted_calc(),
248 * @ref edje_object_parts_extends_calc() or even any other internal event.
249 *
250 * Whether this object updates its size hints automatically.
251 *
252 * @return Whether or not update the size hints.
253 *
254 * @ingroup Edje_Object
255 */
256EAPI Eina_Bool edje_object_update_hints_get(const Edje_Object *obj);
257
258/**
259 * @brief Calculates the minimum required size for a given Edje object.
260 *
261 * This call works exactly as edje_object_size_min_restricted_calc(), with the
262 * last two arguments set to 0. Please refer to its documentation, then.
263 *
264 * @param[out] minw The minimum required width (return value)
265 * @param[out] minh The minimum required height (return value)
266 *
267 * @ingroup Edje_Object
268 */
269EAPI void edje_object_size_min_calc(Edje_Object *obj, int *minw, int *minh);
270
271/**
272 * @brief Calculates the minimum required size for a given Edje object.
273 *
274 * This call will trigger an internal recalculation of all parts of the object,
275 * in order to return its minimum required dimensions for width and height. The
276 * user might choose to impose those minimum sizes, making the resulting
277 * calculation to get to values equal or larger than @c restrictedw and
278 * @c restrictedh, for width and height, respectively.
279 *
280 * @note At the end of this call, the object won't be automatically resized to
281 * the new dimensions, but just return the calculated sizes. The caller is the
282 * one up to change its geometry or not.
283 *
284 * @warning Be advised that invisible parts in the object will be taken into
285 * account in this calculation.
286 *
287 * @param[out] minw The minimum required width (return value)
288 * @param[out] minh The minimum required height (return value)
289 * @param[in] restrictedw The minimum width constraint as input, @c minw can
290 * not be lower than this
291 * @param[in] restrictedh The minimum height constraint as input, @c minh can
292 * not be lower than this
293 *
294 * @ingroup Edje_Object
295 */
296EAPI void edje_object_size_min_restricted_calc(Edje_Object *obj, int *minw, int *minh, int restrictedw, int restrictedh);
297
298/**
299 * @brief Calculates the geometry of the region, relative to a given Edje
300 * object's area, occupied by all parts in the object.
301 *
302 * This function gets the geometry of the rectangle equal to the area required
303 * to group all parts in obj's group/collection. The x and y coordinates are
304 * relative to the top left corner of the whole obj object's area. Parts placed
305 * out of the group's boundaries will also be taken in account, so that x and y
306 * may be negative.
307 *
308 * @note On failure, this function will make all non-$null geometry pointers'
309 * pointed variables be set to zero.
310 *
311 * @param[out] x The parts region's X coordinate
312 * @param[out] y The parts region's Y coordinate
313 * @param[out] w The parts region's width
314 * @param[out] h The parts region's height
315 *
316 * @return @c true on success, @c false otherwise
317 *
318 * @ingroup Edje_Object
319 */
320EAPI Eina_Bool edje_object_parts_extends_calc(Edje_Object *obj, int *x, int *y, int *w, int *h);
321
322/**
323 * @brief Forces a Size/Geometry calculation.
324 *
325 * Forces the object to recalculate its layout regardless of freeze/thaw.
326 *
327 * See also @ref edje_object_freeze and @ref edje_object_thaw.
328 *
329 * @ingroup Edje_Object
330 */
331EAPI void edje_object_calc_force(Edje_Object *obj);
332
333/**
334 * @brief Freezes the Edje object.
335 *
336 * This function puts all changes on hold. Successive freezes will nest,
337 * requiring an equal number of thaws.
338 *
339 * See also @ref edje_object_thaw()
340 *
341 * @return The frozen state or 0 on error
342 *
343 * @ingroup Edje_Object
344 */
345EAPI int edje_object_freeze(Edje_Object *obj);
346
347/**
348 * @brief Thaws the Edje object.
349 *
350 * This function thaws the given Edje object.
351 *
352 * @note If sucessive freezes were done, an equal number of thaws will be
353 * required.
354 *
355 * See also @ref edje_object_freeze()
356 *
357 * @return The frozen state or 0 if the object is not frozen or on error.
358 *
359 * @ingroup Edje_Object
360 */
361EAPI int edje_object_thaw(Edje_Object *obj);
362
363
364
365/**
217 * @ingroup Edje_Object_Communication_Interface_Message 366 * @ingroup Edje_Object_Communication_Interface_Message
218 * 367 *
219 * @{ 368 * @{
diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c
index 256f468fe9..f41f2f681e 100644
--- a/src/lib/edje/edje_legacy.c
+++ b/src/lib/edje/edje_legacy.c
@@ -1009,3 +1009,53 @@ edje_object_part_text_insert(Eo *obj, const char *part, const char *text)
1009 if (ed->text_change.func) 1009 if (ed->text_change.func)
1010 ed->text_change.func(ed->text_change.data, obj, part); 1010 ed->text_change.func(ed->text_change.data, obj, part);
1011} 1011}
1012
1013/* Calc interface APIs */
1014
1015EAPI void
1016edje_object_update_hints_set(Edje_Object *obj, Eina_Bool update)
1017{
1018 efl_canvas_layout_calc_auto_update_hints_set(obj, update);
1019}
1020
1021EAPI Eina_Bool
1022edje_object_update_hints_get(const Edje_Object *obj)
1023{
1024 return efl_canvas_layout_calc_auto_update_hints_get(obj);
1025}
1026
1027EAPI void
1028edje_object_size_min_calc(Edje_Object *obj, int *minw, int *minh)
1029{
1030 efl_canvas_layout_calc_size_min(obj, minw, minh);
1031}
1032
1033EAPI void
1034edje_object_size_min_restricted_calc(Edje_Object *obj, int *minw, int *minh, int restrictedw, int restrictedh)
1035{
1036 efl_canvas_layout_calc_size_min_restricted(obj, minw, minh, restrictedw, restrictedh);
1037}
1038
1039EAPI Eina_Bool
1040edje_object_parts_extends_calc(Edje_Object *obj, int *x, int *y, int *w, int *h)
1041{
1042 return efl_canvas_layout_calc_parts_extends(obj, x, y, w, h);
1043}
1044
1045EAPI int
1046edje_object_freeze(Edje_Object *obj)
1047{
1048 return efl_canvas_layout_calc_freeze(obj);
1049}
1050
1051EAPI int
1052edje_object_thaw(Edje_Object *obj)
1053{
1054 return efl_canvas_layout_calc_thaw(obj);
1055}
1056
1057EAPI void
1058edje_object_calc_force(Edje_Object *obj)
1059{
1060 efl_canvas_layout_calc_force(obj);
1061}
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index be6d2e2a00..5aacfa15a8 100644
--- a/src/lib/edje/edje_object.eo
+++ b/src/lib/edje/edje_object.eo
@@ -3,7 +3,7 @@ import edje_types;
3// FIXME: This EO doc needs a direct link to the "edcref" doc 3// FIXME: This EO doc needs a direct link to the "edcref" doc
4 4
5class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part, 5class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
6 Efl.Observer, Efl.Ui.Base) 6 Efl.Observer, Efl.Ui.Base, Efl.Canvas.Layout_Calc)
7{ 7{
8 [[Edje object class]] 8 [[Edje object class]]
9 legacy_prefix: edje_object; 9 legacy_prefix: edje_object;
@@ -140,133 +140,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
140 } 140 }
141 } 141 }
142 142
143 /* EDJE CALC APIS BEGIN ---------------------------------------------- */
144 @property calc_update_hints {
145 [[Whether this object updates its size hints automatically.
146
147 By default edje doesn't set size hints on itself. If this property
148 is set to $true, size hints will be updated after recalculation.
149 Be careful, as recalculation may happen often, enabling this
150 property may have a considerable performance impact as other widgets
151 will be notified of the size hints changes.
152
153 A layout recalculation can be triggered by @.size_min_calc(),
154 @.size_min_restricted_calc(), @.parts_extends_calc() or even any
155 other internal event.
156 ]]
157 set {
158 [[Enable or disable auto-update of size hints.]]
159 legacy: edje_object_update_hints_set;
160 }
161 get {
162 [[Whether this object updates its size hints automatically.]]
163 legacy: edje_object_update_hints_get;
164 }
165 values {
166 update: bool(false); [[Whether or not update the size hints.]]
167 }
168 }
169 // FIXME: Prefix with calc_ ?
170 size_min_calc {
171 [[Calculates the minimum required size for a given Edje object.
172
173 This call works exactly as edje_object_size_min_restricted_calc(),
174 with the last two arguments set to 0. Please refer to its
175 documentation, then.
176 ]]
177 // FIXME: Return a 2D size type (no @out values)
178 params {
179 @out minw: int; [[The minimum required width (return value)]]
180 @out minh: int; [[The minimum required height (return value)]]
181 }
182 }
183 // FIXME: Prefix with calc_ ?
184 size_min_restricted_calc {
185 [[Calculates the minimum required size for a given Edje object.
186
187 This call will trigger an internal recalculation of all parts of
188 the object, in order to return its minimum required dimensions for
189 width and height. The user might choose to impose those minimum
190 sizes, making the resulting calculation to get to values equal or
191 larger than $restrictedw and $restrictedh, for width and height,
192 respectively.
193
194 Note: At the end of this call, the object won't be automatically
195 resized to the new dimensions, but just return the calculated sizes.
196 The caller is the one up to change its geometry or not.
197
198 Warning: Be advised that invisible parts in the object will be taken
199 into account in this calculation.
200 ]]
201 // FIXME: Return a 2D size type (no @out values)
202 params {
203 @out minw: int; [[The minimum required width (return value)]]
204 @out minh: int; [[The minimum required height (return value)]]
205 @in restrictedw: int; [[The minimum width constraint as input,
206 $minw can not be lower than this]]
207 @in restrictedh: int; [[The minimum height constraint as input,
208 $minh can not be lower than this]]
209 }
210 }
211 // FIXME: Prefix with calc_ ?
212 parts_extends_calc {
213 [[Calculates the geometry of the region, relative to a given Edje
214 object's area, occupied by all parts in the object.
215
216 This function gets the geometry of the rectangle equal to the area
217 required to group all parts in obj's group/collection. The x
218 and y coordinates are relative to the top left corner of the
219 whole obj object's area. Parts placed out of the group's
220 boundaries will also be taken in account, so that x and y
221 may be negative.
222
223 Note: On failure, this function will make all non-$null geometry
224 pointers' pointed variables be set to zero.
225 ]]
226 return: bool; [[$true on success, $false otherwise]]
227 /* FIXME: Return a 2D size type (no @out values) */
228 params {
229 @out x: int; [[The parts region's X coordinate]]
230 @out y: int; [[The parts region's Y coordinate]]
231 @out w: int; [[The parts region's width]]
232 @out h: int; [[The parts region's height]]
233 }
234 }
235 calc_force {
236 [[Forces a Size/Geometry calculation.
237
238 Forces the object to recalculate its layout regardless of
239 freeze/thaw.
240
241 See also @.calc_freeze and @.calc_thaw.
242 ]]
243 }
244 calc_freeze {
245 [[Freezes the Edje object.
246
247 This function puts all changes on hold. Successive freezes will
248 nest, requiring an equal number of thaws.
249
250 See also @.calc_thaw()
251 ]]
252 return: int; [[The frozen state or 0 on error]]
253 legacy: edje_object_freeze;
254 }
255 calc_thaw {
256 [[Thaws the Edje object.
257
258 This function thaws the given Edje object.
259
260 Note: If sucessive freezes were done, an equal number of thaws will
261 be required.
262
263 See also @.calc_freeze()
264 ]]
265 return: int; [[The frozen state or 0 if the object is not frozen or on error.]]
266 legacy: edje_object_thaw;
267 }
268 /* EDJE CALC APIS END ------------------------------------------------ */
269
270 /* EDJE GROUP DATA APIS BEGIN ---------------------------------------- */ 143 /* EDJE GROUP DATA APIS BEGIN ---------------------------------------- */
271 @property group_size_min { 144 @property group_size_min {
272 get { 145 get {
@@ -1180,6 +1053,13 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
1180 Efl.Canvas.Object.no_render { set; } 1053 Efl.Canvas.Object.no_render { set; }
1181 Efl.Canvas.Object.paragraph_direction { set; } 1054 Efl.Canvas.Object.paragraph_direction { set; }
1182 Efl.Canvas.Group.group_calculate; 1055 Efl.Canvas.Group.group_calculate;
1056 Efl.Canvas.Layout_Calc.calc_auto_update_hints { get; set; }
1057 Efl.Canvas.Layout_Calc.calc_size_min;
1058 Efl.Canvas.Layout_Calc.calc_size_min_restricted;
1059 Efl.Canvas.Layout_Calc.calc_parts_extends;
1060 Efl.Canvas.Layout_Calc.calc_freeze;
1061 Efl.Canvas.Layout_Calc.calc_thaw;
1062 Efl.Canvas.Layout_Calc.calc_force;
1183 Efl.Ui.Base.mirrored { set; get; } 1063 Efl.Ui.Base.mirrored { set; get; }
1184 Efl.Ui.Base.language { set; get; } 1064 Efl.Ui.Base.language { set; get; }
1185 Efl.Ui.Base.scale { set; get; } 1065 Efl.Ui.Base.scale { set; get; }
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index af7075208f..26b85ee19f 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -40,6 +40,7 @@
40#endif 40#endif
41 41
42#define EFL_CANVAS_OBJECT_PROTECTED 42#define EFL_CANVAS_OBJECT_PROTECTED
43#define EFL_CANVAS_LAYOUT_CALC_PROTECTED
43 44
44#include <Eina.h> 45#include <Eina.h>
45#include <Eet.h> 46#include <Eet.h>
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 070efff883..4a6a76bbca 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -561,3 +561,4 @@ _edje_object_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object *obs,
561 EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _edje_object_efl_object_dbg_info_get) 561 EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _edje_object_efl_object_dbg_info_get)
562 562
563#include "edje_object.eo.c" 563#include "edje_object.eo.c"
564#include "efl_canvas_layout_calc.eo.c"
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index 0829a803de..8b75432981 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -463,7 +463,7 @@ _edje_object_group_data_get(Eo *obj EINA_UNUSED, Edje *ed, const char *key)
463} 463}
464 464
465EOLIAN int 465EOLIAN int
466_edje_object_calc_freeze(Eo *obj EINA_UNUSED, Edje *ed) 466_edje_object_efl_canvas_layout_calc_calc_freeze(Eo *obj EINA_UNUSED, Edje *ed)
467{ 467{
468 unsigned short i; 468 unsigned short i;
469 469
@@ -481,7 +481,7 @@ _edje_object_calc_freeze(Eo *obj EINA_UNUSED, Edje *ed)
481} 481}
482 482
483EOLIAN int 483EOLIAN int
484_edje_object_calc_thaw(Eo *obj EINA_UNUSED, Edje *ed) 484_edje_object_efl_canvas_layout_calc_calc_thaw(Eo *obj EINA_UNUSED, Edje *ed)
485{ 485{
486 unsigned short i; 486 unsigned short i;
487 487
@@ -3143,7 +3143,7 @@ _edje_object_group_size_max_get(Eo *obj EINA_UNUSED, Edje *ed EINA_UNUSED, Evas_
3143} 3143}
3144 3144
3145EOLIAN void 3145EOLIAN void
3146_edje_object_calc_force(Eo *obj EINA_UNUSED, Edje *ed) 3146_edje_object_efl_canvas_layout_calc_calc_force(Eo *obj EINA_UNUSED, Edje *ed)
3147{ 3147{
3148 int pf, pf2; 3148 int pf, pf2;
3149 3149
@@ -3166,13 +3166,13 @@ _edje_object_calc_force(Eo *obj EINA_UNUSED, Edje *ed)
3166} 3166}
3167 3167
3168EOLIAN void 3168EOLIAN void
3169_edje_object_size_min_calc(Eo *obj, Edje *_pd EINA_UNUSED, Evas_Coord *minw, Evas_Coord *minh) 3169_edje_object_efl_canvas_layout_calc_calc_size_min(Eo *obj, Edje *_pd EINA_UNUSED, Evas_Coord *minw, Evas_Coord *minh)
3170{ 3170{
3171 edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0); 3171 edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0);
3172} 3172}
3173 3173
3174EOLIAN Eina_Bool 3174EOLIAN Eina_Bool
3175_edje_object_parts_extends_calc(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) 3175_edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
3176{ 3176{
3177 Evas_Coord xx1 = INT_MAX, yy1 = INT_MAX; 3177 Evas_Coord xx1 = INT_MAX, yy1 = INT_MAX;
3178 Evas_Coord xx2 = 0, yy2 = 0; 3178 Evas_Coord xx2 = 0, yy2 = 0;
@@ -3223,7 +3223,7 @@ _edje_object_parts_extends_calc(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *x, Ev
3223} 3223}
3224 3224
3225EOLIAN void 3225EOLIAN void
3226_edje_object_size_min_restricted_calc(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh) 3226_edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh)
3227{ 3227{
3228 const int CALC_COUNT_LIMIT = 255; 3228 const int CALC_COUNT_LIMIT = 255;
3229 3229
@@ -4854,7 +4854,7 @@ _edje_object_preload(Eo *obj, Edje *ed, Eina_Bool cancel)
4854} 4854}
4855 4855
4856EOLIAN void 4856EOLIAN void
4857_edje_object_calc_update_hints_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool update) 4857_edje_object_efl_canvas_layout_calc_calc_auto_update_hints_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool update)
4858{ 4858{
4859 if (!ed) return; 4859 if (!ed) return;
4860 if (ed->update_hints == !!update) return; 4860 if (ed->update_hints == !!update) return;
@@ -4868,7 +4868,7 @@ _edje_object_calc_update_hints_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool upda
4868} 4868}
4869 4869
4870EOLIAN Eina_Bool 4870EOLIAN Eina_Bool
4871_edje_object_calc_update_hints_get(Eo *obj EINA_UNUSED, Edje *ed) 4871_edje_object_efl_canvas_layout_calc_calc_auto_update_hints_get(Eo *obj EINA_UNUSED, Edje *ed)
4872{ 4872{
4873 return ed->update_hints; 4873 return ed->update_hints;
4874} 4874}
diff --git a/src/lib/edje/efl_canvas_layout_calc.eo b/src/lib/edje/efl_canvas_layout_calc.eo
new file mode 100644
index 0000000000..17cb5c1060
--- /dev/null
+++ b/src/lib/edje/efl_canvas_layout_calc.eo
@@ -0,0 +1,131 @@
1interface Efl.Canvas.Layout_Calc
2{
3 [[This interface defines a common set of APIs used to trigger calculations
4 with layout objects.
5
6 This defines all the APIs supported by legacy "Edje" object, known in EO
7 API as Efl.Canvas.Layout.
8
9 @since 1.21
10 ]]
11 methods {
12 @property calc_auto_update_hints {
13 [[Whether this object updates its size hints automatically.
14
15 By default edje doesn't set size hints on itself. If this property
16 is set to $true, size hints will be updated after recalculation.
17 Be careful, as recalculation may happen often, enabling this
18 property may have a considerable performance impact as other widgets
19 will be notified of the size hints changes.
20
21 A layout recalculation can be triggered by @.calc_size_min(),
22 @.calc_size_min_restricted(), @.calc_parts_extends() or even any
23 other internal event.
24 ]]
25 set {
26 [[Enable or disable auto-update of size hints.]]
27 }
28 get {
29 [[Whether this object updates its size hints automatically.]]
30 }
31 values {
32 update: bool(false); [[Whether or not update the size hints.]]
33 }
34 }
35 calc_size_min {
36 [[Calculates the minimum required size for a given Edje object.
37
38 This call works exactly as edje_object_size_min_restricted_calc(),
39 with the last two arguments set to 0. Please refer to its
40 documentation, then.
41 ]]
42 // FIXME: Return a 2D size type (no @out values)
43 params {
44 @out minw: int; [[The minimum required width (return value)]]
45 @out minh: int; [[The minimum required height (return value)]]
46 }
47 }
48 calc_size_min_restricted {
49 [[Calculates the minimum required size for a given layout object.
50
51 This call will trigger an internal recalculation of all parts of
52 the object, in order to return its minimum required dimensions for
53 width and height. The user might choose to impose those minimum
54 sizes, making the resulting calculation to get to values equal or
55 larger than $restrictedw and $restrictedh, for width and height,
56 respectively.
57
58 Note: At the end of this call, the object won't be automatically
59 resized to the new dimensions, but just return the calculated sizes.
60 The caller is the one up to change its geometry or not.
61
62 Warning: Be advised that invisible parts in the object will be taken
63 into account in this calculation.
64 ]]
65 // FIXME: Return a 2D size type (no @out values)
66 params {
67 @out minw: int; [[The minimum required width (return value)]]
68 @out minh: int; [[The minimum required height (return value)]]
69 @in restrictedw: int @optional; [[The minimum width constraint as
70 input, $minw can not be lower than this]]
71 @in restrictedh: int @optional; [[The minimum height constraint as
72 input, $minh can not be lower than this]]
73 }
74 }
75 calc_parts_extends {
76 [[Calculates the geometry of the region, relative to a given layout
77 object's area, occupied by all parts in the object.
78
79 This function gets the geometry of the rectangle equal to the area
80 required to group all parts in obj's group/collection. The x
81 and y coordinates are relative to the top left corner of the
82 whole obj object's area. Parts placed out of the group's
83 boundaries will also be taken in account, so that x and y
84 may be negative.
85
86 Note: On failure, this function will make all non-$null geometry
87 pointers' pointed variables be set to zero.
88 ]]
89 return: bool; [[$true on success, $false otherwise]]
90 /* FIXME: Return a 2D size type (no @out values) */
91 params {
92 @out x: int; [[The parts region's X coordinate]]
93 @out y: int; [[The parts region's Y coordinate]]
94 @out w: int; [[The parts region's width]]
95 @out h: int; [[The parts region's height]]
96 }
97 }
98 calc_freeze {
99 [[Freezes the layout object.
100
101 This function puts all changes on hold. Successive freezes will
102 nest, requiring an equal number of thaws.
103
104 See also @.calc_thaw.
105 ]]
106 return: int; [[The frozen state or 0 on error]]
107 }
108 calc_thaw {
109 [[Thaws the layout object.
110
111 This function thaws (in other words "unfreezes") the given layout
112 object.
113
114 Note: If sucessive freezes were done, an equal number of thaws will
115 be required.
116
117 See also @.calc_freeze.
118 ]]
119 return: int; [[The frozen state or 0 if the object is not frozen or on error.]]
120 }
121 calc_force @protected {
122 [[Forces a Size/Geometry calculation.
123
124 Forces the object to recalculate its layout regardless of
125 freeze/thaw. This API should be used carefully.
126
127 See also @.calc_freeze and @.calc_thaw.
128 ]]
129 }
130 }
131}