aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/bin/test_toolbar.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/elementary/src/bin/test_toolbar.c')
-rw-r--r--libraries/elementary/src/bin/test_toolbar.c905
1 files changed, 905 insertions, 0 deletions
diff --git a/libraries/elementary/src/bin/test_toolbar.c b/libraries/elementary/src/bin/test_toolbar.c
new file mode 100644
index 0000000..e9ffdd1
--- /dev/null
+++ b/libraries/elementary/src/bin/test_toolbar.c
@@ -0,0 +1,905 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5#ifndef ELM_LIB_QUICKLAUNCH
6static void
7tb_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", elm_app_data_dir_get());
11 elm_photo_file_set(data, buf);
12}
13
14static void
15tb_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", elm_app_data_dir_get());
19 elm_photo_file_set(data, buf);
20}
21
22static void
23tb_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", elm_app_data_dir_get());
27 elm_photo_file_set(data, buf);
28}
29
30static void
31tb_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
37static void
38tb_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
44static void
45tb_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", elm_app_data_dir_get());
49 elm_photo_file_set(data, buf);
50}
51
52static void
53tb_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
58static void
59tb_5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
60{
61 elm_photo_file_set(data, NULL);
62}
63
64void
65test_toolbar(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
66{
67 Evas_Object *win, *bx, *tb, *ph, *menu;
68 Evas_Object *ph1, *ph2, *ph3, *ph4;
69 Elm_Object_Item *tb_it;
70 Elm_Object_Item *menu_it;
71 char buf[PATH_MAX];
72
73 win = elm_win_util_standard_add("toolbar", "Toolbar");
74 elm_win_autodel_set(win, EINA_TRUE);
75
76 bx = elm_box_add(win);
77 elm_win_resize_object_add(win, bx);
78 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
79 evas_object_show(bx);
80
81 tb = elm_toolbar_add(win);
82 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_MENU);
83 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
84 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
85 elm_object_scale_set(tb, 0.9);
86
87 ph1 = elm_photo_add(win);
88 ph2 = elm_photo_add(win);
89 ph3 = elm_photo_add(win);
90 ph4 = elm_photo_add(win);
91
92 tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
93 elm_object_item_disabled_set(tb_it, EINA_TRUE);
94 elm_toolbar_item_priority_set(tb_it, 100);
95
96 tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
97 elm_toolbar_item_priority_set(tb_it, -100);
98
99 tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
100 elm_toolbar_item_priority_set(tb_it, 150);
101
102 tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
103 elm_toolbar_item_priority_set(tb_it, 0);
104
105 tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
106 elm_toolbar_item_priority_set(tb_it, -200);
107
108 tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
109 elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
110 elm_toolbar_item_priority_set(tb_it, -999999);
111 elm_toolbar_menu_parent_set(tb, win);
112 menu = elm_toolbar_item_menu_get(tb_it);
113
114 elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
115 menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
116 elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
117 elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4);
118
119 elm_box_pack_end(bx, tb);
120 evas_object_show(tb);
121
122 tb = elm_table_add(win);
123 //elm_table_homogeneous_set(tb, 1);
124 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
125 evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
126
127 ph = ph1;
128 elm_photo_size_set(ph, 40);
129 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
130 elm_photo_file_set(ph, buf);
131 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
132 evas_object_size_hint_align_set(ph, 0.5, 0.5);
133 elm_table_pack(tb, ph, 0, 0, 1, 1);
134 evas_object_show(ph);
135
136 ph = ph2;
137 elm_photo_size_set(ph, 80);
138 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
139 evas_object_size_hint_align_set(ph, 0.5, 0.5);
140 elm_table_pack(tb, ph, 1, 0, 1, 1);
141 evas_object_show(ph);
142
143 ph = ph3;
144 elm_photo_size_set(ph, 20);
145 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
146 elm_photo_file_set(ph, buf);
147 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
148 evas_object_size_hint_align_set(ph, 0.5, 0.5);
149 elm_table_pack(tb, ph, 0, 1, 1, 1);
150 evas_object_show(ph);
151
152 ph = ph4;
153 elm_photo_size_set(ph, 60);
154 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
155 elm_photo_file_set(ph, buf);
156 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
157 evas_object_size_hint_align_set(ph, 0.5, 0.5);
158 elm_table_pack(tb, ph, 1, 1, 1, 1);
159 evas_object_show(ph);
160
161 elm_box_pack_end(bx, tb);
162 evas_object_show(tb);
163
164 evas_object_resize(win, 320, 300);
165 evas_object_show(win);
166}
167
168void
169test_toolbar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
170{
171 Evas_Object *win, *bx, *tb, *ph, *menu;
172 Evas_Object *ph1, *ph2, *ph3, *ph4;
173 Elm_Object_Item *item;
174 Elm_Object_Item *menu_it;
175 char buf[PATH_MAX];
176
177 win = elm_win_util_standard_add("toolbar2", "Toolbar 2");
178 elm_win_autodel_set(win, EINA_TRUE);
179
180 bx = elm_box_add(win);
181 elm_win_resize_object_add(win, bx);
182 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
183 evas_object_show(bx);
184
185 tb = elm_toolbar_add(win);
186 elm_toolbar_homogeneous_set(tb, 0);
187 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL);
188 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
189 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
190
191 ph1 = elm_photo_add(win);
192 ph2 = elm_photo_add(win);
193 ph3 = elm_photo_add(win);
194 ph4 = elm_photo_add(win);
195
196 item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
197 elm_object_item_disabled_set(item, EINA_TRUE);
198 elm_toolbar_item_priority_set(item, -100);
199
200 item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
201 elm_toolbar_item_priority_set(item, 100);
202
203 item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
204 elm_toolbar_item_priority_set(item, -150);
205
206 item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
207 elm_toolbar_item_priority_set(item, -200);
208
209 item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
210 elm_toolbar_item_priority_set(item, 0);
211
212 item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
213 elm_toolbar_item_menu_set(item, EINA_TRUE);
214 elm_toolbar_item_priority_set(item, -999999);
215 elm_toolbar_menu_parent_set(tb, win);
216 menu = elm_toolbar_item_menu_get(item);
217
218 elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
219 menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
220 elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
221 elm_menu_item_add(menu, NULL, "edit-delete", "Scroll", tb_5, ph4);
222
223 elm_box_pack_end(bx, tb);
224 evas_object_show(tb);
225
226 tb = elm_table_add(win);
227 //elm_table_homogeneous_set(tb, 1);
228 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
229 evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
230
231 ph = ph1;
232 elm_photo_size_set(ph, 40);
233 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
234 elm_photo_file_set(ph, buf);
235 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
236 evas_object_size_hint_align_set(ph, 0.5, 0.5);
237 elm_table_pack(tb, ph, 0, 0, 1, 1);
238 evas_object_show(ph);
239
240 ph = ph2;
241 elm_photo_size_set(ph, 80);
242 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
243 evas_object_size_hint_align_set(ph, 0.5, 0.5);
244 elm_table_pack(tb, ph, 1, 0, 1, 1);
245 evas_object_show(ph);
246
247 ph = ph3;
248 elm_photo_size_set(ph, 20);
249 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
250 elm_photo_file_set(ph, buf);
251 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
252 evas_object_size_hint_align_set(ph, 0.5, 0.5);
253 elm_table_pack(tb, ph, 0, 1, 1, 1);
254 evas_object_show(ph);
255
256 ph = ph4;
257 elm_photo_size_set(ph, 60);
258 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
259 elm_photo_file_set(ph, buf);
260 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
261 evas_object_size_hint_align_set(ph, 0.5, 0.5);
262 elm_table_pack(tb, ph, 1, 1, 1, 1);
263 evas_object_show(ph);
264
265 elm_box_pack_end(bx, tb);
266 evas_object_show(tb);
267
268 evas_object_resize(win, 320, 300);
269 evas_object_show(win);
270}
271
272void
273test_toolbar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
274{
275 Evas_Object *win, *bx, *tb, *ph, *menu;
276 Evas_Object *ph1, *ph2, *ph3, *ph4;
277 Elm_Object_Item *tb_it;
278 Elm_Object_Item *menu_it;
279 char buf[PATH_MAX];
280
281 win = elm_win_util_standard_add("toolbar3", "Toolbar 3");
282 elm_win_autodel_set(win, EINA_TRUE);
283
284 bx = elm_box_add(win);
285 elm_win_resize_object_add(win, bx);
286 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
287 evas_object_show(bx);
288
289 tb = elm_toolbar_add(win);
290 elm_toolbar_homogeneous_set(tb, EINA_FALSE);
291 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_NONE);
292 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
293 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
294
295 ph1 = elm_photo_add(win);
296 ph2 = elm_photo_add(win);
297 ph3 = elm_photo_add(win);
298 ph4 = elm_photo_add(win);
299
300 tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
301 elm_object_item_disabled_set(tb_it, EINA_TRUE);
302 elm_toolbar_item_priority_set(tb_it, EINA_FALSE);
303
304 tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
305 elm_toolbar_item_priority_set(tb_it, -200);
306
307 tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
308 elm_toolbar_item_priority_set(tb_it, EINA_TRUE);
309
310 tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
311 elm_toolbar_item_priority_set(tb_it, -10);
312
313 tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
314 elm_toolbar_item_priority_set(tb_it, 50);
315
316 tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
317 elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
318 elm_toolbar_item_priority_set(tb_it, 999999);
319 elm_toolbar_menu_parent_set(tb, win);
320 menu = elm_toolbar_item_menu_get(tb_it);
321
322 elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
323 menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
324 elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
325 elm_menu_item_add(menu, NULL, "edit-delete", "None", tb_5, ph4);
326
327 elm_box_pack_end(bx, tb);
328 evas_object_show(tb);
329
330 tb = elm_table_add(win);
331 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
332 evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
333
334 ph = ph1;
335 elm_photo_size_set(ph, 40);
336 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
337 elm_photo_file_set(ph, buf);
338 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
339 evas_object_size_hint_align_set(ph, 0.5, 0.5);
340 elm_table_pack(tb, ph, 0, 0, 1, 1);
341 evas_object_show(ph);
342
343 ph = ph2;
344 elm_photo_size_set(ph, 80);
345 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
346 evas_object_size_hint_align_set(ph, 0.5, 0.5);
347 elm_table_pack(tb, ph, 1, 0, 1, 1);
348 evas_object_show(ph);
349
350 ph = ph3;
351 elm_photo_size_set(ph, 20);
352 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
353 elm_photo_file_set(ph, buf);
354 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
355 evas_object_size_hint_align_set(ph, 0.5, 0.5);
356 elm_table_pack(tb, ph, 0, 1, 1, 1);
357 evas_object_show(ph);
358
359 ph = ph4;
360 elm_photo_size_set(ph, 60);
361 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
362 elm_photo_file_set(ph, buf);
363 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
364 evas_object_size_hint_align_set(ph, 0.5, 0.5);
365 elm_table_pack(tb, ph, 1, 1, 1, 1);
366 evas_object_show(ph);
367
368 elm_box_pack_end(bx, tb);
369 evas_object_show(tb);
370
371 evas_object_resize(win, 320, 300);
372 evas_object_show(win);
373}
374
375/* The same test of toolbar, but using hide shrink mode instead of menu */
376void
377test_toolbar4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
378{
379 Evas_Object *win, *bx, *tb, *ph, *menu;
380 Evas_Object *ph1, *ph2, *ph3, *ph4;
381 Elm_Object_Item *tb_it;
382 Elm_Object_Item *menu_it;
383 char buf[PATH_MAX];
384
385 win = elm_win_util_standard_add("toolbar4", "Toolbar 4");
386 elm_win_autodel_set(win, EINA_TRUE);
387
388 bx = elm_box_add(win);
389 elm_win_resize_object_add(win, bx);
390 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
391 evas_object_show(bx);
392
393 tb = elm_toolbar_add(win);
394 elm_toolbar_homogeneous_set(tb, 0);
395 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_HIDE);
396 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
397 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
398
399 ph1 = elm_photo_add(win);
400 ph2 = elm_photo_add(win);
401 ph3 = elm_photo_add(win);
402 ph4 = elm_photo_add(win);
403
404 tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
405 elm_object_item_disabled_set(tb_it, EINA_TRUE);
406 elm_toolbar_item_priority_set(tb_it, 100);
407
408 tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
409 elm_toolbar_item_priority_set(tb_it, -100);
410
411 tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
412 elm_toolbar_item_priority_set(tb_it, 150);
413
414 tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
415 elm_toolbar_item_priority_set(tb_it, 0);
416
417 tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
418 elm_toolbar_item_priority_set(tb_it, -200);
419
420 tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
421 elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
422 elm_toolbar_item_priority_set(tb_it, -999999);
423 elm_toolbar_menu_parent_set(tb, win);
424 menu = elm_toolbar_item_menu_get(tb_it);
425
426 elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
427 menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
428 elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
429 elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4);
430
431 elm_box_pack_end(bx, tb);
432 evas_object_show(tb);
433
434 tb = elm_table_add(win);
435 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
436 evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
437
438 ph = ph1;
439 elm_photo_size_set(ph, 40);
440 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
441 elm_photo_file_set(ph, buf);
442 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
443 evas_object_size_hint_align_set(ph, 0.5, 0.5);
444 elm_table_pack(tb, ph, 0, 0, 1, 1);
445 evas_object_show(ph);
446
447 ph = ph2;
448 elm_photo_size_set(ph, 80);
449 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
450 evas_object_size_hint_align_set(ph, 0.5, 0.5);
451 elm_table_pack(tb, ph, 1, 0, 1, 1);
452 evas_object_show(ph);
453
454 ph = ph3;
455 elm_photo_size_set(ph, 20);
456 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
457 elm_photo_file_set(ph, buf);
458 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
459 evas_object_size_hint_align_set(ph, 0.5, 0.5);
460 elm_table_pack(tb, ph, 0, 1, 1, 1);
461 evas_object_show(ph);
462
463 ph = ph4;
464 elm_photo_size_set(ph, 60);
465 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
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, 1, 1, 1, 1);
470 evas_object_show(ph);
471
472 elm_box_pack_end(bx, tb);
473 evas_object_show(tb);
474
475 evas_object_resize(win, 320, 300);
476 evas_object_show(win);
477}
478
479/* Toolbar with multiple state buttons */
480void
481test_toolbar5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
482{
483 Evas_Object *win, *bx, *tb, *ph, *menu;
484 Evas_Object *ph1, *ph2, *ph3, *ph4;
485 Elm_Object_Item *tb_it;
486 Elm_Object_Item *menu_it;
487 char buf[PATH_MAX];
488
489 win = elm_win_util_standard_add("toolbar5", "Toolbar 5");
490 elm_win_autodel_set(win, EINA_TRUE);
491
492 bx = elm_box_add(win);
493 elm_win_resize_object_add(win, bx);
494 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
495 evas_object_show(bx);
496
497 tb = elm_toolbar_add(win);
498 elm_toolbar_homogeneous_set(tb, 0);
499 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_MENU);
500 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
501 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
502 elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_NONE);
503
504 ph1 = elm_photo_add(win);
505 ph2 = elm_photo_add(win);
506 ph3 = elm_photo_add(win);
507 ph4 = elm_photo_add(win);
508
509 tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
510 elm_object_item_disabled_set(tb_it, EINA_TRUE);
511 elm_toolbar_item_priority_set(tb_it, 100);
512
513 snprintf(buf, sizeof(buf), "%s/images/icon_04.pngj", elm_app_data_dir_get());
514 tb_it = elm_toolbar_item_append(tb, buf, "World", tb_2, ph1);
515 elm_toolbar_item_priority_set(tb_it, -100);
516
517 tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3a, ph4);
518 elm_toolbar_item_state_add(tb_it, "object-rotate-left", "H2", tb_3b, ph4);
519 elm_toolbar_item_priority_set(tb_it, 150);
520
521 tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4a, ph4);
522 elm_toolbar_item_state_add(tb_it, "emptytrash", "Comes2", tb_4a, ph4);
523 elm_toolbar_item_state_add(tb_it, "trashcan_full", "Comes3", tb_4a, ph4);
524 elm_toolbar_item_priority_set(tb_it, 0);
525
526 tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
527 elm_toolbar_item_priority_set(tb_it, -200);
528
529 tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
530 elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
531 elm_toolbar_item_priority_set(tb_it, -999999);
532 elm_toolbar_menu_parent_set(tb, win);
533 menu = elm_toolbar_item_menu_get(tb_it);
534
535 elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
536 menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
537 elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
538 elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4);
539
540 elm_box_pack_end(bx, tb);
541 evas_object_show(tb);
542
543 tb = elm_table_add(win);
544 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
545 evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
546
547 ph = ph1;
548 elm_photo_size_set(ph, 40);
549 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
550 elm_photo_file_set(ph, buf);
551 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
552 evas_object_size_hint_align_set(ph, 0.5, 0.5);
553 elm_table_pack(tb, ph, 0, 0, 1, 1);
554 evas_object_show(ph);
555
556 ph = ph2;
557 elm_photo_size_set(ph, 80);
558 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
559 evas_object_size_hint_align_set(ph, 0.5, 0.5);
560 elm_table_pack(tb, ph, 1, 0, 1, 1);
561 evas_object_show(ph);
562
563 ph = ph3;
564 elm_photo_size_set(ph, 20);
565 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
566 elm_photo_file_set(ph, buf);
567 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
568 evas_object_size_hint_align_set(ph, 0.5, 0.5);
569 elm_table_pack(tb, ph, 0, 1, 1, 1);
570 evas_object_show(ph);
571
572 ph = ph4;
573 elm_photo_size_set(ph, 60);
574 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
575 elm_photo_file_set(ph, buf);
576 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
577 evas_object_size_hint_align_set(ph, 0.5, 0.5);
578 elm_table_pack(tb, ph, 1, 1, 1, 1);
579 evas_object_show(ph);
580
581 elm_box_pack_end(bx, tb);
582 evas_object_show(tb);
583
584 evas_object_resize(win, 320, 300);
585 evas_object_show(win);
586}
587
588void
589test_toolbar6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
590{
591 Evas_Object *win, *bx, *tb, *ph, *menu;
592 Evas_Object *ph1, *ph2, *ph3, *ph4;
593 Elm_Object_Item *tb_it;
594 Elm_Object_Item *menu_it;
595 char buf[PATH_MAX];
596
597 win = elm_win_util_standard_add("toolbar6", "Toolbar 6");
598 elm_win_autodel_set(win, EINA_TRUE);
599
600 bx = elm_box_add(win);
601 elm_win_resize_object_add(win, bx);
602 elm_box_horizontal_set(bx, EINA_TRUE);
603 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
604 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
605 evas_object_show(bx);
606
607 tb = elm_toolbar_add(win);
608 elm_toolbar_horizontal_set(tb, EINA_FALSE);
609 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_MENU);
610 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
611 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
612
613 ph1 = elm_photo_add(win);
614 ph2 = elm_photo_add(win);
615 ph3 = elm_photo_add(win);
616 ph4 = elm_photo_add(win);
617
618 tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
619 elm_object_item_disabled_set(tb_it, EINA_TRUE);
620 elm_toolbar_item_priority_set(tb_it, 100);
621
622 tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
623 elm_toolbar_item_priority_set(tb_it, -100);
624
625 tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
626 elm_toolbar_item_priority_set(tb_it, 150);
627
628 tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
629 elm_toolbar_item_priority_set(tb_it, 0);
630
631 tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
632 elm_toolbar_item_priority_set(tb_it, -200);
633
634 tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
635 elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
636 elm_toolbar_item_priority_set(tb_it, -999999);
637 elm_toolbar_menu_parent_set(tb, win);
638 menu = elm_toolbar_item_menu_get(tb_it);
639
640 elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
641 menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
642 elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
643 elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4);
644
645 elm_box_pack_end(bx, tb);
646 evas_object_show(tb);
647
648 tb = elm_table_add(win);
649 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
650 evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
651
652 ph = ph1;
653 elm_photo_size_set(ph, 40);
654 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
655 elm_photo_file_set(ph, buf);
656 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
657 evas_object_size_hint_align_set(ph, 0.5, 0.5);
658 elm_table_pack(tb, ph, 0, 0, 1, 1);
659 evas_object_show(ph);
660
661 ph = ph2;
662 elm_photo_size_set(ph, 80);
663 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
664 evas_object_size_hint_align_set(ph, 0.5, 0.5);
665 elm_table_pack(tb, ph, 1, 0, 1, 1);
666 evas_object_show(ph);
667
668 ph = ph3;
669 elm_photo_size_set(ph, 20);
670 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
671 elm_photo_file_set(ph, buf);
672 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
673 evas_object_size_hint_align_set(ph, 0.5, 0.5);
674 elm_table_pack(tb, ph, 0, 1, 1, 1);
675 evas_object_show(ph);
676
677 ph = ph4;
678 elm_photo_size_set(ph, 60);
679 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
680 elm_photo_file_set(ph, buf);
681 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
682 evas_object_size_hint_align_set(ph, 0.5, 0.5);
683 elm_table_pack(tb, ph, 1, 1, 1, 1);
684 evas_object_show(ph);
685
686 elm_box_pack_end(bx, tb);
687 evas_object_show(tb);
688
689 evas_object_resize(win, 320, 300);
690 evas_object_show(win);
691}
692
693void
694test_toolbar7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
695{
696 Evas_Object *win, *bx, *tb, *ph, *menu;
697 Evas_Object *ph1, *ph2, *ph3, *ph4;
698 Elm_Object_Item *tb_it;
699 Elm_Object_Item *menu_it;
700 char buf[PATH_MAX];
701
702 win = elm_win_util_standard_add("toolbar7", "Toolbar 7");
703 elm_win_autodel_set(win, EINA_TRUE);
704
705 bx = elm_box_add(win);
706 elm_win_resize_object_add(win, bx);
707 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
708 evas_object_show(bx);
709
710 tb = elm_toolbar_add(win);
711 elm_object_style_set(tb, "item_horizontal");
712 elm_toolbar_homogeneous_set(tb, 0);
713 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_MENU);
714 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
715 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
716
717 ph1 = elm_photo_add(win);
718 ph2 = elm_photo_add(win);
719 ph3 = elm_photo_add(win);
720 ph4 = elm_photo_add(win);
721
722 tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
723 elm_object_item_disabled_set(tb_it, EINA_TRUE);
724 elm_toolbar_item_priority_set(tb_it, 100);
725
726 tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
727 elm_toolbar_item_priority_set(tb_it, -100);
728
729 tb_it = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
730 elm_toolbar_item_priority_set(tb_it, 150);
731
732 tb_it = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
733 elm_toolbar_item_priority_set(tb_it, 0);
734
735 tb_it = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
736 elm_toolbar_item_priority_set(tb_it, -200);
737
738 tb_it = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
739 elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
740 elm_toolbar_item_priority_set(tb_it, -999999);
741 elm_toolbar_menu_parent_set(tb, win);
742 menu = elm_toolbar_item_menu_get(tb_it);
743
744 elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
745 menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
746 elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
747 elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4);
748
749 elm_box_pack_end(bx, tb);
750 evas_object_show(tb);
751
752 tb = elm_table_add(win);
753 //elm_table_homogeneous_set(tb, 1);
754 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
755 evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
756
757 ph = ph1;
758 elm_photo_size_set(ph, 40);
759 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
760 elm_photo_file_set(ph, buf);
761 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
762 evas_object_size_hint_align_set(ph, 0.5, 0.5);
763 elm_table_pack(tb, ph, 0, 0, 1, 1);
764 evas_object_show(ph);
765
766 ph = ph2;
767 elm_photo_size_set(ph, 80);
768 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
769 evas_object_size_hint_align_set(ph, 0.5, 0.5);
770 elm_table_pack(tb, ph, 1, 0, 1, 1);
771 evas_object_show(ph);
772
773 ph = ph3;
774 elm_photo_size_set(ph, 20);
775 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
776 elm_photo_file_set(ph, buf);
777 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
778 evas_object_size_hint_align_set(ph, 0.5, 0.5);
779 elm_table_pack(tb, ph, 0, 1, 1, 1);
780 evas_object_show(ph);
781
782 ph = ph4;
783 elm_photo_size_set(ph, 60);
784 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
785 elm_photo_file_set(ph, buf);
786 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
787 evas_object_size_hint_align_set(ph, 0.5, 0.5);
788 elm_table_pack(tb, ph, 1, 1, 1, 1);
789 evas_object_show(ph);
790
791 elm_box_pack_end(bx, tb);
792 evas_object_show(tb);
793
794 evas_object_resize(win, 320, 300);
795 evas_object_show(win);
796}
797
798void
799test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
800{
801 Evas_Object *win, *bx, *tb, *ph, *sl, *menu;
802 Evas_Object *ph1, *ph2, *ph3, *ph4;
803 Elm_Object_Item *item;
804 Elm_Object_Item *menu_it;
805 char buf[PATH_MAX];
806
807 win = elm_win_util_standard_add("toolbar8", "Toolbar 8");
808 elm_win_autodel_set(win, EINA_TRUE);
809
810 bx = elm_box_add(win);
811 elm_win_resize_object_add(win, bx);
812 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
813 evas_object_show(bx);
814
815 tb = elm_toolbar_add(win);
816 elm_toolbar_homogeneous_set(tb, EINA_FALSE);
817 elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_EXPAND);
818 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
819 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
820
821 ph1 = elm_photo_add(win);
822 ph2 = elm_photo_add(win);
823 ph3 = elm_photo_add(win);
824 ph4 = elm_photo_add(win);
825
826 item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
827 elm_object_item_disabled_set(item, EINA_TRUE);
828 elm_toolbar_item_priority_set(item, -100);
829
830 item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
831 elm_toolbar_item_priority_set(item, 100);
832
833 item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
834 elm_toolbar_item_priority_set(item, -150);
835
836 sl = elm_slider_add(win);
837 evas_object_size_hint_min_set(sl, 100, 50);
838 item = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL);
839 elm_object_item_part_content_set(item, "object", sl);
840
841 item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
842 elm_toolbar_item_priority_set(item, -200);
843
844 item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
845 elm_toolbar_item_priority_set(item, 0);
846
847 item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
848 elm_toolbar_item_menu_set(item, EINA_TRUE);
849 elm_toolbar_item_priority_set(item, -999999);
850 elm_toolbar_menu_parent_set(tb, win);
851 menu = elm_toolbar_item_menu_get(item);
852
853 elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
854 menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
855 elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
856 elm_menu_item_add(menu, NULL, "edit-delete", "Scroll", tb_5, ph4);
857
858 elm_box_pack_end(bx, tb);
859 evas_object_show(tb);
860
861 tb = elm_table_add(win);
862 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
863 evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
864
865 ph = ph1;
866 elm_photo_size_set(ph, 40);
867 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
868 elm_photo_file_set(ph, buf);
869 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
870 evas_object_size_hint_align_set(ph, 0.5, 0.5);
871 elm_table_pack(tb, ph, 0, 0, 1, 1);
872 evas_object_show(ph);
873
874 ph = ph2;
875 elm_photo_size_set(ph, 80);
876 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
877 evas_object_size_hint_align_set(ph, 0.5, 0.5);
878 elm_table_pack(tb, ph, 1, 0, 1, 1);
879 evas_object_show(ph);
880
881 ph = ph3;
882 elm_photo_size_set(ph, 20);
883 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
884 elm_photo_file_set(ph, buf);
885 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
886 evas_object_size_hint_align_set(ph, 0.5, 0.5);
887 elm_table_pack(tb, ph, 0, 1, 1, 1);
888 evas_object_show(ph);
889
890 ph = ph4;
891 elm_photo_size_set(ph, 60);
892 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
893 elm_photo_file_set(ph, buf);
894 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
895 evas_object_size_hint_align_set(ph, 0.5, 0.5);
896 elm_table_pack(tb, ph, 1, 1, 1, 1);
897 evas_object_show(ph);
898
899 elm_box_pack_end(bx, tb);
900 evas_object_show(tb);
901
902 evas_object_resize(win, 420, 250);
903 evas_object_show(win);
904}
905#endif