forked from enlightenment/efl
efl_ui: use unified size hints api and be explicit about which hint is changed
unified widgets should use unified api internally and also be more explicit about which min size hint (restricted or user) is being set in order to improve readability of code when unified widgets also implement legacy wrappers, legacy api should be used for the legacy objects no functional changes Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9495
This commit is contained in:
parent
c5030346d4
commit
f34f92bb29
|
@ -93,7 +93,10 @@ _sizing_eval(Evas_Object *obj)
|
|||
|
||||
elm_coords_finger_size_adjust(fingx, &minw, fingy, &minh);
|
||||
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
if (elm_widget_is_legacy(obj))
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
else
|
||||
efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
|
||||
evas_object_size_hint_max_set(obj, maxw, maxh);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,10 @@ _sizing_eval(Evas_Object *obj,
|
|||
evas_object_size_hint_min_get(obj, &cminw, &cminh);
|
||||
if ((minw == cminw) && (minh == cminh)) return;
|
||||
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
if (elm_widget_is_legacy(obj))
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
else
|
||||
efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
|
||||
evas_object_size_hint_max_set(obj, -1, -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -802,7 +802,10 @@ _efl_ui_image_sizing_eval(Evas_Object *obj)
|
|||
}
|
||||
}
|
||||
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
if (elm_widget_is_legacy(obj))
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
else
|
||||
efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
|
||||
evas_object_size_hint_max_set(obj, maxw, maxh);
|
||||
|
||||
if (sd->img)
|
||||
|
|
|
@ -116,7 +116,10 @@ _sizing_eval(Evas_Object *obj)
|
|||
|
||||
evas_object_size_hint_max_get
|
||||
(wd->resize_obj, &maxw, &maxh);
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
if (elm_widget_is_legacy(obj))
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
else
|
||||
efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
|
||||
evas_object_size_hint_max_set(obj, maxw, maxh);
|
||||
}
|
||||
|
||||
|
@ -1861,7 +1864,10 @@ _efl_ui_image_zoomable_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Zoomable
|
|||
(priv->img, EVAS_CALLBACK_IMAGE_PRELOADED, _main_img_preloaded_cb, obj);
|
||||
|
||||
edje_object_size_min_calc(edje, &minw, &minh);
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
if (elm_widget_is_legacy(obj))
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
else
|
||||
efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
|
||||
|
||||
_efl_ui_image_zoomable_edje_object_attach(obj);
|
||||
|
||||
|
@ -2028,7 +2034,7 @@ _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd,
|
|||
|
||||
evas_object_image_source_set(sd->img, sd->edje);
|
||||
evas_object_image_source_visible_set(sd->img, EINA_FALSE);
|
||||
evas_object_size_hint_min_set(sd->img, w, h);
|
||||
efl_gfx_hint_size_min_set(sd->img, EINA_SIZE2D(w, h));
|
||||
evas_object_show(sd->img);
|
||||
evas_object_show(sd->edje);
|
||||
|
||||
|
|
|
@ -862,7 +862,7 @@ _efl_ui_list_view_efl_ui_list_view_model_min_size_set(Eo *obj, Efl_Ui_List_View_
|
|||
pd->min.w = min.w;
|
||||
pd->min.h = min.h;
|
||||
|
||||
evas_object_size_hint_min_set(wd->resize_obj, pd->min.w, pd->min.h);
|
||||
efl_gfx_hint_size_min_set(wd->resize_obj, EINA_SIZE2D(pd->min.w, pd->min.h));
|
||||
efl_event_callback_call(pd->pan_obj, EFL_UI_PAN_EVENT_PAN_CONTENT_CHANGED, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ _efl_ui_panel_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Panel_Data *sd)
|
|||
|
||||
evas_object_hide(sd->event);
|
||||
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
||||
evas_object_size_hint_min_set(sd->event, minw, minh);
|
||||
efl_gfx_hint_size_min_set(sd->event, EINA_SIZE2D(minw, minh));
|
||||
|
||||
if (edje_object_part_exists(wd->resize_obj, "efl.swallow.event"))
|
||||
efl_content_set(efl_part(efl_super(obj, MY_CLASS), "efl.swallow.event"), sd->event);
|
||||
|
@ -770,15 +770,15 @@ _scrollable_layout_resize(Eo *obj, Efl_Ui_Panel_Data *sd, Evas_Coord w, Evas_Coo
|
|||
case EFL_UI_PANEL_ORIENT_BOTTOM:
|
||||
// vertical
|
||||
evas_object_resize(sd->scr_ly, w, (1 + sd->content_size_ratio) * h);
|
||||
evas_object_size_hint_min_set(sd->scr_panel, w, (sd->content_size_ratio * h));
|
||||
evas_object_size_hint_min_set(sd->scr_event, w, h);
|
||||
efl_gfx_hint_size_min_set(sd->scr_panel, EINA_SIZE2D(w, (sd->content_size_ratio * h)));
|
||||
efl_gfx_hint_size_min_set(sd->scr_event, EINA_SIZE2D(w, h));
|
||||
break;
|
||||
case EFL_UI_PANEL_ORIENT_LEFT:
|
||||
case EFL_UI_PANEL_ORIENT_RIGHT:
|
||||
// horizontal
|
||||
evas_object_resize(sd->scr_ly, (1 + sd->content_size_ratio) * w, h);
|
||||
evas_object_size_hint_min_set(sd->scr_panel, (sd->content_size_ratio * w), h);
|
||||
evas_object_size_hint_min_set(sd->scr_event, w, h);
|
||||
efl_gfx_hint_size_min_set(sd->scr_panel, EINA_SIZE2D((sd->content_size_ratio * w), h));
|
||||
efl_gfx_hint_size_min_set(sd->scr_event, EINA_SIZE2D(w, h));
|
||||
break;
|
||||
}
|
||||
efl_canvas_group_change(obj);
|
||||
|
@ -868,7 +868,7 @@ _efl_ui_panel_efl_object_constructor(Eo *obj, Efl_Ui_Panel_Data *_pd)
|
|||
Evas_Coord minw = 0, minh = 0;
|
||||
|
||||
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
||||
evas_object_size_hint_min_set(_pd->event, minw, minh);
|
||||
efl_gfx_hint_size_min_set(_pd->event, EINA_SIZE2D(minw, minh));
|
||||
efl_content_set(efl_part(efl_super(obj, MY_CLASS), "efl.swallow.event"), _pd->event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ _efl_ui_panes_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Panes_Data *sd)
|
|||
|
||||
evas_object_hide(sd->event);
|
||||
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
||||
evas_object_size_hint_min_set(sd->event, minw, minh);
|
||||
efl_gfx_hint_size_min_set(sd->event, EINA_SIZE2D(minw, minh));
|
||||
|
||||
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
||||
if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
|
||||
|
@ -468,7 +468,7 @@ _efl_ui_panes_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UN
|
|||
Evas_Coord minw = 0, minh = 0;
|
||||
|
||||
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
||||
evas_object_size_hint_min_set(sd->event, minw, minh);
|
||||
efl_gfx_hint_size_min_set(sd->event, EINA_SIZE2D(minw, minh));
|
||||
elm_layout_content_set(obj, "elm.swallow.event", sd->event);
|
||||
}
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ _efl_ui_panes_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UN
|
|||
Evas_Coord minw = 0, minh = 0;
|
||||
|
||||
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
||||
evas_object_size_hint_min_set(sd->event, minw, minh);
|
||||
efl_gfx_hint_size_min_set(sd->event, EINA_SIZE2D(minw, minh));
|
||||
elm_layout_content_set(obj, "efl.event", sd->event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,13 +249,13 @@ _efl_ui_progressbar_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *
|
|||
sd->has_cur_progressbar_part = edje_object_part_exists(obj, curprogresspart[elm_widget_is_legacy(obj)]);
|
||||
|
||||
if (_is_horizontal(sd->dir))
|
||||
evas_object_size_hint_min_set
|
||||
(sd->spacer, (double)sd->size * efl_gfx_entity_scale_get(obj) *
|
||||
elm_config_scale_get(), 1);
|
||||
efl_gfx_hint_size_min_set
|
||||
(sd->spacer, EINA_SIZE2D((double)sd->size * efl_gfx_entity_scale_get(obj) *
|
||||
elm_config_scale_get(), 1));
|
||||
else
|
||||
evas_object_size_hint_min_set
|
||||
(sd->spacer, 1, (double)sd->size * efl_gfx_entity_scale_get(obj) *
|
||||
elm_config_scale_get());
|
||||
efl_gfx_hint_size_min_set
|
||||
(sd->spacer, EINA_SIZE2D(1, (double)sd->size * efl_gfx_entity_scale_get(obj) *
|
||||
elm_config_scale_get()));
|
||||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
|
@ -447,13 +447,13 @@ _progressbar_span_size_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Evas_Coord size
|
|||
sd->size = size;
|
||||
|
||||
if (_is_horizontal(sd->dir))
|
||||
evas_object_size_hint_min_set
|
||||
(sd->spacer, (double)sd->size * efl_gfx_entity_scale_get(obj) *
|
||||
elm_config_scale_get(), 1);
|
||||
efl_gfx_hint_size_min_set
|
||||
(sd->spacer, EINA_SIZE2D((double)sd->size * efl_gfx_entity_scale_get(obj) *
|
||||
elm_config_scale_get(), 1));
|
||||
else
|
||||
evas_object_size_hint_min_set
|
||||
(sd->spacer, 1, (double)sd->size * efl_gfx_entity_scale_get(obj) *
|
||||
elm_config_scale_get());
|
||||
efl_gfx_hint_size_min_set
|
||||
(sd->spacer, EINA_SIZE2D(1, (double)sd->size * efl_gfx_entity_scale_get(obj) *
|
||||
elm_config_scale_get()));
|
||||
|
||||
efl_canvas_group_change(obj);
|
||||
}
|
||||
|
|
|
@ -719,7 +719,7 @@ _label_set(Evas_Object *obj,
|
|||
efl_pack_unpack(sd->box, sd->label);
|
||||
sd->label_packed = EINA_TRUE;
|
||||
edje_object_size_min_calc(sd->label, &width, &height);
|
||||
evas_object_size_hint_min_set(sd->label, width, height);
|
||||
efl_gfx_hint_size_min_set(sd->label, EINA_SIZE2D(width, height));
|
||||
efl_pack_begin(sd->box, sd->label);
|
||||
evas_object_show(sd->label);
|
||||
}
|
||||
|
|
|
@ -552,7 +552,7 @@ _ellipsis_set(Efl_Ui_Textpath_Data *pd, Eo *obj)
|
|||
tb = edje_object_part_object_get(pd->text_obj, "efl.text");
|
||||
|
||||
evas_object_textblock_size_native_get(tb, &w, &h);
|
||||
evas_object_size_hint_min_set(pd->text_obj, w, h);
|
||||
efl_gfx_hint_size_restricted_min_set(pd->text_obj, EINA_SIZE2D(w, h));
|
||||
if (pd->ellipsis)
|
||||
{
|
||||
if (w > pd->total_length)
|
||||
|
|
|
@ -5024,7 +5024,7 @@ _indicator_resized(void *data, const Efl_Event *event)
|
|||
ELM_WIN_DATA_GET_OR_RETURN(data, sd);
|
||||
Evas_Object *indicator = event->object;
|
||||
Evas_Coord_Size *size = (Evas_Coord_Size *)event->info;
|
||||
efl_gfx_hint_size_restricted_min_set(indicator, EINA_SIZE2D(size->w, size->h));
|
||||
efl_gfx_hint_size_min_set(indicator, EINA_SIZE2D(size->w, size->h));
|
||||
_elm_win_frame_obj_update(sd, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue