evas_object_box.c | evas_object_box.c | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
static const Evas_Smart_Cb_Description _signals[] = | static const Evas_Smart_Cb_Description _signals[] = | |||
{ | { | |||
{SIG_CHILD_ADDED, ""}, | {SIG_CHILD_ADDED, ""}, | |||
{SIG_CHILD_REMOVED, ""}, | {SIG_CHILD_REMOVED, ""}, | |||
{NULL, NULL} | {NULL, NULL} | |||
}; | }; | |||
static void _sizing_eval(Evas_Object *obj); | static void _sizing_eval(Evas_Object *obj); | |||
#define EVAS_OBJECT_BOX_DATA_GET(o, ptr) \ | #define EVAS_OBJECT_BOX_DATA_GET(o, ptr) \ | |||
Evas_Object_Box_Data *ptr = evas_object_smart_data_get(o) | Evas_Object_Box_Data *ptr = evas_object_smart_data_get(o) | |||
#define EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(o, ptr) \ | #define EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(o, ptr) \ | |||
EVAS_OBJECT_BOX_DATA_GET(o, ptr); \ | EVAS_OBJECT_BOX_DATA_GET(o, ptr); \ | |||
if (!ptr) \ | if (!ptr) \ | |||
{ \ | { \ | |||
CRIT("no widget data for object %p (%s)", \ | CRIT("no widget data for object %p (%s)", \ | |||
o, evas_object_type_get(o)); \ | o, evas_object_type_get(o)); \ | |||
fflush(stderr); \ | fflush(stderr); \ | |||
abort(); | return; \ | |||
\ | } | |||
return; \ | ||||
} | #define EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ | |||
EVAS_OBJECT_BOX_DATA_GET(o, ptr); \ | ||||
#define EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ | if (!ptr) \ | |||
EVAS_OBJECT_BOX_DATA_GET(o, ptr); \ | { \ | |||
if (!ptr) \ | CRIT("no widget data for object %p (%s)", \ | |||
{ \ | o, evas_object_type_get(o)); \ | |||
CRIT("no widget data for object %p (%s)", \ | fflush(stderr); \ | |||
o, evas_object_type_get(o)); \ | return val; \ | |||
fflush(stderr); \ | } | |||
abort(); | ||||
\ | ||||
return val; \ | ||||
} | ||||
EVAS_SMART_SUBCLASS_NEW(_evas_object_box_type, _evas_object_box, | EVAS_SMART_SUBCLASS_NEW(_evas_object_box_type, _evas_object_box, | |||
Evas_Object_Box_Api, Evas_Smart_Class, | Evas_Object_Box_Api, Evas_Smart_Class, | |||
evas_object_smart_clipped_class_get, NULL) | evas_object_smart_clipped_class_get, NULL) | |||
static Eina_Bool | static Eina_Bool | |||
_evas_object_box_iterator_next(Evas_Object_Box_Iterator *it, void **data) | _evas_object_box_iterator_next(Evas_Object_Box_Iterator *it, void **data) | |||
{ | { | |||
Evas_Object_Box_Option *opt; | Evas_Object_Box_Option *opt; | |||
if (!eina_iterator_next(it->real_iterator, (void **)&opt)) | if (!eina_iterator_next(it->real_iterator, (void **)&opt)) | |||
return EINA_FALSE; | return EINA_FALSE; | |||
if (data) *data = opt->obj; | if (data) *data = opt->obj; | |||
return EINA_TRUE; | return EINA_TRUE; | |||
skipping to change at line 135 | skipping to change at line 133 | |||
_on_child_del(void *data, Evas *evas __UNUSED__, Evas_Object *o, void *einf o __UNUSED__) | _on_child_del(void *data, Evas *evas __UNUSED__, Evas_Object *o, void *einf o __UNUSED__) | |||
{ | { | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
Evas_Object *box = data; | Evas_Object *box = data; | |||
EVAS_OBJECT_BOX_DATA_GET(box, priv); | EVAS_OBJECT_BOX_DATA_GET(box, priv); | |||
api = priv->api; | api = priv->api; | |||
if ((!api) || (!api->remove)) | if ((!api) || (!api->remove)) | |||
{ | { | |||
ERR("no api->remove"); | ERR("no api->remove"); | |||
return; | return; | |||
} | } | |||
if (!api->remove(box, priv, o)) | if (!api->remove(box, priv, o)) | |||
ERR("child removal failed"); | ERR("child removal failed"); | |||
evas_object_smart_changed(box); | evas_object_smart_changed(box); | |||
} | } | |||
static void | static void | |||
_on_child_hints_changed(void *data, Evas *evas __UNUSED__, Evas_Object *o _ _UNUSED__, void *einfo __UNUSED__) | _on_child_hints_changed(void *data, Evas *evas __UNUSED__, Evas_Object *o _ _UNUSED__, void *einfo __UNUSED__) | |||
{ | { | |||
Evas_Object *box = data; | Evas_Object *box = data; | |||
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(box, priv); | EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(box, priv); | |||
if (!priv->layouting) evas_object_smart_changed(box); | // XXX: this breaks box repacking in elementary. widgets DEPEND on being ab | |||
le | ||||
// to change their hints evenr WHILE being laid out. so comment this out. | ||||
// if (!priv->layouting) | ||||
evas_object_smart_changed(box); | ||||
} | } | |||
static void | static void | |||
_on_hints_changed(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *o , void *einfo __UNUSED__) | _on_hints_changed(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *o , void *einfo __UNUSED__) | |||
{ | { | |||
_sizing_eval(o); | _sizing_eval(o); | |||
} | } | |||
static Evas_Object_Box_Option * | static Evas_Object_Box_Option * | |||
_evas_object_box_option_new(Evas_Object *o, Evas_Object_Box_Data *priv, Eva s_Object *child) | _evas_object_box_option_new(Evas_Object *o, Evas_Object_Box_Data *priv, Eva s_Object *child) | |||
{ | { | |||
Evas_Object_Box_Option *opt; | Evas_Object_Box_Option *opt; | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
api = priv->api; | api = priv->api; | |||
if ((!api) || (!api->option_new)) | if ((!api) || (!api->option_new)) | |||
{ | { | |||
ERR("no api->option_new"); | ERR("no api->option_new"); | |||
return NULL; | return NULL; | |||
} | } | |||
opt = api->option_new(o, priv, child); | opt = api->option_new(o, priv, child); | |||
if (!opt) | if (!opt) | |||
{ | { | |||
ERR("option_new failed"); | ERR("option_new failed"); | |||
return NULL; | return NULL; | |||
} | } | |||
return opt; | return opt; | |||
} | } | |||
static void | static void | |||
_evas_object_box_child_callbacks_unregister(Evas_Object *obj) | _evas_object_box_child_callbacks_unregister(Evas_Object *obj) | |||
{ | { | |||
evas_object_event_callback_del | evas_object_event_callback_del | |||
(obj, EVAS_CALLBACK_RESIZE, _on_child_resize); | (obj, EVAS_CALLBACK_RESIZE, _on_child_resize); | |||
skipping to change at line 277 | skipping to change at line 278 | |||
static Evas_Object_Box_Option * | static Evas_Object_Box_Option * | |||
_evas_object_box_insert_before_default(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, const Evas_Object *reference) | _evas_object_box_insert_before_default(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, const Evas_Object *reference) | |||
{ | { | |||
Eina_List *l; | Eina_List *l; | |||
Evas_Object_Box_Option *opt; | Evas_Object_Box_Option *opt; | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
if (opt->obj == reference) | if (opt->obj == reference) | |||
{ | { | |||
Evas_Object_Box_Option *new_opt; | Evas_Object_Box_Option *new_opt; | |||
new_opt = _evas_object_box_option_new(o, priv, child); | new_opt = _evas_object_box_option_new(o, priv, child); | |||
if (!new_opt) | if (!new_opt) | |||
return NULL; | return NULL; | |||
priv->children = eina_list_prepend_relative | priv->children = eina_list_prepend_relative | |||
(priv->children, new_opt, opt); | (priv->children, new_opt, opt); | |||
priv->children_changed = EINA_TRUE; | priv->children_changed = EINA_TRUE; | |||
evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); | evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); | |||
return new_opt; | return new_opt; | |||
} | } | |||
} | } | |||
return NULL; | return NULL; | |||
} | } | |||
static Evas_Object_Box_Option * | static Evas_Object_Box_Option * | |||
_evas_object_box_insert_after_default(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, const Evas_Object *reference) | _evas_object_box_insert_after_default(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, const Evas_Object *reference) | |||
{ | { | |||
Eina_List *l; | Eina_List *l; | |||
Evas_Object_Box_Option *opt; | Evas_Object_Box_Option *opt; | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
if (opt->obj == reference) | if (opt->obj == reference) | |||
{ | { | |||
Evas_Object_Box_Option *new_opt; | Evas_Object_Box_Option *new_opt; | |||
new_opt = _evas_object_box_option_new(o, priv, child); | new_opt = _evas_object_box_option_new(o, priv, child); | |||
if (!new_opt) | if (!new_opt) | |||
return NULL; | return NULL; | |||
priv->children = eina_list_append_relative | priv->children = eina_list_append_relative | |||
(priv->children, new_opt, opt); | (priv->children, new_opt, opt); | |||
priv->children_changed = EINA_TRUE; | priv->children_changed = EINA_TRUE; | |||
evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); | evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); | |||
return new_opt; | return new_opt; | |||
} | } | |||
} | } | |||
return NULL; | return NULL; | |||
} | } | |||
static Evas_Object_Box_Option * | static Evas_Object_Box_Option * | |||
_evas_object_box_insert_at_default(Evas_Object *o, Evas_Object_Box_Data *pr iv, Evas_Object *child, unsigned int pos) | _evas_object_box_insert_at_default(Evas_Object *o, Evas_Object_Box_Data *pr iv, Evas_Object *child, unsigned int pos) | |||
{ | { | |||
Eina_List *l; | Eina_List *l; | |||
unsigned int i; | unsigned int i; | |||
if ((pos == 0) && (eina_list_count(priv->children) == 0)) | if ((pos == 0) && (eina_list_count(priv->children) == 0)) | |||
{ | { | |||
Evas_Object_Box_Option *new_opt; | Evas_Object_Box_Option *new_opt; | |||
new_opt = _evas_object_box_option_new(o, priv, child); | new_opt = _evas_object_box_option_new(o, priv, child); | |||
if (!new_opt) | if (!new_opt) | |||
return NULL; | return NULL; | |||
priv->children = eina_list_prepend(priv->children, new_opt); | priv->children = eina_list_prepend(priv->children, new_opt); | |||
priv->children_changed = EINA_TRUE; | priv->children_changed = EINA_TRUE; | |||
evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); | evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); | |||
return new_opt; | return new_opt; | |||
} | } | |||
for (l = priv->children, i = 0; l; l = l->next, i++) | for (l = priv->children, i = 0; l; l = l->next, i++) | |||
{ | { | |||
Evas_Object_Box_Option *opt = l->data; | Evas_Object_Box_Option *opt = l->data; | |||
if (i == pos) | if (i == pos) | |||
{ | { | |||
Evas_Object_Box_Option *new_opt; | Evas_Object_Box_Option *new_opt; | |||
new_opt = _evas_object_box_option_new(o, priv, child); | new_opt = _evas_object_box_option_new(o, priv, child); | |||
if (!new_opt) | if (!new_opt) | |||
return NULL; | return NULL; | |||
priv->children = eina_list_prepend_relative | priv->children = eina_list_prepend_relative | |||
(priv->children, new_opt, opt); | (priv->children, new_opt, opt); | |||
priv->children_changed = EINA_TRUE; | priv->children_changed = EINA_TRUE; | |||
evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); | evas_object_smart_callback_call(o, SIG_CHILD_ADDED, new_opt); | |||
return new_opt; | return new_opt; | |||
} | } | |||
} | } | |||
return NULL; | return NULL; | |||
} | } | |||
static Evas_Object * | static Evas_Object * | |||
_evas_object_box_remove_default(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child) | _evas_object_box_remove_default(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child) | |||
{ | { | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
Evas_Object_Box_Option *opt; | Evas_Object_Box_Option *opt; | |||
Eina_List *l; | Eina_List *l; | |||
api = priv->api; | api = priv->api; | |||
if ((!api) || (!api->option_free)) | if ((!api) || (!api->option_free)) | |||
{ | { | |||
ERR("api->option_free not set (may cause memory leaks, segfaults)"); | ERR("api->option_free not set (may cause memory leaks, segfaults)") | |||
return NULL; | ; | |||
return NULL; | ||||
} | } | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
Evas_Object *obj = opt->obj; | Evas_Object *obj = opt->obj; | |||
if (obj == child) | if (obj == child) | |||
{ | { | |||
priv->children = eina_list_remove(priv->children, opt); | priv->children = eina_list_remove(priv->children, opt); | |||
api->option_free(o, priv, opt); | api->option_free(o, priv, opt); | |||
priv->children_changed = EINA_TRUE; | priv->children_changed = EINA_TRUE; | |||
evas_object_smart_callback_call(o, SIG_CHILD_REMOVED, obj); | evas_object_smart_callback_call(o, SIG_CHILD_REMOVED, obj); | |||
return obj; | return obj; | |||
} | } | |||
} | } | |||
return NULL; | return NULL; | |||
} | } | |||
static Evas_Object * | static Evas_Object * | |||
_evas_object_box_remove_at_default(Evas_Object *o, Evas_Object_Box_Data *pr iv, unsigned int pos) | _evas_object_box_remove_at_default(Evas_Object *o, Evas_Object_Box_Data *pr iv, unsigned int pos) | |||
{ | { | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
Eina_List *node; | Eina_List *node; | |||
Evas_Object_Box_Option *opt; | Evas_Object_Box_Option *opt; | |||
Evas_Object *obj; | Evas_Object *obj; | |||
api = priv->api; | api = priv->api; | |||
if ((!api) || (!api->option_free)) | if ((!api) || (!api->option_free)) | |||
{ | { | |||
WRN("api->option_free not set (may cause memory leaks, segfaults)"); | WRN("api->option_free not set (may cause memory leaks, segfaults)") ; | |||
return NULL; | return NULL; | |||
} | } | |||
node = eina_list_nth_list(priv->children, pos); | node = eina_list_nth_list(priv->children, pos); | |||
if (!node) | if (!node) | |||
{ | { | |||
ERR("No item to be removed at position %d", pos); | ERR("No item to be removed at position %d", pos); | |||
return NULL; | return NULL; | |||
} | } | |||
opt = node->data; | opt = node->data; | |||
obj = opt->obj; | obj = opt->obj; | |||
priv->children = eina_list_remove_list(priv->children, node); | priv->children = eina_list_remove_list(priv->children, node); | |||
api->option_free(o, priv, opt); | api->option_free(o, priv, opt); | |||
priv->children_changed = EINA_TRUE; | priv->children_changed = EINA_TRUE; | |||
evas_object_smart_callback_call(o, SIG_CHILD_REMOVED, obj); | evas_object_smart_callback_call(o, SIG_CHILD_REMOVED, obj); | |||
return obj; | return obj; | |||
skipping to change at line 442 | skipping to change at line 443 | |||
_evas_object_box_smart_add(Evas_Object *o) | _evas_object_box_smart_add(Evas_Object *o) | |||
{ | { | |||
Evas_Object_Box_Data *priv; | Evas_Object_Box_Data *priv; | |||
priv = evas_object_smart_data_get(o); | priv = evas_object_smart_data_get(o); | |||
if (!priv) | if (!priv) | |||
{ | { | |||
const Evas_Smart *smart; | const Evas_Smart *smart; | |||
const Evas_Smart_Class *sc; | const Evas_Smart_Class *sc; | |||
priv = (Evas_Object_Box_Data *)calloc(1, sizeof(*priv)); | priv = (Evas_Object_Box_Data *)calloc(1, sizeof(*priv)); | |||
if (!priv) | if (!priv) | |||
{ | { | |||
ERR("Could not allocate object private data."); | ERR("Could not allocate object private data."); | |||
return; | return; | |||
} | } | |||
smart = evas_object_smart_smart_get(o); | smart = evas_object_smart_smart_get(o); | |||
sc = evas_smart_class_get(smart); | sc = evas_smart_class_get(smart); | |||
priv->api = (const Evas_Object_Box_Api *)sc; | priv->api = (const Evas_Object_Box_Api *)sc; | |||
evas_object_smart_data_set(o, priv); | evas_object_smart_data_set(o, priv); | |||
} | } | |||
_evas_object_box_parent_sc->add(o); | _evas_object_box_parent_sc->add(o); | |||
evas_object_event_callback_add | evas_object_event_callback_add | |||
(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_hints_changed, o); | (o, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_hints_changed, o); | |||
priv->children = NULL; | priv->children = NULL; | |||
priv->align.h = 0.5; | priv->align.h = 0.5; | |||
priv->align.v = 0.5; | priv->align.v = 0.5; | |||
priv->pad.h = 0; | priv->pad.h = 0; | |||
priv->pad.v = 0; | priv->pad.v = 0; | |||
skipping to change at line 480 | skipping to change at line 481 | |||
_evas_object_box_smart_del(Evas_Object *o) | _evas_object_box_smart_del(Evas_Object *o) | |||
{ | { | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
Eina_List *l; | Eina_List *l; | |||
EVAS_OBJECT_BOX_DATA_GET(o, priv); | EVAS_OBJECT_BOX_DATA_GET(o, priv); | |||
api = priv->api; | api = priv->api; | |||
if ((!api) || (!api->option_free)) | if ((!api) || (!api->option_free)) | |||
{ | { | |||
WRN("api->option_free not set (may cause memory leaks, segfaults)"); | WRN("api->option_free not set (may cause memory leaks, segfaults)") ; | |||
return; | return; | |||
} | } | |||
l = priv->children; | l = priv->children; | |||
while (l) | while (l) | |||
{ | { | |||
Evas_Object_Box_Option *opt = l->data; | Evas_Object_Box_Option *opt = l->data; | |||
_evas_object_box_child_callbacks_unregister(opt->obj); | _evas_object_box_child_callbacks_unregister(opt->obj); | |||
api->option_free(o, priv, opt); | api->option_free(o, priv, opt); | |||
l = eina_list_remove_list(l, l); | l = eina_list_remove_list(l, l); | |||
} | } | |||
if (priv->layout.data && priv->layout.free_data) | if (priv->layout.data && priv->layout.free_data) | |||
priv->layout.free_data(priv->layout.data); | priv->layout.free_data(priv->layout.data); | |||
_evas_object_box_parent_sc->del(o); | _evas_object_box_parent_sc->del(o); | |||
} | } | |||
static void | static void | |||
_evas_object_box_smart_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h) | _evas_object_box_smart_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h) | |||
skipping to change at line 617 | skipping to change at line 618 | |||
int quotient = (long long)(dividend << 16) / divisor; | int quotient = (long long)(dividend << 16) / divisor; | |||
*frac_part = quotient & 0xffff; | *frac_part = quotient & 0xffff; | |||
*int_part = quotient >> 16; | *int_part = quotient >> 16; | |||
} | } | |||
static void | static void | |||
_layout_dimension_change_min_max_cell_bound(int dim, int *new_dim, int min_ d, int max_d, int cell_sz) | _layout_dimension_change_min_max_cell_bound(int dim, int *new_dim, int min_ d, int max_d, int cell_sz) | |||
{ | { | |||
if (dim > cell_sz) | if (dim > cell_sz) | |||
{ | { | |||
if ((min_d != 0) && (cell_sz < min_d)) | if ((min_d != 0) && (cell_sz < min_d)) | |||
*new_dim = min_d; | *new_dim = min_d; | |||
else | else | |||
*new_dim = cell_sz; | *new_dim = cell_sz; | |||
} | } | |||
else | else | |||
{ | { | |||
if ((max_d != -1) && (cell_sz > max_d)) | if ((max_d != -1) && (cell_sz > max_d)) | |||
*new_dim = max_d; | *new_dim = max_d; | |||
else | else | |||
*new_dim = cell_sz; | *new_dim = cell_sz; | |||
} | } | |||
} | } | |||
static void | static void | |||
_layout_set_offset_and_expand_dimension_space_max_bounded(int dim, int *new _dim, int space_sz, int max_dim, int *offset, double align, int pad_before, int pad_after) | _layout_set_offset_and_expand_dimension_space_max_bounded(int dim, int *new _dim, int space_sz, int max_dim, int *offset, double align, int pad_before, int pad_after) | |||
{ | { | |||
if (align >= 0.0) | if (align >= 0.0) | |||
{ | { | |||
*new_dim = dim; | *new_dim = dim; | |||
*offset = (space_sz - (dim + pad_before + pad_after)) * align | *offset = (space_sz - (dim + pad_before + pad_after)) * align | |||
+ pad_before; | + pad_before; | |||
} | } | |||
else | else | |||
{ | { | |||
if ((max_dim != -1) && (space_sz > max_dim)) | if ((max_dim != -1) && (space_sz > max_dim)) | |||
{ | { | |||
*new_dim = max_dim; | *new_dim = max_dim; | |||
*offset = (space_sz - (max_dim + pad_before + pad_after)) * 0.5 | *offset = (space_sz - (max_dim + pad_before + pad_after)) * 0. | |||
+ pad_before; | 5 | |||
} | + pad_before; | |||
else | } | |||
{ | else | |||
*new_dim = space_sz; | { | |||
*offset = 0; | *new_dim = space_sz; | |||
} | *offset = 0; | |||
} | ||||
} | } | |||
} | } | |||
static void | static void | |||
_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) | _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) | if (align >= 0.0) | |||
{ | { | |||
*new_dim = dim; | *new_dim = dim; | |||
*offset = | *offset = | |||
(cell_sz - (dim + pad_before + pad_after)) * align + pad_before; | (cell_sz - (dim + pad_before + pad_after)) * align + pad_before; | |||
} | } | |||
else | else | |||
{ | { | |||
*offset = pad_before; | *offset = pad_before; | |||
_layout_dimension_change_min_max_cell_bound | _layout_dimension_change_min_max_cell_bound | |||
(dim, new_dim, min_dim, max_dim, cell_sz - pad_before - pad_after) ; | (dim, new_dim, min_dim, max_dim, cell_sz - pad_before - pad_afte r); | |||
} | } | |||
} | } | |||
static void | static void | |||
_sizing_eval(Evas_Object *obj) | _sizing_eval(Evas_Object *obj) | |||
{ | { | |||
Evas_Coord minw, minh, maxw, maxh; | Evas_Coord minw, minh, maxw, maxh; | |||
Evas_Coord w, h; | Evas_Coord w, h; | |||
evas_object_size_hint_min_get(obj, &minw, &minh); | evas_object_size_hint_min_get(obj, &minw, &minh); | |||
skipping to change at line 706 | skipping to change at line 707 | |||
for (i = 0; i < n_objects; i++) | for (i = 0; i < n_objects; i++) | |||
{ | { | |||
Evas_Object_Box_Option *opt = objects[i]; | Evas_Object_Box_Option *opt = objects[i]; | |||
Evas_Object *o = opt->obj; | Evas_Object *o = opt->obj; | |||
int h; | int h; | |||
evas_object_geometry_get(o, NULL, NULL, NULL, &h); | evas_object_geometry_get(o, NULL, NULL, NULL, &h); | |||
if (remaining <= 0) | if (remaining <= 0) | |||
{ | { | |||
int min_w; | int min_w; | |||
evas_object_size_hint_min_get(o, &min_w, NULL); | evas_object_size_hint_min_get(o, &min_w, NULL); | |||
evas_object_resize(o, min_w, h); | evas_object_resize(o, min_w, h); | |||
} | } | |||
else | else | |||
{ | { | |||
double normal_weight, weight_x; | double normal_weight, weight_x; | |||
int target_size; | int target_size; | |||
int max_w; | int max_w; | |||
evas_object_size_hint_weight_get(o, &weight_x, NULL); | evas_object_size_hint_weight_get(o, &weight_x, NULL); | |||
normal_weight = weight_x / weight_total; | normal_weight = weight_x / weight_total; | |||
target_size = (int)((double)remaining * normal_weight); | target_size = (int)((double)remaining * normal_weight); | |||
evas_object_size_hint_max_get(o, &max_w, NULL); | evas_object_size_hint_max_get(o, &max_w, NULL); | |||
if ((max_w != -1) && (target_size > max_w)) | if ((max_w != -1) && (target_size > max_w)) | |||
{ | { | |||
evas_object_resize(o, max_w, h); | evas_object_resize(o, max_w, h); | |||
rem_diff += max_w; | rem_diff += max_w; | |||
objects[i] = objects[n_objects - 1]; | objects[i] = objects[n_objects - 1]; | |||
weight_total -= weight_x; | weight_total -= weight_x; | |||
n_objects--; | n_objects--; | |||
return _evas_object_box_layout_horizontal_weight_apply | return _evas_object_box_layout_horizontal_weight_apply | |||
(priv, objects, n_objects, remaining - rem_diff, | (priv, objects, n_objects, remaining - rem_diff, | |||
weight_total); | weight_total); | |||
} | } | |||
else | else | |||
{ | { | |||
evas_object_resize(o, target_size, h); | evas_object_resize(o, target_size, h); | |||
rem_diff += target_size; | rem_diff += target_size; | |||
} | } | |||
} | } | |||
} | } | |||
return remaining - rem_diff; | return remaining - rem_diff; | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_layout_horizontal(Evas_Object *o, Evas_Object_Box_Data *pri v, void *data __UNUSED__) | evas_object_box_layout_horizontal(Evas_Object *o, Evas_Object_Box_Data *pri v, void *data __UNUSED__) | |||
{ | { | |||
int pad_inc = 0, sub_pixel = 0; | int pad_inc = 0, sub_pixel = 0; | |||
int req_w, global_pad, remaining, top_h = 0; | int req_w, global_pad, remaining, top_h = 0; | |||
skipping to change at line 775 | skipping to change at line 776 | |||
evas_object_geometry_get(o, &x, &y, &w, &h); | evas_object_geometry_get(o, &x, &y, &w, &h); | |||
global_pad = priv->pad.h; | global_pad = priv->pad.h; | |||
req_w = global_pad * (n_children - 1); | req_w = global_pad * (n_children - 1); | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int padding_l, padding_r; | int padding_l, padding_r; | |||
double weight_x; | double weight_x; | |||
_sizing_eval(opt->obj); | _sizing_eval(opt->obj); | |||
evas_object_size_hint_weight_get(opt->obj, &weight_x, NULL); | evas_object_size_hint_weight_get(opt->obj, &weight_x, NULL); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, NULL, NULL); | (opt->obj, &padding_l, &padding_r, NULL, NULL); | |||
req_w += padding_l + padding_r; | req_w += padding_l + padding_r; | |||
if (!weight_x) | if (!weight_x) | |||
{ | { | |||
int child_w; | int child_w; | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, NULL); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, NULL) | |||
req_w += child_w; | ; | |||
} | req_w += child_w; | |||
else | } | |||
{ | else | |||
objects[weight_use] = opt; | { | |||
weight_use++; | objects[weight_use] = opt; | |||
weight_total += weight_x; | weight_use++; | |||
} | weight_total += weight_x; | |||
} | ||||
} | } | |||
remaining = w - req_w; | remaining = w - req_w; | |||
if (weight_use) | if (weight_use) | |||
remaining = _evas_object_box_layout_horizontal_weight_apply | remaining = _evas_object_box_layout_horizontal_weight_apply | |||
(priv, objects, weight_use, remaining, weight_total); | (priv, objects, weight_use, remaining, weight_total); | |||
if (priv->align.h >= 0.0) | if (priv->align.h >= 0.0) | |||
x += remaining * priv->align.h; | x += remaining * priv->align.h; | |||
skipping to change at line 821 | skipping to change at line 822 | |||
} | } | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int child_w, child_h, max_h, new_h, off_x, off_y; | int child_w, child_h, max_h, new_h, off_x, off_y; | |||
int padding_l, padding_r, padding_t, padding_b; | int padding_l, padding_r, padding_t, padding_b; | |||
double align_y; | double align_y; | |||
evas_object_size_hint_align_get(opt->obj, NULL, &align_y); | evas_object_size_hint_align_get(opt->obj, NULL, &align_y); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | (opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | |||
evas_object_size_hint_max_get(opt->obj, NULL, &max_h); | evas_object_size_hint_max_get(opt->obj, NULL, &max_h); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | |||
off_x = padding_l; | off_x = padding_l; | |||
new_h = child_h; | new_h = child_h; | |||
if (new_h > top_h) top_h = new_h; | if (new_h > top_h) top_h = new_h; | |||
_layout_set_offset_and_expand_dimension_space_max_bounded | _layout_set_offset_and_expand_dimension_space_max_bounded | |||
(child_h, &new_h, h, max_h, &off_y, align_y, padding_t, padding_b) ; | (child_h, &new_h, h, max_h, &off_y, align_y, padding_t, padding_ b); | |||
if (new_h != child_h) | if (new_h != child_h) | |||
evas_object_resize(opt->obj, child_w, new_h); | evas_object_resize(opt->obj, child_w, new_h); | |||
evas_object_move(opt->obj, x + off_x, y + off_y); | evas_object_move(opt->obj, x + off_x, y + off_y); | |||
x += child_w + padding_l + padding_r + global_pad; | x += child_w + padding_l + padding_r + global_pad; | |||
sub_pixel += pad_inc; | sub_pixel += pad_inc; | |||
if (sub_pixel >= 1 << 16) | if (sub_pixel >= 1 << 16) | |||
{ | { | |||
x++; | x++; | |||
sub_pixel -= 1 << 16; | sub_pixel -= 1 << 16; | |||
} | } | |||
} | } | |||
evas_object_size_hint_min_set(o, req_w, top_h); | evas_object_size_hint_min_set(o, req_w, top_h); | |||
} | } | |||
static int | static int | |||
_evas_object_box_layout_vertical_weight_apply(Evas_Object_Box_Data *priv, E vas_Object_Box_Option **objects, int n_objects, int remaining, double weigh t_total) | _evas_object_box_layout_vertical_weight_apply(Evas_Object_Box_Data *priv, E vas_Object_Box_Option **objects, int n_objects, int remaining, double weigh t_total) | |||
{ | { | |||
int rem_diff = 0; | int rem_diff = 0; | |||
int i; | int i; | |||
for (i = 0; i < n_objects; i++) | for (i = 0; i < n_objects; i++) | |||
{ | { | |||
Evas_Object_Box_Option *opt = objects[i]; | Evas_Object_Box_Option *opt = objects[i]; | |||
Evas_Object *o = opt->obj; | Evas_Object *o = opt->obj; | |||
int w; | int w; | |||
evas_object_geometry_get(o, NULL, NULL, &w, NULL); | evas_object_geometry_get(o, NULL, NULL, &w, NULL); | |||
if (remaining <= 0) | if (remaining <= 0) | |||
{ | { | |||
int min_h; | int min_h; | |||
evas_object_size_hint_min_get(o, NULL, &min_h); | evas_object_size_hint_min_get(o, NULL, &min_h); | |||
evas_object_resize(o, w, min_h); | evas_object_resize(o, w, min_h); | |||
} | } | |||
else | else | |||
{ | { | |||
double normal_weight, weight_y; | double normal_weight, weight_y; | |||
int target_size; | int target_size; | |||
int max_h; | int max_h; | |||
evas_object_size_hint_weight_get(o, NULL, &weight_y); | evas_object_size_hint_weight_get(o, NULL, &weight_y); | |||
normal_weight = weight_y / weight_total; | normal_weight = weight_y / weight_total; | |||
target_size = (int)((double)remaining * normal_weight); | target_size = (int)((double)remaining * normal_weight); | |||
evas_object_size_hint_max_get(o, NULL, &max_h); | evas_object_size_hint_max_get(o, NULL, &max_h); | |||
if ((max_h != -1) && (target_size > max_h)) | if ((max_h != -1) && (target_size > max_h)) | |||
{ | { | |||
evas_object_resize(o, w, max_h); | evas_object_resize(o, w, max_h); | |||
rem_diff += max_h; | rem_diff += max_h; | |||
objects[i] = objects[n_objects - 1]; | objects[i] = objects[n_objects - 1]; | |||
weight_total -= weight_y; | weight_total -= weight_y; | |||
n_objects--; | n_objects--; | |||
return _evas_object_box_layout_vertical_weight_apply | return _evas_object_box_layout_vertical_weight_apply | |||
(priv, objects, n_objects, remaining - rem_diff, | (priv, objects, n_objects, remaining - rem_diff, | |||
weight_total); | weight_total); | |||
} | } | |||
else | else | |||
{ | { | |||
evas_object_resize(o, w, target_size); | evas_object_resize(o, w, target_size); | |||
rem_diff += target_size; | rem_diff += target_size; | |||
} | } | |||
} | } | |||
} | } | |||
return remaining - rem_diff; | return remaining - rem_diff; | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_layout_vertical(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__) | evas_object_box_layout_vertical(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__) | |||
{ | { | |||
int pad_inc = 0, sub_pixel = 0; | int pad_inc = 0, sub_pixel = 0; | |||
int req_h, global_pad, remaining, top_w = 0; | int req_h, global_pad, remaining, top_w = 0; | |||
skipping to change at line 933 | skipping to change at line 934 | |||
evas_object_geometry_get(o, &x, &y, &w, &h); | evas_object_geometry_get(o, &x, &y, &w, &h); | |||
global_pad = priv->pad.v; | global_pad = priv->pad.v; | |||
req_h = global_pad * (n_children - 1); | req_h = global_pad * (n_children - 1); | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int padding_t, padding_b; | int padding_t, padding_b; | |||
double weight_y; | double weight_y; | |||
_sizing_eval(opt->obj); | _sizing_eval(opt->obj); | |||
evas_object_size_hint_weight_get(opt->obj, NULL, &weight_y); | evas_object_size_hint_weight_get(opt->obj, NULL, &weight_y); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, NULL, NULL, &padding_t, &padding_b); | (opt->obj, NULL, NULL, &padding_t, &padding_b); | |||
req_h += padding_t + padding_b; | req_h += padding_t + padding_b; | |||
if (!weight_y) | if (!weight_y) | |||
{ | { | |||
int child_h; | int child_h; | |||
evas_object_geometry_get(opt->obj, NULL, NULL, NULL, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, NULL, &child_h) | |||
req_h += child_h; | ; | |||
} | req_h += child_h; | |||
else | } | |||
{ | else | |||
objects[weight_use] = opt; | { | |||
weight_use++; | objects[weight_use] = opt; | |||
weight_total += weight_y; | weight_use++; | |||
} | weight_total += weight_y; | |||
} | ||||
} | } | |||
remaining = h - req_h; | remaining = h - req_h; | |||
if (weight_use) | if (weight_use) | |||
remaining = _evas_object_box_layout_vertical_weight_apply | remaining = _evas_object_box_layout_vertical_weight_apply | |||
(priv, objects, weight_use, remaining, weight_total); | (priv, objects, weight_use, remaining, weight_total); | |||
if (priv->align.v >= 0.0) | if (priv->align.v >= 0.0) | |||
y += remaining * priv->align.v; | y += remaining * priv->align.v; | |||
else if (n_children == 1) | else if (n_children == 1) | |||
y += remaining / 2; | y += remaining / 2; | |||
else | else | |||
{ /* justified */ | { /* justified */ | |||
_fixed_point_divide_and_decompose_integer | _fixed_point_divide_and_decompose_integer | |||
(remaining, n_children - 1, &global_pad, &pad_inc); | (remaining, n_children - 1, &global_pad, &pad_inc); | |||
global_pad += priv->pad.v; | global_pad += priv->pad.v; | |||
} | } | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int child_w, child_h, max_w, new_w, off_x, off_y; | int child_w, child_h, max_w, new_w, off_x, off_y; | |||
int padding_l, padding_r, padding_t, padding_b; | int padding_l, padding_r, padding_t, padding_b; | |||
double align_x; | double align_x; | |||
evas_object_size_hint_align_get(opt->obj, &align_x, NULL); | evas_object_size_hint_align_get(opt->obj, &align_x, NULL); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | (opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | |||
evas_object_size_hint_max_get(opt->obj, &max_w, NULL); | evas_object_size_hint_max_get(opt->obj, &max_w, NULL); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | |||
off_y = padding_t; | off_y = padding_t; | |||
new_w = child_w; | new_w = child_w; | |||
_layout_set_offset_and_expand_dimension_space_max_bounded | _layout_set_offset_and_expand_dimension_space_max_bounded | |||
(child_w, &new_w, w, max_w, &off_x, align_x, padding_l, padding_r) ; | (child_w, &new_w, w, max_w, &off_x, align_x, padding_l, padding_ r); | |||
if (new_w > top_w) top_w = new_w; | if (new_w > top_w) top_w = new_w; | |||
if (new_w != child_w) | if (new_w != child_w) | |||
evas_object_resize(opt->obj, new_w, child_h); | evas_object_resize(opt->obj, new_w, child_h); | |||
evas_object_move(opt->obj, x + off_x, y + off_y); | evas_object_move(opt->obj, x + off_x, y + off_y); | |||
y += child_h + padding_t + padding_b + global_pad; | y += child_h + padding_t + padding_b + global_pad; | |||
sub_pixel += pad_inc; | sub_pixel += pad_inc; | |||
if (sub_pixel >= 1 << 16) | if (sub_pixel >= 1 << 16) | |||
{ | { | |||
y++; | y++; | |||
sub_pixel -= 1 << 16; | sub_pixel -= 1 << 16; | |||
} | } | |||
} | } | |||
evas_object_size_hint_min_set(o, top_w, req_h); | evas_object_size_hint_min_set(o, top_w, req_h); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_layout_homogeneous_horizontal(Evas_Object *o, Evas_Object_B ox_Data *priv, void *data __UNUSED__) | evas_object_box_layout_homogeneous_horizontal(Evas_Object *o, Evas_Object_B ox_Data *priv, void *data __UNUSED__) | |||
{ | { | |||
int cell_sz, share, inc; | int cell_sz, share, inc; | |||
int sub_pixel = 0; | int sub_pixel = 0; | |||
skipping to change at line 1036 | skipping to change at line 1037 | |||
(share, n_children, &cell_sz, &inc); | (share, n_children, &cell_sz, &inc); | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int child_w, child_h, max_h, min_w, max_w, new_w, new_h, off_x, off _y; | int child_w, child_h, max_h, min_w, max_w, new_w, new_h, off_x, off _y; | |||
int padding_l, padding_r, padding_t, padding_b; | int padding_l, padding_r, padding_t, padding_b; | |||
double align_x, align_y; | double align_x, align_y; | |||
evas_object_size_hint_align_get(opt->obj, &align_x, &align_y); | evas_object_size_hint_align_get(opt->obj, &align_x, &align_y); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | (opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | |||
evas_object_size_hint_max_get(opt->obj, &max_w, &max_h); | evas_object_size_hint_max_get(opt->obj, &max_w, &max_h); | |||
evas_object_size_hint_min_get(opt->obj, &min_w, NULL); | evas_object_size_hint_min_get(opt->obj, &min_w, NULL); | |||
_sizing_eval(opt->obj); | _sizing_eval(opt->obj); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | |||
new_w = child_w; | new_w = child_w; | |||
new_h = child_h; | new_h = child_h; | |||
_layout_set_offset_and_expand_dimension_space_max_bounded | _layout_set_offset_and_expand_dimension_space_max_bounded | |||
(child_h, &new_h, h, max_h, &off_y, align_y, padding_t, padding_b) ; | (child_h, &new_h, h, max_h, &off_y, align_y, padding_t, padding_ b); | |||
_layout_set_offset_and_change_dimension_min_max_cell_bounded | _layout_set_offset_and_change_dimension_min_max_cell_bounded | |||
(child_w, &new_w, min_w, max_w, cell_sz, &off_x, align_x, | (child_w, &new_w, min_w, max_w, cell_sz, &off_x, align_x, | |||
padding_l, padding_r); | padding_l, padding_r); | |||
if ((new_w != child_w) || (new_h != child_h)) | if ((new_w != child_w) || (new_h != child_h)) | |||
evas_object_resize(opt->obj, new_w, new_h); | evas_object_resize(opt->obj, new_w, new_h); | |||
evas_object_move(opt->obj, x + off_x, y + off_y); | evas_object_move(opt->obj, x + off_x, y + off_y); | |||
x += cell_sz + priv->pad.h; | x += cell_sz + priv->pad.h; | |||
sub_pixel += inc; | sub_pixel += inc; | |||
if (sub_pixel >= 1 << 16) | if (sub_pixel >= 1 << 16) | |||
{ | { | |||
x++; | x++; | |||
sub_pixel -= 1 << 16; | sub_pixel -= 1 << 16; | |||
} | } | |||
} | } | |||
evas_object_size_hint_min_set(o, w, h); | evas_object_size_hint_min_set(o, w, h); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_layout_homogeneous_vertical(Evas_Object *o, Evas_Object_Box _Data *priv, void *data __UNUSED__) | evas_object_box_layout_homogeneous_vertical(Evas_Object *o, Evas_Object_Box _Data *priv, void *data __UNUSED__) | |||
{ | { | |||
int cell_sz, share, inc; | int cell_sz, share, inc; | |||
int sub_pixel = 0; | int sub_pixel = 0; | |||
skipping to change at line 1097 | skipping to change at line 1098 | |||
(share, n_children, &cell_sz, &inc); | (share, n_children, &cell_sz, &inc); | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int child_w, child_h, max_w, min_h, max_h, new_w, new_h, off_x, off _y; | int child_w, child_h, max_w, min_h, max_h, new_w, new_h, off_x, off _y; | |||
int padding_l, padding_r, padding_t, padding_b; | int padding_l, padding_r, padding_t, padding_b; | |||
double align_x, align_y; | double align_x, align_y; | |||
evas_object_size_hint_align_get(opt->obj, &align_x, &align_y); | evas_object_size_hint_align_get(opt->obj, &align_x, &align_y); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | (opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | |||
evas_object_size_hint_max_get(opt->obj, &max_w, &max_h); | evas_object_size_hint_max_get(opt->obj, &max_w, &max_h); | |||
evas_object_size_hint_min_get(opt->obj, NULL, &min_h); | evas_object_size_hint_min_get(opt->obj, NULL, &min_h); | |||
_sizing_eval(opt->obj); | _sizing_eval(opt->obj); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | |||
new_w = child_w; | new_w = child_w; | |||
new_h = child_h; | new_h = child_h; | |||
_layout_set_offset_and_expand_dimension_space_max_bounded | _layout_set_offset_and_expand_dimension_space_max_bounded | |||
(child_w, &new_w, w, max_w, &off_x, align_x, padding_l, padding_r) ; | (child_w, &new_w, w, max_w, &off_x, align_x, padding_l, padding_ r); | |||
_layout_set_offset_and_change_dimension_min_max_cell_bounded | _layout_set_offset_and_change_dimension_min_max_cell_bounded | |||
(child_h, &new_h, min_h, max_h, cell_sz, &off_y, align_y, | (child_h, &new_h, min_h, max_h, cell_sz, &off_y, align_y, | |||
padding_t, padding_b); | padding_t, padding_b); | |||
if ((new_w != child_w) || (new_h != child_h)) | if ((new_w != child_w) || (new_h != child_h)) | |||
evas_object_resize(opt->obj, new_w, new_h); | evas_object_resize(opt->obj, new_w, new_h); | |||
evas_object_move(opt->obj, x + off_x, y + off_y); | evas_object_move(opt->obj, x + off_x, y + off_y); | |||
y += cell_sz + priv->pad.v; | y += cell_sz + priv->pad.v; | |||
sub_pixel += inc; | sub_pixel += inc; | |||
if (sub_pixel >= 1 << 16) | if (sub_pixel >= 1 << 16) | |||
{ | { | |||
y++; | y++; | |||
sub_pixel -= 1 << 16; | sub_pixel -= 1 << 16; | |||
} | } | |||
} | } | |||
evas_object_size_hint_min_set(o, w, h); | evas_object_size_hint_min_set(o, w, h); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_layout_homogeneous_max_size_horizontal(Evas_Object *o, Evas _Object_Box_Data *priv, void *data __UNUSED__) | evas_object_box_layout_homogeneous_max_size_horizontal(Evas_Object *o, Evas _Object_Box_Data *priv, void *data __UNUSED__) | |||
{ | { | |||
int remaining, global_pad, pad_inc = 0, sub_pixel = 0; | int remaining, global_pad, pad_inc = 0, sub_pixel = 0; | |||
int cell_sz = 0; | int cell_sz = 0; | |||
skipping to change at line 1150 | skipping to change at line 1151 | |||
n_children = eina_list_count(priv->children); | n_children = eina_list_count(priv->children); | |||
if (!n_children) | if (!n_children) | |||
return; | return; | |||
evas_object_geometry_get(o, &x, &y, &w, &h); | evas_object_geometry_get(o, &x, &y, &w, &h); | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int child_w, padding_l, padding_r; | int child_w, padding_l, padding_r; | |||
_sizing_eval(opt->obj); | _sizing_eval(opt->obj); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, NULL, NULL); | (opt->obj, &padding_l, &padding_r, NULL, NULL); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, NULL); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, NULL); | |||
if (child_w + padding_l + padding_r > cell_sz) | if (child_w + padding_l + padding_r > cell_sz) | |||
cell_sz = child_w + padding_l + padding_r; | cell_sz = child_w + padding_l + padding_r; | |||
} | } | |||
global_pad = priv->pad.h; | global_pad = priv->pad.h; | |||
remaining = w - n_children * cell_sz - global_pad * (n_children - 1); | remaining = w - n_children * cell_sz - global_pad * (n_children - 1); | |||
if (priv->align.h >= 0.0) | if (priv->align.h >= 0.0) | |||
x += remaining * priv->align.h; | x += remaining * priv->align.h; | |||
else if (n_children == 1) | else if (n_children == 1) | |||
x += remaining / 2; | x += remaining / 2; | |||
else | else | |||
{ /* justified */ | { /* justified */ | |||
_fixed_point_divide_and_decompose_integer | _fixed_point_divide_and_decompose_integer | |||
(remaining, n_children - 1, &global_pad, &pad_inc); | (remaining, n_children - 1, &global_pad, &pad_inc); | |||
global_pad += priv->pad.h; | global_pad += priv->pad.h; | |||
} | } | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int child_w, child_h, min_w, max_w, max_h, new_w, new_h, off_x, off _y; | int child_w, child_h, min_w, max_w, max_h, new_w, new_h, off_x, off _y; | |||
int padding_l, padding_r, padding_t, padding_b; | int padding_l, padding_r, padding_t, padding_b; | |||
double align_x, align_y; | double align_x, align_y; | |||
evas_object_size_hint_align_get(opt->obj, &align_x, &align_y); | evas_object_size_hint_align_get(opt->obj, &align_x, &align_y); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | (opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | |||
evas_object_size_hint_max_get(opt->obj, &max_w, &max_h); | evas_object_size_hint_max_get(opt->obj, &max_w, &max_h); | |||
evas_object_size_hint_min_get(opt->obj, &min_w, NULL); | evas_object_size_hint_min_get(opt->obj, &min_w, NULL); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | |||
new_w = child_w; | new_w = child_w; | |||
new_h = child_h; | new_h = child_h; | |||
if (new_h > top_h) top_h = new_h; | if (new_h > top_h) top_h = new_h; | |||
_layout_set_offset_and_expand_dimension_space_max_bounded | _layout_set_offset_and_expand_dimension_space_max_bounded | |||
(child_h, &new_h, h, max_h, &off_y, align_y, padding_t, padding_b) ; | (child_h, &new_h, h, max_h, &off_y, align_y, padding_t, padding_ b); | |||
_layout_set_offset_and_change_dimension_min_max_cell_bounded | _layout_set_offset_and_change_dimension_min_max_cell_bounded | |||
(child_w, &new_w, min_w, max_w, cell_sz, &off_x, align_x, | (child_w, &new_w, min_w, max_w, cell_sz, &off_x, align_x, | |||
padding_l, padding_r); | padding_l, padding_r); | |||
if ((new_w != child_w) || (new_h != child_h)) | if ((new_w != child_w) || (new_h != child_h)) | |||
evas_object_resize(opt->obj, new_w, new_h); | evas_object_resize(opt->obj, new_w, new_h); | |||
evas_object_move(opt->obj, x + off_x, y + off_y); | evas_object_move(opt->obj, x + off_x, y + off_y); | |||
x += cell_sz + global_pad; | x += cell_sz + global_pad; | |||
sub_pixel += pad_inc; | sub_pixel += pad_inc; | |||
if (sub_pixel >= 1 << 16) | if (sub_pixel >= 1 << 16) | |||
{ | { | |||
x++; | x++; | |||
sub_pixel -= 1 << 16; | sub_pixel -= 1 << 16; | |||
} | } | |||
} | } | |||
evas_object_size_hint_min_set(o, x, top_h); | evas_object_size_hint_min_set(o, x, top_h); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_layout_homogeneous_max_size_vertical(Evas_Object *o, Evas_O bject_Box_Data *priv, void *data __UNUSED__) | evas_object_box_layout_homogeneous_max_size_vertical(Evas_Object *o, Evas_O bject_Box_Data *priv, void *data __UNUSED__) | |||
{ | { | |||
int remaining, global_pad, pad_inc = 0, sub_pixel = 0; | int remaining, global_pad, pad_inc = 0, sub_pixel = 0; | |||
int cell_sz = 0; | int cell_sz = 0; | |||
skipping to change at line 1234 | skipping to change at line 1235 | |||
n_children = eina_list_count(priv->children); | n_children = eina_list_count(priv->children); | |||
if (!n_children) | if (!n_children) | |||
return; | return; | |||
evas_object_geometry_get(o, &x, &y, &w, &h); | evas_object_geometry_get(o, &x, &y, &w, &h); | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int child_h, padding_t, padding_b; | int child_h, padding_t, padding_b; | |||
_sizing_eval(opt->obj); | _sizing_eval(opt->obj); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, NULL, NULL, &padding_t, &padding_b); | (opt->obj, NULL, NULL, &padding_t, &padding_b); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, NULL, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, NULL, &child_h); | |||
if (child_h + padding_t + padding_b > cell_sz) | if (child_h + padding_t + padding_b > cell_sz) | |||
cell_sz = child_h + padding_t + padding_b; | cell_sz = child_h + padding_t + padding_b; | |||
} | } | |||
global_pad = priv->pad.v; | global_pad = priv->pad.v; | |||
remaining = h - n_children * cell_sz - global_pad * (n_children - 1); | remaining = h - n_children * cell_sz - global_pad * (n_children - 1); | |||
if (priv->align.v >= 0.0) | if (priv->align.v >= 0.0) | |||
y += remaining * priv->align.v; | y += remaining * priv->align.v; | |||
else if (n_children == 1) | else if (n_children == 1) | |||
y += remaining / 2; | y += remaining / 2; | |||
else | else | |||
{ /* justified */ | { /* justified */ | |||
_fixed_point_divide_and_decompose_integer | _fixed_point_divide_and_decompose_integer | |||
(remaining, n_children - 1, &global_pad, &pad_inc); | (remaining, n_children - 1, &global_pad, &pad_inc); | |||
global_pad += priv->pad.v; | global_pad += priv->pad.v; | |||
} | } | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
int child_w, child_h, max_h, min_h, max_w, new_w, new_h, off_x, off _y; | int child_w, child_h, max_h, min_h, max_w, new_w, new_h, off_x, off _y; | |||
int padding_l, padding_r, padding_t, padding_b; | int padding_l, padding_r, padding_t, padding_b; | |||
double align_x, align_y; | double align_x, align_y; | |||
evas_object_size_hint_align_get(opt->obj, &align_x, &align_y); | evas_object_size_hint_align_get(opt->obj, &align_x, &align_y); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | (opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | |||
evas_object_size_hint_max_get(opt->obj, &max_w, &max_h); | evas_object_size_hint_max_get(opt->obj, &max_w, &max_h); | |||
evas_object_size_hint_min_get(opt->obj, NULL, &min_h); | evas_object_size_hint_min_get(opt->obj, NULL, &min_h); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | |||
new_w = child_w; | new_w = child_w; | |||
new_h = child_h; | new_h = child_h; | |||
if (new_w > top_w) top_w = new_w; | if (new_w > top_w) top_w = new_w; | |||
_layout_set_offset_and_expand_dimension_space_max_bounded | _layout_set_offset_and_expand_dimension_space_max_bounded | |||
(child_w, &new_w, w, max_w, &off_x, align_x, padding_l, padding_r) ; | (child_w, &new_w, w, max_w, &off_x, align_x, padding_l, padding_ r); | |||
_layout_set_offset_and_change_dimension_min_max_cell_bounded | _layout_set_offset_and_change_dimension_min_max_cell_bounded | |||
(child_h, &new_h, min_h, max_h, cell_sz, &off_y, align_y, | (child_h, &new_h, min_h, max_h, cell_sz, &off_y, align_y, | |||
padding_t, padding_b); | padding_t, padding_b); | |||
if ((new_w != child_w) || (new_h != child_h)) | if ((new_w != child_w) || (new_h != child_h)) | |||
evas_object_resize(opt->obj, new_w, new_h); | evas_object_resize(opt->obj, new_w, new_h); | |||
evas_object_move(opt->obj, x + off_x, y + off_y); | evas_object_move(opt->obj, x + off_x, y + off_y); | |||
y += cell_sz + global_pad; | y += cell_sz + global_pad; | |||
sub_pixel += pad_inc; | sub_pixel += pad_inc; | |||
if (sub_pixel >= 1 << 16) | if (sub_pixel >= 1 << 16) | |||
{ | { | |||
y++; | y++; | |||
sub_pixel -= 1 << 16; | sub_pixel -= 1 << 16; | |||
} | } | |||
} | } | |||
evas_object_size_hint_min_set(o, top_w, y); | evas_object_size_hint_min_set(o, top_w, y); | |||
} | } | |||
static void | static void | |||
_evas_object_box_layout_flow_horizontal_row_info_collect(Evas_Object_Box_Da ta *priv, int box_w, int *row_count, int *row_max_h, int *row_break, int *r ow_width, int *off_y_ret, int *max_h_ret) | _evas_object_box_layout_flow_horizontal_row_info_collect(Evas_Object_Box_Da ta *priv, int box_w, int *row_count, int *row_max_h, int *row_break, int *r ow_width, int *off_y_ret, int *max_h_ret) | |||
{ | { | |||
int i, remain_w = box_w, start_i = 0; | int i, remain_w = box_w, start_i = 0; | |||
int off_y = 0, max_h = 0, n_rows = 0; | int off_y = 0, max_h = 0, n_rows = 0; | |||
Eina_List *l; | Eina_List *l; | |||
for (i = 0, l = priv->children; l; i++, l = l->next) | for (i = 0, l = priv->children; l; i++, l = l->next) | |||
{ | { | |||
Evas_Object_Box_Option *opt = l->data; | Evas_Object_Box_Option *opt = l->data; | |||
int padding_l, padding_r, padding_t, padding_b; | int padding_l, padding_r, padding_t, padding_b; | |||
int child_w, child_h, off_x = 0; | int child_w, child_h, off_x = 0; | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | (opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | |||
_sizing_eval(opt->obj); | _sizing_eval(opt->obj); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | |||
child_w += padding_l + padding_r + priv->pad.h; | child_w += padding_l + padding_r + priv->pad.h; | |||
child_h += padding_t + padding_b; | child_h += padding_t + padding_b; | |||
remain_w -= child_w; | remain_w -= child_w; | |||
if (remain_w + priv->pad.h >= 0) | if (remain_w + priv->pad.h >= 0) | |||
{ /* continue "line" */ | { /* continue "line" */ | |||
if (child_h > max_h) | if (child_h > max_h) | |||
max_h = child_h; | max_h = child_h; | |||
off_x += child_w; | off_x += child_w; | |||
row_width[n_rows] += child_w; | row_width[n_rows] += child_w; | |||
} | } | |||
else | else | |||
{ /* break line */ | { /* break line */ | |||
if (i == start_i) | if (i == start_i) | |||
{ /* obj goes to actual line */ | { /* obj goes to actual line */ | |||
max_h = child_h; | max_h = child_h; | |||
row_width[n_rows] = child_w; | row_width[n_rows] = child_w; | |||
} | } | |||
else | else | |||
{ /* obj goes to next line */ | { /* obj goes to next line */ | |||
row_max_h[n_rows] = max_h; | row_max_h[n_rows] = max_h; | |||
row_break[n_rows] = i - 1; | row_break[n_rows] = i - 1; | |||
n_rows++; | n_rows++; | |||
off_x = child_w; | off_x = child_w; | |||
off_y += max_h; | off_y += max_h; | |||
max_h = child_h; | max_h = child_h; | |||
row_width[n_rows] = child_w; | row_width[n_rows] = child_w; | |||
start_i = i; | start_i = i; | |||
remain_w = box_w - off_x; | remain_w = box_w - off_x; | |||
} | } | |||
} | } | |||
} | } | |||
row_break[n_rows] = i - 1; | row_break[n_rows] = i - 1; | |||
row_max_h[n_rows] = max_h; | row_max_h[n_rows] = max_h; | |||
*row_count = n_rows; | *row_count = n_rows; | |||
*off_y_ret = off_y; | *off_y_ret = off_y; | |||
*max_h_ret = max_h; | *max_h_ret = max_h; | |||
} | } | |||
skipping to change at line 1403 | skipping to change at line 1404 | |||
evas_object_geometry_get(o, &x, &y, &w, &h); | evas_object_geometry_get(o, &x, &y, &w, &h); | |||
_evas_object_box_layout_flow_horizontal_row_info_collect | _evas_object_box_layout_flow_horizontal_row_info_collect | |||
(priv, w, &row_count, row_max_h, row_break, row_width, &offset_y, &max _h); | (priv, w, &row_count, row_max_h, row_break, row_width, &offset_y, &max _h); | |||
inc_y = 0; | inc_y = 0; | |||
remain_y = h - (offset_y + max_h); | remain_y = h - (offset_y + max_h); | |||
if (remain_y > 0) | if (remain_y > 0) | |||
{ | { | |||
if (priv->align.v >= 0.0) | if (priv->align.v >= 0.0) | |||
inc_y = priv->align.v * remain_y; | inc_y = priv->align.v * remain_y; | |||
else if (row_count == 0) | else if (row_count == 0) | |||
y += remain_y / 2; | y += remain_y / 2; | |||
else /* y-justified */ | else /* y-justified */ | |||
inc_y = remain_y / row_count; | inc_y = remain_y / row_count; | |||
} | } | |||
inc_y += priv->pad.v; | inc_y += priv->pad.v; | |||
for (i = 0, r = 0, l = priv->children; r <= row_count; r++) | for (i = 0, r = 0, l = priv->children; r <= row_count; r++) | |||
{ | { | |||
int row_justify = 0, just_inc = 0, sub_pixel = 0; | int row_justify = 0, just_inc = 0, sub_pixel = 0; | |||
int row_size, remain_x; | int row_size, remain_x; | |||
row_size = row_break[r] - i; | row_size = row_break[r] - i; | |||
remain_x = (w - row_width[r]); | remain_x = (w - row_width[r]); | |||
if (priv->align.h < 0.0) | if (priv->align.h < 0.0) | |||
{ | { | |||
if (row_size == 0) | if (row_size == 0) | |||
x += remain_x / 2; | x += remain_x / 2; | |||
else | else | |||
_fixed_point_divide_and_decompose_integer | _fixed_point_divide_and_decompose_integer | |||
(remain_x, row_size, &row_justify, &just_inc); | (remain_x, row_size, &row_justify, &just_inc); | |||
} | } | |||
row_justify += priv->pad.h; | row_justify += priv->pad.h; | |||
for (; i <= row_break[r]; i++, l = l->next) | for (; i <= row_break[r]; i++, l = l->next) | |||
{ | { | |||
Evas_Object_Box_Option *opt = l->data; | Evas_Object_Box_Option *opt = l->data; | |||
int off_x, off_y, y_remain; | int off_x, off_y, y_remain; | |||
int padding_l, padding_r; | int padding_l, padding_r; | |||
int child_w, child_h; | int child_w, child_h; | |||
double align_y; | double align_y; | |||
evas_object_size_hint_align_get(opt->obj, NULL, &align_y); | evas_object_size_hint_align_get(opt->obj, NULL, &align_y); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, NULL, NULL); | (opt->obj, &padding_l, &padding_r, NULL, NULL); | |||
evas_object_geometry_get | evas_object_geometry_get | |||
(opt->obj, NULL, NULL, &child_w, &child_h); | (opt->obj, NULL, NULL, &child_w, &child_h); | |||
y_remain = row_max_h[r] - child_h; | y_remain = row_max_h[r] - child_h; | |||
off_x = padding_l; | off_x = padding_l; | |||
if (priv->align.h >= 0.0) | if (priv->align.h >= 0.0) | |||
off_x += remain_x * priv->align.h; | off_x += remain_x * priv->align.h; | |||
off_y = y_remain * align_y; | off_y = y_remain * align_y; | |||
evas_object_move(opt->obj, x + off_x, y + off_y); | evas_object_move(opt->obj, x + off_x, y + off_y); | |||
x += child_w + padding_l + padding_r + row_justify; | x += child_w + padding_l + padding_r + row_justify; | |||
sub_pixel += just_inc; | sub_pixel += just_inc; | |||
if (sub_pixel >= 1 << 16) | if (sub_pixel >= 1 << 16) | |||
{ | { | |||
x++; | x++; | |||
sub_pixel -= 1 << 16; | sub_pixel -= 1 << 16; | |||
} | } | |||
} | } | |||
evas_object_geometry_get(o, &x, NULL, NULL, NULL); | evas_object_geometry_get(o, &x, NULL, NULL, NULL); | |||
if (min_w < row_width[r]) | if (min_w < row_width[r]) | |||
min_w = row_width[r]; | min_w = row_width[r]; | |||
min_h += row_max_h[r]; | min_h += row_max_h[r]; | |||
y += row_max_h[r] + inc_y; | y += row_max_h[r] + inc_y; | |||
} | } | |||
evas_object_size_hint_min_set(o, min_w, min_h); | evas_object_size_hint_min_set(o, min_w, min_h); | |||
} | } | |||
skipping to change at line 1490 | skipping to change at line 1491 | |||
int off_x = 0, max_w = 0, n_cols = 0; | int off_x = 0, max_w = 0, n_cols = 0; | |||
Eina_List *l; | Eina_List *l; | |||
for (i = 0, l = priv->children; l; i++, l = l->next) | for (i = 0, l = priv->children; l; i++, l = l->next) | |||
{ | { | |||
Evas_Object_Box_Option *opt = l->data; | Evas_Object_Box_Option *opt = l->data; | |||
int padding_l, padding_r, padding_t, padding_b; | int padding_l, padding_r, padding_t, padding_b; | |||
int child_w, child_h, off_y = 0; | int child_w, child_h, off_y = 0; | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | (opt->obj, &padding_l, &padding_r, &padding_t, &padding_b); | |||
_sizing_eval(opt->obj); | _sizing_eval(opt->obj); | |||
evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | evas_object_geometry_get(opt->obj, NULL, NULL, &child_w, &child_h); | |||
child_w += padding_l + padding_r; | child_w += padding_l + padding_r; | |||
child_h += padding_t + padding_b + priv->pad.v; | child_h += padding_t + padding_b + priv->pad.v; | |||
remain_h -= child_h; | remain_h -= child_h; | |||
if (remain_h + priv->pad.v >= 0) | if (remain_h + priv->pad.v >= 0) | |||
{ /* continue "col" */ | { /* continue "col" */ | |||
if (child_w > max_w) | if (child_w > max_w) | |||
max_w = child_w; | max_w = child_w; | |||
off_y += child_h; | off_y += child_h; | |||
col_height[n_cols] += child_h; | col_height[n_cols] += child_h; | |||
} | } | |||
else | else | |||
{ | { | |||
/* break col */ | /* break col */ | |||
if (i == start_i) | if (i == start_i) | |||
{ /* obj goes to actual col */ | { /* obj goes to actual col */ | |||
max_w = child_w; | max_w = child_w; | |||
col_height[n_cols] = child_h; | col_height[n_cols] = child_h; | |||
} | } | |||
else | else | |||
{ /* obj goes to next col */ | { /* obj goes to next col */ | |||
col_max_w[n_cols] = max_w; | col_max_w[n_cols] = max_w; | |||
col_break[n_cols] = i - 1; | col_break[n_cols] = i - 1; | |||
n_cols++; | n_cols++; | |||
off_x += max_w; | off_x += max_w; | |||
off_y = child_h; | off_y = child_h; | |||
max_w = child_w; | max_w = child_w; | |||
col_height[n_cols] = child_h; | col_height[n_cols] = child_h; | |||
start_i = i; | start_i = i; | |||
remain_h = box_h - off_y; | remain_h = box_h - off_y; | |||
} | } | |||
} | } | |||
} | } | |||
col_break[n_cols] = i - 1; | col_break[n_cols] = i - 1; | |||
col_max_w[n_cols] = max_w; | col_max_w[n_cols] = max_w; | |||
*col_count = n_cols; | *col_count = n_cols; | |||
*off_x_ret = off_x; | *off_x_ret = off_x; | |||
*max_w_ret = max_w; | *max_w_ret = max_w; | |||
} | } | |||
skipping to change at line 1583 | skipping to change at line 1584 | |||
evas_object_geometry_get(o, &x, &y, &w, &h); | evas_object_geometry_get(o, &x, &y, &w, &h); | |||
_evas_object_box_layout_flow_vertical_col_info_collect | _evas_object_box_layout_flow_vertical_col_info_collect | |||
(priv, h, &col_count, col_max_w, col_break, col_height, &offset_x, &ma x_w); | (priv, h, &col_count, col_max_w, col_break, col_height, &offset_x, &ma x_w); | |||
inc_x = 0; | inc_x = 0; | |||
remain_x = w - (offset_x + max_w); | remain_x = w - (offset_x + max_w); | |||
if (remain_x > 0) | if (remain_x > 0) | |||
{ | { | |||
if (priv->align.h >= 0) | if (priv->align.h >= 0) | |||
inc_x = priv->align.h * remain_x; | inc_x = priv->align.h * remain_x; | |||
else if (col_count == 0) | else if (col_count == 0) | |||
x += remain_x / 2; | x += remain_x / 2; | |||
else /* x-justified */ | else /* x-justified */ | |||
inc_x = remain_x / col_count; | inc_x = remain_x / col_count; | |||
} | } | |||
inc_x += priv->pad.h; | inc_x += priv->pad.h; | |||
for (i = 0, c = 0, l = priv->children; c <= col_count; c++) | for (i = 0, c = 0, l = priv->children; c <= col_count; c++) | |||
{ | { | |||
int col_justify = 0, just_inc = 0, sub_pixel = 0; | int col_justify = 0, just_inc = 0, sub_pixel = 0; | |||
int col_size, remain_y; | int col_size, remain_y; | |||
col_size = col_break[c] - i; | col_size = col_break[c] - i; | |||
remain_y = (h - col_height[c]); | remain_y = (h - col_height[c]); | |||
if (priv->align.v < 0.0) | if (priv->align.v < 0.0) | |||
{ | { | |||
if (col_size == 0) | if (col_size == 0) | |||
y += remain_y / 2; | y += remain_y / 2; | |||
else | else | |||
_fixed_point_divide_and_decompose_integer | _fixed_point_divide_and_decompose_integer | |||
(remain_y, col_size, &col_justify, &just_inc); | (remain_y, col_size, &col_justify, &just_inc); | |||
} | } | |||
col_justify += priv->pad.v; | col_justify += priv->pad.v; | |||
for (; i <= col_break[c]; i++, l = l->next) | for (; i <= col_break[c]; i++, l = l->next) | |||
{ | { | |||
Evas_Object_Box_Option *opt = l->data; | Evas_Object_Box_Option *opt = l->data; | |||
int off_x, off_y, x_remain; | int off_x, off_y, x_remain; | |||
int padding_t, padding_b; | int padding_t, padding_b; | |||
int child_w, child_h; | int child_w, child_h; | |||
double align_x; | double align_x; | |||
evas_object_size_hint_align_get(opt->obj, &align_x, NULL); | evas_object_size_hint_align_get(opt->obj, &align_x, NULL); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(opt->obj, NULL, NULL, &padding_t, &padding_b); | (opt->obj, NULL, NULL, &padding_t, &padding_b); | |||
evas_object_geometry_get | evas_object_geometry_get | |||
(opt->obj, NULL, NULL, &child_w, &child_h); | (opt->obj, NULL, NULL, &child_w, &child_h); | |||
x_remain = col_max_w[c] - child_w; | x_remain = col_max_w[c] - child_w; | |||
off_x = x_remain * align_x; | off_x = x_remain * align_x; | |||
off_y = padding_t; | off_y = padding_t; | |||
if (priv->align.v >= 0.0) | if (priv->align.v >= 0.0) | |||
off_y += remain_y * priv->align.v; | off_y += remain_y * priv->align.v; | |||
evas_object_move(opt->obj, x + off_x, y + off_y); | evas_object_move(opt->obj, x + off_x, y + off_y); | |||
y += child_h + padding_t + padding_b + col_justify; | y += child_h + padding_t + padding_b + col_justify; | |||
sub_pixel += just_inc; | sub_pixel += just_inc; | |||
if (sub_pixel >= 1 << 16) | if (sub_pixel >= 1 << 16) | |||
{ | { | |||
y++; | y++; | |||
sub_pixel -= 1 << 16; | sub_pixel -= 1 << 16; | |||
} | } | |||
} | } | |||
evas_object_geometry_get(o, NULL, &y, NULL, NULL); | evas_object_geometry_get(o, NULL, &y, NULL, NULL); | |||
min_w += col_max_w[c]; | min_w += col_max_w[c]; | |||
if (min_h < col_height[c]) | if (min_h < col_height[c]) | |||
min_h = col_height[c]; | min_h = col_height[c]; | |||
x += col_max_w[c] + inc_x; | x += col_max_w[c] + inc_x; | |||
} | } | |||
evas_object_size_hint_min_set(o, min_w, min_h); | evas_object_size_hint_min_set(o, min_w, min_h); | |||
} | } | |||
skipping to change at line 1671 | skipping to change at line 1672 | |||
Evas_Coord top_w = 0, top_h = 0; | Evas_Coord top_w = 0, top_h = 0; | |||
Evas_Object_Box_Option *opt; | Evas_Object_Box_Option *opt; | |||
Evas_Object *old_child = NULL; | Evas_Object *old_child = NULL; | |||
evas_object_geometry_get(o, &ox, &oy, &ow, &oh); | evas_object_geometry_get(o, &ox, &oy, &ow, &oh); | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
Evas_Object *child = opt->obj; | Evas_Object *child = opt->obj; | |||
Evas_Coord max_w, max_h, min_w, min_h, pad_l, pad_r, pad_t, pad_b, | Evas_Coord max_w, max_h, min_w, min_h, pad_l, pad_r, pad_t, pad_b, | |||
child_w, child_h, new_w, new_h, off_x, off_y; | child_w, child_h, new_w, new_h, off_x, off_y; | |||
double align_x, align_y; | double align_x, align_y; | |||
evas_object_size_hint_align_get(child, &align_x, &align_y); | evas_object_size_hint_align_get(child, &align_x, &align_y); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(child, &pad_l, &pad_r, &pad_t, &pad_b); | (child, &pad_l, &pad_r, &pad_t, &pad_b); | |||
evas_object_size_hint_max_get(child, &max_w, &max_h); | evas_object_size_hint_max_get(child, &max_w, &max_h); | |||
evas_object_size_hint_min_get(child, &min_w, &min_h); | evas_object_size_hint_min_get(child, &min_w, &min_h); | |||
_sizing_eval(opt->obj); | _sizing_eval(opt->obj); | |||
evas_object_geometry_get(child, NULL, NULL, &child_w, &child_h); | evas_object_geometry_get(child, NULL, NULL, &child_w, &child_h); | |||
new_w = child_w; | new_w = child_w; | |||
new_h = child_h; | new_h = child_h; | |||
if (new_w > top_w) top_w = new_w; | if (new_w > top_w) top_w = new_w; | |||
if (new_h > top_h) top_h = new_h; | if (new_h > top_h) top_h = new_h; | |||
_layout_set_offset_and_change_dimension_min_max_cell_bounded | _layout_set_offset_and_change_dimension_min_max_cell_bounded | |||
(child_w, &new_w, min_w, max_w, ow, &off_x, align_x, pad_l, pad_r) ; | (child_w, &new_w, min_w, max_w, ow, &off_x, align_x, pad_l, pad_ r); | |||
_layout_set_offset_and_change_dimension_min_max_cell_bounded | _layout_set_offset_and_change_dimension_min_max_cell_bounded | |||
(child_h, &new_h, min_h, max_h, oh, &off_y, align_y, pad_t, pad_b) ; | (child_h, &new_h, min_h, max_h, oh, &off_y, align_y, pad_t, pad_ b); | |||
if ((new_w != child_w) || (new_h != child_h)) | if ((new_w != child_w) || (new_h != child_h)) | |||
evas_object_resize(child, new_w, new_h); | evas_object_resize(child, new_w, new_h); | |||
evas_object_move(child, ox + off_x, oy + off_y); | evas_object_move(child, ox + off_x, oy + off_y); | |||
if (old_child) | if (old_child) | |||
evas_object_stack_above(child, old_child); | evas_object_stack_above(child, old_child); | |||
old_child = child; | old_child = child; | |||
} | } | |||
evas_object_size_hint_min_set(o, top_w, top_h); | evas_object_size_hint_min_set(o, top_w, top_h); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_align_set(Evas_Object *o, double horizontal, double vertica l) | evas_object_box_align_set(Evas_Object *o, double horizontal, double vertica l) | |||
{ | { | |||
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(o, priv); | EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(o, priv); | |||
skipping to change at line 1721 | skipping to change at line 1722 | |||
priv->align.v = vertical; | priv->align.v = vertical; | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_align_get(const Evas_Object *o, double *horizontal, double *vertical) | evas_object_box_align_get(const Evas_Object *o, double *horizontal, double *vertical) | |||
{ | { | |||
EVAS_OBJECT_BOX_DATA_GET(o, priv); | EVAS_OBJECT_BOX_DATA_GET(o, priv); | |||
if (priv) | if (priv) | |||
{ | { | |||
if (horizontal) *horizontal = priv->align.h; | if (horizontal) *horizontal = priv->align.h; | |||
if (vertical) *vertical = priv->align.v; | if (vertical) *vertical = priv->align.v; | |||
} | } | |||
else | else | |||
{ | { | |||
if (horizontal) *horizontal = 0.5; | if (horizontal) *horizontal = 0.5; | |||
if (vertical) *vertical = 0.5; | if (vertical) *vertical = 0.5; | |||
} | } | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_padding_set(Evas_Object *o, Evas_Coord horizontal, Evas_Coo rd vertical) | evas_object_box_padding_set(Evas_Object *o, Evas_Coord horizontal, Evas_Coo rd vertical) | |||
{ | { | |||
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(o, priv); | EVAS_OBJECT_BOX_DATA_GET_OR_RETURN(o, priv); | |||
if (priv->pad.h == horizontal && priv->pad.v == vertical) | if (priv->pad.h == horizontal && priv->pad.v == vertical) | |||
return; | return; | |||
priv->pad.h = horizontal; | priv->pad.h = horizontal; | |||
priv->pad.v = vertical; | priv->pad.v = vertical; | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_box_padding_get(const Evas_Object *o, Evas_Coord *horizontal, E vas_Coord *vertical) | evas_object_box_padding_get(const Evas_Object *o, Evas_Coord *horizontal, E vas_Coord *vertical) | |||
{ | { | |||
EVAS_OBJECT_BOX_DATA_GET(o, priv); | EVAS_OBJECT_BOX_DATA_GET(o, priv); | |||
if (priv) | if (priv) | |||
{ | { | |||
if (horizontal) *horizontal = priv->pad.h; | if (horizontal) *horizontal = priv->pad.h; | |||
if (vertical) *vertical = priv->pad.v; | if (vertical) *vertical = priv->pad.v; | |||
} | } | |||
else | else | |||
{ | { | |||
if (horizontal) *horizontal = 0; | if (horizontal) *horizontal = 0; | |||
if (vertical) *vertical = 0; | if (vertical) *vertical = 0; | |||
} | } | |||
} | } | |||
EAPI Evas_Object_Box_Option * | EAPI Evas_Object_Box_Option * | |||
evas_object_box_append(Evas_Object *o, Evas_Object *child) | evas_object_box_append(Evas_Object *o, Evas_Object *child) | |||
{ | { | |||
Evas_Object_Box_Option *opt; | Evas_Object_Box_Option *opt; | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, 0); | EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, 0); | |||
skipping to change at line 1854 | skipping to change at line 1855 | |||
return NULL; | return NULL; | |||
api = priv->api; | api = priv->api; | |||
if ((!api) || (!api->insert_after)) | if ((!api) || (!api->insert_after)) | |||
return NULL; | return NULL; | |||
opt = api->insert_after(o, priv, child, reference); | opt = api->insert_after(o, priv, child, reference); | |||
if (opt) | if (opt) | |||
{ | { | |||
evas_object_smart_member_add(child, o); | evas_object_smart_member_add(child, o); | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
return _evas_object_box_option_callbacks_register(o, priv, opt); | return _evas_object_box_option_callbacks_register(o, priv, opt); | |||
} | } | |||
return NULL; | return NULL; | |||
} | } | |||
EAPI Evas_Object_Box_Option * | EAPI Evas_Object_Box_Option * | |||
evas_object_box_insert_at(Evas_Object *o, Evas_Object *child, unsigned int pos) | evas_object_box_insert_at(Evas_Object *o, Evas_Object *child, unsigned int pos) | |||
{ | { | |||
Evas_Object_Box_Option *opt; | Evas_Object_Box_Option *opt; | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
skipping to change at line 2031 | skipping to change at line 2032 | |||
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, NULL); | EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, NULL); | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
new_list = eina_list_append(new_list, opt->obj); | new_list = eina_list_append(new_list, opt->obj); | |||
return new_list; | return new_list; | |||
} | } | |||
EAPI const char * | EAPI const char * | |||
evas_object_box_option_property_name_get(Evas_Object *o, int property) | evas_object_box_option_property_name_get(const Evas_Object *o, int property ) | |||
{ | { | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, NULL); | EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, NULL); | |||
if (property < 0) | if (property < 0) | |||
return NULL; | return NULL; | |||
api = priv->api; | api = priv->api; | |||
if ((!api) || (!api->property_name_get)) | if ((!api) || (!api->property_name_get)) | |||
return NULL; | return NULL; | |||
return api->property_name_get(o, property); | return api->property_name_get(o, property); | |||
} | } | |||
EAPI int | EAPI int | |||
evas_object_box_option_property_id_get(Evas_Object *o, const char *name) | evas_object_box_option_property_id_get(const Evas_Object *o, const char *na me) | |||
{ | { | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, -1); | EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, -1); | |||
if (!name) | if (!name) | |||
return -1; | return -1; | |||
api = priv->api; | api = priv->api; | |||
if ((!api) || (!api->property_id_get)) | if ((!api) || (!api->property_id_get)) | |||
skipping to change at line 2098 | skipping to change at line 2099 | |||
return EINA_FALSE; | return EINA_FALSE; | |||
if (!api->property_set(o, opt, property, args)) | if (!api->property_set(o, opt, property, args)) | |||
return EINA_FALSE; | return EINA_FALSE; | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
return EINA_TRUE; | return EINA_TRUE; | |||
} | } | |||
EAPI Eina_Bool | EAPI Eina_Bool | |||
evas_object_box_option_property_get(Evas_Object *o, Evas_Object_Box_Option *opt, int property, ...) | evas_object_box_option_property_get(const Evas_Object *o, Evas_Object_Box_O ption *opt, int property, ...) | |||
{ | { | |||
Eina_Bool ret; | Eina_Bool ret; | |||
va_list args; | va_list args; | |||
va_start(args, property); | va_start(args, property); | |||
ret = evas_object_box_option_property_vget(o, opt, property, args); | ret = evas_object_box_option_property_vget(o, opt, property, args); | |||
va_end(args); | va_end(args); | |||
return ret; | return ret; | |||
} | } | |||
EAPI Eina_Bool | EAPI Eina_Bool | |||
evas_object_box_option_property_vget(Evas_Object *o, Evas_Object_Box_Option *opt, int property, va_list args) | evas_object_box_option_property_vget(const Evas_Object *o, Evas_Object_Box_ Option *opt, int property, va_list args) | |||
{ | { | |||
const Evas_Object_Box_Api *api; | const Evas_Object_Box_Api *api; | |||
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, 0); | EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, 0); | |||
if (!opt) return EINA_FALSE; | if (!opt) return EINA_FALSE; | |||
api = priv->api; | api = priv->api; | |||
if ((!api) || (!api->property_get)) | if ((!api) || (!api->property_get)) | |||
return EINA_FALSE; | return EINA_FALSE; | |||
End of changes. 115 change blocks. | ||||
456 lines changed or deleted | 460 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |