elm_panel: Add _scrollable_layout_resize internal funcion for refactoring

Summary:
Remove duplicated code in _elm_panel_efl_gfx_size_set
and _elm_panel_scrollable_content_size_set.

Reviewers: jpeg, woohyun, eunue, jypark

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4553
This commit is contained in:
JEONGHYUN YUN 2017-01-05 17:26:32 +09:00 committed by Jean-Philippe Andre
parent b11f371703
commit e998529f2e
1 changed files with 22 additions and 34 deletions

View File

@ -1121,18 +1121,9 @@ _elm_panel_efl_gfx_position_set(Eo *obj, Elm_Panel_Data *sd, Evas_Coord x, Evas_
evas_object_move(sd->hit_rect, x, y);
}
EOLIAN static void
_elm_panel_efl_gfx_size_set(Eo *obj, Elm_Panel_Data *sd, Evas_Coord w, Evas_Coord h)
static void
_scrollable_layout_resize(Eo *obj, Elm_Panel_Data *sd, Evas_Coord w, Evas_Coord h)
{
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, w, h))
return;
efl_gfx_size_set(efl_super(obj, MY_CLASS), w, h);
if (!sd->scrollable) return;
evas_object_resize(sd->hit_rect, w, h);
switch (sd->orient)
{
case ELM_PANEL_ORIENT_TOP:
@ -1154,6 +1145,21 @@ _elm_panel_efl_gfx_size_set(Eo *obj, Elm_Panel_Data *sd, Evas_Coord w, Evas_Coor
elm_layout_sizing_eval(obj);
}
EOLIAN static void
_elm_panel_efl_gfx_size_set(Eo *obj, Elm_Panel_Data *sd, Evas_Coord w, Evas_Coord h)
{
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, w, h))
return;
efl_gfx_size_set(efl_super(obj, MY_CLASS), w, h);
if (!sd->scrollable) return;
evas_object_resize(sd->hit_rect, w, h);
_scrollable_layout_resize(obj, sd, w, h);
}
EOLIAN static void
_elm_panel_efl_canvas_group_group_member_add(Eo *obj, Elm_Panel_Data *sd, Evas_Object *member)
{
@ -1420,30 +1426,12 @@ _elm_panel_scrollable_content_size_set(Eo *obj, Elm_Panel_Data *sd, double ratio
sd->content_size_ratio = ratio;
if (sd->scrollable)
{
Evas_Coord w, h;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
{
Evas_Coord w, h;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
switch (sd->orient)
{
case ELM_PANEL_ORIENT_TOP:
case ELM_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);
break;
case ELM_PANEL_ORIENT_LEFT:
case ELM_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);
break;
}
elm_layout_sizing_eval(obj);
}
_scrollable_layout_resize(obj, sd, w, h);
}
}
EOLIAN static Eina_Bool