elm test: Refactoring. Changed 1 to EINA_TRUE for Eina_Bool parameter of elm_win_auto...
[framework/uifw/elementary.git] / src / bin / test_toolbar.c
1 #include <Elementary.h>
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #ifndef ELM_LIB_QUICKLAUNCH
6 static void
7 tb_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
8 {
9    char buf[PATH_MAX];
10    snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", PACKAGE_DATA_DIR);
11    elm_photo_file_set(data, buf);
12 }
13
14 static void
15 tb_2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
16 {
17    char buf[PATH_MAX];
18    snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", PACKAGE_DATA_DIR);
19    elm_photo_file_set(data, buf);
20 }
21
22 static void
23 tb_3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
24 {
25    char buf[PATH_MAX];
26    snprintf(buf, sizeof(buf), "%s/images/wood_01.jpg", PACKAGE_DATA_DIR);
27    elm_photo_file_set(data, buf);
28 }
29
30 static void
31 tb_3a(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
32 {
33    tb_3(data, obj, event_info);
34    elm_toolbar_item_state_set(event_info, elm_toolbar_item_state_next(event_info));
35 }
36
37 static void
38 tb_3b(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
39 {
40    tb_3(data, obj, event_info);
41    elm_toolbar_item_state_unset(event_info);
42 }
43
44 static void
45 tb_4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
46 {
47    char buf[PATH_MAX];
48    snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", PACKAGE_DATA_DIR);
49    elm_photo_file_set(data, buf);
50 }
51
52 static void
53 tb_4a(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
54 {
55    elm_toolbar_item_state_set(event_info, elm_toolbar_item_state_prev(event_info));
56 }
57
58 static void
59 tb_5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
60 {
61    elm_photo_file_set(data, NULL);
62 }
63
64 void
65 test_toolbar(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
66 {
67    Evas_Object *win, *bg, *bx, *tb, *ph, *menu;
68    Evas_Object *ph1, *ph2, *ph3, *ph4;
69    Elm_Toolbar_Item *item;
70    Elm_Menu_Item *menu_item;
71    char buf[PATH_MAX];
72
73    win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC);
74    elm_win_title_set(win, "Toolbar");
75    elm_win_autodel_set(win, EINA_TRUE);
76
77    bg = elm_bg_add(win);
78    elm_win_resize_object_add(win, bg);
79    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
80    evas_object_show(bg);
81
82    bx = elm_box_add(win);
83    elm_win_resize_object_add(win, bx);
84    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
85    evas_object_show(bx);
86
87    tb = elm_toolbar_add(win);
88    elm_toolbar_homogeneous_set(tb, 0);
89    elm_toolbar_mode_shrink_set(tb, ELM_TOOLBAR_SHRINK_MENU);
90    evas_object_size_hint_weight_set(tb, 0.0, 0.0);
91    evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
92
93    ph1 = elm_photo_add(win);
94    ph2 = elm_photo_add(win);
95    ph3 = elm_photo_add(win);
96    ph4 = elm_photo_add(win);
97
98    item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
99    elm_toolbar_item_disabled_set(item, EINA_TRUE);
100    elm_toolbar_item_priority_set(item, 100);
101
102    item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
103    elm_toolbar_item_priority_set(item, -100);
104
105    item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
106    elm_toolbar_item_priority_set(item, 150);
107
108    item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
109    elm_toolbar_item_priority_set(item, 0);
110
111    item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
112    elm_toolbar_item_priority_set(item, -200);
113
114    item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
115    elm_toolbar_item_menu_set(item, 1);
116    elm_toolbar_item_priority_set(item, -999999);
117    elm_toolbar_menu_parent_set(tb, win);
118    menu = elm_toolbar_item_menu_get(item);
119
120    elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
121    menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
122    elm_menu_item_add(menu, menu_item, "edit-paste", "is set to", tb_4, ph4);
123    elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4);
124
125    elm_box_pack_end(bx, tb);
126    evas_object_show(tb);
127
128    tb = elm_table_add(win);
129    //elm_table_homogeneous_set(tb, 1);
130    evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
131    evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
132
133    ph = ph1;
134    elm_photo_size_set(ph, 40);
135    snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
136    elm_photo_file_set(ph, buf);
137    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
138    evas_object_size_hint_align_set(ph, 0.5, 0.5);
139    elm_table_pack(tb, ph, 0, 0, 1, 1);
140    evas_object_show(ph);
141
142    ph = ph2;
143    elm_photo_size_set(ph, 80);
144    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
145    evas_object_size_hint_align_set(ph, 0.5, 0.5);
146    elm_table_pack(tb, ph, 1, 0, 1, 1);
147    evas_object_show(ph);
148
149    ph = ph3;
150    elm_photo_size_set(ph, 20);
151    snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", PACKAGE_DATA_DIR);
152    elm_photo_file_set(ph, buf);
153    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
154    evas_object_size_hint_align_set(ph, 0.5, 0.5);
155    elm_table_pack(tb, ph, 0, 1, 1, 1);
156    evas_object_show(ph);
157
158    ph = ph4;
159    elm_photo_size_set(ph, 60);
160    snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
161    elm_photo_file_set(ph, buf);
162    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
163    evas_object_size_hint_align_set(ph, 0.5, 0.5);
164    elm_table_pack(tb, ph, 1, 1, 1, 1);
165    evas_object_show(ph);
166
167    elm_box_pack_end(bx, tb);
168    evas_object_show(tb);
169
170    evas_object_resize(win, 320, 300);
171    evas_object_show(win);
172 }
173
174 void
175 test_toolbar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
176 {
177    Evas_Object *win, *bg, *bx, *tb, *ph, *menu;
178    Evas_Object *ph1, *ph2, *ph3, *ph4;
179    Elm_Toolbar_Item *item;
180    Elm_Menu_Item *menu_item;
181    char buf[PATH_MAX];
182
183    win = elm_win_add(NULL, "toolbar2", ELM_WIN_BASIC);
184    elm_win_title_set(win, "Toolbar 2");
185    elm_win_autodel_set(win, EINA_TRUE);
186
187    bg = elm_bg_add(win);
188    elm_win_resize_object_add(win, bg);
189    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
190    evas_object_show(bg);
191
192    bx = elm_box_add(win);
193    elm_win_resize_object_add(win, bx);
194    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
195    evas_object_show(bx);
196
197    tb = elm_toolbar_add(win);
198    elm_toolbar_homogeneous_set(tb, 0);
199    elm_toolbar_mode_shrink_set(tb, ELM_TOOLBAR_SHRINK_SCROLL);
200    evas_object_size_hint_weight_set(tb, 0.0, 0.0);
201    evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
202
203    ph1 = elm_photo_add(win);
204    ph2 = elm_photo_add(win);
205    ph3 = elm_photo_add(win);
206    ph4 = elm_photo_add(win);
207
208    item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
209    elm_toolbar_item_disabled_set(item, EINA_TRUE);
210    elm_toolbar_item_priority_set(item, -100);
211
212    item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
213    elm_toolbar_item_priority_set(item, 100);
214
215    item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
216    elm_toolbar_item_priority_set(item, -150);
217
218    item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
219    elm_toolbar_item_priority_set(item, -200);
220
221    item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
222    elm_toolbar_item_priority_set(item, 0);
223
224    item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
225    elm_toolbar_item_menu_set(item, 1);
226    elm_toolbar_item_priority_set(item, -999999);
227    elm_toolbar_menu_parent_set(tb, win);
228    menu = elm_toolbar_item_menu_get(item);
229
230    elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
231    menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
232    elm_menu_item_add(menu, menu_item, "edit-paste", "is set to", tb_4, ph4);
233    elm_menu_item_add(menu, NULL, "edit-delete", "Scroll", tb_5, ph4);
234
235    elm_box_pack_end(bx, tb);
236    evas_object_show(tb);
237
238    tb = elm_table_add(win);
239    //elm_table_homogeneous_set(tb, 1);
240    evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
241    evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
242
243    ph = ph1;
244    elm_photo_size_set(ph, 40);
245    snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
246    elm_photo_file_set(ph, buf);
247    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
248    evas_object_size_hint_align_set(ph, 0.5, 0.5);
249    elm_table_pack(tb, ph, 0, 0, 1, 1);
250    evas_object_show(ph);
251
252    ph = ph2;
253    elm_photo_size_set(ph, 80);
254    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
255    evas_object_size_hint_align_set(ph, 0.5, 0.5);
256    elm_table_pack(tb, ph, 1, 0, 1, 1);
257    evas_object_show(ph);
258
259    ph = ph3;
260    elm_photo_size_set(ph, 20);
261    snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", PACKAGE_DATA_DIR);
262    elm_photo_file_set(ph, buf);
263    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
264    evas_object_size_hint_align_set(ph, 0.5, 0.5);
265    elm_table_pack(tb, ph, 0, 1, 1, 1);
266    evas_object_show(ph);
267
268    ph = ph4;
269    elm_photo_size_set(ph, 60);
270    snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
271    elm_photo_file_set(ph, buf);
272    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
273    evas_object_size_hint_align_set(ph, 0.5, 0.5);
274    elm_table_pack(tb, ph, 1, 1, 1, 1);
275    evas_object_show(ph);
276
277    elm_box_pack_end(bx, tb);
278    evas_object_show(tb);
279
280    evas_object_resize(win, 320, 300);
281    evas_object_show(win);
282 }
283
284 void
285 test_toolbar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
286 {
287    Evas_Object *win, *bg, *bx, *tb, *ph, *menu;
288    Evas_Object *ph1, *ph2, *ph3, *ph4;
289    Elm_Toolbar_Item *item;
290    Elm_Menu_Item *menu_item;
291    char buf[PATH_MAX];
292
293    win = elm_win_add(NULL, "toolbar3", ELM_WIN_BASIC);
294    elm_win_title_set(win, "Toolbar 3");
295    elm_win_autodel_set(win, EINA_TRUE);
296
297    bg = elm_bg_add(win);
298    elm_win_resize_object_add(win, bg);
299    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
300    evas_object_show(bg);
301
302    bx = elm_box_add(win);
303    elm_win_resize_object_add(win, bx);
304    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
305    evas_object_show(bx);
306
307    tb = elm_toolbar_add(win);
308    elm_toolbar_homogeneous_set(tb, 0);
309    elm_toolbar_mode_shrink_set(tb, ELM_TOOLBAR_SHRINK_NONE);
310    evas_object_size_hint_weight_set(tb, 0.0, 0.0);
311    evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
312
313    ph1 = elm_photo_add(win);
314    ph2 = elm_photo_add(win);
315    ph3 = elm_photo_add(win);
316    ph4 = elm_photo_add(win);
317
318    item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
319    elm_toolbar_item_disabled_set(item, EINA_TRUE);
320    elm_toolbar_item_priority_set(item, 0);
321
322    item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
323    elm_toolbar_item_priority_set(item, -200);
324
325    item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
326    elm_toolbar_item_priority_set(item, 1);
327
328    item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
329    elm_toolbar_item_priority_set(item, -10);
330
331    item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
332    elm_toolbar_item_priority_set(item, 50);
333
334    item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
335    elm_toolbar_item_menu_set(item, 1);
336    elm_toolbar_item_priority_set(item, 999999);
337    elm_toolbar_menu_parent_set(tb, win);
338    menu = elm_toolbar_item_menu_get(item);
339
340    elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
341    menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
342    elm_menu_item_add(menu, menu_item, "edit-paste", "is set to", tb_4, ph4);
343    elm_menu_item_add(menu, NULL, "edit-delete", "None", tb_5, ph4);
344
345    elm_box_pack_end(bx, tb);
346    evas_object_show(tb);
347
348    tb = elm_table_add(win);
349    //elm_table_homogeneous_set(tb, 1);
350    evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
351    evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
352
353    ph = ph1;
354    elm_photo_size_set(ph, 40);
355    snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
356    elm_photo_file_set(ph, buf);
357    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
358    evas_object_size_hint_align_set(ph, 0.5, 0.5);
359    elm_table_pack(tb, ph, 0, 0, 1, 1);
360    evas_object_show(ph);
361
362    ph = ph2;
363    elm_photo_size_set(ph, 80);
364    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
365    evas_object_size_hint_align_set(ph, 0.5, 0.5);
366    elm_table_pack(tb, ph, 1, 0, 1, 1);
367    evas_object_show(ph);
368
369    ph = ph3;
370    elm_photo_size_set(ph, 20);
371    snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", PACKAGE_DATA_DIR);
372    elm_photo_file_set(ph, buf);
373    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
374    evas_object_size_hint_align_set(ph, 0.5, 0.5);
375    elm_table_pack(tb, ph, 0, 1, 1, 1);
376    evas_object_show(ph);
377
378    ph = ph4;
379    elm_photo_size_set(ph, 60);
380    snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
381    elm_photo_file_set(ph, buf);
382    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
383    evas_object_size_hint_align_set(ph, 0.5, 0.5);
384    elm_table_pack(tb, ph, 1, 1, 1, 1);
385    evas_object_show(ph);
386
387    elm_box_pack_end(bx, tb);
388    evas_object_show(tb);
389
390    evas_object_resize(win, 320, 300);
391    evas_object_show(win);
392 }
393
394 /* The same test of toolbar, but using hide shrink mode instead of menu */
395 void
396 test_toolbar4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
397 {
398    Evas_Object *win, *bg, *bx, *tb, *ph, *menu;
399    Evas_Object *ph1, *ph2, *ph3, *ph4;
400    Elm_Toolbar_Item *item;
401    Elm_Menu_Item *menu_item;
402    char buf[PATH_MAX];
403
404    win = elm_win_add(NULL, "toolbar4", ELM_WIN_BASIC);
405    elm_win_title_set(win, "Toolbar 4");
406    elm_win_autodel_set(win, EINA_TRUE);
407
408    bg = elm_bg_add(win);
409    elm_win_resize_object_add(win, bg);
410    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
411    evas_object_show(bg);
412
413    bx = elm_box_add(win);
414    elm_win_resize_object_add(win, bx);
415    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
416    evas_object_show(bx);
417
418    tb = elm_toolbar_add(win);
419    elm_toolbar_homogeneous_set(tb, 0);
420    elm_toolbar_mode_shrink_set(tb, ELM_TOOLBAR_SHRINK_HIDE);
421    evas_object_size_hint_weight_set(tb, 0.0, 0.0);
422    evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
423
424    ph1 = elm_photo_add(win);
425    ph2 = elm_photo_add(win);
426    ph3 = elm_photo_add(win);
427    ph4 = elm_photo_add(win);
428
429    item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
430    elm_toolbar_item_disabled_set(item, EINA_TRUE);
431    elm_toolbar_item_priority_set(item, 100);
432
433    item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
434    elm_toolbar_item_priority_set(item, -100);
435
436    item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
437    elm_toolbar_item_priority_set(item, 150);
438
439    item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
440    elm_toolbar_item_priority_set(item, 0);
441
442    item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
443    elm_toolbar_item_priority_set(item, -200);
444
445    item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
446    elm_toolbar_item_menu_set(item, 1);
447    elm_toolbar_item_priority_set(item, -999999);
448    elm_toolbar_menu_parent_set(tb, win);
449    menu = elm_toolbar_item_menu_get(item);
450
451    elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
452    menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
453    elm_menu_item_add(menu, menu_item, "edit-paste", "is set to", tb_4, ph4);
454    elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4);
455
456    elm_box_pack_end(bx, tb);
457    evas_object_show(tb);
458
459    tb = elm_table_add(win);
460    evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
461    evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
462
463    ph = ph1;
464    elm_photo_size_set(ph, 40);
465    snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
466    elm_photo_file_set(ph, buf);
467    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
468    evas_object_size_hint_align_set(ph, 0.5, 0.5);
469    elm_table_pack(tb, ph, 0, 0, 1, 1);
470    evas_object_show(ph);
471
472    ph = ph2;
473    elm_photo_size_set(ph, 80);
474    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
475    evas_object_size_hint_align_set(ph, 0.5, 0.5);
476    elm_table_pack(tb, ph, 1, 0, 1, 1);
477    evas_object_show(ph);
478
479    ph = ph3;
480    elm_photo_size_set(ph, 20);
481    snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", PACKAGE_DATA_DIR);
482    elm_photo_file_set(ph, buf);
483    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
484    evas_object_size_hint_align_set(ph, 0.5, 0.5);
485    elm_table_pack(tb, ph, 0, 1, 1, 1);
486    evas_object_show(ph);
487
488    ph = ph4;
489    elm_photo_size_set(ph, 60);
490    snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
491    elm_photo_file_set(ph, buf);
492    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
493    evas_object_size_hint_align_set(ph, 0.5, 0.5);
494    elm_table_pack(tb, ph, 1, 1, 1, 1);
495    evas_object_show(ph);
496
497    elm_box_pack_end(bx, tb);
498    evas_object_show(tb);
499
500    evas_object_resize(win, 320, 300);
501    evas_object_show(win);
502 }
503
504 /* Toolbar with multiple state buttons */
505 void
506 test_toolbar5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
507 {
508    Evas_Object *win, *bg, *bx, *tb, *ph, *menu;
509    Evas_Object *ph1, *ph2, *ph3, *ph4;
510    Elm_Toolbar_Item *item;
511    Elm_Menu_Item *menu_item;
512    char buf[PATH_MAX];
513
514    win = elm_win_add(NULL, "toolbar5", ELM_WIN_BASIC);
515    elm_win_title_set(win, "Toolbar 5");
516    elm_win_autodel_set(win, EINA_TRUE);
517
518    bg = elm_bg_add(win);
519    elm_win_resize_object_add(win, bg);
520    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
521    evas_object_show(bg);
522
523    bx = elm_box_add(win);
524    elm_win_resize_object_add(win, bx);
525    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
526    evas_object_show(bx);
527
528    tb = elm_toolbar_add(win);
529    elm_toolbar_homogeneous_set(tb, 0);
530    elm_toolbar_mode_shrink_set(tb, ELM_TOOLBAR_SHRINK_MENU);
531    evas_object_size_hint_weight_set(tb, 0.0, 0.0);
532    evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
533    elm_toolbar_no_select_mode_set(tb, EINA_TRUE);
534
535    ph1 = elm_photo_add(win);
536    ph2 = elm_photo_add(win);
537    ph3 = elm_photo_add(win);
538    ph4 = elm_photo_add(win);
539
540    item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
541    elm_toolbar_item_disabled_set(item, EINA_TRUE);
542    elm_toolbar_item_priority_set(item, 100);
543
544    item = elm_toolbar_item_append(tb, PACKAGE_DATA_DIR"/images/icon_04.png", "World", tb_2, ph1);
545    elm_toolbar_item_priority_set(item, -100);
546
547    item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3a, ph4);
548    elm_toolbar_item_state_add(item, "object-rotate-left", "H2", tb_3b, ph4);
549    elm_toolbar_item_priority_set(item, 150);
550
551    item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4a, ph4);
552    elm_toolbar_item_state_add(item, "emptytrash", "Comes2", tb_4a, ph4);
553    elm_toolbar_item_state_add(item, "trashcan_full", "Comes3", tb_4a, ph4);
554    elm_toolbar_item_priority_set(item, 0);
555
556    item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
557    elm_toolbar_item_priority_set(item, -200);
558
559    item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
560    elm_toolbar_item_menu_set(item, 1);
561    elm_toolbar_item_priority_set(item, -999999);
562    elm_toolbar_menu_parent_set(tb, win);
563    menu = elm_toolbar_item_menu_get(item);
564
565    elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
566    menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
567    elm_menu_item_add(menu, menu_item, "edit-paste", "is set to", tb_4, ph4);
568    elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4);
569
570    elm_box_pack_end(bx, tb);
571    evas_object_show(tb);
572
573    tb = elm_table_add(win);
574    //elm_table_homogeneous_set(tb, 1);
575    evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
576    evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
577
578    ph = ph1;
579    elm_photo_size_set(ph, 40);
580    snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
581    elm_photo_file_set(ph, buf);
582    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
583    evas_object_size_hint_align_set(ph, 0.5, 0.5);
584    elm_table_pack(tb, ph, 0, 0, 1, 1);
585    evas_object_show(ph);
586
587    ph = ph2;
588    elm_photo_size_set(ph, 80);
589    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
590    evas_object_size_hint_align_set(ph, 0.5, 0.5);
591    elm_table_pack(tb, ph, 1, 0, 1, 1);
592    evas_object_show(ph);
593
594    ph = ph3;
595    elm_photo_size_set(ph, 20);
596    snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", PACKAGE_DATA_DIR);
597    elm_photo_file_set(ph, buf);
598    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
599    evas_object_size_hint_align_set(ph, 0.5, 0.5);
600    elm_table_pack(tb, ph, 0, 1, 1, 1);
601    evas_object_show(ph);
602
603    ph = ph4;
604    elm_photo_size_set(ph, 60);
605    snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
606    elm_photo_file_set(ph, buf);
607    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
608    evas_object_size_hint_align_set(ph, 0.5, 0.5);
609    elm_table_pack(tb, ph, 1, 1, 1, 1);
610    evas_object_show(ph);
611
612    elm_box_pack_end(bx, tb);
613    evas_object_show(tb);
614
615    evas_object_resize(win, 320, 300);
616    evas_object_show(win);
617 }
618 #endif