From: JEONGHYUN YUN Date: Thu, 5 Jan 2017 08:32:35 +0000 (+0900) Subject: elm_panel: Add _scrollable_layout_resize internal funcion for refactoring X-Git-Tag: accepted/tizen/common/20170110.154939~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5eeede74bca2cffca6b9d85e522738c37d9abb8;p=platform%2Fupstream%2Felementary.git 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 Differential Revision: https://phab.enlightenment.org/D4553 Change-Id: I51196afc9519f93a16d10da479be87e5fec39de8 Signed-off-by: JEONGHYUN YUN --- diff --git a/src/lib/elm_panel.c b/src/lib/elm_panel.c index 6974394..089b61b 100644 --- a/src/lib/elm_panel.c +++ b/src/lib/elm_panel.c @@ -1130,15 +1130,9 @@ _elm_panel_evas_object_smart_move(Eo *obj, Elm_Panel_Data *sd, Evas_Coord x, Eva evas_object_move(sd->hit_rect, x, y); } -EOLIAN static void -_elm_panel_evas_object_smart_resize(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) { - eo_do_super(obj, MY_CLASS, evas_obj_smart_resize(w, h)); - - if (!sd->scrollable) return; - - evas_object_resize(sd->hit_rect, w, h); - switch (sd->orient) { case ELM_PANEL_ORIENT_TOP: @@ -1161,6 +1155,18 @@ _elm_panel_evas_object_smart_resize(Eo *obj, Elm_Panel_Data *sd, Evas_Coord w, E } EOLIAN static void +_elm_panel_evas_object_smart_resize(Eo *obj, Elm_Panel_Data *sd, Evas_Coord w, Evas_Coord h) +{ + eo_do_super(obj, MY_CLASS, evas_obj_smart_resize(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_evas_object_smart_member_add(Eo *obj, Elm_Panel_Data *sd, Evas_Object *member) { eo_do_super(obj, MY_CLASS, evas_obj_smart_member_add(member)); @@ -1431,25 +1437,7 @@ _elm_panel_scrollable_content_size_set(Eo *obj, Elm_Panel_Data *sd, double ratio 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); } }