forked from enlightenment/efl
elm_layout: deferred sizing_eval to calculate (pre-render) phase.
This plays well with edje's own deferred calculations. Usually size hints are set on children and edje will flag itself as dirty, but real calculations are deferred to "calculate" phase before rendering. For now this unbreaks elm_layout with contents... but other types such as GROUP, BOX and TABLE remain broken: when they change their internal state (ie: child object is packed into box or table), this will not trigger elm_layout. That said, we need a better solution. Maybe ask edje to emit signals when one of its children change hints (it already listen to this anyway), in this case elm_layout should listen to those instead of connecting directly to objects given through elm_layout_content_set(). SVN revision: 43752
This commit is contained in:
parent
04242f0952
commit
818032a68f
|
@ -17,6 +17,7 @@ struct _Widget_Data
|
|||
{
|
||||
Evas_Object *lay;
|
||||
Eina_List *subs;
|
||||
Eina_Bool needs_size_calc:1;
|
||||
};
|
||||
|
||||
struct _Subinfo
|
||||
|
@ -55,6 +56,17 @@ _theme_hook(Evas_Object *obj)
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_changed_hook(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->needs_size_calc)
|
||||
{
|
||||
_sizing_eval(obj);
|
||||
wd->needs_size_calc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_sizing_eval(Evas_Object *obj)
|
||||
{
|
||||
|
@ -66,10 +78,19 @@ _sizing_eval(Evas_Object *obj)
|
|||
evas_object_size_hint_max_set(obj, -1, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
_request_sizing_eval(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->needs_size_calc) return;
|
||||
wd->needs_size_calc = 1;
|
||||
evas_object_smart_changed(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
_sizing_eval(data);
|
||||
_request_sizing_eval(data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -119,13 +140,14 @@ elm_layout_add(Evas_Object *parent)
|
|||
elm_widget_data_set(obj, wd);
|
||||
elm_widget_del_hook_set(obj, _del_hook);
|
||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_changed_hook_set(obj, _changed_hook);
|
||||
|
||||
wd->lay = edje_object_add(e);
|
||||
elm_widget_resize_object_set(obj, wd->lay);
|
||||
|
||||
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
||||
|
||||
_sizing_eval(obj);
|
||||
_request_sizing_eval(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -146,7 +168,7 @@ elm_layout_file_set(Evas_Object *obj, const char *file, const char *group)
|
|||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Eina_Bool ret = edje_object_file_set(wd->lay, file, group);
|
||||
|
||||
if (ret) _sizing_eval(obj);
|
||||
if (ret) _request_sizing_eval(obj);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -186,7 +208,7 @@ elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *conte
|
|||
si->swallow = eina_stringshare_add(swallow);
|
||||
si->obj = content;
|
||||
wd->subs = eina_list_append(wd->subs, si);
|
||||
_sizing_eval(obj);
|
||||
_request_sizing_eval(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ EAPI void elm_widget_focus_hook_set(Evas_Object *obj, void (*func) (Evas
|
|||
EAPI void elm_widget_activate_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
|
||||
EAPI void elm_widget_disable_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
|
||||
EAPI void elm_widget_theme_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
|
||||
EAPI void elm_widget_changed_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
|
||||
EAPI void elm_widget_theme(Evas_Object *obj);
|
||||
EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
|
||||
EAPI void elm_widget_on_change_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
|
||||
|
|
|
@ -28,6 +28,7 @@ struct _Smart_Data
|
|||
void (*activate_func) (Evas_Object *obj);
|
||||
void (*disable_func) (Evas_Object *obj);
|
||||
void (*theme_func) (Evas_Object *obj);
|
||||
void (*changed_func) (Evas_Object *obj);
|
||||
void (*on_focus_func) (void *data, Evas_Object *obj);
|
||||
void *on_focus_data;
|
||||
void (*on_change_func) (void *data, Evas_Object *obj);
|
||||
|
@ -57,6 +58,7 @@ static void _smart_hide(Evas_Object *obj);
|
|||
static void _smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
|
||||
static void _smart_clip_set(Evas_Object *obj, Evas_Object * clip);
|
||||
static void _smart_clip_unset(Evas_Object *obj);
|
||||
static void _smart_calculate(Evas_Object *obj);
|
||||
static void _smart_init(void);
|
||||
|
||||
/* local subsystem globals */
|
||||
|
@ -145,6 +147,13 @@ elm_widget_theme_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
|
|||
sd->theme_func = func;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_widget_changed_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
|
||||
{
|
||||
API_ENTRY return;
|
||||
sd->changed_func = func;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_widget_theme(Evas_Object *obj)
|
||||
{
|
||||
|
@ -961,6 +970,13 @@ _smart_clip_unset(Evas_Object *obj)
|
|||
evas_object_clip_unset(sd->resize_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_smart_calculate(Evas_Object *obj)
|
||||
{
|
||||
INTERNAL_ENTRY;
|
||||
if (sd->changed_func) sd->changed_func(obj);
|
||||
}
|
||||
|
||||
/* never need to touch this */
|
||||
|
||||
static void
|
||||
|
@ -981,7 +997,7 @@ _smart_init(void)
|
|||
_smart_color_set,
|
||||
_smart_clip_set,
|
||||
_smart_clip_unset,
|
||||
NULL,
|
||||
_smart_calculate,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
Loading…
Reference in New Issue