elm_panel: Add _scrollable_layout_resize internal funcion for refactoring 27/108627/1
authorJEONGHYUN YUN <jh0506.yun@samsung.com>
Thu, 5 Jan 2017 08:32:35 +0000 (17:32 +0900)
committerJEONGHYUN YUN <jh0506.yun@samsung.com>
Thu, 5 Jan 2017 08:34:46 +0000 (17:34 +0900)
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 <jh0506.yun@samsung.com>
src/lib/elm_panel.c

index 6974394..089b61b 100644 (file)
@@ -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);
      }
 }