From 4613933a34d656e7cd8f45a83f768e1cf598c06e Mon Sep 17 00:00:00 2001 From: Jaehwan Kim Date: Wed, 12 Sep 2012 05:15:43 +0000 Subject: [PATCH] When the number of item is changed, the toolbar emits the signal to theme. The theme can be changed something according the number of item. SVN revision: 76487 --- legacy/elementary/ChangeLog | 5 +++++ legacy/elementary/src/lib/elm_toolbar.c | 28 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 24aa270366..d8281204b8 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -456,3 +456,8 @@ * Even if the top item is inserted into the naviframe. Any transition wouldn't be launched. + +2012-09-12 Jaehwan Kim + + * When the number of item is changed, the toolbar emits the signal to theme. + The theme can be changed something according the number of item. diff --git a/legacy/elementary/src/lib/elm_toolbar.c b/legacy/elementary/src/lib/elm_toolbar.c index 48b0f83b88..e3bc732dff 100644 --- a/legacy/elementary/src/lib/elm_toolbar.c +++ b/legacy/elementary/src/lib/elm_toolbar.c @@ -775,6 +775,32 @@ _item_theme_hook(Evas_Object *obj, evas_object_size_hint_min_set(view, minw, mh); } +static void +_inform_item_number(Evas_Object *obj) +{ + ELM_TOOLBAR_DATA_GET(obj, sd); + Elm_Toolbar_Item *it; + char buf[sizeof("elm,action,click,") + 3]; + static int scount = 0; + int count = 0; + + EINA_INLIST_FOREACH(sd->items, it) + { + if (!it->separator) count++; + } + if (scount != count) + { + scount = count; + sprintf(buf, "elm,number,item,%d", count); + + EINA_INLIST_FOREACH(sd->items, it) + { + if (!it->separator && !it->object) + edje_object_signal_emit(VIEW(it), buf, "elm"); + } + } +} + static void _sizing_eval(Evas_Object *obj) { @@ -835,6 +861,8 @@ _sizing_eval(Evas_Object *obj) evas_object_resize(sd->more, w, h); evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, -1, -1); + + _inform_item_number(obj); } static Eina_Bool