summaryrefslogtreecommitdiff
path: root/src/lib/elm_toolbar.c
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2016-01-04 09:31:29 +0900
committerJaehwan Kim <jae.hwan.kim@samsung.com>2016-01-04 10:43:35 +0900
commitd1867909117123f74ac6a3561296a7bd57e5c22f (patch)
treec0ccb31cb886460275ffe0c3533dc385c6d24e99 /src/lib/elm_toolbar.c
parent4f0723d91eb2fffed4412965a531c070f3a07d64 (diff)
toolbar: Send a signal when shrink mode is changed.
Summary: It is useful for changing item's state according to shrink mode. @feature Test Plan: It includes a use case for the patch in toolbar default theme. Run "elementary_test -to toolbar2". Reviewers: jaehwan, woohyun, cedric, raster Subscribers: eagleeye Differential Revision: https://phab.enlightenment.org/D3481
Notes
Notes: breaks toolbar layouts: before -> after https://www.enlightenment.org/ss/e-568c35d5ee6854.99441370.jpg
Diffstat (limited to 'src/lib/elm_toolbar.c')
-rw-r--r--src/lib/elm_toolbar.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index d5aaa5020..a899bb95f 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.c
@@ -1224,6 +1224,31 @@ _item_del(Elm_Toolbar_Item_Data *it)
1224} 1224}
1225 1225
1226static void 1226static void
1227_item_shrink_signal_emit(Evas_Object *view, Elm_Toolbar_Shrink_Mode shrink_mode)
1228{
1229 switch (shrink_mode)
1230 {
1231 case ELM_TOOLBAR_SHRINK_HIDE:
1232 elm_layout_signal_emit(view, "elm,state,shrink,hide", "elm");
1233 break;
1234 case ELM_TOOLBAR_SHRINK_SCROLL:
1235 elm_layout_signal_emit(view, "elm,state,shrink,scroll", "elm");
1236 break;
1237 case ELM_TOOLBAR_SHRINK_MENU:
1238 elm_layout_signal_emit(view, "elm,state,shrink,menu", "elm");
1239 break;
1240 case ELM_TOOLBAR_SHRINK_EXPAND:
1241 elm_layout_signal_emit(view, "elm,state,shrink,expand", "elm");
1242 break;
1243 case ELM_TOOLBAR_SHRINK_NONE:
1244 case ELM_TOOLBAR_SHRINK_LAST:
1245 default:
1246 elm_layout_signal_emit(view, "elm,state,shrink,default", "elm");
1247 break;
1248 }
1249}
1250
1251static void
1227_item_theme_hook(Evas_Object *obj, 1252_item_theme_hook(Evas_Object *obj,
1228 Elm_Toolbar_Item_Data *it, 1253 Elm_Toolbar_Item_Data *it,
1229 double scale, 1254 double scale,
@@ -1286,6 +1311,8 @@ _item_theme_hook(Evas_Object *obj,
1286 } 1311 }
1287 } 1312 }
1288 1313
1314 _item_shrink_signal_emit(view, sd->shrink_mode);
1315
1289 if (sd->vertical) 1316 if (sd->vertical)
1290 elm_layout_signal_emit(view, "elm,orient,vertical", "elm"); 1317 elm_layout_signal_emit(view, "elm,orient,vertical", "elm");
1291 else 1318 else
@@ -3326,6 +3353,7 @@ _elm_toolbar_item_separator_get(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *
3326EOLIAN static void 3353EOLIAN static void
3327_elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *sd, Elm_Toolbar_Shrink_Mode shrink_mode) 3354_elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *sd, Elm_Toolbar_Shrink_Mode shrink_mode)
3328{ 3355{
3356 Elm_Toolbar_Item_Data *it;
3329 Eina_Bool bounce; 3357 Eina_Bool bounce;
3330 3358
3331 if (sd->shrink_mode == shrink_mode) return; 3359 if (sd->shrink_mode == shrink_mode) return;
@@ -3366,6 +3394,9 @@ _elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *sd, Elm_Toolbar_Shrink_M
3366 eo_do(obj, elm_interface_scrollable_policy_set 3394 eo_do(obj, elm_interface_scrollable_policy_set
3367 (ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF)); 3395 (ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF));
3368 3396
3397 EINA_INLIST_FOREACH(sd->items, it)
3398 _item_shrink_signal_emit(VIEW(it), sd->shrink_mode);
3399
3369 evas_object_smart_need_recalculate_set(obj, EINA_TRUE); 3400 evas_object_smart_need_recalculate_set(obj, EINA_TRUE);
3370} 3401}
3371 3402