From b621e13b3627e7fa0de6dc181e4e3370c5e14ee3 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Wed, 11 Jan 2012 15:29:11 +0900 Subject: [PATCH] merged with opensource Now naviframe could be resized by the largest contents from the stack. Change-Id: I54dd1d2439f548701bd139b59511b9adc24ca87c --- src/lib/elc_naviframe.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c index cbdd6e6..c134cf6 100644 --- a/src/lib/elc_naviframe.c +++ b/src/lib/elc_naviframe.c @@ -41,6 +41,8 @@ struct _Elm_Naviframe_Item Evas_Object *title_next_btn; Evas_Object *title_icon; const char *style; + Evas_Coord minw; + Evas_Coord minh; Eina_Bool back_btn: 1; Eina_Bool title_visible: 1; }; @@ -82,7 +84,6 @@ static void _item_signal_emit_hook(Elm_Object_Item *it, const char *source); static void _item_title_visible_update(Elm_Naviframe_Item *navi_it); static void _sizing_eval(Evas_Object *obj); -static void _item_sizing_eval(Elm_Naviframe_Item *it); static void _move(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _resize(void *data, Evas *e, @@ -416,26 +417,24 @@ _sizing_eval(Evas_Object *obj) { Widget_Data *wd; Elm_Naviframe_Item *it; - wd = elm_widget_data_get(obj); - if (!wd) return; - - EINA_INLIST_FOREACH(wd->stack, it) - _item_sizing_eval(it); -} - -static void -_item_sizing_eval(Elm_Naviframe_Item *it) -{ - Widget_Data *wd; Evas_Coord x, y, w, h; - if (!it) return; + Evas_Coord minw = -1, minh = -1; - wd = elm_widget_data_get(WIDGET(it)); + wd = elm_widget_data_get(obj); if (!wd) return; - evas_object_geometry_get(WIDGET(it), &x, &y, &w, &h); - evas_object_move(VIEW(it), x, y); - evas_object_resize(VIEW(it), w, h); + evas_object_geometry_get(obj, &x, &y, &w, &h); + + EINA_INLIST_FOREACH(wd->stack, it) + { + evas_object_move(VIEW(it), x, y); + evas_object_resize(VIEW(it), w, h); + edje_object_size_min_calc(VIEW(it), &it->minw, &it->minh); + if (it->minw > minw) minw = it->minw; + if (it->minh > minh) minh = it->minh; + } + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); } static void @@ -979,14 +978,12 @@ _item_style_set(Elm_Naviframe_Item *navi_it, const char *item_style) if (!item_style) { - sprintf(buf, "item/basic"); + strcpy(buf, "item/basic"); eina_stringshare_replace(&navi_it->style, "basic"); } else { - if (strlen(item_style) > sizeof(buf)) - WRN("too much long style name! : naviframe=%p", WIDGET(navi_it)); - sprintf(buf, "item/%s", item_style); + snprintf(buf, sizeof(buf), "item/%s", item_style); eina_stringshare_replace(&navi_it->style, item_style); } _elm_theme_object_set(WIDGET(navi_it), -- 2.7.4