Genlist: Calculate the min size of content before item realize

Summary:
Genlist item doesn't change its size when its content size is changed,
but its size is determined in realization.
Therefore, deferred calculations for content should be performed immediately
before swallowing it by genlist item.

Test Plan: make and run attached sample

Reviewers: jpeg, SanghyeonLee, cedric

Differential Revision: https://phab.enlightenment.org/D4705
This commit is contained in:
Jeeyong Um 2017-06-09 14:34:58 +09:00 committed by Jean-Philippe Andre
parent ebaffb3533
commit 02893c39ba
2 changed files with 25 additions and 14 deletions

View File

@ -203,9 +203,6 @@ Evas_Object *gl_content_full_get(void *data EINA_UNUSED, Evas_Object *obj, const
elm_box_pack_end(bx, ck); elm_box_pack_end(bx, ck);
elm_layout_content_set(fr, NULL, bx); elm_layout_content_set(fr, NULL, bx);
evas_object_size_hint_min_set(fr,
ELM_SCALE_SIZE(100),
ELM_SCALE_SIZE(100));
return fr; return fr;
} }

View File

@ -363,6 +363,24 @@ _item_text_realize(Elm_Gen_Item *it,
} }
} }
static void
_widget_calculate_recursive(Eo *obj)
{
Elm_Widget_Smart_Data *pd = NULL;
Eina_List *l;
Evas_Object *child;
if (!efl_isa(obj, ELM_WIDGET_CLASS)) return;
pd = efl_data_scope_get(obj, ELM_WIDGET_CLASS);
if (!pd) return;
EINA_LIST_FOREACH(pd->subobjs, l, child)
_widget_calculate_recursive(child);
efl_canvas_group_calculate(obj);
}
static void static void
_item_content_realize(Elm_Gen_Item *it, _item_content_realize(Elm_Gen_Item *it,
Evas_Object *target, Evas_Object *target,
@ -409,18 +427,14 @@ _item_content_realize(Elm_Gen_Item *it,
if (content != old) if (content != old)
{ {
// FIXME: cause elm_layout sizing eval is delayed by smart calc, // FIXME: Genlist item doesn't update its size when the size of
// genlist cannot get actual min size of edje. // content is changed, so deferred calculation for content should
// This is workaround code to set min size directly. // be performed before realization.
if (efl_class_get(content) == ELM_LAYOUT_CLASS) if (efl_isa(content, ELM_WIDGET_CLASS))
{ {
Evas_Coord old_w, old_h, minw = 0, minh = 0; ELM_WIDGET_DATA_GET_OR_RETURN(content, wd);
efl_gfx_size_hint_combined_min_get(content, &old_w, &old_h); if (efl_canvas_group_need_recalculate_get(wd->resize_obj))
edje_object_size_min_calc(elm_layout_edje_get(content), &minw, &minh); _widget_calculate_recursive(content);
if (old_w > minw) minw = old_w;
if (old_h > minh) minw = old_h;
evas_object_size_hint_min_set(content, minw, minh);
} }
if (!edje_object_part_swallow(target, key, content)) if (!edje_object_part_swallow(target, key, content))