X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Flib%2Felm_toolbar.c;h=6bbebb6bdb67c889194857098b730a5a0658f21e;hb=bbecbceec5a924f31039d9f5b43d21501d6b0e89;hp=f09c18e0bf76a46140e06f257726c538d5fdeefa;hpb=17fe5c2b8b49941dbfac16a44ed1d240e982fc6d;p=framework%2Fuifw%2Felementary.git diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index f09c18e..6bbebb6 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -289,8 +289,13 @@ _item_del(Elm_Toolbar_Item *it) free(it_state); } eina_stringshare_del(it->label); + if (it->label) edje_object_signal_emit(VIEW(it), "elm,state,text,hidden", "elm"); eina_stringshare_del(it->icon_str); - if (it->icon) evas_object_del(it->icon); + if (it->icon) + { + edje_object_signal_emit(VIEW(it), "elm,state,icon,hidden", "elm"); + evas_object_del(it->icon); + } if (it->object) evas_object_del(it->object); //TODO: See if checking for wd->menu_parent is necessary before deleting menu if (it->o_menu) evas_object_del(it->o_menu); @@ -345,7 +350,7 @@ _theme_hook_item(Evas_Object *obj, Elm_Toolbar_Item *it, double scale, int icon_ { Widget_Data *wd = elm_widget_data_get(obj); Evas_Object *view = VIEW(it); - Evas_Coord mw, mh; + Evas_Coord mw, mh, minw, minh; const char *style = elm_widget_style_get(obj); _mirrored_set_item(obj, it, elm_widget_mirrored_get(obj)); @@ -371,8 +376,13 @@ _theme_hook_item(Evas_Object *obj, Elm_Toolbar_Item *it, double scale, int icon_ evas_object_size_hint_min_set(it->icon, ms, ms); evas_object_size_hint_max_set(it->icon, ms, ms); edje_object_part_swallow(view, "elm.swallow.icon", it->icon); + edje_object_signal_emit(VIEW(it), "elm,state,icon,visible", "elm"); + } + if (it->label) + { + edje_object_part_text_escaped_set(view, "elm.text", it->label); + edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm"); } - edje_object_part_text_escaped_set(view, "elm.text", it->label); } else { @@ -397,13 +407,19 @@ _theme_hook_item(Evas_Object *obj, Elm_Toolbar_Item *it, double scale, int icon_ } } - mw = mh = -1; + mw = mh = minw = minh = -1; if (!it->separator && !it->object) elm_coords_finger_size_adjust(1, &mw, 1, &mh); edje_object_size_min_restricted_calc(view, &mw, &mh, mw, mh); if (!it->separator && !it->object) elm_coords_finger_size_adjust(1, &mw, 1, &mh); - evas_object_size_hint_min_set(view, mw, mh); + evas_object_size_hint_min_get(view, &minw, &minh); + if ((minw < mw) && (minh < mh)) + evas_object_size_hint_min_set(view, mw, mh); + else if ((minw < mw) && (minh > mh)) + evas_object_size_hint_min_set(view, mw, minh); + else if ((minw > mw) && (minh < mh)) + evas_object_size_hint_min_set(view, minw, mh); } static void @@ -428,6 +444,7 @@ _theme_hook(Evas_Object *obj) if (!wd) return; _elm_widget_mirrored_reload(obj); elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", elm_widget_style_get(obj)); + elm_layout_theme_set(wd->more, "toolbar", "more", elm_widget_style_get(obj)); _mirrored_set(obj, elm_widget_mirrored_get(obj)); scale = (elm_widget_scale_get(obj) * _elm_config->scale); edje_object_scale_set(wd->scr, scale); @@ -498,7 +515,7 @@ _item_content_unset_hook(Elm_Object_Item *it, const char *part) Elm_Toolbar_Item *item = (Elm_Toolbar_Item *) it; Evas_Object *obj = WIDGET(item); Widget_Data *wd = elm_widget_data_get(obj); - + edje_object_part_unswallow(VIEW(it), item->object); elm_widget_sub_object_del(obj, item->object); o = item->object; @@ -1065,10 +1082,15 @@ _item_reorder_start(Elm_Toolbar_Item *item) evas_object_size_hint_min_set(it->icon, ms, ms); evas_object_size_hint_max_set(it->icon, ms, ms); edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon); + edje_object_signal_emit(VIEW(it), "elm,state,icon,visible", "elm"); evas_object_show(it->icon); elm_widget_sub_object_add(obj, it->icon); } - edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label); + if (it->label) + { + edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label); + edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm"); + } edje_object_signal_emit(VIEW(it), "elm,state,moving", "elm"); @@ -1317,9 +1339,11 @@ _item_new(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb f edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm"); } mw = mh = -1; - elm_coords_finger_size_adjust(1, &mw, 1, &mh); + if (!it->separator && !it->object) + elm_coords_finger_size_adjust(1, &mw, 1, &mh); edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh); - elm_coords_finger_size_adjust(1, &mw, 1, &mh); + if (!it->separator && !it->object) + elm_coords_finger_size_adjust(1, &mw, 1, &mh); if (wd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND) { if (wd->vertical) @@ -1350,7 +1374,7 @@ _item_new(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb f static void _elm_toolbar_item_label_update(Elm_Toolbar_Item *item) { - Evas_Coord mw = -1, mh = -1; + Evas_Coord mw = -1, mh = -1, minw = -1, minh = -1; Widget_Data *wd = elm_widget_data_get(WIDGET(item)); edje_object_part_text_escaped_set(VIEW(item), "elm.text", item->label); edje_object_signal_emit(VIEW(item), "elm,state,text,visible", "elm"); @@ -1376,7 +1400,13 @@ _elm_toolbar_item_label_update(Elm_Toolbar_Item *item) evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); } - evas_object_size_hint_min_set(VIEW(item), mw, mh); + evas_object_size_hint_min_get(VIEW(item), &minw, &minh); + if ((minw < mw) && (minh < mh)) + evas_object_size_hint_min_set(VIEW(item), mw, mh); + else if ((minw < mw) && (minh > mh)) + evas_object_size_hint_min_set(VIEW(item), mw, minh); + else if ((minw > mw) && (minh < mh)) + evas_object_size_hint_min_set(VIEW(item), minw, mh); } static void @@ -1416,14 +1446,15 @@ _elm_toolbar_item_icon_update(Elm_Toolbar_Item *item) { Elm_Toolbar_Item_State *it_state; Eina_List *l; - Evas_Coord mw = -1, mh = -1; + Evas_Coord mw = -1, mh = -1, minw = -1, minh = -1; Widget_Data *wd = elm_widget_data_get(WIDGET(item)); Evas_Object *old_icon = edje_object_part_swallow_get(VIEW(item), "elm.swallow.icon"); elm_widget_sub_object_del(VIEW(item), old_icon); - evas_object_hide(old_icon); + /* edje_object_part_unswallow(VIEW(item), old_icon); */ edje_object_part_swallow(VIEW(item), "elm.swallow.icon", item->icon); edje_object_signal_emit(VIEW(item), "elm,state,icon,visible", "elm"); + evas_object_hide(old_icon); elm_coords_finger_size_adjust(1, &mw, 1, &mh); edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh); elm_coords_finger_size_adjust(1, &mw, 1, &mh); @@ -1445,7 +1476,13 @@ _elm_toolbar_item_icon_update(Elm_Toolbar_Item *item) evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); } - evas_object_size_hint_min_set(VIEW(item), mw, mh); + evas_object_size_hint_min_get(VIEW(item), &minw, &minh); + if ((minw < mw) && (minh < mh)) + evas_object_size_hint_min_set(VIEW(item), mw, mh); + else if ((minw < mw) && (minh > mh)) + evas_object_size_hint_min_set(VIEW(item), mw, minh); + else if ((minw > mw) && (minh < mh)) + evas_object_size_hint_min_set(VIEW(item), minw, mh); EINA_LIST_FOREACH(item->states, l, it_state) { @@ -1967,6 +2004,7 @@ elm_toolbar_item_separator_set(Elm_Object_Item *it, Eina_Bool separator) item->separator = separator; scale = (elm_widget_scale_get(obj) * _elm_config->scale); _theme_hook_item(obj, item, scale, wd->icon_size); + evas_object_size_hint_min_set(VIEW(item), -1, -1); } EAPI Eina_Bool