elm_panel: Add get function in scrollable_content_size property 66/108566/4
authorJEONGHYUN YUN <jh0506.yun@samsung.com>
Thu, 5 Jan 2017 05:54:08 +0000 (14:54 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 5 Jan 2017 06:32:33 +0000 (22:32 -0800)
Summary:
1.Added get function for getting the size of the scrollable panel.
Additionally, added some exception handling code in scrollable_content_size_set

Reviewed By: jpeg

Differential Revision: https://phab.enlightenment.org/D4549

Change-Id: I14df2301872773d3f4e0604f3d66505233bc6676
Signed-off-by: JEONGHYUN YUN <jh0506.yun@samsung.com>
src/lib/elm_panel.c
src/lib/elm_panel.eo

index beed2ceb7c25ed786e6ab3721123fa8630b19cc2..69743948bdaf51bbe2156e5e1aaa7cc3b304d6d8 100644 (file)
@@ -1412,32 +1412,45 @@ _elm_panel_elm_widget_disable(Eo *obj, Elm_Panel_Data *sd)
    return EINA_TRUE;
 }
 
+EOLIAN static double
+_elm_panel_scrollable_content_size_get(Eo *obj EINA_UNUSED, Elm_Panel_Data *sd)
+{
+   return sd->content_size_ratio;
+}
+
 EOLIAN static void
 _elm_panel_scrollable_content_size_set(Eo *obj, Elm_Panel_Data *sd, double ratio)
 {
-   Evas_Coord w, h;
+   if (ratio < 0) ratio = 0;
+   else if (ratio > 1.0) ratio = 1.0;
+
    sd->content_size_ratio = ratio;
-   evas_object_geometry_get(obj, NULL, NULL, &w, &h);
 
-   switch (sd->orient)
+   if (sd->scrollable)
      {
-      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;
-     }
+        Evas_Coord w, h;
+        evas_object_geometry_get(obj, NULL, NULL, &w, &h);
 
-   elm_layout_sizing_eval(obj);
+        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);
+     }
 }
 
 EOLIAN static Eina_Bool
index da03c0d54b42a8463681e22a734eefc01c513c06..33ebde13b106780dae02ff68cc67268f1562712c 100644 (file)
@@ -89,6 +89,12 @@ class Elm.Panel (Elm.Layout, Elm_Interface_Scrollable,
               \@endif
             ]]
          }
+         get {
+            [[Get the size of the scrollable panel.
+
+              @since 1.19
+            ]]
+         }
          values {
             ratio: double;
          }