2 * Simple Elementary's <b>toolbar widget</b> example, illustrating its
5 * See stdout/stderr for output. Compile with:
8 * gcc -g `pkg-config --cflags --libs elementary` toolbar_example_01.c -o toolbar_example_01
12 #include <Elementary.h>
14 # include "elementary_config.h"
20 _on_done(void *data __UNUSED__,
21 Evas_Object *obj __UNUSED__,
22 void *event_info __UNUSED__)
28 _item_1_pressed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
30 Evas_Object *bt = data;
31 elm_object_text_set(bt, "Print Document");
35 _item_2_pressed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
37 Evas_Object *bt = data;
38 elm_object_text_set(bt, "Create new folder");
42 _item_3_pressed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
44 /* This function won't be called because we disabled item that call it */
45 Evas_Object *bt = data;
46 elm_object_text_set(bt, "Create and send email");
50 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
52 Evas_Object *win, *bg, *bx, *tb, *bt;
53 Elm_Object_Item *tb_it;
55 win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC);
56 elm_win_title_set(win, "Toolbar Example");
57 evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
60 elm_win_resize_object_add(win, bg);
61 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
64 bx = elm_box_add(win);
65 elm_win_resize_object_add(win, bx);
66 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
67 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
70 bt = elm_button_add(win);
71 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
72 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
73 elm_object_text_set(bt, "Button");
76 tb = elm_toolbar_add(win);
77 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL);
78 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
79 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
82 elm_toolbar_item_append(tb, "document-print", "Print", _item_1_pressed, bt);
83 elm_toolbar_item_append(tb, "folder-new", "New Folder", _item_2_pressed, bt);
85 tb_it = elm_toolbar_item_append(tb, "mail-send", "Create and send email",
87 elm_object_item_disabled_set(tb_it, EINA_TRUE);
89 elm_toolbar_homogeneous_set(tb, EINA_FALSE);
91 elm_box_pack_end(bx, tb);
92 elm_box_pack_end(bx, bt);
94 evas_object_resize(win, 200, 200);
95 evas_object_show(win);