summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-18 17:01:10 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-18 17:26:53 +0900
commit942cbbed733f4d997e0a175b9e0e2e055a1f75d4 (patch)
treee81ee6aa0b580c2726d53e4bc31d3c58720c28be /src/lib/edje
parentd8eea084fb86514843e64390479c9a6b17bd2e57 (diff)
edje: Use Eina.Size2D for group min & max size
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/Edje_Legacy.h44
-rw-r--r--src/lib/edje/edje_legacy.c18
-rw-r--r--src/lib/edje/edje_private.h2
-rw-r--r--src/lib/edje/edje_util.c50
-rw-r--r--src/lib/edje/efl_canvas_layout_group.eo10
5 files changed, 83 insertions, 41 deletions
diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h
index a1e2ae4742..28c69b6d77 100644
--- a/src/lib/edje/Edje_Legacy.h
+++ b/src/lib/edje/Edje_Legacy.h
@@ -2231,6 +2231,50 @@ EAPI void edje_object_transition_duration_factor_set(Evas_Object *obj, double sc
2231EAPI double edje_object_transition_duration_factor_get(const Evas_Object *obj); 2231EAPI double edje_object_transition_duration_factor_get(const Evas_Object *obj);
2232 2232
2233/** 2233/**
2234 * @brief Gets the minimum size specified -- as an EDC property -- for a given
2235 * Edje object
2236 *
2237 * This function retrieves the obj object's minimum size values, as declared in
2238 * its EDC group definition. For instance, for an Edje object of minimum size
2239 * 100x100 pixels: collections { group { name: "a_group"; min: 100 100; } }
2240 *
2241 * @note If the @c min EDC property was not declared for this object, this call
2242 * will return 0x0.
2243 *
2244 * @note On failure, this function also return 0x0.
2245 *
2246 * See also @ref edje_object_size_max_get.
2247 *
2248 * @param[out] minw Pointer to a variable where to store the minimum width
2249 * @param[out] minh Pointer to a variable where to store the minimum height
2250 *
2251 * @ingroup Edje_Object
2252 */
2253EAPI void edje_object_size_min_get(const Edje_Object *obj, int *minw, int *minh);
2254
2255/**
2256 * @brief Gets the maximum size specified -- as an EDC property -- for a given
2257 * Edje object
2258 *
2259 * This function retrieves the object's maximum size values, as declared in its
2260 * EDC group definition. For instance, for an Edje object of maximum size
2261 * 100x100 pixels: collections { group { name: "a_group"; max: 100 100; } }
2262 *
2263 * @note If the @c max EDC property was not declared for the object, this call
2264 * will return the maximum size a given Edje object may have, for each axis.
2265 *
2266 * @note On failure, this function will return 0x0.
2267 *
2268 * See also @ref edje_object_size_min_get.
2269 *
2270 * @param[out] maxw The maximum width
2271 * @param[out] maxh The maximum height
2272 *
2273 * @ingroup Edje_Object
2274 */
2275EAPI void edje_object_size_max_get(const Edje_Object *obj, int *maxw, int *maxh);
2276
2277/**
2234 * @} 2278 * @}
2235 */ 2279 */
2236#include "edje_object.eo.legacy.h" 2280#include "edje_object.eo.legacy.h"
diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c
index 0756122aa0..25f0a8116f 100644
--- a/src/lib/edje/edje_legacy.c
+++ b/src/lib/edje/edje_legacy.c
@@ -1158,3 +1158,21 @@ edje_object_transition_duration_factor_get(const Evas_Object *obj)
1158 if (speed <= 0.0) speed = 1.0; 1158 if (speed <= 0.0) speed = 1.0;
1159 return 1.0/speed; 1159 return 1.0/speed;
1160} 1160}
1161
1162EAPI void
1163edje_object_size_min_get(const Edje_Object *obj, int *minw, int *minh)
1164{
1165 Eina_Size2D sz;
1166 sz = efl_canvas_layout_group_size_min_get(obj);
1167 if (minw) *minw = sz.w;
1168 if (minh) *minh = sz.h;
1169}
1170
1171EAPI void
1172edje_object_size_max_get(const Edje_Object *obj, int *maxw, int *maxh)
1173{
1174 Eina_Size2D sz;
1175 sz = efl_canvas_layout_group_size_max_get(obj);
1176 if (maxw) *maxw = sz.w;
1177 if (maxh) *maxh = sz.h;
1178}
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index f0e7f00252..090a79f25e 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1114,7 +1114,7 @@ struct _Edje_Part_Collection
1114 int references; 1114 int references;
1115 1115
1116 struct { 1116 struct {
1117 Edje_Size min, max; 1117 Eina_Size2D min, max;
1118 unsigned char orientation; 1118 unsigned char orientation;
1119 } prop; 1119 } prop;
1120 1120
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index 5bf0326d86..701e595364 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -3096,50 +3096,32 @@ _edje_object_efl_part_part(Eo *obj, Edje *ed, const char *part)
3096 return _edje_other_internal_proxy_get(obj, ed, rp); 3096 return _edje_other_internal_proxy_get(obj, ed, rp);
3097} 3097}
3098 3098
3099EOLIAN void 3099EOLIAN Eina_Size2D
3100_edje_object_efl_canvas_layout_group_group_size_min_get(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh) 3100_edje_object_efl_canvas_layout_group_group_size_min_get(Eo *obj EINA_UNUSED, Edje *ed)
3101{ 3101{
3102 if ((!ed) || (!ed->collection)) 3102 if ((!ed) || (!ed->collection))
3103 { 3103 return EINA_SIZE2D(0, 0);
3104 if (minw) *minw = 0; 3104
3105 if (minh) *minh = 0; 3105 return ed->collection->prop.min;
3106 return;
3107 }
3108 if (minw) *minw = ed->collection->prop.min.w;
3109 if (minh) *minh = ed->collection->prop.min.h;
3110} 3106}
3111 3107
3112EOLIAN void 3108EOLIAN Eina_Size2D
3113_edje_object_efl_canvas_layout_group_group_size_max_get(Eo *obj EINA_UNUSED, Edje *ed EINA_UNUSED, Evas_Coord *maxw, Evas_Coord *maxh) 3109_edje_object_efl_canvas_layout_group_group_size_max_get(Eo *obj EINA_UNUSED, Edje *ed EINA_UNUSED)
3114{ 3110{
3111 Eina_Size2D sz;
3112
3115 if ((!ed) || (!ed->collection)) 3113 if ((!ed) || (!ed->collection))
3116 { 3114 return EINA_SIZE2D(0, 0);
3117 if (maxw) *maxw = 0;
3118 if (maxh) *maxh = 0;
3119 return;
3120 }
3121 3115
3122 /* Need to recalc before providing the object. */ 3116 /* Need to recalc before providing the object. */
3123 _edje_recalc_do(ed); 3117 _edje_recalc_do(ed);
3124 3118
3125 if (ed->collection->prop.max.w == 0) 3119 sz = ed->collection->prop.max;
3126 { 3120
3127 /* XXX TODO: convert maxw to 0, fix things that break. */ 3121 /* XXX TODO: use 0 as max, fix things that break. */
3128 if (maxw) *maxw = EDJE_INF_MAX_W; 3122 if (sz.w == 0) sz.w = EDJE_INF_MAX_W;
3129 } 3123 if (sz.h == 0) sz.h = EDJE_INF_MAX_H;
3130 else 3124 return sz;
3131 {
3132 if (maxw) *maxw = ed->collection->prop.max.w;
3133 }
3134 if (ed->collection->prop.max.h == 0)
3135 {
3136 /* XXX TODO: convert maxh to 0, fix things that break. */
3137 if (maxh) *maxh = EDJE_INF_MAX_H;
3138 }
3139 else
3140 {
3141 if (maxh) *maxh = ed->collection->prop.max.h;
3142 }
3143} 3125}
3144 3126
3145EOLIAN void 3127EOLIAN void
diff --git a/src/lib/edje/efl_canvas_layout_group.eo b/src/lib/edje/efl_canvas_layout_group.eo
index 44714bbc8e..3c85ecee82 100644
--- a/src/lib/edje/efl_canvas_layout_group.eo
+++ b/src/lib/edje/efl_canvas_layout_group.eo
@@ -1,3 +1,5 @@
1import eina_types;
2
1interface Efl.Canvas.Layout_Group 3interface Efl.Canvas.Layout_Group
2{ 4{
3 [[APIs representing static data from a group in an edje file. 5 [[APIs representing static data from a group in an edje file.
@@ -27,11 +29,9 @@ interface Efl.Canvas.Layout_Group
27 29
28 See also @.group_size_max. 30 See also @.group_size_max.
29 ]] 31 ]]
30 legacy: edje_object_size_min_get;
31 } 32 }
32 values { 33 values {
33 minw: int; [[Pointer to a variable where to store the minimum width]] 34 min: Eina.Size2D; [[The minimum size as set in EDC.]]
34 minh: int; [[Pointer to a variable where to store the minimum height]]
35 } 35 }
36 } 36 }
37 @property group_size_max { 37 @property group_size_max {
@@ -57,11 +57,9 @@ interface Efl.Canvas.Layout_Group
57 57
58 See also @.group_size_min. 58 See also @.group_size_min.
59 ]] 59 ]]
60 legacy: edje_object_size_max_get;
61 } 60 }
62 values { 61 values {
63 maxw: int; [[The maximum width]] 62 max: Eina.Size2D; [[The maximum size as set in EDC.]]
64 maxh: int; [[The maximum height]]
65 } 63 }
66 } 64 }
67 @property group_data { 65 @property group_data {