elm box -> use padding!

SVN revision: 59699
This commit is contained in:
Carsten Haitzler 2011-05-26 09:22:43 +00:00
parent 517f5c3d52
commit 322b55133d
2 changed files with 16 additions and 4 deletions

View File

@ -77,7 +77,8 @@ test_box_vert2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
bx = elm_box_add(win);
elm_win_resize_object_add(win, bx);
evas_object_size_hint_weight_set(bx, 0.0, 0.0);
elm_box_padding_set(bx, 10, 10);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bx);
bt = elm_button_add(win);
@ -188,8 +189,8 @@ _test_box_transition_change(void *data)
if (!data) return;
next_layout = eina_list_data_get(tdata->transitions);
layout_data = elm_box_transition_new(2.0, tdata->last_layout,
NULL, NULL, next_layout, NULL, NULL,
_test_box_transition_change, tdata);
NULL, NULL, next_layout, NULL, NULL,
_test_box_transition_change, tdata);
elm_box_layout_set(tdata->box, elm_box_layout_transition, layout_data, elm_box_transition_free);
tdata->last_layout = next_layout;
@ -200,8 +201,9 @@ static void
_win_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Transitions_Data *tdata = data;
if (!data) return;
elm_box_layout_set(tdata->box, evas_object_box_layout_horizontal, NULL, NULL);
free(data);
free(tdata);
}
void

View File

@ -7,6 +7,7 @@ _smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int horiz
Evas_Coord minw, minh, mnw, mnh;
const Eina_List *l;
Evas_Object_Box_Option *opt;
int c;
/* FIXME: need to calc max */
minw = 0;
@ -41,6 +42,12 @@ _smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int horiz
}
}
}
c = eina_list_count(priv->children) - 1;
if (c > 0)
{
if (horizontal) minw += priv->pad.h * c;
else minh += priv->pad.v * c;
}
evas_object_size_hint_min_set(box, minw, minh);
}
@ -62,6 +69,7 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int
evas_object_size_hint_min_get(o, &minw, &minh);
evas_object_size_hint_align_get(o, &ax, &ay);
count = eina_list_count(priv->children);
if (w < minw)
{
x = x + ((w - minw) * (1.0 - ax));
@ -153,6 +161,7 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int
yy + (Evas_Coord)(((double)(hh - oh)) * ay));
evas_object_resize(obj, ow, oh);
xx += ww;
xx += priv->pad.h;
}
else
{
@ -185,6 +194,7 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, int horizontal, int
yy + (Evas_Coord)(((double)(hh - oh)) * ay));
evas_object_resize(obj, ow, oh);
yy += hh;
yy += priv->pad.v;
}
}
}