_on_child_resize(void *data, Evas *evas __UNUSED__, Evas_Object *o __UNUSED__, void *einfo __UNUSED__)
{
Evas_Object *box = data;
- evas_object_smart_changed(box);
+ EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(box, priv);
+ if (!priv->layouting) evas_object_smart_changed(box);
}
static void
_on_child_hints_changed(void *data, Evas *evas __UNUSED__, Evas_Object *o __UNUSED__, void *einfo __UNUSED__)
{
Evas_Object *box = data;
- evas_object_smart_changed(box);
+ EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(box, priv);
+ if (!priv->layouting) evas_object_smart_changed(box);
}
static Evas_Object_Box_Option *
{
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(o, priv);
if (priv->layout.cb)
- priv->layout.cb(o, priv, priv->layout.data);
+ {
+ priv->layouting = 1;
+ priv->layout.cb(o, priv, priv->layout.data);
+ priv->layouting = 0;
+ }
else
ERR("No layout function set for %p box.", o);
}
{
if (align >= 0.0)
{
+ *new_dim = dim;
*offset = (space_sz - (dim + pad_before + pad_after)) * align
+ pad_before;
}
_layout_set_offset_and_change_dimension_min_max_cell_bounded(int dim, int *new_dim, int min_dim, int max_dim, int cell_sz, int *offset, double align, int pad_before, int pad_after)
{
if (align >= 0.0)
- *offset = (cell_sz - (dim + pad_before + pad_after)) * align
- + pad_before;
+ {
+ *new_dim = dim;
+ *offset =
+ (cell_sz - (dim + pad_before + pad_after)) * align + pad_before;
+ }
else
{
*offset = pad_before;
- _layout_dimension_change_min_max_cell_bound(
- dim, new_dim, min_dim, max_dim, cell_sz - pad_before - pad_after);
+ _layout_dimension_change_min_max_cell_bound
+ (dim, new_dim, min_dim, max_dim, cell_sz - pad_before - pad_after);
}
}
+static void
+_sizing_eval(Evas_Object *obj)
+{
+ Evas_Coord minw, minh, maxw, maxh;
+ Evas_Coord w, h;
+
+ evas_object_size_hint_min_get(obj, &minw, &minh);
+ evas_object_size_hint_max_get(obj, &maxw, &maxh);
+ evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+
+ if (w < minw) w = minw;
+ if (h < minh) h = minh;
+ if ((maxw >= 0) && (w > maxw)) w = maxw;
+ if ((maxh >= 0) && (h > maxh)) h = maxh;
+
+ evas_object_resize(obj, w, h);
+}
+
static int
_evas_object_box_layout_horizontal_weight_apply(Evas_Object_Box_Data *priv, Evas_Object_Box_Option **objects, int n_objects, int remaining, int weight_total)
{
evas_object_geometry_get(o, NULL, NULL, NULL, &h);
- if (remaining < 0)
+ if (remaining <= 0)
{
int min_w;
* resized bounded to a minimum or maximum size, their size hint
* properties must be set (by the
* evas_object_size_hint_{min,max}_set() functions.
- *
- * @todo consider aspect hint and respect it.
*/
void
evas_object_box_layout_horizontal(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
int padding_l, padding_r;
double weight_x;
+ _sizing_eval(opt->obj);
evas_object_size_hint_weight_get(opt->obj, &weight_x, NULL);
evas_object_size_hint_padding_get
(opt->obj, &padding_l, &padding_r, NULL, NULL);
sub_pixel -= 1 << 16;
}
}
+
evas_object_size_hint_min_set(o, req_w, top_h);
}
evas_object_geometry_get(o, NULL, NULL, &w, NULL);
- if (remaining < 0)
+ if (remaining <= 0)
{
int min_h;
* This function behaves analogously to
* evas_object_box_layout_horizontal(). The description of its
* behaviour can be derived from that function's documentation.
- *
- * @todo consider aspect hint and respect it.
*/
void
evas_object_box_layout_vertical(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
int padding_t, padding_b;
double weight_y;
+ _sizing_eval(opt->obj);
evas_object_size_hint_weight_get(opt->obj, NULL, &weight_y);
evas_object_size_hint_padding_get
(opt->obj, NULL, NULL, &padding_t, &padding_b);
sub_pixel -= 1 << 16;
}
}
+
evas_object_size_hint_min_set(o, top_w, req_h);
}
* value of -1.0 to @c align_y makes the box try to resize this child
* element to the exact height of its parent (respecting the max hint
* on the child's height).
- *
- * @todo consider aspect hint and respect it.
*/
void
evas_object_box_layout_homogeneous_horizontal(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
evas_object_size_hint_max_get(opt->obj, &max_w, &max_h);
evas_object_size_hint_min_get(opt->obj, &min_w, NULL);
+ _sizing_eval(opt->obj);
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h);
new_w = child_w;
sub_pixel -= 1 << 16;
}
}
+
evas_object_size_hint_min_set(o, w, h);
}
* This function behaves analogously to
* evas_object_box_layout_homogeneous_horizontal(). The description
* of its behaviour can be derived from that function's documentation.
- *
- * @todo consider aspect hint and respect it.
*/
void
evas_object_box_layout_homogeneous_vertical(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
evas_object_size_hint_max_get(opt->obj, &max_w, &max_h);
evas_object_size_hint_min_get(opt->obj, NULL, &min_h);
+ _sizing_eval(opt->obj);
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h);
new_w = child_w;
new_h = child_h;
sub_pixel -= 1 << 16;
}
}
+
evas_object_size_hint_min_set(o, w, h);
}
* value of -1.0 to @c align_y makes the box try to resize this child
* element to the exact height of its parent (respecting the max hint
* on the child's height).
- *
- * @todo consider aspect hint and respect it.
*/
void
evas_object_box_layout_homogeneous_max_size_horizontal(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
{
int child_w, padding_l, padding_r;
+ _sizing_eval(opt->obj);
evas_object_size_hint_padding_get
(opt->obj, &padding_l, &padding_r, NULL, NULL);
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, NULL);
sub_pixel -= 1 << 16;
}
}
+
evas_object_size_hint_min_set(o, x, top_h);
}
* evas_object_box_layout_homogeneous_max_size_horizontal(). The
* description of its behaviour can be derived from that function's
* documentation.
- *
- * @todo consider aspect hint and respect it.
*/
void
evas_object_box_layout_homogeneous_max_size_vertical(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
{
int child_h, padding_t, padding_b;
+ _sizing_eval(opt->obj);
evas_object_size_hint_padding_get
(opt->obj, NULL, NULL, &padding_t, &padding_b);
evas_object_geometry_get(opt->obj, NULL, NULL, NULL, &child_h);
sub_pixel -= 1 << 16;
}
}
+
evas_object_size_hint_min_set(o, top_w, y);
}
evas_object_size_hint_padding_get
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b);
- evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h);
+ _sizing_eval(opt->obj);
+ evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h);
child_w += padding_l + padding_r + priv->pad.h;
child_h += padding_t + padding_b;
*row_count = n_rows;
*off_y_ret = off_y;
*max_h_ret = max_h;
-
- //TODO set size hints
- //evas_object_size_hint_min_set(o, w,h);
}
/**
* row justifying) of setting space between rows. Note, however, that
* @c align_y dictates positioning relative to the *largest height*
* required by a child object in the actual row.
- *
- * @todo consider aspect hint and respect it.
*/
void
evas_object_box_layout_flow_horizontal(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
evas_object_size_hint_padding_get
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b);
+ _sizing_eval(opt->obj);
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h);
child_w += padding_l + padding_r;
*col_count = n_cols;
*off_x_ret = off_x;
*max_w_ret = max_w;
-
- //TODO set size hints
- //evas_object_size_hint_min_set(o, w,h);
}
/**
* This function behaves analogously to
* evas_object_box_layout_flow_horizontal(). The description of its
* behaviour can be derived from that function's documentation.
- *
- * @todo consider aspect hint and respect it.
*/
void
evas_object_box_layout_flow_vertical(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
* (respecting the min and max hints on the child's width *and*
* accounting its horizontal padding properties). Same applies to
* vertical axis.
- *
- * @todo consider aspect hint and respect it.
*/
void
evas_object_box_layout_stack(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__)
evas_object_size_hint_max_get(child, &max_w, &max_h);
evas_object_size_hint_min_get(child, &min_w, &min_h);
- evas_object_geometry_get(child, NULL, NULL, &child_w, &child_h);
+ _sizing_eval(opt->obj);
+ evas_object_geometry_get(child, NULL, NULL, &child_w, &child_h);
new_w = child_w;
new_h = child_h;
if (new_w > top_w) top_w = new_w;
evas_object_stack_above(child, old_child);
old_child = child;
}
+
evas_object_size_hint_min_set(o, top_w, top_h);
}