2 * Simple Elementary's <b>toolbar widget</b> example, illustrating its
5 * See stdout/stderr for output. Compile with:
8 * gcc -g toolbar_example_01.c -o toolbar_example_01 `pkg-config --cflags --libs elementary`
12 #include <Elementary.h>
23 _item_1_pressed(void *data, Evas_Object *obj, void *event_info)
25 Evas_Object *bt = data;
26 elm_object_text_set(bt, "Print Document");
30 _item_2_pressed(void *data, Evas_Object *obj, void *event_info)
32 Evas_Object *bt = data;
33 elm_object_text_set(bt, "Create new folder");
37 _item_3_pressed(void *data, Evas_Object *obj, void *event_info)
39 /* This function won't be called because we disabled item that call it */
40 Evas_Object *bt = data;
41 elm_object_text_set(bt, "Create and send email");
45 elm_main(int argc, char **argv)
47 Evas_Object *win, *bg, *bx, *tb, *bt;
48 Elm_Object_Item *tb_it;
50 win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC);
51 elm_win_title_set(win, "Toolbar Example");
52 evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
55 elm_win_resize_object_add(win, bg);
56 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
59 bx = elm_box_add(win);
60 elm_win_resize_object_add(win, bx);
61 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
62 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
65 bt = elm_button_add(win);
66 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
67 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
68 elm_object_text_set(bt, "Button");
71 tb = elm_toolbar_add(win);
72 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL);
73 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
74 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
77 elm_toolbar_item_append(tb, "document-print", "Print", _item_1_pressed, bt);
78 elm_toolbar_item_append(tb, "folder-new", "New Folder", _item_2_pressed, bt);
80 tb_it = elm_toolbar_item_append(tb, "mail-send", "Create and send email",
82 elm_object_item_disabled_set(tb_it, EINA_TRUE);
84 elm_toolbar_homogeneous_set(tb, EINA_FALSE);
86 elm_box_pack_end(bx, tb);
87 elm_box_pack_end(bx, bt);
89 evas_object_resize(win, 200, 200);
90 evas_object_show(win);