From: SangHyeon Lee Date: Tue, 3 Jan 2017 08:40:26 +0000 (+0900) Subject: gengrid : enable layout sizing eval and content min limit feature in gengrid X-Git-Tag: submit/tizen/20170110.035404~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90b7dac2fceafafbcc8e29a719216543a5ba86a7;p=platform%2Fupstream%2Felementary.git gengrid : enable layout sizing eval and content min limit feature in gengrid Change-Id: Id3fa2770a19b46b149168e782b2c5a87376f84b4 (cherry picked from commit 209e03d4a3612ede14f7473b90ee8f7394fc6ef6) --- diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c index 8a957184c..9d76dafc6 100644 --- a/src/lib/elm_gengrid.c +++ b/src/lib/elm_gengrid.c @@ -678,6 +678,7 @@ _calc(void *data) { sd->minh = minh; sd->minw = minw; + elm_layout_sizing_eval(sd->obj); eo_do(sd->pan_obj, eo_event_callback_call (ELM_PAN_EVENT_CHANGED, NULL)); } @@ -4621,11 +4622,48 @@ _elm_gengrid_item_new(Elm_Gengrid_Data *sd, /* 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 _elm_gengrid_evas_object_smart_add(Eo *obj, Elm_Gengrid_Data *priv) { @@ -4675,7 +4713,8 @@ _elm_gengrid_evas_object_smart_add(Eo *obj, Elm_Gengrid_Data *priv) elm_interface_scrollable_edge_top_cb_set(_edge_top_cb), elm_interface_scrollable_edge_bottom_cb_set(_edge_bottom_cb), elm_interface_scrollable_scroll_cb_set(_scroll_cb), - elm_interface_scrollable_page_change_cb_set(_scroll_page_change_cb)); + elm_interface_scrollable_page_change_cb_set(_scroll_page_change_cb), + elm_interface_scrollable_content_min_limit_cb_set(_content_min_limit_cb)); //Tizen Only: Item should be shown as top position. priv->align_x = 0.0; diff --git a/src/lib/elm_widget_gengrid.h b/src/lib/elm_widget_gengrid.h index cab2334c7..1d23a7775 100644 --- a/src/lib/elm_widget_gengrid.h +++ b/src/lib/elm_widget_gengrid.h @@ -160,6 +160,8 @@ 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 : 1; + Eina_Bool scr_minh : 1; }; struct Elm_Gen_Item_Type