efl_ui/layout_base: add subobjs_calc internal functionality

Summary:
this functionality forces group_calc on a layout's subobjects during
layout group_calc so that the layout's own group_calc will yield consistent
and correct results

currently this is only used in panel widgets

Depends on D9437

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: bu5hm4n, cedric, #reviewers, #committers

Tags: #efl_widgets

Maniphest Tasks: T8059

Differential Revision: https://phab.enlightenment.org/D9438
This commit is contained in:
Mike Blumenkrantz 2019-07-30 13:11:41 -04:00
parent e583eba56b
commit 586f41f927
2 changed files with 19 additions and 0 deletions

View File

@ -169,6 +169,14 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd)
if (!efl_alive_get(obj)) return;
if (sd->calc_subobjs && !evas_smart_objects_calculating_get(evas_object_evas_get(obj)))
{
Eina_List *l;
Eo *subobj;
/* user has manually triggered a smart calc and wants subobjs to also calc */
EINA_LIST_FOREACH(wd->subobjs, l, subobj)
efl_canvas_group_calculate(subobj);
}
elm_coords_finger_size_adjust(sd->finger_size_multiplier_x, &rest_w,
sd->finger_size_multiplier_y, &rest_h);
if (elm_widget_is_legacy(obj))
@ -202,6 +210,14 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd)
sd->restricted_calc_w = sd->restricted_calc_h = EINA_FALSE;
}
void
_efl_ui_layout_subobjs_calc_set(Eo *obj, Eina_Bool set)
{
Efl_Ui_Layout_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN(sd);
sd->calc_subobjs = !!set;
}
/* common content cases for layout objects: icon and text */
static inline void
_signals_emit(Eo *obj,

View File

@ -75,6 +75,7 @@ typedef struct _Elm_Layout_Smart_Data
Eina_Bool automatic_orientation_apply : 1;
Eina_Bool model_bound : 1; /**< Set to true once we are watching over a model*/
Eina_Bool model_watch : 1; /**< Set to true once we do watch for model change*/
Eina_Bool calc_subobjs : 1; /**< Set to true if group_calc should also handle subobjs during manual calc */
} Efl_Ui_Layout_Data;
/**
@ -88,4 +89,6 @@ typedef struct _Elm_Layout_Smart_Data
if (EINA_UNLIKELY(!efl_isa(obj, EFL_UI_LAYOUT_BASE_CLASS))) \
return
void _efl_ui_layout_subobjs_calc_set(Eo *obj, Eina_Bool set);
#endif