sanghyeonlee pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e1b6e9b18ac14afe7518060887a341cb5a128175

commit e1b6e9b18ac14afe7518060887a341cb5a128175
Author: SangHyeon Lee <[email protected]>
Date:   Tue Jan 3 17:35:35 2017 +0900

    gengrid : enable layout sizing eval and content min limit feature in gengrid
    
    Summary :
    As the child of layout and scroll interface user,
    gengrid need to support content min limit feature to set min size
    by layout sizing eval.
    
    Test Plan :
    Set elm_scroller_content_min_limit to gengrid and get min size off
    gengrid object.
    
    Signed-off-by: SangHyeon Lee <[email protected]>
---
 src/lib/elementary/elm_gengrid.c        | 42 ++++++++++++++++++++++++++++++---
 src/lib/elementary/elm_widget_gengrid.h |  3 +++
 2 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index 5437788..9cb7c2a 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -4489,11 +4489,46 @@ _elm_gengrid_item_new(Elm_Gengrid_Data *sd,
   return it;
 }
 
-/* common layout sizing won't apply here */
 EOLIAN static void
-_elm_gengrid_elm_layout_sizing_eval(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *_pd 
EINA_UNUSED)
+_elm_gengrid_elm_layout_sizing_eval(Eo *obj, Elm_Gengrid_Data *sd)
 {
-   return;  /* no-op */
+   Evas_Coord minw = 0, minh = 0, maxw = -1, maxh = -1, vw = 0, vh = 0;
+
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+   evas_object_size_hint_min_get(obj, &minw, &minh);
+   evas_object_size_hint_max_get(obj, &maxw, &maxh);
+   edje_object_size_min_calc(wd->resize_obj, &vw, &vh);
+
+   if (sd->scr_minw)
+     {
+        maxw = -1;
+        minw = vw + sd->minw;
+     }
+   if (sd->scr_minh)
+     {
+        maxh = -1;
+        minh = vh + sd->minh;
+     }
+
+   if ((maxw > 0) && (minw > maxw))
+     minw = maxw;
+   if ((maxh > 0) && (minh > maxh))
+     minh = maxh;
+
+   evas_object_size_hint_min_set(obj, minw, minh);
+   evas_object_size_hint_max_set(obj, maxw, maxh);
+}
+
+static void
+_content_min_limit_cb(Evas_Object *obj, Eina_Bool w, Eina_Bool h)
+{
+   ELM_GENGRID_DATA_GET(obj, sd);
+
+   sd->scr_minw = !!w;
+   sd->scr_minh = !!h;
+
+   elm_layout_sizing_eval(obj);
 }
 
 EOLIAN static void
@@ -4543,6 +4578,7 @@ _elm_gengrid_efl_canvas_group_group_add(Eo *obj, 
Elm_Gengrid_Data *priv)
    elm_interface_scrollable_edge_bottom_cb_set(obj, _edge_bottom_cb);
    elm_interface_scrollable_scroll_cb_set(obj, _scroll_cb);
    elm_interface_scrollable_page_change_cb_set(obj, _scroll_page_change_cb);
+   elm_interface_scrollable_content_min_limit_cb_set(obj, 
_content_min_limit_cb);
 
    priv->align_x = 0.5;
    priv->align_y = 0.5;
diff --git a/src/lib/elementary/elm_widget_gengrid.h 
b/src/lib/elementary/elm_widget_gengrid.h
index 6f28c38..f28130f 100644
--- a/src/lib/elementary/elm_widget_gengrid.h
+++ b/src/lib/elementary/elm_widget_gengrid.h
@@ -146,6 +146,9 @@ struct _Elm_Gengrid_Data
    unsigned int                       *custom_tot_sum; /* array to store total 
sum of all widths or heights. this is used for item alignment calculations. */
    unsigned int                       custom_tot_max; /* maximum of the total 
sums over all rows or columns. this is also used for item alignment 
calculations. */
    unsigned int                       custom_alloc_size; /* amount of memory 
allocated to above dynamic arrays in terms of number of rows or columns. */
+
+   Eina_Bool                          scr_minw;
+   Eina_Bool                          scr_minh;
 };
 
 struct Elm_Gen_Item_Type

-- 


Reply via email to