summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJee-Yong Um <jc9.um@samsung.com>2016-02-12 20:45:20 +0100
committerCedric BAIL <cedric@osg.samsung.com>2016-02-12 20:45:28 +0100
commit92d905ffa0e9c5b2f5b01885856349a010b49ee4 (patch)
treeecbe7841cbcdcd40d43baa4cfbfc5469e4ecbf57
parenta3e66305d7601fa4a62629ec2ceb29a1af274915 (diff)
box: add support size hint padding
Summary: This patch adds suppoting size hint padding for elm_box. Reviewers: raster, cedric, Hermet Subscribers: cedric, kimcinoo Differential Revision: https://phab.enlightenment.org/D3500 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/els_box.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/lib/els_box.c b/src/lib/els_box.c
index 40b0c67a0..1499c0b2c 100644
--- a/src/lib/els_box.c
+++ b/src/lib/els_box.c
@@ -105,6 +105,7 @@ _smart_extents_non_homogeneous_calc(Evas_Object_Box_Data *priv, int w, int h, in
105 const Eina_List *l; 105 const Eina_List *l;
106 Evas_Object_Box_Option *opt; 106 Evas_Object_Box_Option *opt;
107 int mnw, mnh, mxw, mxh, cminw, cminh; 107 int mnw, mnh, mxw, mxh, cminw, cminh;
108 Evas_Coord pad_l, pad_r, pad_t, pad_b;
108 Evas_Coord *rw, *rh, *rxw, *rxh, *rminw, *rminh, *rmaxw, *rmaxh; 109 Evas_Coord *rw, *rh, *rxw, *rxh, *rminw, *rminh, *rmaxw, *rmaxh;
109 Eina_Bool max = EINA_TRUE, asp = EINA_FALSE; 110 Eina_Bool max = EINA_TRUE, asp = EINA_FALSE;
110 111
@@ -146,7 +147,10 @@ _smart_extents_non_homogeneous_calc(Evas_Object_Box_Data *priv, int w, int h, in
146 else 147 else
147 rrw = &oh, rrh = &ow; 148 rrw = &oh, rrh = &ow;
148 149
150 evas_object_size_hint_padding_get(opt->obj, &pad_l, &pad_r, &pad_t, &pad_b);
149 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh); 151 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh);
152 mnw += pad_l + pad_r;
153 mnh += pad_t + pad_b;
150 if (*rminw < *rw) *rminw = *rw; 154 if (*rminw < *rw) *rminw = *rw;
151 *rminh += *rh; 155 *rminh += *rh;
152 156
@@ -160,6 +164,8 @@ _smart_extents_non_homogeneous_calc(Evas_Object_Box_Data *priv, int w, int h, in
160 asp |= !!aspect; 164 asp |= !!aspect;
161 165
162 evas_object_size_hint_max_get(opt->obj, &mxw, &mxh); 166 evas_object_size_hint_max_get(opt->obj, &mxw, &mxh);
167 if (mxw >= 0) mxw += pad_l + pad_r;
168 if (mxh >= 0) mxh += pad_t + pad_b;
163 if (*rxh < 0) 169 if (*rxh < 0)
164 { 170 {
165 *rmaxh = -1; 171 *rmaxh = -1;
@@ -221,6 +227,7 @@ static void
221_smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int w, int h, double expand, Eina_Bool horizontal, Eina_Bool homogeneous) 227_smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int w, int h, double expand, Eina_Bool horizontal, Eina_Bool homogeneous)
222{ 228{
223 Evas_Coord minw, minh, mnw, mnh, maxw, maxh; 229 Evas_Coord minw, minh, mnw, mnh, maxw, maxh;
230 Evas_Coord pad_l, pad_r, pad_t, pad_b;
224 const Eina_List *l; 231 const Eina_List *l;
225 Evas_Object_Box_Option *opt; 232 Evas_Object_Box_Option *opt;
226 int c; 233 int c;
@@ -245,7 +252,10 @@ _smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int w, in
245 if (ax < 0) fw = 1; 252 if (ax < 0) fw = 1;
246 if (ay < 0) fh = 1; 253 if (ay < 0) fh = 1;
247 254
255 evas_object_size_hint_padding_get(opt->obj, &pad_l, &pad_r, &pad_t, &pad_b);
248 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh); 256 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh);
257 mnw += pad_l + pad_r;
258 mnh += pad_t + pad_b;
249 if (minh < mnh) minh = mnh; 259 if (minh < mnh) minh = mnh;
250 if (minw < mnw) minw = mnw; 260 if (minw < mnw) minw = mnw;
251 261
@@ -267,11 +277,13 @@ _smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int w, in
267 evas_object_size_hint_max_get(opt->obj, &mnw, &mnh); 277 evas_object_size_hint_max_get(opt->obj, &mnw, &mnh);
268 if (mnh >= 0) 278 if (mnh >= 0)
269 { 279 {
280 if (mnh >= 0) mnh += pad_t + pad_b;
270 if (maxh == -1) maxh = mnh; 281 if (maxh == -1) maxh = mnh;
271 else if (maxh > mnh) maxh = mnh; 282 else if (maxh > mnh) maxh = mnh;
272 } 283 }
273 if (mnw >= 0) 284 if (mnw >= 0)
274 { 285 {
286 if (mnw >= 0) mnw += pad_l + pad_r;
275 if (maxw == -1) maxw = mnw; 287 if (maxw == -1) maxw = mnw;
276 else if (maxw > mnw) maxw = mnw; 288 else if (maxw > mnw) maxw = mnw;
277 } 289 }
@@ -392,6 +404,7 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal
392 EINA_LIST_FOREACH(priv->children, l, opt) 404 EINA_LIST_FOREACH(priv->children, l, opt)
393 { 405 {
394 Evas_Coord mnw, mnh, mxw, mxh; 406 Evas_Coord mnw, mnh, mxw, mxh;
407 Evas_Coord pad_l, pad_r, pad_t, pad_b;
395 int fw, fh, xw, xh;//fillw, fillw, expandw, expandh 408 int fw, fh, xw, xh;//fillw, fillw, expandw, expandh
396 Evas_Aspect_Control aspect = EVAS_ASPECT_CONTROL_NONE; 409 Evas_Aspect_Control aspect = EVAS_ASPECT_CONTROL_NONE;
397 int asx, asy; 410 int asx, asy;
@@ -399,8 +412,13 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal
399 obj = opt->obj; 412 obj = opt->obj;
400 evas_object_size_hint_align_get(obj, &ax, &ay); 413 evas_object_size_hint_align_get(obj, &ax, &ay);
401 evas_object_size_hint_weight_get(obj, &wx, &wy); 414 evas_object_size_hint_weight_get(obj, &wx, &wy);
415 evas_object_size_hint_padding_get(obj, &pad_l, &pad_r, &pad_t, &pad_b);
402 evas_object_size_hint_min_get(obj, &mnw, &mnh); 416 evas_object_size_hint_min_get(obj, &mnw, &mnh);
417 mnw += pad_l + pad_r;
418 mnh += pad_t + pad_b;
403 evas_object_size_hint_max_get(obj, &mxw, &mxh); 419 evas_object_size_hint_max_get(obj, &mxw, &mxh);
420 if (mxw >= 0) mxw += pad_l + pad_r;
421 if (mxh >= 0) mxh += pad_t + pad_b;
404 evas_object_size_hint_aspect_get(obj, &aspect, &asx, &asy); 422 evas_object_size_hint_aspect_get(obj, &aspect, &asx, &asy);
405 if (aspect && ((asx < 1) || (asy < 1))) 423 if (aspect && ((asx < 1) || (asy < 1)))
406 aspect = EVAS_ASPECT_CONTROL_NONE; 424 aspect = EVAS_ASPECT_CONTROL_NONE;
@@ -438,9 +456,11 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal
438 if (xw && aspect && (!homogeneous)) 456 if (xw && aspect && (!homogeneous))
439 ww = ow; 457 ww = ow;
440 evas_object_move(obj, 458 evas_object_move(obj,
441 ((!rtl) ? (xx) : (x + (w - (xx - x) - ww))) 459 ((!rtl) ? (xx + pad_l) : (x + (w - (xx - x) - ww) + pad_r))
442 + (Evas_Coord)(((double)(ww - ow)) * ax), 460 + (Evas_Coord)(((double)(ww - ow)) * ax),
443 yy + (Evas_Coord)(((double)(hh - oh)) * ay)); 461 yy + (Evas_Coord)(((double)(hh - oh)) * ay) + pad_t);
462 ow -= pad_l + pad_r;
463 oh -= pad_t + pad_b;
444 evas_object_resize(obj, ow, oh); 464 evas_object_resize(obj, ow, oh);
445 xx += ww; 465 xx += ww;
446 xx += priv->pad.h; 466 xx += priv->pad.h;
@@ -468,8 +488,10 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal
468 if (xh && aspect && (!homogeneous)) 488 if (xh && aspect && (!homogeneous))
469 hh = oh; 489 hh = oh;
470 evas_object_move(obj, 490 evas_object_move(obj,
471 xx + (Evas_Coord)(((double)(ww - ow)) * ax), 491 xx + (Evas_Coord)(((double)(ww - ow)) * ax) + pad_l,
472 yy + (Evas_Coord)(((double)(hh - oh)) * ay)); 492 yy + (Evas_Coord)(((double)(hh - oh)) * ay) + pad_t);
493 ow -= pad_l + pad_r;
494 oh -= pad_t + pad_b;
473 evas_object_resize(obj, ow, oh); 495 evas_object_resize(obj, ow, oh);
474 yy += hh; 496 yy += hh;
475 yy += priv->pad.v; 497 yy += priv->pad.v;