1 #include <Elementary.h>
3 #include "els_scroller.h"
7 typedef struct _Widget_Data Widget_Data;
8 typedef struct _Elm_Toolbar_Item Elm_Toolbar_Item;
12 Evas_Object *scr, *bx;
13 Evas_Object *menu_parent;
15 Elm_Toolbar_Item *more_item, *selected_item;
16 Elm_Toolbar_Shrink_Mode shrink_mode;
17 Elm_Icon_Lookup_Order lookup_order;
19 unsigned int item_count;
21 Eina_Bool homogeneous : 1;
22 Eina_Bool no_select : 1;
23 Eina_Bool always_select : 1;
24 Eina_Bool vertical : 1;
25 Eina_Bool long_press : 1;
26 Ecore_Timer *long_timer;
27 Ecore_Job *resize_job;
30 struct _Elm_Toolbar_Item
42 Eina_Bool visible : 1;
44 Eina_Bool selected : 1;
45 Eina_Bool separator : 1;
48 Eina_List *current_state;
51 #define ELM_TOOLBAR_ITEM_FROM_INLIST(item) \
52 ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Toolbar_Item) : NULL)
54 struct _Elm_Toolbar_Item_State
63 static const char *widtype = NULL;
64 static void _item_show(Elm_Toolbar_Item *it);
65 static void _item_select(Elm_Toolbar_Item *it);
66 static void _item_unselect(Elm_Toolbar_Item *it);
67 static void _del_pre_hook(Evas_Object *obj);
68 static void _del_hook(Evas_Object *obj);
69 static void _mirrored_set(Evas_Object *obj, Eina_Bool mirrored);
70 static void _mirrored_set_item(Evas_Object *obj, Elm_Toolbar_Item *it, Eina_Bool mirrored);
71 static void _theme_hook(Evas_Object *obj);
72 static void _sizing_eval(Evas_Object *obj);
73 static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
74 static void _menu_move_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
75 static void _menu_hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
76 static void _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data);
77 static void _elm_toolbar_item_icon_obj_set(Evas_Object *obj, Elm_Toolbar_Item *item, Evas_Object *icon_obj, const char *icon_str, double icon_size, const char *signal);
78 static void _item_label_set(Elm_Toolbar_Item *item, const char *label, const char *signal);
80 static const char SIG_CLICKED[] = "clicked";
81 static const char SIG_LONGPRESSED[] = "longpressed";
82 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
84 static const Evas_Smart_Cb_Description _signals[] = {
86 {SIG_LONGPRESSED, ""},
87 {SIG_CLICKED_DOUBLE, ""},
92 _item_disable_hook(Elm_Object_Item *it)
95 Elm_Toolbar_Item *toolbar_it = (Elm_Toolbar_Item *)it;
97 wd = elm_widget_data_get(WIDGET(toolbar_it));
100 if (elm_widget_item_disabled_get(toolbar_it))
102 edje_object_signal_emit(VIEW(toolbar_it), "elm,state,disabled", "elm");
103 elm_widget_signal_emit(toolbar_it->icon, "elm,state,disabled", "elm");
107 edje_object_signal_emit(VIEW(toolbar_it), "elm,state,enabled", "elm");
108 elm_widget_signal_emit(toolbar_it->icon, "elm,state,enabled", "elm");
110 _resize(WIDGET(toolbar_it), NULL, NULL, NULL);
114 _item_icon_set(Evas_Object *icon_obj, const char *type, const char *icon)
118 if ((!type) || (!*type)) goto end;
119 if ((!icon) || (!*icon)) return EINA_FALSE;
120 if ((snprintf(icon_str, sizeof(icon_str), "%s%s", type, icon) > 0)
121 && (elm_icon_standard_set(icon_obj, icon_str)))
124 if (elm_icon_standard_set(icon_obj, icon))
126 WRN("couldn't find icon definition for '%s'", icon);
131 _elm_toolbar_icon_size_get(Widget_Data *wd)
133 const char *icon_size = edje_object_data_get(
134 elm_smart_scroller_edje_object_get(wd->scr), "icon_size");
136 return atoi(icon_size);
137 return _elm_config->icon_size;
141 _item_show(Elm_Toolbar_Item *it)
143 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
144 Evas_Coord x, y, w, h, bx, by;
147 evas_object_geometry_get(wd->bx, &bx, &by, NULL, NULL);
148 evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
149 elm_smart_scroller_child_region_show(wd->scr, x - bx, y - by, w, h);
153 _item_unselect(Elm_Toolbar_Item *item)
156 if ((!item) || (!item->selected)) return;
157 wd = elm_widget_data_get(WIDGET(item));
159 item->selected = EINA_FALSE;
160 wd->selected_item = NULL;
161 edje_object_signal_emit(VIEW(item), "elm,state,unselected", "elm");
162 elm_widget_signal_emit(item->icon, "elm,state,unselected", "elm");
166 _item_select(Elm_Toolbar_Item *it)
168 Elm_Toolbar_Item *it2;
169 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
174 if (elm_widget_item_disabled_get(it) || (it->separator) || (it->object)) return;
181 if (wd->always_select) return;
186 it2 = (Elm_Toolbar_Item *)
187 elm_toolbar_selected_item_get(WIDGET(it));
190 it->selected = EINA_TRUE;
191 wd->selected_item = it;
192 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
193 elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
198 if (it->menu && (!sel))
200 evas_object_show(it->o_menu);
201 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_RESIZE,
202 _menu_move_resize, it);
203 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOVE,
204 _menu_move_resize, it);
206 _menu_move_resize(it, NULL, NULL, NULL);
208 if (it->func) it->func((void *)(it->base.data), WIDGET(it), it);
209 evas_object_smart_callback_call(obj2, SIG_CLICKED, it);
213 _menu_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
215 Elm_Toolbar_Item *selected;
216 Elm_Toolbar_Item *it = data;
217 selected = (Elm_Toolbar_Item *) elm_toolbar_selected_item_get(WIDGET(it));
218 _item_unselect(selected);
222 _menu_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
224 // avoid hide being emitted during object deletion
225 evas_object_event_callback_del_full
226 (obj, EVAS_CALLBACK_HIDE, _menu_hide, data);
230 _menu_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
232 Elm_Toolbar_Item *it = data;
234 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
236 if ((!wd) || (!wd->menu_parent)) return;
237 evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
238 elm_menu_move(it->o_menu, x, y+h);
242 _item_del(Elm_Toolbar_Item *it)
244 Elm_Toolbar_Item_State *it_state;
246 EINA_LIST_FREE(it->states, it_state)
248 if (it->icon == it_state->icon)
250 eina_stringshare_del(it_state->label);
251 eina_stringshare_del(it_state->icon_str);
252 if (it_state->icon) evas_object_del(it_state->icon);
255 eina_stringshare_del(it->label);
256 eina_stringshare_del(it->icon_str);
257 if (it->icon) evas_object_del(it->icon);
258 //TODO: See if checking for wd->menu_parent is necessary before deleting menu
259 if (it->o_menu) evas_object_del(it->o_menu);
263 _del_pre_hook(Evas_Object *obj)
265 Widget_Data *wd = elm_widget_data_get(obj);
266 Elm_Toolbar_Item *it, *next;
269 it = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items);
272 next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
274 elm_widget_item_free(it);
279 _item_del(wd->more_item);
280 elm_widget_item_free(wd->more_item);
284 ecore_timer_del(wd->long_timer);
285 wd->long_timer = NULL;
290 _del_hook(Evas_Object *obj)
292 Widget_Data *wd = elm_widget_data_get(obj);
300 _mirrored_set_item(Evas_Object *obj __UNUSED__, Elm_Toolbar_Item *it, Eina_Bool mirrored)
302 edje_object_mirrored_set(VIEW(it), mirrored);
303 elm_widget_mirrored_set(it->o_menu, mirrored);
307 _theme_hook_item(Evas_Object *obj, Elm_Toolbar_Item *it, double scale, int icon_size)
309 Widget_Data *wd = elm_widget_data_get(obj);
310 Evas_Object *view = VIEW(it);
312 const char *style = elm_widget_style_get(obj);
314 _mirrored_set_item(obj, it, elm_widget_mirrored_get(obj));
315 edje_object_scale_set(view, scale);
316 if (!it->separator && !it->object)
318 _elm_theme_object_set(obj, view, "toolbar", "item", style);
321 edje_object_signal_emit(view, "elm,state,selected", "elm");
322 elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
324 if (elm_widget_item_disabled_get(it))
326 edje_object_signal_emit(view, "elm,state,disabled", "elm");
327 elm_widget_signal_emit(it->icon, "elm,state,disabled", "elm");
333 ms = ((double)icon_size * scale);
334 evas_object_size_hint_min_set(it->icon, ms, ms);
335 evas_object_size_hint_max_set(it->icon, ms, ms);
336 edje_object_part_swallow(view, "elm.swallow.icon", it->icon);
338 edje_object_part_text_set(view, "elm.text", it->label);
344 _elm_theme_object_set(obj, view, "toolbar", "separator", style);
347 evas_object_size_hint_weight_set(view, EVAS_HINT_EXPAND, -1.0);
348 evas_object_size_hint_align_set(view, EVAS_HINT_FILL, 0.5);
352 evas_object_size_hint_weight_set(view, -1.0, EVAS_HINT_EXPAND);
353 evas_object_size_hint_align_set(view, 0.5, EVAS_HINT_FILL);
358 _elm_theme_object_set(obj, view, "toolbar", "object", style);
359 edje_object_part_swallow(view, "elm.swallow.object", it->object);
364 if (!it->separator && !it->object)
365 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
366 edje_object_size_min_restricted_calc(view, &mw, &mh, mw, mh);
367 if (!it->separator && !it->object)
368 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
369 evas_object_size_hint_min_set(view, mw, mh);
373 _mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
375 Widget_Data *wd = elm_widget_data_get(obj);
376 Elm_Toolbar_Item *it;
378 EINA_INLIST_FOREACH(wd->items, it)
379 _mirrored_set_item(obj, it, mirrored);
381 _mirrored_set_item(obj, wd->more_item, mirrored);
385 _theme_hook(Evas_Object *obj)
387 Widget_Data *wd = elm_widget_data_get(obj);
388 Elm_Toolbar_Item *it;
392 _elm_widget_mirrored_reload(obj);
393 elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", elm_widget_style_get(obj));
394 _mirrored_set(obj, elm_widget_mirrored_get(obj));
395 scale = (elm_widget_scale_get(obj) * _elm_config->scale);
396 edje_object_scale_set(wd->scr, scale);
397 wd->icon_size = _elm_toolbar_icon_size_get(wd);
398 EINA_INLIST_FOREACH(wd->items, it)
399 _theme_hook_item(obj, it, scale, wd->icon_size);
401 _theme_hook_item(obj, wd->more_item, scale, wd->icon_size);
406 _item_text_set_hook(Elm_Object_Item *it,
410 if (part && strcmp(part, "default")) return;
411 _item_label_set(((Elm_Toolbar_Item *)it), label, "elm,state,label_set");
415 _item_text_get_hook(const Elm_Object_Item *it, const char *part)
417 if (part && strcmp(part, "default")) return NULL;
418 return ((Elm_Toolbar_Item *)it)->label;
422 _item_content_set_hook(Elm_Object_Item *it,
424 Evas_Object *content)
428 if (part && strcmp(part, "object")) return;
429 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *) it;
430 Evas_Object *obj = WIDGET(item);
431 Widget_Data *wd = elm_widget_data_get(obj);
433 if (item->object == content) return;
434 item->object = content;
435 elm_widget_sub_object_add(obj, item->object);
436 scale = (elm_widget_scale_get(obj) * _elm_config->scale);
437 _theme_hook_item(obj, item, scale, wd->icon_size);
441 _item_content_get_hook(const Elm_Object_Item *it, const char *part)
443 if (part && strcmp(part, "object")) return NULL;
444 return ((Elm_Toolbar_Item *) it)->object;
448 _item_content_unset_hook(Elm_Object_Item *it, const char *part)
453 if (part && strcmp(part, "object")) return NULL;
454 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *) it;
455 Evas_Object *obj = WIDGET(item);
456 Widget_Data *wd = elm_widget_data_get(obj);
458 edje_object_part_unswallow(VIEW(it), item->object);
459 elm_widget_sub_object_del(obj, item->object);
462 scale = (elm_widget_scale_get(obj) * _elm_config->scale);
463 _theme_hook_item(obj, item, scale, wd->icon_size);
468 _translate_hook(Evas_Object *obj)
470 evas_object_smart_callback_call(obj, "language,changed", NULL);
474 _sizing_eval(Evas_Object *obj)
476 Widget_Data *wd = elm_widget_data_get(obj);
477 Evas_Coord minw = -1, minh = -1, minw_bx = -1, minh_bx = -1;
478 Evas_Coord vw = 0, vh = 0;
482 evas_object_smart_need_recalculate_set(wd->bx, EINA_TRUE);
483 evas_object_smart_calculate(wd->bx);
484 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
486 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
487 if (w < minw) w = minw;
488 if (h < minh) h = minh;
489 evas_object_resize(wd->scr, w, h);
491 evas_object_size_hint_min_get(wd->bx, &minw_bx, &minh_bx);
492 // if (wd->vertical && (h > minh)) minh = h;
493 // if ((!wd->vertical) && (w > minw)) minw = w;
494 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
495 if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_NONE)
499 minw = minw_bx + (w - vw);
500 minh = minh_bx + (h - vh);
504 minw = minw_bx + (w - vw);
505 minh = minh_bx + (h - vh);
508 else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
510 minw = minw_bx + (w - vw);
511 minh = minh_bx + (h - vh);
512 if (minw_bx < vw) minw_bx = vw;
513 if (minh_bx < vh) minh_bx = vh;
519 minw = minw_bx + (w - vw);
525 minh = minh_bx + (h - vh);
527 // if (wd->vertical) minh = h - vh;
528 // else minw = w - vw;
529 // minh = minh + (h - vh);
531 evas_object_resize(wd->bx, minw_bx, minh_bx);
532 evas_object_size_hint_min_set(obj, minw, minh);
533 evas_object_size_hint_max_set(obj, -1, -1);
537 _item_menu_create(Widget_Data *wd, Elm_Toolbar_Item *item)
539 item->o_menu = elm_menu_add(VIEW(item));
540 item->menu = EINA_TRUE;
542 elm_menu_parent_set(item->o_menu, wd->menu_parent);
543 evas_object_event_callback_add(item->o_menu, EVAS_CALLBACK_HIDE,
545 evas_object_event_callback_add(item->o_menu, EVAS_CALLBACK_DEL,
550 _item_menu_destroy(Elm_Toolbar_Item *item)
554 evas_object_del(item->o_menu);
557 item->menu = EINA_FALSE;
561 _toolbar_item_prio_compare_cb(const void *i1, const void *i2)
563 const Elm_Toolbar_Item *eti1 = i1;
564 const Elm_Toolbar_Item *eti2 = i2;
567 if (!eti1) return -1;
569 return eti2->prio.priority - eti1->prio.priority;
573 _fix_items_visibility(Widget_Data *wd, Evas_Coord *iw, Evas_Coord vw)
575 Elm_Toolbar_Item *it;
576 Eina_List *sorted = NULL;
577 Evas_Coord ciw = 0, cih = 0;
579 EINA_INLIST_FOREACH(wd->items, it)
581 sorted = eina_list_sorted_insert(sorted,
582 _toolbar_item_prio_compare_cb, it);
587 evas_object_geometry_get(wd->VIEW(more_item), NULL, NULL, &ciw, &cih);
588 if (wd->vertical) *iw += cih;
591 EINA_LIST_FREE(sorted, it)
593 evas_object_geometry_get(VIEW(it), NULL, NULL, &ciw, &cih);
594 if (wd->vertical) *iw += cih;
596 it->prio.visible = (*iw <= vw);
601 _elm_toolbar_item_menu_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
603 Elm_Toolbar_Item *it = data;
604 if (it->func) it->func((void *)(it->base.data), WIDGET(it), it);
608 _resize_job(void *data)
610 Evas_Object *obj = (Evas_Object *)data;
611 Widget_Data *wd = elm_widget_data_get(obj);
612 Evas_Coord mw, mh, vw = 0, vh = 0, w = 0, h = 0;
613 Elm_Toolbar_Item *it;
616 wd->resize_job = NULL;
617 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
618 evas_object_size_hint_min_get(wd->bx, &mw, &mh);
619 evas_object_geometry_get(wd->bx, NULL, NULL, &w, &h);
620 if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_MENU)
622 Evas_Coord iw = 0, ih = 0, more_w = 0, more_h = 0;
626 evas_object_resize(wd->bx, w, vh);
627 _fix_items_visibility(wd, &ih, vh);
631 evas_object_resize(wd->bx, vw, h);
632 _fix_items_visibility(wd, &iw, vw);
634 evas_object_geometry_get(wd->VIEW(more_item), NULL, NULL,
638 if ((ih - more_h) <= vh) ih -= more_h;
642 if ((iw - more_w) <= vw) iw -= more_w;
645 /* All items are removed from the box object, since removing individual
646 * items won't trigger a resize. Items are be readded below. */
647 evas_object_box_remove_all(wd->bx, EINA_FALSE);
648 if (((wd->vertical) && (ih > vh)) ||
649 ((!wd->vertical) && (iw > vw)))
653 _item_menu_destroy(wd->more_item);
654 _item_menu_create(wd, wd->more_item);
655 menu = elm_toolbar_item_menu_get((Elm_Object_Item *)wd->more_item);
656 EINA_INLIST_FOREACH(wd->items, it)
658 if (!it->prio.visible)
661 elm_menu_item_separator_add(menu, NULL);
664 Elm_Object_Item *menu_it;
665 menu_it = elm_menu_item_add
666 (menu, NULL, it->icon_str, it->label,
667 _elm_toolbar_item_menu_cb, it);
668 elm_object_item_disabled_set
669 (menu_it, elm_widget_item_disabled_get(it));
671 elm_menu_clone(it->o_menu, menu, menu_it);
673 evas_object_hide(VIEW(it));
677 evas_object_box_append(wd->bx, VIEW(it));
678 evas_object_show(VIEW(it));
681 evas_object_box_append(wd->bx, wd->VIEW(more_item));
682 evas_object_show(wd->VIEW(more_item));
686 /* All items are visible, show them all (except for the "More"
687 * button, of course). */
688 EINA_INLIST_FOREACH(wd->items, it)
690 evas_object_show(VIEW(it));
691 evas_object_box_append(wd->bx, VIEW(it));
693 evas_object_hide(wd->VIEW(more_item));
696 else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_HIDE)
698 Evas_Coord iw = 0, ih = 0;
702 evas_object_resize(wd->bx, w, vh);
703 _fix_items_visibility(wd, &ih, vh);
707 evas_object_resize(wd->bx, vw, h);
708 _fix_items_visibility(wd, &iw, vw);
710 evas_object_box_remove_all(wd->bx, EINA_FALSE);
711 if (((wd->vertical) && (ih > vh)) ||
712 ((!wd->vertical) && (iw > vw)))
714 EINA_INLIST_FOREACH(wd->items, it)
716 if (!it->prio.visible)
717 evas_object_hide(VIEW(it));
720 evas_object_box_append(wd->bx, VIEW(it));
721 evas_object_show(VIEW(it));
727 /* All items are visible, show them all */
728 EINA_INLIST_FOREACH(wd->items, it)
730 evas_object_show(VIEW(it));
731 evas_object_box_append(wd->bx, VIEW(it));
735 else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
737 if ((vw >= mw) && (vh >= mh))
738 evas_object_resize(wd->bx, vw, vh);
740 evas_object_resize(wd->bx, mw, vh);
742 evas_object_resize(wd->bx, vw, mh);
748 if ((vh >= mh) && (h != vh)) evas_object_resize(wd->bx, w, vh);
752 if ((vw >= mw) && (w != vw)) evas_object_resize(wd->bx, vw, h);
754 EINA_INLIST_FOREACH(wd->items, it)
764 _mirrored_set(obj, elm_widget_mirrored_get(obj));
768 _resize_item(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
771 _resize(data, NULL, NULL, NULL);
775 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
777 Widget_Data *wd = elm_widget_data_get(data);
779 wd->resize_job = ecore_job_add(_resize_job, data);
783 _select_filter(Elm_Toolbar_Item *it, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
786 char buf[sizeof("elm,action,click,") + 1];
788 button = atoi(emission + sizeof("mouse,clicked,") - 1);
789 if (button == 1) return; /* regular left click event */
790 snprintf(buf, sizeof(buf), "elm,action,click,%d", button);
791 edje_object_signal_emit(VIEW(it), buf, "elm");
795 _select(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
797 Elm_Toolbar_Item *it = data;
799 if ((_elm_config->access_mode == ELM_ACCESS_MODE_OFF) ||
800 (_elm_access_2nd_click_timeout(VIEW(it))))
802 if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
803 _elm_access_say(E_("Selected"));
809 _long_press(Elm_Toolbar_Item *it)
811 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
812 wd->long_timer = NULL;
813 wd->long_press = EINA_TRUE;
814 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
815 return ECORE_CALLBACK_CANCEL;
819 _mouse_down(Elm_Toolbar_Item *it, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Down *ev)
821 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
823 if (ev->button != 1) return;
824 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
825 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
826 wd->long_press = EINA_FALSE;
827 if (wd->long_timer) ecore_timer_interval_set(wd->long_timer, _elm_config->longpress_timeout);
828 else wd->long_timer = ecore_timer_add(_elm_config->longpress_timeout, (Ecore_Task_Cb)_long_press, it);
832 _mouse_up(Elm_Toolbar_Item *it, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Up *ev)
834 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
836 if (ev->button != 1) return;
839 ecore_timer_del(wd->long_timer);
840 wd->long_timer = NULL;
845 _mouse_in(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
847 Elm_Toolbar_Item *it = data;
848 edje_object_signal_emit(VIEW(it), "elm,state,highlighted", "elm");
849 elm_widget_signal_emit(it->icon, "elm,state,highlighted", "elm");
853 _mouse_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
855 Elm_Toolbar_Item *it = data;
856 edje_object_signal_emit(VIEW(it), "elm,state,unhighlighted", "elm");
857 elm_widget_signal_emit(it->icon, "elm,state,unhighlighted", "elm");
861 _layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data)
863 Evas_Object *obj = (Evas_Object *) data;
864 Widget_Data *wd = elm_widget_data_get(obj);
866 _els_box_layout(o, priv, !wd->vertical, wd->homogeneous,
867 elm_widget_mirrored_get(obj));
871 _access_info_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Widget_Item *item)
873 Elm_Toolbar_Item *it = (Elm_Toolbar_Item *)item;
874 const char *txt = item->access_info;
875 if (!txt) txt = it->label;
876 if (txt) return strdup(txt);
881 _access_state_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Widget_Item *item __UNUSED__)
883 Elm_Toolbar_Item *it = (Elm_Toolbar_Item *)item;
885 return strdup(E_("Separator"));
886 else if (elm_widget_item_disabled_get(it))
887 return strdup(E_("State: Disabled"));
888 else if (it->selected)
889 return strdup(E_("State: Selected"));
891 return strdup(E_("Has menu"));
896 _item_del_pre_hook(Elm_Object_Item *it)
900 Elm_Toolbar_Item *item, *next;
901 item = (Elm_Toolbar_Item *)it;
903 wd = elm_widget_data_get(WIDGET(item));
904 if (!wd) return EINA_FALSE;
907 next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next);
908 wd->items = eina_inlist_remove(wd->items, EINA_INLIST_GET(item));
910 if (!next) next = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items);
911 if (wd->always_select && item->selected && next) _item_select(next);
918 static Elm_Toolbar_Item *
919 _item_new(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
921 Widget_Data *wd = elm_widget_data_get(obj);
922 Evas_Object *icon_obj;
924 Elm_Toolbar_Item *it;
926 icon_obj = elm_icon_add(obj);
927 elm_icon_order_lookup_set(icon_obj, wd->lookup_order);
928 if (!icon_obj) return NULL;
929 it = elm_widget_item_new(obj, Elm_Toolbar_Item);
932 evas_object_del(icon_obj);
936 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
937 elm_widget_item_disable_hook_set(it, _item_disable_hook);
938 elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
939 elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
940 elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
941 elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
942 elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
944 it->label = eina_stringshare_add(label);
945 it->prio.visible = 1;
946 it->prio.priority = 0;
948 it->separator = EINA_FALSE;
950 it->base.data = data;
951 VIEW(it) = edje_object_add(evas_object_evas_get(obj));
952 _elm_access_item_register(&it->base, VIEW(it));
953 _elm_access_text_set(_elm_access_item_get(&it->base),
954 ELM_ACCESS_TYPE, E_("Tool Item"));
955 _elm_access_callback_set(_elm_access_item_get(&it->base),
956 ELM_ACCESS_INFO, _access_info_cb, it);
957 _elm_access_callback_set(_elm_access_item_get(&it->base),
958 ELM_ACCESS_STATE, _access_state_cb, it);
960 if (_item_icon_set(icon_obj, "toolbar/", icon))
963 it->icon_str = eina_stringshare_add(icon);
969 evas_object_del(icon_obj);
972 _elm_theme_object_set(obj, VIEW(it), "toolbar", "item",
973 elm_widget_style_get(obj));
974 edje_object_signal_callback_add(VIEW(it), "elm,action,click", "elm",
976 edje_object_signal_callback_add(VIEW(it), "mouse,clicked,*", "*",
977 (Edje_Signal_Cb)_select_filter, it);
978 edje_object_signal_callback_add(VIEW(it), "elm,mouse,in", "elm",
980 edje_object_signal_callback_add(VIEW(it), "elm,mouse,out", "elm",
982 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
983 (Evas_Object_Event_Cb)_mouse_down, it);
984 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
985 (Evas_Object_Event_Cb)_mouse_up, it);
986 elm_widget_sub_object_add(obj, VIEW(it));
991 ms = ((double)wd->icon_size * _elm_config->scale);
992 evas_object_size_hint_min_set(it->icon, ms, ms);
993 evas_object_size_hint_max_set(it->icon, ms, ms);
994 edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon);
995 evas_object_show(it->icon);
996 elm_widget_sub_object_add(obj, it->icon);
998 edje_object_part_text_set(VIEW(it), "elm.text", it->label);
1000 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1001 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh);
1002 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1003 if (wd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
1007 evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, -1.0);
1008 evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, 0.5);
1012 evas_object_size_hint_weight_set(VIEW(it), -1.0, EVAS_HINT_EXPAND);
1013 evas_object_size_hint_align_set(VIEW(it), 0.5, EVAS_HINT_FILL);
1018 evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1019 evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL);
1021 evas_object_size_hint_min_set(VIEW(it), mw, mh);
1022 evas_object_size_hint_max_set(VIEW(it), -1, -1);
1023 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_RESIZE,
1025 if ((!wd->items) && wd->always_select) _item_select(it);
1031 _elm_toolbar_item_label_update(Elm_Toolbar_Item *item)
1033 Evas_Coord mw = -1, mh = -1;
1034 Widget_Data *wd = elm_widget_data_get(WIDGET(item));
1035 edje_object_part_text_set(VIEW(item), "elm.text", item->label);
1037 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1038 edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh);
1039 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1040 if (wd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
1044 evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, -1.0);
1045 evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, 0.5);
1049 evas_object_size_hint_weight_set(VIEW(item), -1.0, EVAS_HINT_EXPAND);
1050 evas_object_size_hint_align_set(VIEW(item), 0.5, EVAS_HINT_FILL);
1055 evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1056 evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
1058 evas_object_size_hint_min_set(VIEW(item), mw, mh);
1062 _elm_toolbar_item_label_set_cb (void *data, Evas_Object *obj, const char *emission, const char *source)
1064 Elm_Toolbar_Item *item = data;
1065 _elm_toolbar_item_label_update(item);
1066 edje_object_signal_callback_del(obj, emission, source,
1067 _elm_toolbar_item_label_set_cb);
1068 edje_object_signal_emit (VIEW(item), "elm,state,label,reset", "elm");
1072 _item_label_set(Elm_Toolbar_Item *item, const char *label, const char *signal)
1076 if ((label) && (item->label) && (!strcmp(label, item->label))) return;
1078 eina_stringshare_replace(&item->label, label);
1079 s = edje_object_data_get(VIEW(item), "transition_animation_on");
1080 if ((s) && (atoi(s)))
1082 edje_object_part_text_set(VIEW(item), "elm.text_new", item->label);
1083 edje_object_signal_emit (VIEW(item), signal, "elm");
1084 edje_object_signal_callback_add(VIEW(item),
1085 "elm,state,label_set,done", "elm",
1086 _elm_toolbar_item_label_set_cb, item);
1089 _elm_toolbar_item_label_update(item);
1090 _resize(WIDGET(item), NULL, NULL, NULL);
1094 _elm_toolbar_item_icon_update(Elm_Toolbar_Item *item)
1096 Elm_Toolbar_Item_State *it_state;
1098 Evas_Coord mw = -1, mh = -1;
1099 Widget_Data *wd = elm_widget_data_get(WIDGET(item));
1100 Evas_Object *old_icon = edje_object_part_swallow_get(VIEW(item),
1101 "elm.swallow.icon");
1102 elm_widget_sub_object_del(VIEW(item), old_icon);
1103 evas_object_hide(old_icon);
1104 edje_object_part_swallow(VIEW(item), "elm.swallow.icon", item->icon);
1105 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1106 edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh);
1107 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1108 if (wd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
1112 evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, -1.0);
1113 evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, 0.5);
1117 evas_object_size_hint_weight_set(VIEW(item), -1.0, EVAS_HINT_EXPAND);
1118 evas_object_size_hint_align_set(VIEW(item), 0.5, EVAS_HINT_FILL);
1123 evas_object_size_hint_weight_set(VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1124 evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
1126 evas_object_size_hint_min_set(VIEW(item), mw, mh);
1128 EINA_LIST_FOREACH(item->states, l, it_state)
1130 if (it_state->icon == old_icon) return;
1132 evas_object_del(old_icon);
1136 _elm_toolbar_item_icon_set_cb (void *data, Evas_Object *obj, const char *emission, const char *source)
1138 Elm_Toolbar_Item *item = data;
1139 edje_object_part_unswallow(VIEW(item), item->icon);
1140 _elm_toolbar_item_icon_update(item);
1141 edje_object_signal_callback_del(obj, emission, source,
1142 _elm_toolbar_item_icon_set_cb);
1143 edje_object_signal_emit (VIEW(item), "elm,state,icon,reset", "elm");
1147 _elm_toolbar_item_icon_obj_set(Evas_Object *obj, Elm_Toolbar_Item *item, Evas_Object *icon_obj, const char *icon_str, double icon_size, const char *signal)
1149 Evas_Object *old_icon;
1154 eina_stringshare_replace(&item->icon_str, icon_str);
1157 eina_stringshare_del(item->icon_str);
1158 item->icon_str = NULL;
1160 item->icon = icon_obj;
1163 ms = (icon_size * _elm_config->scale);
1164 evas_object_size_hint_min_set(item->icon, ms, ms);
1165 evas_object_size_hint_max_set(item->icon, ms, ms);
1166 evas_object_show(item->icon);
1167 elm_widget_sub_object_add(obj, item->icon);
1169 s = edje_object_data_get(VIEW(item), "transition_animation_on");
1170 if ((s) && (atoi(s)))
1172 old_icon = edje_object_part_swallow_get(VIEW(item),
1173 "elm.swallow.icon_new");
1176 elm_widget_sub_object_del(VIEW(item), old_icon);
1177 evas_object_hide(old_icon);
1179 edje_object_part_swallow(VIEW(item), "elm.swallow.icon_new",
1181 edje_object_signal_emit (VIEW(item), signal, "elm");
1182 edje_object_signal_callback_add(VIEW(item),
1183 "elm,state,icon_set,done", "elm",
1184 _elm_toolbar_item_icon_set_cb, item);
1187 _elm_toolbar_item_icon_update(item);
1188 _resize(obj, NULL, NULL, NULL);
1192 _elm_toolbar_item_state_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1194 Elm_Toolbar_Item *it = event_info;
1195 Elm_Toolbar_Item_State *it_state;
1197 it_state = eina_list_data_get(it->current_state);
1199 it_state->func((void *)it_state->data, obj, event_info);
1202 static Elm_Toolbar_Item_State *
1203 _item_state_new(const char *label, const char *icon_str, Evas_Object *icon, Evas_Smart_Cb func, const void *data)
1205 Elm_Toolbar_Item_State *it_state;
1206 it_state = ELM_NEW(Elm_Toolbar_Item_State);
1207 it_state->label = eina_stringshare_add(label);
1208 it_state->icon_str = eina_stringshare_add(icon_str);
1209 it_state->icon = icon;
1210 it_state->func = func;
1211 it_state->data = data;
1216 elm_toolbar_add(Evas_Object *parent)
1222 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
1224 ELM_SET_WIDTYPE(widtype, "toolbar");
1225 elm_widget_type_set(obj, "toolbar");
1226 elm_widget_sub_object_add(parent, obj);
1227 elm_widget_data_set(obj, wd);
1228 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
1229 elm_widget_del_hook_set(obj, _del_hook);
1230 elm_widget_theme_hook_set(obj, _theme_hook);
1231 elm_widget_translate_hook_set(obj, _translate_hook);
1232 elm_widget_can_focus_set(obj, EINA_FALSE);
1234 wd->more_item = NULL;
1235 wd->selected_item = NULL;
1236 wd->scr = elm_smart_scroller_add(e);
1237 elm_smart_scroller_widget_set(wd->scr, obj);
1238 elm_smart_scroller_object_theme_set(obj, wd->scr, "toolbar", "base", "default");
1239 elm_smart_scroller_bounce_allow_set(wd->scr,
1240 _elm_config->thumbscroll_bounce_enable,
1242 elm_widget_resize_object_set(obj, wd->scr);
1243 elm_smart_scroller_policy_set(wd->scr,
1244 ELM_SMART_SCROLLER_POLICY_AUTO,
1245 ELM_SMART_SCROLLER_POLICY_OFF);
1248 wd->icon_size = _elm_toolbar_icon_size_get(wd);
1251 wd->homogeneous = EINA_TRUE;
1254 wd->bx = evas_object_box_add(e);
1255 evas_object_size_hint_align_set(wd->bx, wd->align, 0.5);
1256 evas_object_box_layout_set(wd->bx, _layout, obj, NULL);
1257 elm_widget_sub_object_add(obj, wd->bx);
1258 elm_smart_scroller_child_set(wd->scr, wd->bx);
1259 evas_object_show(wd->bx);
1261 elm_toolbar_shrink_mode_set(obj, _elm_config->toolbar_shrink_mode);
1262 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, _resize, obj);
1263 evas_object_event_callback_add(wd->bx, EVAS_CALLBACK_RESIZE, _resize, obj);
1264 elm_toolbar_icon_order_lookup_set(obj, ELM_ICON_LOOKUP_THEME_FDO);
1266 evas_object_smart_callbacks_descriptions_set(obj, _signals);
1273 elm_toolbar_icon_size_set(Evas_Object *obj, int icon_size)
1275 ELM_CHECK_WIDTYPE(obj, widtype);
1276 Widget_Data *wd = elm_widget_data_get(obj);
1278 if (wd->icon_size == icon_size) return;
1279 wd->icon_size = icon_size;
1284 elm_toolbar_icon_size_get(const Evas_Object *obj)
1286 ELM_CHECK_WIDTYPE(obj, widtype) 0;
1287 Widget_Data *wd = elm_widget_data_get(obj);
1289 return wd->icon_size;
1292 EAPI Elm_Object_Item *
1293 elm_toolbar_item_append(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
1295 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1296 Widget_Data *wd = elm_widget_data_get(obj);
1297 if (!wd) return NULL;
1299 Elm_Toolbar_Item *it = _item_new(obj, icon, label, func, data);
1300 if (!it) return NULL;
1301 double scale = (elm_widget_scale_get(obj) * _elm_config->scale);
1303 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
1304 evas_object_box_append(wd->bx, VIEW(it));
1305 evas_object_show(VIEW(it));
1307 _theme_hook_item(obj, it, scale, wd->icon_size);
1310 return (Elm_Object_Item *)it;
1313 EAPI Elm_Object_Item *
1314 elm_toolbar_item_prepend(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
1316 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1317 Widget_Data *wd = elm_widget_data_get(obj);
1318 if (!wd) return NULL;
1320 Elm_Toolbar_Item *it = _item_new(obj, icon, label, func, data);
1321 if (!it) return NULL;
1322 double scale = (elm_widget_scale_get(obj) * _elm_config->scale);
1324 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
1325 evas_object_box_prepend(wd->bx, VIEW(it));
1326 evas_object_show(VIEW(it));
1327 _theme_hook_item(obj, it, scale, wd->icon_size);
1330 return (Elm_Object_Item *)it;
1333 EAPI Elm_Object_Item *
1334 elm_toolbar_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
1336 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1337 ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL);
1339 Elm_Toolbar_Item *it, *_before;
1341 wd = elm_widget_data_get(obj);
1342 if (!wd) return NULL;
1343 _before = (Elm_Toolbar_Item *) before;
1344 it = _item_new(obj, icon, label, func, data);
1345 if (!it) return NULL;
1346 double scale = (elm_widget_scale_get(obj) * _elm_config->scale);
1348 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
1349 EINA_INLIST_GET(_before));
1350 evas_object_box_insert_before(wd->bx, VIEW(it), VIEW(_before));
1351 evas_object_show(VIEW(it));
1352 _theme_hook_item(obj, it, scale, wd->icon_size);
1355 return (Elm_Object_Item *)it;
1358 EAPI Elm_Object_Item *
1359 elm_toolbar_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
1361 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1362 ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL);
1364 Elm_Toolbar_Item *it, *_after;
1366 wd = elm_widget_data_get(obj);
1367 if (!wd) return NULL;
1368 _after = (Elm_Toolbar_Item *) after;
1369 it = _item_new(obj, icon, label, func, data);
1370 if (!it) return NULL;
1371 double scale = (elm_widget_scale_get(obj) * _elm_config->scale);
1373 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
1374 EINA_INLIST_GET(_after));
1375 evas_object_box_insert_after(wd->bx, VIEW(it), VIEW(_after));
1376 evas_object_show(VIEW(it));
1377 _theme_hook_item(obj, it, scale, wd->icon_size);
1380 return (Elm_Object_Item *)it;
1383 EAPI Elm_Object_Item *
1384 elm_toolbar_first_item_get(const Evas_Object *obj)
1386 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1387 Widget_Data *wd = elm_widget_data_get(obj);
1388 if (!wd || !wd->items) return NULL;
1389 return (Elm_Object_Item *) ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items);
1392 EAPI Elm_Object_Item *
1393 elm_toolbar_last_item_get(const Evas_Object *obj)
1395 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1396 Widget_Data *wd = elm_widget_data_get(obj);
1397 if (!wd || !wd->items) return NULL;
1398 return (Elm_Object_Item *) ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items->last);
1401 EAPI Elm_Object_Item *
1402 elm_toolbar_item_next_get(const Elm_Object_Item *it)
1404 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1405 return (Elm_Object_Item *) ELM_TOOLBAR_ITEM_FROM_INLIST(
1406 EINA_INLIST_GET(((Elm_Toolbar_Item *)it))->next);
1409 EAPI Elm_Object_Item *
1410 elm_toolbar_item_prev_get(const Elm_Object_Item *it)
1412 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1413 return (Elm_Object_Item *) ELM_TOOLBAR_ITEM_FROM_INLIST(
1414 EINA_INLIST_GET(((Elm_Toolbar_Item *)it))->prev);
1418 elm_toolbar_item_toolbar_get(const Elm_Object_Item *it)
1420 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1421 return elm_object_item_widget_get(it);
1425 elm_toolbar_item_priority_set(Elm_Object_Item *it, int priority)
1427 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1428 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1429 if (item->prio.priority == priority) return;
1430 item->prio.priority = priority;
1431 _resize(WIDGET(item), NULL, NULL, NULL);
1435 elm_toolbar_item_priority_get(const Elm_Object_Item *it)
1437 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, 0);
1438 return ((Elm_Toolbar_Item *)it)->prio.priority;
1442 elm_toolbar_item_label_get(const Elm_Object_Item *it)
1444 return _item_text_get_hook(it, NULL);
1448 elm_toolbar_item_label_set(Elm_Object_Item *it, const char *label)
1450 _item_text_set_hook(it, NULL, label);
1454 elm_toolbar_item_data_get(const Elm_Object_Item *it)
1456 return elm_object_item_data_get(it);
1460 elm_toolbar_item_data_set(Elm_Object_Item *it, const void *data)
1462 elm_object_item_data_set(it, (void *) data);
1465 EAPI Elm_Object_Item *
1466 elm_toolbar_item_find_by_label(const Evas_Object *obj, const char *label)
1468 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1469 Elm_Toolbar_Item *it;
1470 Widget_Data *wd = elm_widget_data_get(obj);
1471 if (!wd) return NULL;
1473 EINA_INLIST_FOREACH(wd->items, it)
1475 if (!strcmp(it->label, label))
1476 return (Elm_Object_Item *)it;
1482 elm_toolbar_item_selected_set(Elm_Object_Item *it, Eina_Bool selected)
1484 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1485 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1486 Widget_Data *wd = elm_widget_data_get(WIDGET(item));
1489 if (item->selected == selected) return;
1490 if (selected) _item_select(item);
1491 else _item_unselect(item);
1495 elm_toolbar_item_selected_get(const Elm_Object_Item *it)
1497 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1498 return ((Elm_Toolbar_Item *)it)->selected;
1501 EAPI Elm_Object_Item *
1502 elm_toolbar_selected_item_get(const Evas_Object *obj)
1504 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1505 Widget_Data *wd = elm_widget_data_get(obj);
1506 if (!wd) return NULL;
1507 return (Elm_Object_Item *) wd->selected_item;
1511 elm_toolbar_item_icon_set(Elm_Object_Item *it, const char *icon)
1513 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1515 Evas_Object *icon_obj;
1518 Elm_Toolbar_Item * item = (Elm_Toolbar_Item *)it;
1521 wd = elm_widget_data_get(obj);
1523 if ((icon) && (item->icon_str) && (!strcmp(icon, item->icon_str))) return;
1525 icon_obj = elm_icon_add(obj);
1526 if (!icon_obj) return;
1527 if (_item_icon_set(icon_obj, "toolbar/", icon))
1528 _elm_toolbar_item_icon_obj_set(obj, item, icon_obj, icon, wd->icon_size,
1529 "elm,state,icon_set");
1532 _elm_toolbar_item_icon_obj_set(obj, item, NULL, NULL, 0,
1533 "elm,state,icon_set");
1534 evas_object_del(icon_obj);
1539 elm_toolbar_item_icon_get(const Elm_Object_Item *it)
1541 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1542 return ((Elm_Toolbar_Item *)it)->icon_str;
1546 elm_toolbar_item_object_get(const Elm_Object_Item *it)
1548 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1552 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1555 wd = elm_widget_data_get(obj);
1556 if (!wd) return NULL;
1562 elm_toolbar_item_icon_object_get(Elm_Object_Item *it)
1564 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1565 return ((Elm_Toolbar_Item *)it)->icon;
1569 elm_toolbar_item_icon_memfile_set(Elm_Object_Item *it, const void *img, size_t size, const char *format, const char *key)
1571 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1573 Evas_Object *icon_obj;
1577 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1580 wd = elm_widget_data_get(obj);
1581 if (!wd) return EINA_FALSE;
1585 icon_obj = _els_smart_icon_add(evas_object_evas_get(obj));
1586 evas_object_repeat_events_set(icon_obj, EINA_TRUE);
1587 ret = _els_smart_icon_memfile_set(icon_obj, img, size, format, key);
1590 evas_object_del(icon_obj);
1593 _elm_toolbar_item_icon_obj_set(obj, item, icon_obj, NULL, wd->icon_size,
1594 "elm,state,icon_set");
1597 _elm_toolbar_item_icon_obj_set(obj, item, NULL, NULL, 0, "elm,state,icon_set");
1602 elm_toolbar_item_icon_file_set(Elm_Object_Item *it, const char *file, const char *key)
1604 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1606 Evas_Object *icon_obj;
1610 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1613 wd = elm_widget_data_get(obj);
1614 if (!wd) return EINA_FALSE;
1618 icon_obj = _els_smart_icon_add(evas_object_evas_get(obj));
1619 evas_object_repeat_events_set(icon_obj, EINA_TRUE);
1620 ret = _els_smart_icon_file_key_set(icon_obj, file, key);
1623 evas_object_del(icon_obj);
1626 _elm_toolbar_item_icon_obj_set(obj, item, icon_obj, NULL, wd->icon_size,
1627 "elm,state,icon_set");
1630 _elm_toolbar_item_icon_obj_set(obj, item, NULL, NULL, 0, "elm,state,icon_set");
1635 elm_toolbar_item_del(Elm_Object_Item *it)
1637 elm_object_item_del(it);
1641 elm_toolbar_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
1643 elm_object_item_del_cb_set(it, func);
1647 elm_toolbar_item_disabled_get(const Elm_Object_Item *it)
1649 return elm_object_item_disabled_get(it);
1653 elm_toolbar_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled)
1655 elm_object_item_disabled_set(it, disabled);
1659 elm_toolbar_item_separator_set(Elm_Object_Item *it, Eina_Bool separator)
1661 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1662 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1663 Evas_Object *obj = WIDGET(item);
1664 Widget_Data *wd = elm_widget_data_get(obj);
1666 if (item->separator == separator) return;
1667 item->separator = separator;
1668 scale = (elm_widget_scale_get(obj) * _elm_config->scale);
1669 _theme_hook_item(obj, item, scale, wd->icon_size);
1673 elm_toolbar_item_separator_get(const Elm_Object_Item *it)
1675 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1676 return ((Elm_Toolbar_Item *)it)->separator;
1680 elm_toolbar_shrink_mode_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mode)
1682 ELM_CHECK_WIDTYPE(obj, widtype);
1683 Widget_Data *wd = elm_widget_data_get(obj);
1687 wd->shrink_mode = shrink_mode;
1688 bounce = (_elm_config->thumbscroll_bounce_enable) &&
1689 (shrink_mode == ELM_TOOLBAR_SHRINK_SCROLL);
1690 elm_smart_scroller_bounce_allow_set(wd->scr, bounce, EINA_FALSE);
1694 _item_del(wd->more_item);
1695 elm_widget_item_free(wd->more_item);
1696 wd->more_item = NULL;
1699 if (shrink_mode == ELM_TOOLBAR_SHRINK_MENU)
1701 elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_OFF,
1702 ELM_SMART_SCROLLER_POLICY_OFF);
1703 wd->more_item = _item_new(obj, "more_menu", "More", NULL, NULL);
1705 else if (shrink_mode == ELM_TOOLBAR_SHRINK_HIDE)
1706 elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_OFF,
1707 ELM_SMART_SCROLLER_POLICY_OFF);
1709 elm_smart_scroller_policy_set(wd->scr, ELM_SMART_SCROLLER_POLICY_AUTO,
1710 ELM_SMART_SCROLLER_POLICY_OFF);
1714 EAPI Elm_Toolbar_Shrink_Mode
1715 elm_toolbar_shrink_mode_get(const Evas_Object *obj)
1717 ELM_CHECK_WIDTYPE(obj, widtype) ELM_TOOLBAR_SHRINK_NONE;
1718 Widget_Data *wd = elm_widget_data_get(obj);
1720 if (!wd) return ELM_TOOLBAR_SHRINK_NONE;
1721 return wd->shrink_mode;
1725 elm_toolbar_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous)
1727 ELM_CHECK_WIDTYPE(obj, widtype);
1728 Widget_Data *wd = elm_widget_data_get(obj);
1731 wd->homogeneous = !!homogeneous;
1732 evas_object_smart_calculate(wd->bx);
1736 elm_toolbar_homogeneous_get(const Evas_Object *obj)
1738 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1739 Widget_Data *wd = elm_widget_data_get(obj);
1741 if (!wd) return EINA_FALSE;
1742 return wd->homogeneous;
1746 elm_toolbar_menu_parent_set(Evas_Object *obj, Evas_Object *parent)
1748 Elm_Toolbar_Item *it;
1749 ELM_CHECK_WIDTYPE(obj, widtype);
1750 Widget_Data *wd = elm_widget_data_get(obj);
1753 EINA_SAFETY_ON_NULL_RETURN(parent);
1754 wd->menu_parent = parent;
1755 EINA_INLIST_FOREACH(wd->items, it)
1758 elm_menu_parent_set(it->o_menu, wd->menu_parent);
1760 if ((wd->more_item) && (wd->more_item->o_menu))
1761 elm_menu_parent_set(wd->more_item->o_menu, wd->menu_parent);
1765 elm_toolbar_menu_parent_get(const Evas_Object *obj)
1767 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1768 Widget_Data *wd = elm_widget_data_get(obj);
1770 if (!wd) return NULL;
1771 return wd->menu_parent;
1775 elm_toolbar_align_set(Evas_Object *obj, double align)
1777 ELM_CHECK_WIDTYPE(obj, widtype);
1778 Widget_Data *wd = elm_widget_data_get(obj);
1783 if (wd->align != align)
1784 evas_object_size_hint_align_set(wd->bx, 0.5, align);
1788 if (wd->align != align)
1789 evas_object_size_hint_align_set(wd->bx, align, 0.5);
1795 elm_toolbar_align_get(const Evas_Object *obj)
1797 ELM_CHECK_WIDTYPE(obj, widtype) 0.0;
1798 Widget_Data *wd = elm_widget_data_get(obj);
1800 if (!wd) return 0.0;
1805 elm_toolbar_item_menu_set(Elm_Object_Item *it, Eina_Bool menu)
1807 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1808 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1809 Widget_Data *wd = elm_widget_data_get(WIDGET(item));
1812 if (item->menu == menu) return;
1813 if (menu) _item_menu_create(wd, item);
1814 else _item_menu_destroy(item);
1818 elm_toolbar_item_menu_get(const Elm_Object_Item *it)
1820 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1821 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1822 if (!item->menu) return NULL;
1823 Widget_Data *wd = elm_widget_data_get(WIDGET(item));
1824 if (!wd) return NULL;
1825 return item->o_menu;
1828 EAPI Elm_Toolbar_Item_State *
1829 elm_toolbar_item_state_add(Elm_Object_Item *it, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
1831 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1833 Elm_Toolbar_Item_State *it_state;
1834 Evas_Object *icon_obj;
1837 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1839 wd = elm_widget_data_get(WIDGET(item));
1840 if (!wd) return NULL;
1844 it_state = _item_state_new(item->label, item->icon_str, item->icon,
1845 item->func, item->base.data);
1846 item->states = eina_list_append(item->states, it_state);
1847 item->current_state = item->states;
1850 icon_obj = elm_icon_add(obj);
1851 elm_icon_order_lookup_set(icon_obj, wd->lookup_order);
1852 if (!icon_obj) goto error_state_add;
1854 if (!_item_icon_set(icon_obj, "toolbar/", icon))
1856 evas_object_del(icon_obj);
1861 it_state = _item_state_new(label, icon, icon_obj, func, data);
1862 item->states = eina_list_append(item->states, it_state);
1863 item->func = _elm_toolbar_item_state_cb;
1864 item->base.data = NULL;
1869 if (item->states && !eina_list_next(item->states))
1871 eina_stringshare_del(item->label);
1872 eina_stringshare_del(item->icon_str);
1873 free(eina_list_data_get(item->states));
1874 eina_list_free(item->states);
1875 item->states = NULL;
1881 elm_toolbar_item_state_del(Elm_Object_Item *it, Elm_Toolbar_Item_State *state)
1883 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1885 Eina_List *del_state;
1886 Elm_Toolbar_Item_State *it_state;
1887 Elm_Toolbar_Item *item;
1889 if (!state) return EINA_FALSE;
1891 item = (Elm_Toolbar_Item *)it;
1892 if (!item->states) return EINA_FALSE;
1894 del_state = eina_list_data_find_list(item->states, state);
1895 if (del_state == item->states) return EINA_FALSE;
1896 if (del_state == item->current_state)
1897 elm_toolbar_item_state_unset(it);
1899 eina_stringshare_del(state->label);
1900 eina_stringshare_del(state->icon_str);
1901 if (state->icon) evas_object_del(state->icon);
1903 item->states = eina_list_remove_list(item->states, del_state);
1904 if (item->states && !eina_list_next(item->states))
1906 it_state = eina_list_data_get(item->states);
1907 item->base.data = it_state->data;
1908 item->func = it_state->func;
1909 eina_stringshare_del(it_state->label);
1910 eina_stringshare_del(it_state->icon_str);
1911 free(eina_list_data_get(item->states));
1912 eina_list_free(item->states);
1913 item->states = NULL;
1919 elm_toolbar_item_state_set(Elm_Object_Item *it, Elm_Toolbar_Item_State *state)
1921 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1924 Eina_List *next_state;
1925 Elm_Toolbar_Item_State *it_state;
1927 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1930 wd = elm_widget_data_get(obj);
1931 if (!wd) return EINA_FALSE;
1932 if (!item->states) return EINA_FALSE;
1936 next_state = eina_list_data_find_list(item->states, state);
1937 if (!next_state) return EINA_FALSE;
1940 next_state = item->states;
1942 if (next_state == item->current_state) return EINA_TRUE;
1944 it_state = eina_list_data_get(next_state);
1945 if (eina_list_data_find(item->current_state, state))
1947 _item_label_set(item, it_state->label, "elm,state,label_set,forward");
1948 _elm_toolbar_item_icon_obj_set(obj, item, it_state->icon, it_state->icon_str,
1949 wd->icon_size, "elm,state,icon_set,forward");
1953 _item_label_set(item, it_state->label, "elm,state,label_set,backward");
1954 _elm_toolbar_item_icon_obj_set(obj,
1959 "elm,state,icon_set,backward");
1961 if (elm_widget_item_disabled_get(item))
1962 elm_widget_signal_emit(item->icon, "elm,state,disabled", "elm");
1964 elm_widget_signal_emit(item->icon, "elm,state,enabled", "elm");
1966 item->current_state = next_state;
1971 elm_toolbar_item_state_unset(Elm_Object_Item *it)
1973 elm_toolbar_item_state_set(it, NULL);
1976 EAPI Elm_Toolbar_Item_State *
1977 elm_toolbar_item_state_get(const Elm_Object_Item *it)
1979 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1980 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1982 if ((!item->states) || (!item->current_state)) return NULL;
1983 if (item->current_state == item->states) return NULL;
1985 return eina_list_data_get(item->current_state);
1988 EAPI Elm_Toolbar_Item_State *
1989 elm_toolbar_item_state_next(Elm_Object_Item *it)
1991 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1995 Eina_List *next_state;
1996 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
1999 wd = elm_widget_data_get(obj);
2000 if (!wd) return NULL;
2001 if (!item->states) return NULL;
2003 next_state = eina_list_next(item->current_state);
2005 next_state = eina_list_next(item->states);
2006 return eina_list_data_get(next_state);
2009 EAPI Elm_Toolbar_Item_State *
2010 elm_toolbar_item_state_prev(Elm_Object_Item *it)
2012 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
2016 Eina_List *prev_state;
2017 Elm_Toolbar_Item *item = (Elm_Toolbar_Item *)it;
2020 wd = elm_widget_data_get(obj);
2021 if (!wd) return NULL;
2022 if (!item->states) return NULL;
2024 prev_state = eina_list_prev(item->current_state);
2025 if ((!prev_state) || (prev_state == item->states))
2026 prev_state = eina_list_last(item->states);
2027 return eina_list_data_get(prev_state);
2031 elm_toolbar_item_tooltip_text_set(Elm_Object_Item *it, const char *text)
2033 elm_object_item_tooltip_text_set(it, text);
2037 elm_toolbar_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
2039 elm_object_item_tooltip_content_cb_set(it, func, data, del_cb);
2043 elm_toolbar_item_tooltip_unset(Elm_Object_Item *it)
2045 elm_object_item_tooltip_unset(it);
2049 elm_toolbar_item_tooltip_style_set(Elm_Object_Item *it, const char *style)
2051 elm_object_item_tooltip_style_set(it, style);
2055 elm_toolbar_item_tooltip_style_get(const Elm_Object_Item *it)
2057 return elm_object_item_tooltip_style_get(it);
2061 elm_toolbar_item_cursor_set(Elm_Object_Item *it, const char *cursor)
2063 elm_object_item_cursor_set(it, cursor);
2067 elm_toolbar_item_cursor_get(const Elm_Object_Item *it)
2069 return elm_object_item_cursor_get(it);
2073 elm_toolbar_item_cursor_unset(Elm_Object_Item *it)
2075 elm_object_item_cursor_unset(it);
2079 elm_toolbar_item_cursor_style_set(Elm_Object_Item *it, const char *style)
2081 elm_object_item_cursor_style_set(it, style);
2085 elm_toolbar_item_cursor_style_get(const Elm_Object_Item *it)
2087 return elm_object_item_cursor_style_get(it);
2091 elm_toolbar_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only)
2093 elm_object_item_cursor_engine_only_set(it, engine_only);
2097 elm_toolbar_item_cursor_engine_only_get(const Elm_Object_Item *it)
2099 return elm_object_item_cursor_engine_only_get(it);
2103 elm_toolbar_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select)
2105 ELM_CHECK_WIDTYPE(obj, widtype);
2106 Widget_Data *wd = elm_widget_data_get(obj);
2108 if (always_select && (!wd->always_select) && wd->items)
2109 _item_select(ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items));
2110 wd->always_select = always_select;
2114 elm_toolbar_always_select_mode_get(const Evas_Object *obj)
2116 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2117 Widget_Data *wd = elm_widget_data_get(obj);
2118 if (!wd) return EINA_FALSE;
2119 return wd->always_select;
2123 elm_toolbar_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select)
2125 ELM_CHECK_WIDTYPE(obj, widtype);
2126 Widget_Data *wd = elm_widget_data_get(obj);
2128 wd->no_select = no_select;
2132 elm_toolbar_no_select_mode_get(const Evas_Object *obj)
2134 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2135 Widget_Data *wd = elm_widget_data_get(obj);
2136 if (!wd) return EINA_FALSE;
2137 return wd->no_select;
2141 elm_toolbar_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order)
2143 ELM_CHECK_WIDTYPE(obj, widtype);
2144 Elm_Toolbar_Item *it;
2145 Widget_Data *wd = elm_widget_data_get(obj);
2148 wd->lookup_order = order;
2149 EINA_INLIST_FOREACH(wd->items, it)
2150 elm_icon_order_lookup_set(it->icon, order);
2152 elm_icon_order_lookup_set(wd->more_item->icon, order);
2155 EAPI Elm_Icon_Lookup_Order
2156 elm_toolbar_icon_order_lookup_get(const Evas_Object *obj)
2158 ELM_CHECK_WIDTYPE(obj, widtype) ELM_ICON_LOOKUP_THEME_FDO;
2159 Widget_Data *wd = elm_widget_data_get(obj);
2160 if (!wd) return ELM_ICON_LOOKUP_THEME_FDO;
2161 return wd->lookup_order;
2164 EINA_DEPRECATED EAPI void
2165 elm_toolbar_orientation_set(Evas_Object *obj, Eina_Bool vertical)
2167 elm_toolbar_horizontal_set(obj, !vertical);
2170 EINA_DEPRECATED EAPI Eina_Bool
2171 elm_toolbar_orientation_get(const Evas_Object *obj)
2173 return !elm_toolbar_horizontal_get(obj);
2177 elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
2179 ELM_CHECK_WIDTYPE(obj, widtype);
2180 Widget_Data *wd = elm_widget_data_get(obj);
2182 wd->vertical = !horizontal;
2184 evas_object_size_hint_align_set(wd->bx, 0.5, wd->align);
2186 evas_object_size_hint_align_set(wd->bx, wd->align, 0.5);
2191 elm_toolbar_horizontal_get(const Evas_Object *obj)
2193 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2194 Widget_Data *wd = elm_widget_data_get(obj);
2195 if (!wd) return EINA_FALSE;
2196 return !wd->vertical;
2200 elm_toolbar_items_count(const Evas_Object *obj)
2202 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2203 Widget_Data *wd = elm_widget_data_get(obj);
2205 return wd->item_count;
2208 EINA_DEPRECATED EAPI void
2209 elm_toolbar_mode_shrink_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mode)
2211 elm_toolbar_shrink_mode_set(obj, shrink_mode);
2214 EINA_DEPRECATED EAPI Elm_Toolbar_Shrink_Mode
2215 elm_toolbar_mode_shrink_get(const Evas_Object *obj)
2217 return elm_toolbar_shrink_mode_get(obj);