1 #include <Elementary.h>
5 _smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int horizontal, int homogeneous)
7 Evas_Coord minw, minh, mnw, mnh;
9 Evas_Object_Box_Option *opt;
11 /* FIXME: need to calc max */
16 EINA_LIST_FOREACH(priv->children, l, opt)
18 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh);
19 if (minh < mnh) minh = mnh;
20 if (minw < mnw) minw = mnw;
23 minw *= eina_list_count(priv->children);
25 minh *= eina_list_count(priv->children);
29 EINA_LIST_FOREACH(priv->children, l, opt)
31 evas_object_size_hint_min_get(opt->obj, &mnw, &mnh);
34 if (minh < mnh) minh = mnh;
39 if (minw < mnw) minw = mnw;
44 evas_object_size_hint_min_set(box, minw, minh);
48 _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int homogeneous, int rtl)
50 Evas_Coord x, y, w, h, xx, yy;
53 Evas_Coord minw, minh, wdif, hdif;
54 int count = 0, expand = 0;
56 Evas_Object_Box_Option *opt;
58 _smart_extents_calculate(o, priv, horizontal, homogeneous);
60 evas_object_geometry_get(o, &x, &y, &w, &h);
62 evas_object_size_hint_min_get(o, &minw, &minh);
63 evas_object_size_hint_align_get(o, &ax, &ay);
64 count = eina_list_count(priv->children);
67 x = x + ((w - minw) * (1.0 - ax));
72 y = y + ((h - minh) * (1.0 - ay));
75 EINA_LIST_FOREACH(priv->children, l, opt)
79 evas_object_size_hint_weight_get(opt->obj, &wx, &wy);
82 if (wx > 0.0) expand++;
86 if (wy > 0.0) expand++;
91 evas_object_size_hint_align_get(o, &ax, &ay);
94 x += (double)(w - minw) * ax;
99 y += (double)(h - minh) * ay;
107 EINA_LIST_FOREACH(priv->children, l, opt)
109 Evas_Coord mnw, mnh, mxw, mxh;
114 evas_object_size_hint_align_get(obj, &ax, &ay);
115 evas_object_size_hint_weight_get(obj, &wx, &wy);
116 evas_object_size_hint_min_get(obj, &mnw, &mnh);
117 evas_object_size_hint_max_get(obj, &mxw, &mxh);
120 if (ax == -1.0) {fw = 1; ax = 0.5;}
121 if (ay == -1.0) {fh = 1; ay = 0.5;}
122 if (wx > 0.0) xw = 1;
123 if (wy > 0.0) xh = 1;
126 Evas_Coord ww, hh, ow, oh;
130 ww = (w / (Evas_Coord)count);
135 if ((expand > 0) && (xw))
137 if (expand == 1) ow = wdif;
138 else ow = (w - minw) / expand;
146 if ((mxw >= 0) && (mxw < ow)) ow = mxw;
149 if ((mxh >= 0) && (mxh < oh)) oh = mxh;
150 evas_object_move(obj,
151 ((!rtl) ? (xx) : (x + (w - (xx - x) - ww)))
152 + (Evas_Coord)(((double)(ww - ow)) * ax),
153 yy + (Evas_Coord)(((double)(hh - oh)) * ay));
154 evas_object_resize(obj, ow, oh);
159 Evas_Coord ww, hh, ow, oh;
163 hh = (h / (Evas_Coord)count);
168 if ((expand > 0) && (xh))
170 if (expand == 1) oh = hdif;
171 else oh = (h - minh) / expand;
179 if ((mxw >= 0) && (mxw < ow)) ow = mxw;
182 if ((mxh >= 0) && (mxh < oh)) oh = mxh;
183 evas_object_move(obj,
184 xx + (Evas_Coord)(((double)(ww - ow)) * ax),
185 yy + (Evas_Coord)(((double)(hh - oh)) * ay));
186 evas_object_resize(obj, ow, oh);