summaryrefslogtreecommitdiff
path: root/legacy/elementary
diff options
context:
space:
mode:
Diffstat (limited to 'legacy/elementary')
-rw-r--r--legacy/elementary/src/bin/Makefile.am7
-rw-r--r--legacy/elementary/src/bin/test.c3839
-rw-r--r--legacy/elementary/src/bin/test_anchorblock.c226
-rw-r--r--legacy/elementary/src/bin/test_anchorview.c105
-rw-r--r--legacy/elementary/src/bin/test_bg.c54
-rw-r--r--legacy/elementary/src/bin/test_box.c96
-rw-r--r--legacy/elementary/src/bin/test_button.c61
-rw-r--r--legacy/elementary/src/bin/test_carousel.c20
-rw-r--r--legacy/elementary/src/bin/test_check.c64
-rw-r--r--legacy/elementary/src/bin/test_clock.c51
-rw-r--r--legacy/elementary/src/bin/test_entry.c235
-rw-r--r--legacy/elementary/src/bin/test_fileselector.c62
-rw-r--r--legacy/elementary/src/bin/test_genlist.c921
-rw-r--r--legacy/elementary/src/bin/test_hover.c170
-rw-r--r--legacy/elementary/src/bin/test_hoversel.c94
-rw-r--r--legacy/elementary/src/bin/test_icon.c22
-rw-r--r--legacy/elementary/src/bin/test_inwin.c69
-rw-r--r--legacy/elementary/src/bin/test_layout.c41
-rw-r--r--legacy/elementary/src/bin/test_list.c315
-rw-r--r--legacy/elementary/src/bin/test_notepad.c97
-rw-r--r--legacy/elementary/src/bin/test_pager.c145
-rw-r--r--legacy/elementary/src/bin/test_progressbar.c187
-rw-r--r--legacy/elementary/src/bin/test_radio.c73
-rw-r--r--legacy/elementary/src/bin/test_scaling.c124
-rw-r--r--legacy/elementary/src/bin/test_slider.c88
-rw-r--r--legacy/elementary/src/bin/test_table.c65
-rw-r--r--legacy/elementary/src/bin/test_toggle.c66
-rw-r--r--legacy/elementary/src/bin/test_toolbar.c144
-rw-r--r--legacy/elementary/src/bin/test_win_state.c172
29 files changed, 3857 insertions, 3756 deletions
diff --git a/legacy/elementary/src/bin/Makefile.am b/legacy/elementary/src/bin/Makefile.am
index 31096ec..a4724b4 100644
--- a/legacy/elementary/src/bin/Makefile.am
+++ b/legacy/elementary/src/bin/Makefile.am
@@ -24,7 +24,12 @@ if BUILD_QUICKLAUNCH
24bin_PROGRAMS += elementary_quicklaunch elementary_run elementary_testql 24bin_PROGRAMS += elementary_quicklaunch elementary_run elementary_testql
25endif 25endif
26 26
27elementary_test_SOURCES = test.c 27elementary_test_SOURCES = test.c test_bg.c test_icon.c test_box.c \
28test_button.c test_toggle.c test_table.c test_clock.c test_layout.c \
29test_hover.c test_entry.c test_notepad.c test_anchorview.c test_anchorblock.c \
30test_toolbar.c test_hoversel.c test_list.c test_carousel.c test_inwin.c \
31test_scaling.c test_slider.c test_genlist.c test_check.c test_pager.c \
32test_radio.c test_win_state.c test_progressbar.c test_fileselector.c
28elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la 33elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la
29elementary_test_LDFLAGS = 34elementary_test_LDFLAGS =
30 35
diff --git a/legacy/elementary/src/bin/test.c b/legacy/elementary/src/bin/test.c
index 1860bee..8006129 100644
--- a/legacy/elementary/src/bin/test.c
+++ b/legacy/elementary/src/bin/test.c
@@ -1,3727 +1,56 @@
1#include <Elementary.h> 1#include <Elementary.h>
2#ifndef ELM_LIB_QUICKLAUNCH 2#ifndef ELM_LIB_QUICKLAUNCH
3static void my_win_del(void *data, Evas_Object *obj, void *event_info);
4static void my_bt_1(void *data, Evas_Object *obj, void *event_info);
5static void my_win_main(void);
6 3
7static void
8my_win_del(void *data, Evas_Object *obj, void *event_info)
9{
10 /* called when my_win_main is requested to be deleted */
11 elm_exit(); /* exit the program's main loop that runs in elm_run() */
12}
13
14static void
15my_bt_1(void *data, Evas_Object *obj, void *event_info)
16{
17 Evas_Object *win, *bg;
18
19 win = elm_win_add(NULL, "bg-plain", ELM_WIN_BASIC);
20 elm_win_title_set(win, "Bg Plain");
21 elm_win_autodel_set(win, 1);
22
23 bg = elm_bg_add(win);
24 /* allow bg to expand in x & y */
25 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
26 elm_win_resize_object_add(win, bg);
27 evas_object_show(bg);
28
29 /* set size hints. a minimum size for the bg. this should propagate back
30 * to the window thus limiting its size based off the bg as the bg is one
31 * of the window's resize objects. */
32 evas_object_size_hint_min_set(bg, 160, 160);
33 /* and set a maximum size. not needed very often. normally used together
34 * with evas_object_size_hint_min_set() at the same size to make a
35 * window not resizable */
36 evas_object_size_hint_max_set(bg, 640, 640);
37 /* and now just resize the window to a size you want. normally widgets
38 * will determine the initial size though */
39 evas_object_resize(win, 320, 320);
40 /* and show the window */
41 evas_object_show(win);
42}
43
44static void
45my_bt_2(void *data, Evas_Object *obj, void *event_info)
46{
47 Evas_Object *win, *bg;
48 char buf[PATH_MAX];
49
50 win = elm_win_add(NULL, "bg-image", ELM_WIN_BASIC);
51 elm_win_title_set(win, "Bg Image");
52 elm_win_autodel_set(win, 1);
53
54 bg = elm_bg_add(win);
55 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
56 elm_bg_file_set(bg, buf, NULL);
57 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
58 elm_win_resize_object_add(win, bg);
59 evas_object_show(bg);
60
61 evas_object_size_hint_min_set(bg, 160, 160);
62 evas_object_size_hint_max_set(bg, 640, 640);
63 evas_object_resize(win, 320, 320);
64 evas_object_show(win);
65}
66
67static void
68my_bt_3(void *data, Evas_Object *obj, void *event_info)
69{
70 Evas_Object *win, *bg, *ic;
71 char buf[PATH_MAX];
72
73 win = elm_win_add(NULL, "icon-transparent", ELM_WIN_BASIC);
74 elm_win_title_set(win, "Icon Transparent");
75 elm_win_autodel_set(win, 1);
76 elm_win_alpha_set(win, 1);
77
78 ic = elm_icon_add(win);
79 snprintf(buf, sizeof(buf), "%s/images/logo.png", PACKAGE_DATA_DIR);
80 elm_icon_file_set(ic, buf, NULL);
81 elm_icon_scale_set(ic, 0, 0);
82 elm_win_resize_object_add(win, ic);
83 evas_object_show(ic);
84
85 evas_object_show(win);
86}
87
88static void
89my_bt_4(void *data, Evas_Object *obj, void *event_info)
90{
91 Evas_Object *win, *bg, *bx, *ic;
92 char buf[PATH_MAX];
93
94 win = elm_win_add(NULL, "box-vert", ELM_WIN_BASIC);
95 elm_win_title_set(win, "Box Vert");
96 elm_win_autodel_set(win, 1);
97
98 bg = elm_bg_add(win);
99 elm_win_resize_object_add(win, bg);
100 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
101 evas_object_show(bg);
102
103 bx = elm_box_add(win);
104 elm_win_resize_object_add(win, bx);
105 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
106 evas_object_show(bx);
107
108 ic = elm_icon_add(win);
109 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
110 elm_icon_file_set(ic, buf, NULL);
111 elm_icon_scale_set(ic, 0, 0);
112 evas_object_size_hint_align_set(ic, 0.5, 0.5);
113 elm_box_pack_end(bx, ic);
114 evas_object_show(ic);
115
116 ic = elm_icon_add(win);
117 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
118 elm_icon_file_set(ic, buf, NULL);
119 elm_icon_scale_set(ic, 0, 0);
120 evas_object_size_hint_align_set(ic, 0.0, 0.5);
121 elm_box_pack_end(bx, ic);
122 evas_object_show(ic);
123
124 ic = elm_icon_add(win);
125 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
126 elm_icon_file_set(ic, buf, NULL);
127 elm_icon_scale_set(ic, 0, 0);
128 evas_object_size_hint_align_set(ic, 1.0, 0.5);
129 elm_box_pack_end(bx, ic);
130 evas_object_show(ic);
131
132 evas_object_show(win);
133}
134
135static void
136my_bt_5(void *data, Evas_Object *obj, void *event_info)
137{
138 Evas_Object *win, *bg, *bx, *ic;
139 char buf[PATH_MAX];
140
141 win = elm_win_add(NULL, "box-horiz", ELM_WIN_BASIC);
142 elm_win_title_set(win, "Box Horiz");
143 elm_win_autodel_set(win, 1);
144
145 bg = elm_bg_add(win);
146 elm_win_resize_object_add(win, bg);
147 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
148 evas_object_show(bg);
149
150 bx = elm_box_add(win);
151 elm_box_horizontal_set(bx, 1);
152 elm_win_resize_object_add(win, bx);
153 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
154 evas_object_show(bx);
155
156 ic = elm_icon_add(win);
157 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
158 elm_icon_file_set(ic, buf, NULL);
159 elm_icon_scale_set(ic, 0, 0);
160 evas_object_size_hint_align_set(ic, 0.5, 0.5);
161 elm_box_pack_end(bx, ic);
162 evas_object_show(ic);
163
164 ic = elm_icon_add(win);
165 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
166 elm_icon_file_set(ic, buf, NULL);
167 elm_icon_scale_set(ic, 0, 0);
168 evas_object_size_hint_align_set(ic, 0.5, 0.0);
169 elm_box_pack_end(bx, ic);
170 evas_object_show(ic);
171
172 ic = elm_icon_add(win);
173 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
174 elm_icon_file_set(ic, buf, NULL);
175 elm_icon_scale_set(ic, 0, 0);
176 evas_object_size_hint_align_set(ic, 0.0, 1.0);
177 elm_box_pack_end(bx, ic);
178 evas_object_show(ic);
179
180 evas_object_show(win);
181}
182
183static void
184my_bt_6(void *data, Evas_Object *obj, void *event_info)
185{
186 Evas_Object *win, *bg, *bx, *ic, *bt;
187 char buf[PATH_MAX];
188
189 win = elm_win_add(NULL, "buttons", ELM_WIN_BASIC);
190 elm_win_title_set(win, "Buttons");
191 elm_win_autodel_set(win, 1);
192
193 bg = elm_bg_add(win);
194 elm_win_resize_object_add(win, bg);
195 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
196 evas_object_show(bg);
197
198 bx = elm_box_add(win);
199 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
200 elm_win_resize_object_add(win, bx);
201 evas_object_show(bx);
202
203 ic = elm_icon_add(win);
204 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
205 elm_icon_file_set(ic, buf, NULL);
206 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
207 bt = elm_button_add(win);
208 elm_button_label_set(bt, "Icon sized to button");
209 elm_button_icon_set(bt, ic);
210 elm_box_pack_end(bx, bt);
211 evas_object_show(bt);
212 evas_object_show(ic);
213
214 ic = elm_icon_add(win);
215 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
216 elm_icon_file_set(ic, buf, NULL);
217 elm_icon_scale_set(ic, 0, 0);
218 bt = elm_button_add(win);
219 elm_button_label_set(bt, "Icon no scale");
220 elm_button_icon_set(bt, ic);
221 elm_box_pack_end(bx, bt);
222 evas_object_show(bt);
223 evas_object_show(ic);
224
225 bt = elm_button_add(win);
226 elm_button_label_set(bt, "Label Only");
227 elm_box_pack_end(bx, bt);
228 evas_object_show(bt);
229
230 ic = elm_icon_add(win);
231 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
232 elm_icon_file_set(ic, buf, NULL);
233 elm_icon_scale_set(ic, 0, 0);
234 bt = elm_button_add(win);
235 elm_button_icon_set(bt, ic);
236 elm_box_pack_end(bx, bt);
237 evas_object_show(bt);
238 evas_object_show(ic);
239
240 evas_object_show(win);
241}
242
243static void
244my_bt_7(void *data, Evas_Object *obj, void *event_info)
245{
246 Evas_Object *win, *bg, *bx, *ic, *tg;
247 char buf[PATH_MAX];
248
249 win = elm_win_add(NULL, "toggles", ELM_WIN_BASIC);
250 elm_win_title_set(win, "Toggles");
251 elm_win_autodel_set(win, 1);
252
253 bg = elm_bg_add(win);
254 elm_win_resize_object_add(win, bg);
255 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
256 evas_object_show(bg);
257
258 bx = elm_box_add(win);
259 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
260 elm_win_resize_object_add(win, bx);
261 evas_object_show(bx);
262
263 ic = elm_icon_add(win);
264 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
265 elm_icon_file_set(ic, buf, NULL);
266 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
267 tg = elm_toggle_add(win);
268 evas_object_size_hint_weight_set(tg, 1.0, 1.0);
269 evas_object_size_hint_align_set(tg, -1.0, 0.5);
270 elm_toggle_label_set(tg, "Icon sized to toggle");
271 elm_toggle_icon_set(tg, ic);
272 elm_toggle_state_set(tg, 1);
273 elm_toggle_states_labels_set(tg, "Yes", "No");
274 elm_box_pack_end(bx, tg);
275 evas_object_show(tg);
276 evas_object_show(ic);
277
278 ic = elm_icon_add(win);
279 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
280 elm_icon_file_set(ic, buf, NULL);
281 elm_icon_scale_set(ic, 0, 0);
282 tg = elm_toggle_add(win);
283 elm_toggle_label_set(tg, "Icon no scale");
284 elm_toggle_icon_set(tg, ic);
285 elm_box_pack_end(bx, tg);
286 evas_object_show(tg);
287 evas_object_show(ic);
288
289 tg = elm_toggle_add(win);
290 elm_toggle_label_set(tg, "Label Only");
291 elm_toggle_states_labels_set(tg, "Big long fun times label", "Small long happy fun label");
292 elm_box_pack_end(bx, tg);
293 evas_object_show(tg);
294
295 ic = elm_icon_add(win);
296 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
297 elm_icon_file_set(ic, buf, NULL);
298 elm_icon_scale_set(ic, 0, 0);
299 tg = elm_toggle_add(win);
300 elm_toggle_icon_set(tg, ic);
301 elm_box_pack_end(bx, tg);
302 evas_object_show(tg);
303 evas_object_show(ic);
304
305 evas_object_show(win);
306}
307
308static void
309my_bt_8(void *data, Evas_Object *obj, void *event_info)
310{
311 Evas_Object *win, *bg, *tb, *bt;
312
313 win = elm_win_add(NULL, "table", ELM_WIN_BASIC);
314 elm_win_title_set(win, "Table");
315 elm_win_autodel_set(win, 1);
316
317 bg = elm_bg_add(win);
318 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
319 elm_win_resize_object_add(win, bg);
320 evas_object_show(bg);
321
322 tb = elm_table_add(win);
323 elm_win_resize_object_add(win, tb);
324 evas_object_size_hint_weight_set(tb, 1.0, 1.0);
325 evas_object_show(tb);
326
327 bt = elm_button_add(win);
328 elm_button_label_set(bt, "Button 1");
329 evas_object_size_hint_weight_set(bt, 1.0, 1.0);
330 evas_object_size_hint_align_set(bt, -1.0, -1.0);
331 elm_table_pack(tb, bt, 0, 0, 1, 1);
332 evas_object_show(bt);
333
334 bt = elm_button_add(win);
335 elm_button_label_set(bt, "Button 2");
336 evas_object_size_hint_weight_set(bt, 1.0, 1.0);
337 evas_object_size_hint_align_set(bt, -1.0, -1.0);
338 elm_table_pack(tb, bt, 1, 0, 1, 1);
339 evas_object_show(bt);
340
341 bt = elm_button_add(win);
342 elm_button_label_set(bt, "Button 3");
343 evas_object_size_hint_weight_set(bt, 1.0, 1.0);
344 evas_object_size_hint_align_set(bt, -1.0, -1.0);
345 elm_table_pack(tb, bt, 2, 0, 1, 1);
346 evas_object_show(bt);
347
348 bt = elm_button_add(win);
349 elm_button_label_set(bt, "Button 4");
350 evas_object_size_hint_weight_set(bt, 1.0, 1.0);
351 evas_object_size_hint_align_set(bt, -1.0, -1.0);
352 elm_table_pack(tb, bt, 0, 1, 2, 1);
353 evas_object_show(bt);
354
355 bt = elm_button_add(win);
356 elm_button_label_set(bt, "Button 5");
357 evas_object_size_hint_weight_set(bt, 1.0, 1.0);
358 evas_object_size_hint_align_set(bt, -1.0, -1.0);
359 elm_table_pack(tb, bt, 2, 1, 1, 3);
360 evas_object_show(bt);
361
362 bt = elm_button_add(win);
363 elm_button_label_set(bt, "Button 6");
364 evas_object_size_hint_weight_set(bt, 1.0, 1.0);
365 evas_object_size_hint_align_set(bt, -1.0, -1.0);
366 elm_table_pack(tb, bt, 0, 2, 2, 2);
367 evas_object_show(bt);
368
369 evas_object_show(win);
370}
371
372static void
373my_bt_9(void *data, Evas_Object *obj, void *event_info)
374{
375 Evas_Object *win, *bg, *bx, *ck;
376
377 win = elm_win_add(NULL, "clock", ELM_WIN_BASIC);
378 elm_win_title_set(win, "Clock");
379 elm_win_autodel_set(win, 1);
380
381 bg = elm_bg_add(win);
382 elm_win_resize_object_add(win, bg);
383 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
384 evas_object_show(bg);
385
386 bx = elm_box_add(win);
387 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
388 elm_win_resize_object_add(win, bx);
389 evas_object_show(bx);
390
391 ck = elm_clock_add(win);
392 elm_box_pack_end(bx, ck);
393 evas_object_show(ck);
394
395 ck = elm_clock_add(win);
396 elm_clock_show_am_pm_set(ck, 1);
397 elm_box_pack_end(bx, ck);
398 evas_object_show(ck);
399
400 ck = elm_clock_add(win);
401 elm_clock_show_seconds_set(ck, 1);
402 elm_box_pack_end(bx, ck);
403 evas_object_show(ck);
404
405 ck = elm_clock_add(win);
406 elm_clock_show_seconds_set(ck, 1);
407 elm_clock_show_am_pm_set(ck, 1);
408 elm_box_pack_end(bx, ck);
409 evas_object_show(ck);
410
411 ck = elm_clock_add(win);
412 elm_clock_edit_set(ck, 1);
413 elm_clock_show_seconds_set(ck, 1);
414 elm_clock_show_am_pm_set(ck, 1);
415 elm_clock_time_set(ck, 10, 11, 12);
416 elm_box_pack_end(bx, ck);
417 evas_object_show(ck);
418
419 evas_object_show(win);
420}
421
422static void
423my_bt_10(void *data, Evas_Object *obj, void *event_info)
424{
425 Evas_Object *win, *bg, *ly, *bt;
426 char buf[PATH_MAX];
427
428 win = elm_win_add(NULL, "layout", ELM_WIN_BASIC);
429 elm_win_title_set(win, "Layout");
430 elm_win_autodel_set(win, 1);
431
432 bg = elm_bg_add(win);
433 elm_win_resize_object_add(win, bg);
434 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
435 evas_object_show(bg);
436
437 ly = elm_layout_add(win);
438 snprintf(buf, sizeof(buf), "%s/objects/test.edj", PACKAGE_DATA_DIR);
439 elm_layout_file_set(ly, buf, "layout");
440 evas_object_size_hint_weight_set(ly, 1.0, 1.0);
441 elm_win_resize_object_add(win, ly);
442 evas_object_show(ly);
443
444 bt = elm_button_add(win);
445 elm_button_label_set(bt, "Button 1");
446 elm_layout_content_set(ly, "element1", bt);
447 evas_object_show(bt);
448
449 bt = elm_button_add(win);
450 elm_button_label_set(bt, "Button 2");
451 elm_layout_content_set(ly, "element2", bt);
452 evas_object_show(bt);
453
454 bt = elm_button_add(win);
455 elm_button_label_set(bt, "Button 3");
456 elm_layout_content_set(ly, "element3", bt);
457 evas_object_show(bt);
458
459 evas_object_show(win);
460}
461
462static void
463my_hover_bt_1(void *data, Evas_Object *obj, void *event_info)
464{
465 Evas_Object *hv = data;
466
467 evas_object_show(hv);
468}
469
470static void
471my_bt_11(void *data, Evas_Object *obj, void *event_info)
472{
473 Evas_Object *win, *bg, *bx, *bt, *hv, *ic;
474 char buf[PATH_MAX];
475
476 win = elm_win_add(NULL, "hover", ELM_WIN_BASIC);
477 elm_win_title_set(win, "Hover");
478 elm_win_autodel_set(win, 1);
479
480 bg = elm_bg_add(win);
481 elm_win_resize_object_add(win, bg);
482 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
483 evas_object_show(bg);
484
485 bx = elm_box_add(win);
486 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
487 elm_win_resize_object_add(win, bx);
488 evas_object_show(bx);
489
490 hv = elm_hover_add(win);
491
492 bt = elm_button_add(win);
493 elm_button_label_set(bt, "Button");
494 evas_object_smart_callback_add(bt, "clicked", my_hover_bt_1, hv);
495 elm_box_pack_end(bx, bt);
496 evas_object_show(bt);
497 elm_hover_parent_set(hv, win);
498 elm_hover_target_set(hv, bt);
499
500 bt = elm_button_add(win);
501 elm_button_label_set(bt, "Popup");
502 elm_hover_content_set(hv, "middle", bt);
503 evas_object_show(bt);
504
505 bx = elm_box_add(win);
506
507 ic = elm_icon_add(win);
508 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
509 elm_icon_file_set(ic, buf, NULL);
510 elm_icon_scale_set(ic, 0, 0);
511 elm_box_pack_end(bx, ic);
512 evas_object_show(ic);
513
514 bt = elm_button_add(win);
515 elm_button_label_set(bt, "Top 1");
516 elm_box_pack_end(bx, bt);
517 evas_object_show(bt);
518 bt = elm_button_add(win);
519 elm_button_label_set(bt, "Top 2");
520 elm_box_pack_end(bx, bt);
521 evas_object_show(bt);
522 bt = elm_button_add(win);
523 elm_button_label_set(bt, "Top 3");
524 elm_box_pack_end(bx, bt);
525 evas_object_show(bt);
526
527 evas_object_show(bx);
528 elm_hover_content_set(hv, "top", bx);
529
530 bt = elm_button_add(win);
531 elm_button_label_set(bt, "Bottom");
532 elm_hover_content_set(hv, "bottom", bt);
533 evas_object_show(bt);
534
535 bt = elm_button_add(win);
536 elm_button_label_set(bt, "Left");
537 elm_hover_content_set(hv, "left", bt);
538 evas_object_show(bt);
539
540 bt = elm_button_add(win);
541 elm_button_label_set(bt, "Right");
542 elm_hover_content_set(hv, "right", bt);
543 evas_object_show(bt);
544
545 evas_object_size_hint_min_set(bg, 160, 160);
546 evas_object_size_hint_max_set(bg, 640, 640);
547 evas_object_resize(win, 320, 320);
548 evas_object_show(win);
549}
550
551static void
552my_bt_12(void *data, Evas_Object *obj, void *event_info)
553{
554 Evas_Object *win, *bg, *bx, *bt, *hv, *ic;
555 char buf[PATH_MAX];
556
557 win = elm_win_add(NULL, "hover2", ELM_WIN_BASIC);
558 elm_win_title_set(win, "Hover 2");
559 elm_win_autodel_set(win, 1);
560
561 bg = elm_bg_add(win);
562 elm_win_resize_object_add(win, bg);
563 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
564 evas_object_show(bg);
565
566 bx = elm_box_add(win);
567 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
568 elm_win_resize_object_add(win, bx);
569 evas_object_show(bx);
570
571 hv = elm_hover_add(win);
572 elm_object_style_set(hv, "popout");
573
574 bt = elm_button_add(win);
575 elm_button_label_set(bt, "Button");
576 evas_object_smart_callback_add(bt, "clicked", my_hover_bt_1, hv);
577 elm_box_pack_end(bx, bt);
578 evas_object_show(bt);
579 elm_hover_parent_set(hv, win);
580 elm_hover_target_set(hv, bt);
581
582 bt = elm_button_add(win);
583 elm_button_label_set(bt, "Popup");
584 elm_hover_content_set(hv, "middle", bt);
585 evas_object_show(bt);
586
587 bx = elm_box_add(win);
588
589 ic = elm_icon_add(win);
590 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
591 elm_icon_file_set(ic, buf, NULL);
592 elm_icon_scale_set(ic, 0, 0);
593 elm_box_pack_end(bx, ic);
594 evas_object_show(ic);
595 bt = elm_button_add(win);
596 elm_button_label_set(bt, "Top 1");
597 elm_box_pack_end(bx, bt);
598 evas_object_show(bt);
599 bt = elm_button_add(win);
600 elm_button_label_set(bt, "Top 2");
601 elm_box_pack_end(bx, bt);
602 evas_object_show(bt);
603 bt = elm_button_add(win);
604 elm_button_label_set(bt, "Top 3");
605 elm_box_pack_end(bx, bt);
606 evas_object_show(bt);
607 evas_object_show(bx);
608 elm_hover_content_set(hv, "top", bx);
609
610 bt = elm_button_add(win);
611 elm_button_label_set(bt, "Bot");
612 elm_hover_content_set(hv, "bottom", bt);
613 evas_object_show(bt);
614
615 bt = elm_button_add(win);
616 elm_button_label_set(bt, "Left");
617 elm_hover_content_set(hv, "left", bt);
618 evas_object_show(bt);
619
620 bt = elm_button_add(win);
621 elm_button_label_set(bt, "Right");
622 elm_hover_content_set(hv, "right", bt);
623 evas_object_show(bt);
624
625 evas_object_size_hint_min_set(bg, 160, 160);
626 evas_object_size_hint_max_set(bg, 640, 640);
627 evas_object_resize(win, 320, 320);
628 evas_object_show(win);
629}
630
631static void
632my_entry_bt_1(void *data, Evas_Object *obj, void *event_info)
633{
634 Evas_Object *en = data;
635 elm_entry_entry_set(en, "");
636}
637
638static void
639my_entry_bt_2(void *data, Evas_Object *obj, void *event_info)
640{
641 Evas_Object *en = data;
642 const char *s = elm_entry_entry_get(en);
643 printf("ENTRY:\n");
644 if (s) printf("%s\n", s);
645}
646
647static void
648my_entry_bt_3(void *data, Evas_Object *obj, void *event_info)
649{
650 Evas_Object *en = data;
651 const char *s = elm_entry_selection_get(en);
652 printf("SELECTION:\n");
653 if (s) printf("%s\n", s);
654}
655
656static void
657my_entry_bt_4(void *data, Evas_Object *obj, void *event_info)
658{
659 Evas_Object *en = data;
660 elm_entry_entry_insert(en, "Insert some <b>BOLD</> text");
661}
662
663static void
664my_bt_13(void *data, Evas_Object *obj, void *event_info)
665{
666 Evas_Object *win, *bg, *bx, *bx2, *bt, *en;
667 char buf[PATH_MAX];
668
669 win = elm_win_add(NULL, "entry", ELM_WIN_BASIC);
670 elm_win_title_set(win, "Entry");
671 elm_win_autodel_set(win, 1);
672
673 bg = elm_bg_add(win);
674 elm_win_resize_object_add(win, bg);
675 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
676 evas_object_show(bg);
677
678 bx = elm_box_add(win);
679 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
680 elm_win_resize_object_add(win, bx);
681 evas_object_show(bx);
682
683 en = elm_entry_add(win);
684 elm_entry_line_wrap_set(en, 0);
685 elm_entry_entry_set(en,
686 "This is an entry widget in this window that<br>"
687 "uses markup <b>like this</> for styling and<br>"
688 "formatting <em>like this</>, as well as<br>"
689 "<a href=X><link>links in the text</></a>, so enter text<br>"
690 "in here to edit it. By the way, links are<br>"
691 "called <a href=anc-02>Anchors</a> so you will need<br>"
692 "to refer to them this way.");
693 evas_object_size_hint_weight_set(en, 1.0, 1.0);
694 evas_object_size_hint_align_set(en, -1.0, -1.0);
695 elm_box_pack_end(bx, en);
696 evas_object_show(en);
697
698 bx2 = elm_box_add(win);
699 elm_box_horizontal_set(bx2, 1);
700 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
701 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
702
703 bt = elm_button_add(win);
704 elm_button_label_set(bt, "Clear");
705 evas_object_smart_callback_add(bt, "clicked", my_entry_bt_1, en);
706 evas_object_size_hint_align_set(bt, -1.0, -1.0);
707 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
708 elm_box_pack_end(bx2, bt);
709 evas_object_show(bt);
710
711 bt = elm_button_add(win);
712 elm_button_label_set(bt, "Print");
713 evas_object_smart_callback_add(bt, "clicked", my_entry_bt_2, en);
714 evas_object_size_hint_align_set(bt, -1.0, -1.0);
715 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
716 elm_box_pack_end(bx2, bt);
717 evas_object_show(bt);
718
719 bt = elm_button_add(win);
720 elm_button_label_set(bt, "Selection");
721 evas_object_smart_callback_add(bt, "clicked", my_entry_bt_3, en);
722 evas_object_size_hint_align_set(bt, -1.0, -1.0);
723 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
724 elm_box_pack_end(bx2, bt);
725 evas_object_show(bt);
726
727 bt = elm_button_add(win);
728 elm_button_label_set(bt, "Insert");
729 evas_object_smart_callback_add(bt, "clicked", my_entry_bt_4, en);
730 evas_object_size_hint_align_set(bt, -1.0, -1.0);
731 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
732 elm_box_pack_end(bx2, bt);
733 evas_object_show(bt);
734
735 elm_box_pack_end(bx, bx2);
736 evas_object_show(bx2);
737
738 elm_object_focus(en);
739 evas_object_show(win);
740}
741
742static void
743my_bt_14(void *data, Evas_Object *obj, void *event_info)
744{
745 Evas_Object *win, *bg, *bx, *bx2, *bt, *en, *sc;
746 char buf[PATH_MAX];
747
748 win = elm_win_add(NULL, "entry-scrolled", ELM_WIN_BASIC);
749 elm_win_title_set(win, "Entry Scrolled");
750 elm_win_autodel_set(win, 1);
751
752 bg = elm_bg_add(win);
753 elm_win_resize_object_add(win, bg);
754 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
755 evas_object_show(bg);
756
757 bx = elm_box_add(win);
758 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
759 elm_win_resize_object_add(win, bx);
760 evas_object_show(bx);
761
762 sc = elm_scroller_add(win);
763 elm_scroller_content_min_limit(sc, 0, 1);
764 elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
765 evas_object_size_hint_weight_set(sc, 1.0, 0.0);
766 evas_object_size_hint_align_set(sc, -1.0, -1.0);
767 elm_box_pack_end(bx, sc);
768
769 en = elm_entry_add(win);
770 elm_entry_single_line_set(en, 1);
771 elm_entry_entry_set(en, "This is a single line");
772 evas_object_size_hint_weight_set(en, 1.0, 0.0);
773 evas_object_size_hint_align_set(en, -1.0, 0.0);
774 elm_entry_select_all(en);
775 elm_scroller_content_set(sc, en);
776 evas_object_show(en);
777
778 evas_object_show(sc);
779
780 sc = elm_scroller_add(win);
781 elm_scroller_content_min_limit(sc, 0, 1);
782 elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
783 evas_object_size_hint_weight_set(sc, 1.0, 0.0);
784 evas_object_size_hint_align_set(sc, -1.0, -1.0);
785 elm_box_pack_end(bx, sc);
786
787 en = elm_entry_add(win);
788 elm_entry_password_set(en, 1);
789 elm_entry_entry_set(en, "Password here");
790 evas_object_size_hint_weight_set(en, 1.0, 0.0);
791 evas_object_size_hint_align_set(en, -1.0, 0.0);
792 elm_scroller_content_set(sc, en);
793 evas_object_show(en);
794
795 evas_object_show(sc);
796
797 sc = elm_scroller_add(win);
798 evas_object_size_hint_weight_set(sc, 1.0, 1.0);
799 evas_object_size_hint_align_set(sc, -1.0, -1.0);
800 elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
801 elm_box_pack_end(bx, sc);
802
803 en = elm_entry_add(win);
804 elm_entry_entry_set(en,
805 "This is an entry widget in this window that<br>"
806 "uses markup <b>like this</> for styling and<br>"
807 "formatting <em>like this</>, as well as<br>"
808 "<a href=X><link>links in the text</></a>, so enter text<br>"
809 "in here to edit it. By the way, links are<br>"
810 "called <a href=anc-02>Anchors</a> so you will need<br>"
811 "to refer to them this way. At the end here is a really long line to test line wrapping to see if it works. But just in case this line is not long enough I will add more here to really test it out, as Elementary really needs some good testing to see if entry widgets work as advertised.");
812 evas_object_size_hint_weight_set(en, 1.0, 1.0);
813 evas_object_size_hint_align_set(en, -1.0, -1.0);
814 elm_scroller_content_set(sc, en);
815 evas_object_show(en);
816
817 evas_object_show(sc);
818
819 bx2 = elm_box_add(win);
820 elm_box_horizontal_set(bx2, 1);
821 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
822 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
823
824 bt = elm_button_add(win);
825 elm_button_label_set(bt, "Clear");
826 evas_object_smart_callback_add(bt, "clicked", my_entry_bt_1, en);
827 evas_object_size_hint_align_set(bt, -1.0, -1.0);
828 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
829 elm_box_pack_end(bx2, bt);
830 evas_object_show(bt);
831
832 bt = elm_button_add(win);
833 elm_button_label_set(bt, "Print");
834 evas_object_smart_callback_add(bt, "clicked", my_entry_bt_2, en);
835 evas_object_size_hint_align_set(bt, -1.0, -1.0);
836 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
837 elm_box_pack_end(bx2, bt);
838 evas_object_show(bt);
839
840 bt = elm_button_add(win);
841 elm_button_label_set(bt, "Selection");
842 evas_object_smart_callback_add(bt, "clicked", my_entry_bt_3, en);
843 evas_object_size_hint_align_set(bt, -1.0, -1.0);
844 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
845 elm_box_pack_end(bx2, bt);
846 evas_object_show(bt);
847
848 bt = elm_button_add(win);
849 elm_button_label_set(bt, "Insert");
850 evas_object_smart_callback_add(bt, "clicked", my_entry_bt_4, en);
851 evas_object_size_hint_align_set(bt, -1.0, -1.0);
852 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
853 elm_box_pack_end(bx2, bt);
854 evas_object_show(bt);
855
856 elm_box_pack_end(bx, bx2);
857 evas_object_show(bx2);
858
859 evas_object_resize(win, 320, 300);
860
861 elm_object_focus(win);
862 evas_object_show(win);
863}
864
865static void
866my_notepad_bt_1(void *data, Evas_Object *obj, void *event_info)
867{
868 Evas_Object *np = data;
869}
870
871static void
872my_notepad_bt_2(void *data, Evas_Object *obj, void *event_info)
873{
874 Evas_Object *np = data;
875}
876
877static void
878my_notepad_bt_3(void *data, Evas_Object *obj, void *event_info)
879{
880 Evas_Object *np = data;
881}
882
883static void
884my_bt_15(void *data, Evas_Object *obj, void *event_info)
885{
886 Evas_Object *win, *bg, *bx, *bx2, *bt, *ic, *np;
887 char buf[PATH_MAX];
888
889 win = elm_win_add(NULL, "notepad", ELM_WIN_BASIC);
890 elm_win_title_set(win, "Notepad");
891 elm_win_autodel_set(win, 1);
892
893 bg = elm_bg_add(win);
894 elm_win_resize_object_add(win, bg);
895 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
896 evas_object_show(bg);
897
898 bx = elm_box_add(win);
899 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
900 elm_win_resize_object_add(win, bx);
901 evas_object_show(bx);
902
903 np = elm_notepad_add(win);
904 elm_notepad_file_set(np, "note.txt", ELM_TEXT_FORMAT_PLAIN_UTF8);
905 evas_object_size_hint_weight_set(np, 1.0, 1.0);
906 evas_object_size_hint_align_set(np, -1.0, -1.0);
907 elm_box_pack_end(bx, np);
908 evas_object_show(np);
909
910 bx2 = elm_box_add(win);
911 elm_box_horizontal_set(bx2, 1);
912 elm_box_homogenous_set(bx2, 1);
913 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
914 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
915
916 bt = elm_button_add(win);
917 ic = elm_icon_add(win);
918 elm_icon_standard_set(ic, "arrow_left");
919 elm_icon_scale_set(ic, 1, 0);
920 elm_button_icon_set(bt, ic);
921 evas_object_show(ic);
922 evas_object_smart_callback_add(bt, "clicked", my_notepad_bt_1, np);
923 evas_object_size_hint_align_set(bt, -1.0, -1.0);
924 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
925 elm_box_pack_end(bx2, bt);
926 evas_object_show(bt);
927
928 bt = elm_button_add(win);
929 ic = elm_icon_add(win);
930 elm_icon_standard_set(ic, "close");
931 elm_icon_scale_set(ic, 1, 0);
932 elm_button_icon_set(bt, ic);
933 evas_object_show(ic);
934 evas_object_smart_callback_add(bt, "clicked", my_notepad_bt_2, np);
935 evas_object_size_hint_align_set(bt, -1.0, -1.0);
936 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
937 elm_box_pack_end(bx2, bt);
938 evas_object_show(bt);
939
940 bt = elm_button_add(win);
941 ic = elm_icon_add(win);
942 elm_icon_standard_set(ic, "arrow_right");
943 elm_icon_scale_set(ic, 1, 0);
944 elm_button_icon_set(bt, ic);
945 evas_object_show(ic);
946 evas_object_smart_callback_add(bt, "clicked", my_notepad_bt_3, np);
947 evas_object_size_hint_align_set(bt, -1.0, -1.0);
948 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
949 elm_box_pack_end(bx2, bt);
950 evas_object_show(bt);
951
952 elm_box_pack_end(bx, bx2);
953 evas_object_show(bx2);
954
955 evas_object_resize(win, 320, 300);
956
957 elm_object_focus(win);
958 evas_object_show(win);
959}
960
961static void
962my_anchorview_bt(void *data, Evas_Object *obj, void *event_info)
963{
964 Evas_Object *av = data;
965 elm_anchorview_hover_end(av);
966}
967
968static void
969my_anchorview_anchor(void *data, Evas_Object *obj, void *event_info)
970{
971 Evas_Object *av = data;
972 Elm_Entry_Anchorview_Info *ei = event_info;
973 Evas_Object *bt, *bx;
974
975 bt = elm_button_add(obj);
976 elm_button_label_set(bt, ei->name);
977 elm_hover_content_set(ei->hover, "middle", bt);
978 evas_object_show(bt);
979
980 // hints as to where we probably should put hover contents (buttons etc.).
981 if (ei->hover_top)
982 {
983 bx = elm_box_add(obj);
984 bt = elm_button_add(obj);
985 elm_button_label_set(bt, "Top 1");
986 elm_box_pack_end(bx, bt);
987 evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
988 evas_object_show(bt);
989 bt = elm_button_add(obj);
990 elm_button_label_set(bt, "Top 2");
991 elm_box_pack_end(bx, bt);
992 evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
993 evas_object_show(bt);
994 bt = elm_button_add(obj);
995 elm_button_label_set(bt, "Top 3");
996 elm_box_pack_end(bx, bt);
997 evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
998 evas_object_show(bt);
999 elm_hover_content_set(ei->hover, "top", bx);
1000 evas_object_show(bx);
1001 }
1002 if (ei->hover_bottom)
1003 {
1004 bt = elm_button_add(obj);
1005 elm_button_label_set(bt, "Bot");
1006 elm_hover_content_set(ei->hover, "bottom", bt);
1007 evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
1008 evas_object_show(bt);
1009 }
1010 if (ei->hover_left)
1011 {
1012 bt = elm_button_add(obj);
1013 elm_button_label_set(bt, "Left");
1014 elm_hover_content_set(ei->hover, "left", bt);
1015 evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
1016 evas_object_show(bt);
1017 }
1018 if (ei->hover_right)
1019 {
1020 bt = elm_button_add(obj);
1021 elm_button_label_set(bt, "Right");
1022 elm_hover_content_set(ei->hover, "right", bt);
1023 evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
1024 evas_object_show(bt);
1025 }
1026}
1027
1028static void
1029my_bt_16(void *data, Evas_Object *obj, void *event_info)
1030{
1031 Evas_Object *win, *bg, *av;
1032 char buf[PATH_MAX];
1033
1034 win = elm_win_add(NULL, "anchorview", ELM_WIN_BASIC);
1035 elm_win_title_set(win, "Anchorview");
1036 elm_win_autodel_set(win, 1);
1037
1038 bg = elm_bg_add(win);
1039 elm_win_resize_object_add(win, bg);
1040 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1041 evas_object_show(bg);
1042
1043 av = elm_anchorview_add(win);
1044 elm_anchorview_hover_style_set(av, "popout");
1045 elm_anchorview_hover_parent_set(av, win);
1046 elm_anchorview_text_set(av,
1047 "This is an entry widget in this window that<br>"
1048 "uses markup <b>like this</> for styling and<br>"
1049 "formatting <em>like this</>, as well as<br>"
1050 "<a href=X><link>links in the text</></a>, so enter text<br>"
1051 "in here to edit it. By the way, links are<br>"
1052 "called <a href=anc-02>Anchors</a> so you will need<br>"
1053 "to refer to them this way.");
1054 evas_object_size_hint_weight_set(av, 1.0, 1.0);
1055 evas_object_smart_callback_add(av, "anchor,clicked", my_anchorview_anchor, av);
1056 elm_win_resize_object_add(win, av);
1057 evas_object_show(av);
1058
1059 evas_object_resize(win, 320, 300);
1060
1061 elm_object_focus(win);
1062 evas_object_show(win);
1063}
1064
1065static void
1066my_anchorblock_bt(void *data, Evas_Object *obj, void *event_info)
1067{
1068 Evas_Object *av = data;
1069 elm_anchorblock_hover_end(av);
1070}
1071
1072static void
1073my_anchorblock_anchor(void *data, Evas_Object *obj, void *event_info)
1074{
1075 Evas_Object *av = data;
1076 Elm_Entry_Anchorblock_Info *ei = event_info;
1077 Evas_Object *bt, *bx;
1078
1079 bt = elm_button_add(obj);
1080 elm_button_label_set(bt, ei->name);
1081 elm_hover_content_set(ei->hover, "middle", bt);
1082 evas_object_show(bt);
1083
1084 // hints as to where we probably should put hover contents (buttons etc.).
1085 if (ei->hover_top)
1086 {
1087 bx = elm_box_add(obj);
1088 bt = elm_button_add(obj);
1089 elm_button_label_set(bt, "Top 1");
1090 elm_box_pack_end(bx, bt);
1091 evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
1092 evas_object_show(bt);
1093 bt = elm_button_add(obj);
1094 elm_button_label_set(bt, "Top 2");
1095 elm_box_pack_end(bx, bt);
1096 evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
1097 evas_object_show(bt);
1098 bt = elm_button_add(obj);
1099 elm_button_label_set(bt, "Top 3");
1100 elm_box_pack_end(bx, bt);
1101 evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
1102 evas_object_show(bt);
1103 elm_hover_content_set(ei->hover, "top", bx);
1104 evas_object_show(bx);
1105 }
1106 if (ei->hover_bottom)
1107 {
1108 bt = elm_button_add(obj);
1109 elm_button_label_set(bt, "Bot");
1110 elm_hover_content_set(ei->hover, "bottom", bt);
1111 evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
1112 evas_object_show(bt);
1113 }
1114 if (ei->hover_left)
1115 {
1116 bt = elm_button_add(obj);
1117 elm_button_label_set(bt, "Left");
1118 elm_hover_content_set(ei->hover, "left", bt);
1119 evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
1120 evas_object_show(bt);
1121 }
1122 if (ei->hover_right)
1123 {
1124 bt = elm_button_add(obj);
1125 elm_button_label_set(bt, "Right");
1126 elm_hover_content_set(ei->hover, "right", bt);
1127 evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
1128 evas_object_show(bt);
1129 }
1130}
1131
1132static void
1133my_anchorblock_edge_left(void *data, Evas_Object *obj, void *event_info)
1134{
1135 printf("left\n");
1136}
1137
1138static void
1139my_anchorblock_edge_right(void *data, Evas_Object *obj, void *event_info)
1140{
1141 printf("right\n");
1142}
1143
1144static void
1145my_anchorblock_edge_top(void *data, Evas_Object *obj, void *event_info)
1146{
1147 printf("top\n");
1148}
1149
1150static void
1151my_anchorblock_edge_bottom(void *data, Evas_Object *obj, void *event_info)
1152{
1153 printf("bottom\n");
1154}
1155
1156static void
1157my_anchorblock_scroll(void *data, Evas_Object *obj, void *event_info)
1158{
1159 Evas_Coord x, y, w, h, vw, vh;
1160
1161 elm_scroller_region_get(obj, &x, &y, &w, &h);
1162 elm_scroller_child_size_get(obj, &vw, &vh);
1163 printf("scroll %ix%i +%i+%i in %ix%i\n", w, h, x, y, vw, vh);
1164}
1165
1166static void
1167my_bt_17(void *data, Evas_Object *obj, void *event_info)
1168{
1169 Evas_Object *win, *bg, *av, *sc, *bx, *bb, *ic;
1170 char buf[PATH_MAX];
1171
1172 win = elm_win_add(NULL, "anchorblock", ELM_WIN_BASIC);
1173 elm_win_title_set(win, "Anchorblock");
1174 elm_win_autodel_set(win, 1);
1175
1176 bg = elm_bg_add(win);
1177 elm_win_resize_object_add(win, bg);
1178 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1179 evas_object_show(bg);
1180
1181 sc = elm_scroller_add(win);
1182 evas_object_size_hint_weight_set(sc, 1.0, 1.0);
1183 elm_win_resize_object_add(win, sc);
1184
1185 evas_object_smart_callback_add(sc, "edge_left", my_anchorblock_edge_left, NULL);
1186 evas_object_smart_callback_add(sc, "edge_right", my_anchorblock_edge_right, NULL);
1187 evas_object_smart_callback_add(sc, "edge_top", my_anchorblock_edge_top, NULL);
1188 evas_object_smart_callback_add(sc, "edge_bottom", my_anchorblock_edge_bottom, NULL);
1189 evas_object_smart_callback_add(sc, "scroll", my_anchorblock_scroll, NULL);
1190
1191 bx = elm_box_add(win);
1192 evas_object_size_hint_weight_set(bx, 1.0, 0.0);
1193 evas_object_size_hint_align_set(bx, -1.0, -1.0);
1194 elm_scroller_content_set(sc, bx);
1195 evas_object_show(bx);
1196
1197 ic = elm_icon_add(win);
1198 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1199 elm_icon_file_set(ic, buf, NULL);
1200 elm_icon_scale_set(ic, 0, 0);
1201 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1202
1203 bb = elm_bubble_add(win);
1204 elm_bubble_label_set(bb, "Message 3");
1205 elm_bubble_info_set(bb, "10:32 4/11/2008");
1206 elm_bubble_icon_set(bb, ic);
1207 evas_object_show(ic);
1208 evas_object_size_hint_weight_set(bb, 1.0, 0.0);
1209 evas_object_size_hint_align_set(bb, -1.0,-1.0);
1210 av = elm_anchorblock_add(win);
1211 elm_anchorblock_hover_style_set(av, "popout");
1212 elm_anchorblock_hover_parent_set(av, win);
1213 elm_anchorblock_text_set(av,
1214 "Hi there. This is the most recent message in the "
1215 "list of messages. It has one <a href=tel:+614321234>+61 432 1234</a> "
1216 "(phone number) to click on.");
1217 evas_object_smart_callback_add(av, "anchor,clicked", my_anchorblock_anchor, av);
1218 elm_bubble_content_set(bb, av);
1219 evas_object_show(av);
1220 elm_box_pack_end(bx, bb);
1221 evas_object_show(bb);
1222
1223 ic = elm_icon_add(win);
1224 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1225 elm_icon_file_set(ic, buf, NULL);
1226 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1227
1228 bb = elm_bubble_add(win);
1229 elm_bubble_label_set(bb, "Message 2");
1230 elm_bubble_info_set(bb, "7:16 27/10/2008");
1231 elm_bubble_icon_set(bb, ic);
1232 evas_object_show(ic);
1233 evas_object_size_hint_weight_set(bb, 1.0, 0.0);
1234 evas_object_size_hint_align_set(bb, -1.0,-1.0);
1235 av = elm_anchorblock_add(win);
1236 elm_anchorblock_hover_style_set(av, "popout");
1237 elm_anchorblock_hover_parent_set(av, win);
1238 elm_anchorblock_text_set(av,
1239 "Hey what are you doing? This is the second last message "
1240 "Hi there. This is the most recent message in the "
1241 "list. It's a longer one so it can wrap more and "
1242 "contains a <a href=contact:john>John</a> contact "
1243 "link in it to test popups on links. The idea is that "
1244 "all SMS's are scanned for things that look like phone "
1245 "numbers or names that are in your contacts list, and "
1246 "if they are, they become clickable links that pop up "
1247 "a menus of obvious actions to perform on this piece "
1248 "of information. This of course can be later explicitly "
1249 "done by links maybe running local apps or even being "
1250 "web URL's too that launch the web browser and point it "
1251 "to that URL.");
1252 evas_object_smart_callback_add(av, "anchor,clicked", my_anchorblock_anchor, av);
1253 elm_bubble_content_set(bb, av);
1254 evas_object_show(av);
1255 elm_box_pack_end(bx, bb);
1256 evas_object_show(bb);
1257
1258 ic = elm_icon_add(win);
1259 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1260 elm_icon_file_set(ic, buf, NULL);
1261 elm_icon_scale_set(ic, 0, 0);
1262 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1263
1264 bb = elm_bubble_add(win);
1265 elm_bubble_label_set(bb, "Message 1");
1266 elm_bubble_info_set(bb, "20:47 18/6/2008");
1267 elm_bubble_icon_set(bb, ic);
1268 evas_object_show(ic);
1269 evas_object_size_hint_weight_set(bb, 1.0, 0.0);
1270 evas_object_size_hint_align_set(bb, -1.0,-1.0);
1271 av = elm_anchorblock_add(win);
1272 elm_anchorblock_hover_style_set(av, "popout");
1273 elm_anchorblock_hover_parent_set(av, win);
1274 elm_anchorblock_text_set(av,
1275 "This is a short message");
1276 evas_object_smart_callback_add(av, "anchor,clicked", my_anchorblock_anchor, av);
1277 elm_bubble_content_set(bb, av);
1278 evas_object_show(av);
1279 elm_box_pack_end(bx, bb);
1280 evas_object_show(bb);
1281
1282 evas_object_show(sc);
1283
1284 evas_object_resize(win, 320, 300);
1285
1286 elm_object_focus(win);
1287 evas_object_show(win);
1288}
1289
1290static void
1291tb_1(void *data, Evas_Object *obj, void *event_info)
1292{
1293 char buf[PATH_MAX];
1294 snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", PACKAGE_DATA_DIR);
1295 elm_photo_file_set(data, buf);
1296}
1297
1298static void
1299tb_2(void *data, Evas_Object *obj, void *event_info)
1300{
1301 char buf[PATH_MAX];
1302 snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", PACKAGE_DATA_DIR);
1303 elm_photo_file_set(data, buf);
1304}
1305
1306static void
1307tb_3(void *data, Evas_Object *obj, void *event_info)
1308{
1309 char buf[PATH_MAX];
1310 snprintf(buf, sizeof(buf), "%s/images/wood_01.jpg", PACKAGE_DATA_DIR);
1311 elm_photo_file_set(data, buf);
1312}
1313
1314static void
1315tb_4(void *data, Evas_Object *obj, void *event_info)
1316{
1317 char buf[PATH_MAX];
1318 snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", PACKAGE_DATA_DIR);
1319 elm_photo_file_set(data, buf);
1320}
1321
1322static void
1323tb_5(void *data, Evas_Object *obj, void *event_info)
1324{
1325 elm_photo_file_set(data, NULL);
1326}
1327
1328static void
1329my_bt_18(void *data, Evas_Object *obj, void *event_info)
1330{
1331 Evas_Object *win, *bg, *bx, *tb, *ic, *ph;
1332 Evas_Object *ph1, *ph2, *ph3, *ph4;
1333 char buf[PATH_MAX];
1334
1335 win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC);
1336 elm_win_title_set(win, "Toolbar");
1337 elm_win_autodel_set(win, 1);
1338
1339 bg = elm_bg_add(win);
1340 elm_win_resize_object_add(win, bg);
1341 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1342 evas_object_show(bg);
1343
1344 bx = elm_box_add(win);
1345 elm_win_resize_object_add(win, bx);
1346 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
1347 evas_object_show(bx);
1348
1349 tb = elm_toolbar_add(win);
1350 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
1351 evas_object_size_hint_align_set(tb, -1.0, 0.0);
1352
1353 ph1 = elm_photo_add(win);
1354 ph2 = elm_photo_add(win);
1355 ph3 = elm_photo_add(win);
1356 ph4 = elm_photo_add(win);
1357
1358 ic = elm_icon_add(win);
1359 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1360 elm_icon_file_set(ic, buf, NULL);
1361 elm_toolbar_item_add(tb, ic, "Hello", tb_1, ph1);
1362
1363 ic = elm_icon_add(win);
1364 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1365 elm_icon_file_set(ic, buf, NULL);
1366 elm_toolbar_item_add(tb, ic, "World", tb_2, ph1);
1367
1368 ic = elm_icon_add(win);
1369 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1370 elm_icon_file_set(ic, buf, NULL);
1371 elm_toolbar_item_add(tb, ic, "Here", tb_3, ph4);
1372
1373 ic = elm_icon_add(win);
1374 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1375 elm_icon_file_set(ic, buf, NULL);
1376 elm_toolbar_item_add(tb, ic, "Comes", tb_4, ph4);
1377
1378 ic = elm_icon_add(win);
1379 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1380 elm_icon_file_set(ic, buf, NULL);
1381 elm_toolbar_item_add(tb, ic, "Elementary", tb_5, ph4);
1382
1383 elm_box_pack_end(bx, tb);
1384 evas_object_show(tb);
1385
1386 tb = elm_table_add(win);
1387// elm_table_homogenous_set(tb, 1);
1388 evas_object_size_hint_weight_set(tb, 0.0, 1.0);
1389 evas_object_size_hint_align_set(tb, -1.0, -1.0);
1390
1391 ph = ph1;
1392 elm_photo_size_set(ph, 40);
1393 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
1394 elm_photo_file_set(ph, buf);
1395 evas_object_size_hint_weight_set(ph, 1.0, 1.0);
1396 evas_object_size_hint_align_set(ph, 0.5, 0.5);
1397 elm_table_pack(tb, ph, 0, 0, 1, 1);
1398 evas_object_show(ph);
1399
1400 ph = ph2;
1401 elm_photo_size_set(ph, 80);
1402 evas_object_size_hint_weight_set(ph, 1.0, 1.0);
1403 evas_object_size_hint_align_set(ph, 0.5, 0.5);
1404 elm_table_pack(tb, ph, 1, 0, 1, 1);
1405 evas_object_show(ph);
1406
1407 ph = ph3;
1408 elm_photo_size_set(ph, 20);
1409 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", PACKAGE_DATA_DIR);
1410 elm_photo_file_set(ph, buf);
1411 evas_object_size_hint_weight_set(ph, 1.0, 1.0);
1412 evas_object_size_hint_align_set(ph, 0.5, 0.5);
1413 elm_table_pack(tb, ph, 0, 1, 1, 1);
1414 evas_object_show(ph);
1415
1416 ph = ph4;
1417 elm_photo_size_set(ph, 60);
1418 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
1419 elm_photo_file_set(ph, buf);
1420 evas_object_size_hint_weight_set(ph, 1.0, 1.0);
1421 evas_object_size_hint_align_set(ph, 0.5, 0.5);
1422 elm_table_pack(tb, ph, 1, 1, 1, 1);
1423 evas_object_show(ph);
1424
1425 elm_box_pack_end(bx, tb);
1426 evas_object_show(tb);
1427
1428 evas_object_resize(win, 320, 300);
1429
1430 evas_object_show(win);
1431}
1432
1433static void
1434my_bt_19(void *data, Evas_Object *obj, void *event_info)
1435{
1436 Evas_Object *win, *bg, *bx, *bt, *ic;
1437 char buf[PATH_MAX];
1438
1439 win = elm_win_add(NULL, "hoversel", ELM_WIN_BASIC);
1440 elm_win_title_set(win, "Hoversel");
1441 elm_win_autodel_set(win, 1);
1442
1443 bg = elm_bg_add(win);
1444 elm_win_resize_object_add(win, bg);
1445 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1446 evas_object_show(bg);
1447
1448 bx = elm_box_add(win);
1449 elm_win_resize_object_add(win, bx);
1450 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
1451 evas_object_show(bx);
1452
1453 bt = elm_hoversel_add(win);
1454 elm_hoversel_hover_parent_set(bt, win);
1455 elm_hoversel_label_set(bt, "Labels");
1456 elm_hoversel_item_add(bt, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
1457 elm_hoversel_item_add(bt, "Item 2", NULL, ELM_ICON_NONE, NULL, NULL);
1458 elm_hoversel_item_add(bt, "Item 3", NULL, ELM_ICON_NONE, NULL, NULL);
1459 elm_hoversel_item_add(bt, "Item 4 - Long Label Here", NULL, ELM_ICON_NONE, NULL, NULL);
1460 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
1461 evas_object_size_hint_align_set(bt, 0.5, 0.5);
1462 elm_box_pack_end(bx, bt);
1463 evas_object_show(bt);
1464
1465 bt = elm_hoversel_add(win);
1466 elm_hoversel_hover_parent_set(bt, win);
1467 elm_hoversel_label_set(bt, "Some Icons");
1468 elm_hoversel_item_add(bt, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
1469 elm_hoversel_item_add(bt, "Item 2", NULL, ELM_ICON_NONE, NULL, NULL);
1470 elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL);
1471 elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL);
1472 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
1473 evas_object_size_hint_align_set(bt, 0.5, 0.5);
1474 elm_box_pack_end(bx, bt);
1475 evas_object_show(bt);
1476
1477 bt = elm_hoversel_add(win);
1478 elm_hoversel_hover_parent_set(bt, win);
1479 elm_hoversel_label_set(bt, "All Icons");
1480 elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL);
1481 elm_hoversel_item_add(bt, "Item 2", "arrow_down", ELM_ICON_STANDARD, NULL, NULL);
1482 elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL);
1483 elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL);
1484 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
1485 evas_object_size_hint_align_set(bt, 0.5, 0.5);
1486 elm_box_pack_end(bx, bt);
1487 evas_object_show(bt);
1488
1489 bt = elm_hoversel_add(win);
1490 elm_hoversel_hover_parent_set(bt, win);
1491 elm_hoversel_label_set(bt, "All Icons");
1492 elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL);
1493 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
1494 elm_hoversel_item_add(bt, "Item 2", buf, ELM_ICON_FILE, NULL, NULL);
1495 elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL);
1496 elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL);
1497 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
1498 evas_object_size_hint_align_set(bt, 0.5, 0.5);
1499 elm_box_pack_end(bx, bt);
1500 evas_object_show(bt);
1501
1502 bt = elm_hoversel_add(win);
1503 elm_hoversel_hover_parent_set(bt, win);
1504 elm_hoversel_label_set(bt, "Icon + Label");
1505
1506 ic = elm_icon_add(win);
1507 snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", PACKAGE_DATA_DIR);
1508 elm_icon_file_set(ic, buf, NULL);
1509 elm_hoversel_icon_set(bt, ic);
1510 evas_object_show(ic);
1511
1512 elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL);
1513 elm_hoversel_item_add(bt, "Item 2", "arrow_down", ELM_ICON_STANDARD, NULL, NULL);
1514 elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL);
1515 elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL);
1516 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
1517 evas_object_size_hint_align_set(bt, 0.5, 0.5);
1518 elm_box_pack_end(bx, bt);
1519 evas_object_show(bt);
1520
1521 evas_object_resize(win, 320, 300);
1522
1523 evas_object_show(win);
1524}
1525
1526static void
1527my_bt_20(void *data, Evas_Object *obj, void *event_info)
1528{
1529 Evas_Object *win, *bg, *li, *ic, *ic2, *bx;
1530 char buf[PATH_MAX];
1531
1532 win = elm_win_add(NULL, "list", ELM_WIN_BASIC);
1533 elm_win_title_set(win, "List");
1534 elm_win_autodel_set(win, 1);
1535
1536 bg = elm_bg_add(win);
1537 elm_win_resize_object_add(win, bg);
1538 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1539 evas_object_show(bg);
1540
1541 li = elm_list_add(win);
1542 elm_win_resize_object_add(win, li);
1543 evas_object_size_hint_weight_set(li, 1.0, 1.0);
1544
1545 ic = elm_icon_add(win);
1546 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1547 elm_icon_file_set(ic, buf, NULL);
1548 elm_icon_scale_set(ic, 1, 1);
1549 elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL);
1550 ic = elm_icon_add(win);
1551 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1552 elm_icon_scale_set(ic, 0, 0);
1553 elm_icon_file_set(ic, buf, NULL);
1554 elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
1555 ic = elm_icon_add(win);
1556 elm_icon_standard_set(ic, "edit");
1557 elm_icon_scale_set(ic, 0, 0);
1558 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
1559
1560 ic = elm_icon_add(win);
1561 elm_icon_standard_set(ic, "delete");
1562 elm_icon_scale_set(ic, 0, 0);
1563 ic2 = elm_icon_add(win);
1564 elm_icon_standard_set(ic2, "clock");
1565 elm_icon_scale_set(ic2, 0, 0);
1566 elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
1567
1568 bx = elm_box_add(win);
1569 elm_box_horizontal_set(bx, 1);
1570
1571 ic = elm_icon_add(win);
1572 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1573 elm_icon_file_set(ic, buf, NULL);
1574 elm_icon_scale_set(ic, 0, 0);
1575 evas_object_size_hint_align_set(ic, 0.5, 0.5);
1576 elm_box_pack_end(bx, ic);
1577 evas_object_show(ic);
1578
1579 ic = elm_icon_add(win);
1580 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1581 elm_icon_file_set(ic, buf, NULL);
1582 elm_icon_scale_set(ic, 0, 0);
1583 evas_object_size_hint_align_set(ic, 0.5, 0.0);
1584 elm_box_pack_end(bx, ic);
1585 evas_object_show(ic);
1586
1587 ic = elm_icon_add(win);
1588 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1589 elm_icon_file_set(ic, buf, NULL);
1590 elm_icon_scale_set(ic, 0, 0);
1591 evas_object_size_hint_align_set(ic, 0.0, 1.0);
1592 elm_box_pack_end(bx, ic);
1593 evas_object_show(ic);
1594 elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
1595
1596 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
1597 elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
1598 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
1599 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
1600 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
1601 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
1602 elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
1603 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
1604 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
1605 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
1606 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
1607 elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL);
1608 elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL);
1609
1610 elm_list_go(li);
1611
1612 evas_object_show(li);
1613
1614 evas_object_resize(win, 320, 300);
1615 evas_object_show(win);
1616}
1617
1618static void
1619my_li2_clear(void *data, Evas_Object *obj, void *event_info)
1620{
1621 elm_list_clear(data);
1622}
1623
1624static void
1625my_li2_sel(void *data, Evas_Object *obj, void *event_info)
1626{
1627 Elm_List_Item *it = elm_list_selected_item_get(obj);
1628 elm_list_item_selected_set(it, 0);
1629// elm_list_item_selected_set(event_info, 0);
1630}
1631
1632static void
1633my_bt_21(void *data, Evas_Object *obj, void *event_info)
1634{
1635 Evas_Object *win, *bg, *li, *ic, *ic2, *bx, *bx2, *bt;
1636 char buf[PATH_MAX];
1637 Elm_List_Item *it;
1638
1639 win = elm_win_add(NULL, "list-2", ELM_WIN_BASIC);
1640 elm_win_title_set(win, "List 2");
1641 elm_win_autodel_set(win, 1);
1642
1643 bg = elm_bg_add(win);
1644 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
1645 elm_bg_file_set(bg, buf, NULL);
1646 elm_win_resize_object_add(win, bg);
1647 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1648 evas_object_show(bg);
1649
1650 bx = elm_box_add(win);
1651 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
1652 elm_win_resize_object_add(win, bx);
1653 evas_object_show(bx);
1654
1655 li = elm_list_add(win);
1656 evas_object_size_hint_align_set(li, -1.0, -1.0);
1657 evas_object_size_hint_weight_set(li, 1.0, 1.0);
1658 elm_list_horizontal_mode_set(li, ELM_LIST_LIMIT);
1659// elm_list_multi_select_set(li, 1);
1660
1661 ic = elm_icon_add(win);
1662 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1663 elm_icon_file_set(ic, buf, NULL);
1664 it = elm_list_item_append(li, "Hello", ic, NULL, my_li2_sel, NULL);
1665 elm_list_item_selected_set(it, 1);
1666 ic = elm_icon_add(win);
1667 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1668 elm_icon_scale_set(ic, 0, 0);
1669 elm_icon_file_set(ic, buf, NULL);
1670 elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
1671 ic = elm_icon_add(win);
1672 elm_icon_standard_set(ic, "edit");
1673 elm_icon_scale_set(ic, 0, 0);
1674 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
1675
1676 ic = elm_icon_add(win);
1677 elm_icon_standard_set(ic, "delete");
1678 elm_icon_scale_set(ic, 0, 0);
1679 ic2 = elm_icon_add(win);
1680 elm_icon_standard_set(ic2, "clock");
1681 elm_icon_scale_set(ic2, 0, 0);
1682 elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
1683
1684 bx2 = elm_box_add(win);
1685 elm_box_horizontal_set(bx2, 1);
1686
1687 ic = elm_icon_add(win);
1688 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1689 elm_icon_file_set(ic, buf, NULL);
1690 elm_icon_scale_set(ic, 0, 0);
1691 evas_object_size_hint_align_set(ic, 0.5, 0.5);
1692 elm_box_pack_end(bx2, ic);
1693 evas_object_show(ic);
1694
1695 ic = elm_icon_add(win);
1696 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1697 elm_icon_file_set(ic, buf, NULL);
1698 elm_icon_scale_set(ic, 0, 0);
1699 evas_object_size_hint_align_set(ic, 0.5, 0.0);
1700 elm_box_pack_end(bx2, ic);
1701 evas_object_show(ic);
1702 elm_list_item_append(li, "are", bx2, NULL, NULL, NULL);
1703
1704 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
1705 elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
1706 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
1707 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
1708 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
1709 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
1710 elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
1711 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
1712 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
1713 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
1714 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
1715 elm_list_item_append(li, "Longer label.", NULL, NULL, NULL, NULL);
1716
1717 elm_list_go(li);
1718
1719 elm_box_pack_end(bx, li);
1720 evas_object_show(li);
1721
1722 bx2 = elm_box_add(win);
1723 elm_box_horizontal_set(bx2, 1);
1724 elm_box_homogenous_set(bx2, 1);
1725 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
1726 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
1727
1728 bt = elm_button_add(win);
1729 elm_button_label_set(bt, "Clear");
1730 evas_object_smart_callback_add(bt, "clicked", my_li2_clear, li);
1731 evas_object_size_hint_align_set(bt, -1.0, -1.0);
1732 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
1733 elm_box_pack_end(bx2, bt);
1734 evas_object_show(bt);
1735
1736 elm_box_pack_end(bx, bx2);
1737 evas_object_show(bx2);
1738
1739 evas_object_resize(win, 320, 300);
1740 evas_object_show(win);
1741}
1742
1743static void
1744my_bt_22(void *data, Evas_Object *obj, void *event_info)
1745{
1746 Evas_Object *win, *bg, *li, *ic, *ic2, *bx;
1747 char buf[PATH_MAX];
1748
1749 win = elm_win_add(NULL, "list-3", ELM_WIN_BASIC);
1750 elm_win_title_set(win, "List 3");
1751 elm_win_autodel_set(win, 1);
1752
1753 bg = elm_bg_add(win);
1754 elm_win_resize_object_add(win, bg);
1755 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1756 evas_object_show(bg);
1757
1758 li = elm_list_add(win);
1759 elm_win_resize_object_add(win, li);
1760 evas_object_size_hint_weight_set(li, 1.0, 1.0);
1761 elm_list_horizontal_mode_set(li, ELM_LIST_COMPRESS);
1762
1763 ic = elm_icon_add(win);
1764 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1765 elm_icon_file_set(ic, buf, NULL);
1766 elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL);
1767 ic = elm_icon_add(win);
1768 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1769 elm_icon_scale_set(ic, 0, 0);
1770 elm_icon_file_set(ic, buf, NULL);
1771 elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
1772 ic = elm_icon_add(win);
1773 elm_icon_standard_set(ic, "edit");
1774 elm_icon_scale_set(ic, 0, 0);
1775 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
1776
1777 ic = elm_icon_add(win);
1778 elm_icon_standard_set(ic, "delete");
1779 elm_icon_scale_set(ic, 0, 0);
1780 ic2 = elm_icon_add(win);
1781 elm_icon_standard_set(ic2, "clock");
1782 elm_icon_scale_set(ic2, 0, 0);
1783 elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
1784
1785 bx = elm_box_add(win);
1786 elm_box_horizontal_set(bx, 1);
1787
1788 ic = elm_icon_add(win);
1789 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1790 elm_icon_file_set(ic, buf, NULL);
1791 elm_icon_scale_set(ic, 0, 0);
1792 evas_object_size_hint_align_set(ic, 0.5, 0.5);
1793 elm_box_pack_end(bx, ic);
1794 evas_object_show(ic);
1795
1796 ic = elm_icon_add(win);
1797 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1798 elm_icon_file_set(ic, buf, NULL);
1799 elm_icon_scale_set(ic, 0, 0);
1800 evas_object_size_hint_align_set(ic, 0.5, 0.0);
1801 elm_box_pack_end(bx, ic);
1802 evas_object_show(ic);
1803
1804 ic = elm_icon_add(win);
1805 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1806 elm_icon_file_set(ic, buf, NULL);
1807 elm_icon_scale_set(ic, 0, 0);
1808 evas_object_size_hint_align_set(ic, 0.0, 1.0);
1809 elm_box_pack_end(bx, ic);
1810 evas_object_show(ic);
1811 elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
1812
1813 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
1814 elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
1815 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
1816 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
1817 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
1818 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
1819 elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
1820 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
1821 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
1822 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
1823 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
1824 elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL);
1825 elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL);
1826
1827 elm_list_go(li);
1828
1829 evas_object_show(li);
1830
1831 evas_object_resize(win, 320, 300);
1832 evas_object_show(win);
1833}
1834
1835static void
1836my_bt_23(void *data, Evas_Object *obj, void *event_info)
1837{
1838 Evas_Object *win, *bg;
1839 char buf[PATH_MAX];
1840
1841 win = elm_win_add(NULL, "carousel", ELM_WIN_BASIC);
1842 elm_win_title_set(win, "Carousel");
1843 elm_win_autodel_set(win, 1);
1844 4
1845 bg = elm_bg_add(win); 5/* all tests prototypes */
1846 elm_win_resize_object_add(win, bg); 6void test_bg_plain(void *data, Evas_Object *obj, void *event_info);
1847 evas_object_size_hint_weight_set(bg, 1.0, 1.0); 7void test_bg_image(void *data, Evas_Object *obj, void *event_info);
1848 evas_object_show(bg); 8void test_icon(void *data, Evas_Object *obj, void *event_info);
1849 9void test_box_vert(void *data, Evas_Object *obj, void *event_info);
1850 evas_object_resize(win, 320, 240); 10void test_box_horiz(void *data, Evas_Object *obj, void *event_info);
1851 evas_object_show(win); 11void test_button(void *data, Evas_Object *obj, void *event_info);
1852} 12void test_toggle(void *data, Evas_Object *obj, void *event_info);
1853 13void test_clock(void *data, Evas_Object *obj, void *event_info);
1854static void 14void test_check(void *data, Evas_Object *obj, void *event_info);
1855my_bt_24(void *data, Evas_Object *obj, void *event_info) 15void test_radio(void *data, Evas_Object *obj, void *event_info);
1856{ 16void test_layout(void *data, Evas_Object *obj, void *event_info);
1857 Evas_Object *win, *bg, *inwin, *lb; 17void test_hover(void *data, Evas_Object *obj, void *event_info);
1858 char buf[PATH_MAX]; 18void test_hover2(void *data, Evas_Object *obj, void *event_info);
1859 19void test_entry(void *data, Evas_Object *obj, void *event_info);
1860 win = elm_win_add(NULL, "inwin", ELM_WIN_BASIC); 20void test_entry_scrolled(void *data, Evas_Object *obj, void *event_info);
1861 elm_win_title_set(win, "Inwin"); 21void test_notepad(void *data, Evas_Object *obj, void *event_info);
1862 elm_win_autodel_set(win, 1); 22void test_anchorview(void *data, Evas_Object *obj, void *event_info);
1863 23void test_anchorblock(void *data, Evas_Object *obj, void *event_info);
1864 bg = elm_bg_add(win); 24void test_toolbar(void *data, Evas_Object *obj, void *event_info);
1865 elm_win_resize_object_add(win, bg); 25void test_hoversel(void *data, Evas_Object *obj, void *event_info);
1866 evas_object_size_hint_weight_set(bg, 1.0, 1.0); 26void test_list(void *data, Evas_Object *obj, void *event_info);
1867 evas_object_show(bg); 27void test_list2(void *data, Evas_Object *obj, void *event_info);
1868 28void test_list3(void *data, Evas_Object *obj, void *event_info);
1869 inwin = elm_win_inwin_add(win); 29void test_carousel(void *data, Evas_Object *obj, void *event_info);
1870 evas_object_show(inwin); 30void test_inwin(void *data, Evas_Object *obj, void *event_info);
1871 31void test_inwin2(void *data, Evas_Object *obj, void *event_info);
1872 lb = elm_label_add(win); 32void test_scaling(void *data, Evas_Object *obj, void *event_info);
1873 elm_label_label_set(lb, 33void test_scaling2(void *data, Evas_Object *obj, void *event_info);
1874 "This is an \"inwin\" - a window in a<br>" 34void test_slider(void *data, Evas_Object *obj, void *event_info);
1875 "window. This is handy for quick popups<br>" 35void test_genlist(void *data, Evas_Object *obj, void *event_info);
1876 "you want centered, taking over the window<br>" 36void test_genlist2(void *data, Evas_Object *obj, void *event_info);
1877 "until dismissed somehow. Unlike hovers they<br>" 37void test_genlist3(void *data, Evas_Object *obj, void *event_info);
1878 "don't hover over their target."); 38void test_genlist4(void *data, Evas_Object *obj, void *event_info);
1879 elm_win_inwin_content_set(inwin, lb); 39void test_genlist5(void *data, Evas_Object *obj, void *event_info);
1880 evas_object_show(lb); 40void test_genlist6(void *data, Evas_Object *obj, void *event_info);
1881 41void test_table(void *data, Evas_Object *obj, void *event_info);
1882 evas_object_resize(win, 320, 240); 42void test_pager(void *data, Evas_Object *obj, void *event_info);
1883 evas_object_show(win); 43void test_win_state(void *data, Evas_Object *obj, void *event_info);
1884} 44void test_progressbar(void *data, Evas_Object *obj, void *event_info);
1885 45void test_fileselector(void *data, Evas_Object *obj, void *event_info);
1886static void
1887my_bt_25(void *data, Evas_Object *obj, void *event_info)
1888{
1889 Evas_Object *win, *bg, *inwin, *lb;
1890 char buf[PATH_MAX];
1891
1892 win = elm_win_add(NULL, "inwin", ELM_WIN_BASIC);
1893 elm_win_title_set(win, "Inwin");
1894 elm_win_autodel_set(win, 1);
1895
1896 bg = elm_bg_add(win);
1897 elm_win_resize_object_add(win, bg);
1898 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1899 evas_object_show(bg);
1900
1901 inwin = elm_win_inwin_add(win);
1902 elm_object_style_set(inwin, "minimal_vertical");
1903 evas_object_show(inwin);
1904
1905 lb = elm_label_add(win);
1906 elm_label_label_set(lb,
1907 "This is an \"inwin\" - a window in a<br>"
1908 "window. This is handy for quick popups<br>"
1909 "you want centered, taking over the window<br>"
1910 "until dismissed somehow. Unlike hovers they<br>"
1911 "don't hover over their target.<br>"
1912 "<br>"
1913 "This inwin style compacts itself vertically<br>"
1914 "to the size of its contents minimum size.");
1915 elm_win_inwin_content_set(inwin, lb);
1916 evas_object_show(lb);
1917
1918 evas_object_resize(win, 320, 240);
1919 evas_object_show(win);
1920}
1921
1922static void
1923my_bt_26(void *data, Evas_Object *obj, void *event_info)
1924{
1925 Evas_Object *win, *bg, *bx, *bt;
1926 char buf[PATH_MAX];
1927
1928 win = elm_win_add(NULL, "scaling", ELM_WIN_BASIC);
1929 elm_win_title_set(win, "Scaling");
1930 elm_win_autodel_set(win, 1);
1931
1932 bg = elm_bg_add(win);
1933 elm_win_resize_object_add(win, bg);
1934 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1935 evas_object_show(bg);
1936
1937 bx = elm_box_add(win);
1938 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
1939 elm_win_resize_object_add(win, bx);
1940 evas_object_show(bx);
1941
1942 bt = elm_button_add(win);
1943 elm_button_label_set(bt, "Scale: 0.5");
1944 elm_object_scale_set(bt, 0.5);
1945 elm_box_pack_end(bx, bt);
1946 evas_object_show(bt);
1947
1948 bt = elm_button_add(win);
1949 elm_button_label_set(bt, "Scale: 0.75");
1950 elm_object_scale_set(bt, 0.75);
1951 elm_box_pack_end(bx, bt);
1952 evas_object_show(bt);
1953
1954 bt = elm_button_add(win);
1955 elm_button_label_set(bt, "Scale: 1.0");
1956 elm_object_scale_set(bt, 1.0);
1957 elm_box_pack_end(bx, bt);
1958 evas_object_show(bt);
1959
1960 bt = elm_button_add(win);
1961 elm_button_label_set(bt, "Scale: 1.5");
1962 elm_object_scale_set(bt, 1.5);
1963 elm_box_pack_end(bx, bt);
1964 evas_object_show(bt);
1965
1966 bt = elm_button_add(win);
1967 elm_button_label_set(bt, "Scale: 2.0");
1968 elm_object_scale_set(bt, 2.0);
1969 elm_box_pack_end(bx, bt);
1970 evas_object_show(bt);
1971
1972 bt = elm_button_add(win);
1973 elm_button_label_set(bt, "Scale: 3.0");
1974 elm_object_scale_set(bt, 3.0);
1975 elm_box_pack_end(bx, bt);
1976 evas_object_show(bt);
1977
1978 evas_object_resize(win, 320, 320);
1979 evas_object_show(win);
1980}
1981
1982static void
1983my_bt_27(void *data, Evas_Object *obj, void *event_info)
1984{
1985 Evas_Object *win, *bg, *bx, *fr, *lb;
1986 char buf[PATH_MAX];
1987
1988 win = elm_win_add(NULL, "scaling-2", ELM_WIN_BASIC);
1989 elm_win_title_set(win, "Scaling 2");
1990 elm_win_autodel_set(win, 1);
1991
1992 bg = elm_bg_add(win);
1993 elm_win_resize_object_add(win, bg);
1994 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
1995 evas_object_show(bg);
1996
1997 bx = elm_box_add(win);
1998 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
1999 elm_win_resize_object_add(win, bx);
2000 evas_object_show(bx);
2001
2002 fr = elm_frame_add(win);
2003 elm_object_scale_set(fr, 0.5);
2004 elm_frame_label_set(fr, "Scale: 0.5");
2005 lb = elm_label_add(win);
2006 elm_label_label_set(lb,
2007 "Parent frame scale<br>"
2008 "is 0.5. Child should<br>"
2009 "inherit it.");
2010 elm_frame_content_set(fr, lb);
2011 evas_object_show(lb);
2012 elm_box_pack_end(bx, fr);
2013 evas_object_show(fr);
2014
2015 fr = elm_frame_add(win);
2016 elm_frame_label_set(fr, "Scale: 1.0");
2017 lb = elm_label_add(win);
2018 elm_label_label_set(lb,
2019 "Parent frame scale<br>"
2020 "is 1.0. Child should<br>"
2021 "inherit it.");
2022 elm_frame_content_set(fr, lb);
2023 evas_object_show(lb);
2024 elm_object_scale_set(fr, 1.0);
2025 elm_box_pack_end(bx, fr);
2026 evas_object_show(fr);
2027
2028 fr = elm_frame_add(win);
2029 elm_frame_label_set(fr, "Scale: 2.0");
2030 lb = elm_label_add(win);
2031 elm_label_label_set(lb,
2032 "Parent frame scale<br>"
2033 "is 2.0. Child should<br>"
2034 "inherit it.");
2035 elm_frame_content_set(fr, lb);
2036 evas_object_show(lb);
2037 elm_object_scale_set(fr, 2.0);
2038 elm_box_pack_end(bx, fr);
2039 evas_object_show(fr);
2040
2041 evas_object_resize(win, 320, 320);
2042 evas_object_show(win);
2043}
2044
2045static void
2046my_bt_28(void *data, Evas_Object *obj, void *event_info)
2047{
2048 Evas_Object *win, *bg, *bx, *sl, *ic;
2049 char buf[PATH_MAX];
2050
2051 win = elm_win_add(NULL, "slider", ELM_WIN_BASIC);
2052 elm_win_title_set(win, "Slider");
2053 elm_win_autodel_set(win, 1);
2054
2055 bg = elm_bg_add(win);
2056 elm_win_resize_object_add(win, bg);
2057 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
2058 evas_object_show(bg);
2059
2060 bx = elm_box_add(win);
2061 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
2062 elm_win_resize_object_add(win, bx);
2063 evas_object_show(bx);
2064
2065 ic = elm_icon_add(win);
2066 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2067 elm_icon_file_set(ic, buf, NULL);
2068 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2069 sl = elm_slider_add(win);
2070 elm_slider_label_set(sl, "Label");
2071 elm_slider_icon_set(sl, ic);
2072 elm_slider_unit_format_set(sl, "%1.1f units");
2073 elm_slider_span_size_set(sl, 120);
2074 evas_object_size_hint_align_set(sl, -1.0, 0.5);
2075 evas_object_size_hint_weight_set(sl, 1.0, 1.0);
2076 elm_box_pack_end(bx, sl);
2077 evas_object_show(ic);
2078 evas_object_show(sl);
2079
2080 sl = elm_slider_add(win);
2081 elm_slider_label_set(sl, "Label 2");
2082 elm_slider_span_size_set(sl, 80);
2083 evas_object_size_hint_align_set(sl, -1.0, 0.5);
2084 evas_object_size_hint_weight_set(sl, 1.0, 1.0);
2085 elm_slider_indicator_format_set(sl, "%3.0f");
2086 elm_slider_min_max_set(sl, 50, 150);
2087 elm_slider_value_set(sl, 80);
2088 elm_slider_inverted_set(sl, 1);
2089 evas_object_size_hint_align_set(sl, 0.5, 0.5);
2090 evas_object_size_hint_weight_set(sl, 0.0, 0.0);
2091 elm_box_pack_end(bx, sl);
2092 evas_object_show(ic);
2093 evas_object_show(sl);
2094
2095 sl = elm_slider_add(win);
2096 elm_slider_label_set(sl, "Label 3");
2097 elm_slider_unit_format_set(sl, "units");
2098 elm_slider_span_size_set(sl, 40);
2099 evas_object_size_hint_align_set(sl, -1.0, 0.5);
2100 evas_object_size_hint_weight_set(sl, 1.0, 1.0);
2101 elm_slider_indicator_format_set(sl, "%3.0f");
2102 elm_slider_min_max_set(sl, 50, 150);
2103 elm_slider_value_set(sl, 80);
2104 elm_slider_inverted_set(sl, 1);
2105 elm_object_scale_set(sl, 2.0);
2106 elm_box_pack_end(bx, sl);
2107 evas_object_show(ic);
2108 evas_object_show(sl);
2109
2110 ic = elm_icon_add(win);
2111 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2112 elm_icon_file_set(ic, buf, NULL);
2113 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
2114 sl = elm_slider_add(win);
2115 elm_slider_icon_set(sl, ic);
2116 elm_slider_label_set(sl, "Label 4");
2117 elm_slider_unit_format_set(sl, "units");
2118 elm_slider_span_size_set(sl, 60);
2119 evas_object_size_hint_align_set(sl, 0.5, -1.0);
2120 evas_object_size_hint_weight_set(sl, 0.0, 1.0);
2121 elm_slider_indicator_format_set(sl, "%1.1f");
2122 elm_slider_value_set(sl, 0.2);
2123 elm_object_scale_set(sl, 1.0);
2124 elm_slider_horizontal_set(sl, 0);
2125 elm_box_pack_end(bx, sl);
2126 evas_object_show(ic);
2127 evas_object_show(sl);
2128
2129 evas_object_show(win);
2130}
2131
2132static Elm_Genlist_Item_Class itc1;
2133char *gl_label_get(const void *data, Evas_Object *obj, const char *part)
2134{
2135 char buf[256];
2136 snprintf(buf, sizeof(buf), "Item # %i", (int)data);
2137 return strdup(buf);
2138}
2139Evas_Object *gl_icon_get(const void *data, Evas_Object *obj, const char *part)
2140{
2141 char buf[PATH_MAX];
2142 Evas_Object *ic = elm_icon_add(obj);
2143 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2144 elm_icon_file_set(ic, buf, NULL);
2145 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2146 return ic;
2147}
2148Eina_Bool gl_state_get(const void *data, Evas_Object *obj, const char *part)
2149{
2150 return EINA_FALSE;
2151}
2152void gl_del(const void *data, Evas_Object *obj)
2153{
2154}
2155
2156static void
2157gl_sel(void *data, Evas_Object *obj, void *event_info)
2158{
2159 printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", data, obj, event_info);
2160}
2161
2162static void
2163my_bt_29(void *data, Evas_Object *obj, void *event_info)
2164{
2165 Evas_Object *win, *bg, *gl;
2166 Elm_Genlist_Item *gli;
2167 int i;
2168
2169 win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
2170 elm_win_title_set(win, "Genlist");
2171 elm_win_autodel_set(win, 1);
2172
2173 bg = elm_bg_add(win);
2174 elm_win_resize_object_add(win, bg);
2175 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
2176 evas_object_show(bg);
2177
2178 gl = elm_genlist_add(win);
2179 elm_genlist_horizontal_mode_set(gl, ELM_LIST_LIMIT);
2180 elm_win_resize_object_add(win, gl);
2181 evas_object_size_hint_weight_set(gl, 1.0, 1.0);
2182 evas_object_show(gl);
2183
2184 itc1.item_style = "default";
2185 itc1.func.label_get = gl_label_get;
2186 itc1.func.icon_get = gl_icon_get;
2187 itc1.func.state_get = gl_state_get;
2188 itc1.func.del = gl_del;
2189
2190 for (i = 0; i < 2000; i++)
2191 {
2192 gli = elm_genlist_item_append(gl, &itc1,
2193 (void *)i/* item data */,
2194 NULL/* parent */,
2195 ELM_GENLIST_ITEM_NONE,
2196 gl_sel/* func */,
2197 (void *)(i * 10)/* func data */);
2198 }
2199 evas_object_resize(win, 480, 800);
2200 evas_object_show(win);
2201}
2202
2203static void
2204my_gl_clear(void *data, Evas_Object *obj, void *event_info)
2205{
2206 Evas_Object *gl = data;
2207 elm_genlist_clear(gl);
2208}
2209
2210static void
2211my_gl_add(void *data, Evas_Object *obj, void *event_info)
2212{
2213 Evas_Object *gl = data;
2214 Elm_Genlist_Item *gli;
2215 static int i = 0;
2216
2217 itc1.item_style = "default";
2218 itc1.func.label_get = gl_label_get;
2219 itc1.func.icon_get = gl_icon_get;
2220 itc1.func.state_get = gl_state_get;
2221 itc1.func.del = gl_del;
2222
2223 gli = elm_genlist_item_append(gl, &itc1,
2224 (void *)i/* item data */,
2225 NULL/* parent */,
2226 ELM_GENLIST_ITEM_NONE,
2227 gl_sel/* func */,
2228 (void *)(i * 10)/* func data */);
2229 i++;
2230}
2231
2232static void
2233my_gl_del(void *data, Evas_Object *obj, void *event_info)
2234{
2235 Evas_Object *gl = data;
2236 Elm_Genlist_Item *gli = elm_genlist_selected_item_get(gl);
2237 if (!gli)
2238 {
2239 printf("no item selected\n");
2240 return;
2241 }
2242 elm_genlist_item_del(gli);
2243}
2244
2245static void
2246my_gl_disable(void *data, Evas_Object *obj, void *event_info)
2247{
2248 Evas_Object *gl = data;
2249 Elm_Genlist_Item *gli = elm_genlist_selected_item_get(gl);
2250 if (!gli)
2251 {
2252 printf("no item selected\n");
2253 return;
2254 }
2255 elm_genlist_item_disabled_set(gli, 1);
2256 elm_genlist_item_selected_set(gli, 0);
2257 elm_genlist_item_update(gli);
2258}
2259
2260static void
2261my_gl_update_all(void *data, Evas_Object *obj, void *event_info)
2262{
2263 Evas_Object *gl = data;
2264 int i = 0;
2265 Elm_Genlist_Item *it = elm_genlist_first_item_get(gl);
2266 while (it)
2267 {
2268 elm_genlist_item_update(it);
2269 printf("%i\n", i);
2270 i++;
2271 it = elm_genlist_item_next_get(it);
2272 }
2273}
2274
2275static void
2276my_gl_first(void *data, Evas_Object *obj, void *event_info)
2277{
2278 Evas_Object *gl = data;
2279 Elm_Genlist_Item *gli = elm_genlist_first_item_get(gl);
2280 if (!gli) return;
2281 elm_genlist_item_show(gli);
2282 elm_genlist_item_selected_set(gli, 1);
2283}
2284
2285static void
2286my_gl_last(void *data, Evas_Object *obj, void *event_info)
2287{
2288 Evas_Object *gl = data;
2289 Elm_Genlist_Item *gli = elm_genlist_last_item_get(gl);
2290 if (!gli) return;
2291 elm_genlist_item_show(gli);
2292 elm_genlist_item_selected_set(gli, 1);
2293}
2294
2295static void
2296my_bt_30(void *data, Evas_Object *obj, void *event_info)
2297{
2298 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
2299 Elm_Genlist_Item *gli[10];
2300 char buf[PATH_MAX];
2301 int i;
2302
2303 win = elm_win_add(NULL, "genlist-2", ELM_WIN_BASIC);
2304 elm_win_title_set(win, "Genlist 2");
2305 elm_win_autodel_set(win, 1);
2306
2307 bg = elm_bg_add(win);
2308 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
2309 elm_bg_file_set(bg, buf, NULL);
2310 elm_win_resize_object_add(win, bg);
2311 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
2312 evas_object_show(bg);
2313
2314 bx = elm_box_add(win);
2315 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
2316 elm_win_resize_object_add(win, bx);
2317 evas_object_show(bx);
2318
2319 gl = elm_genlist_add(win);
2320 evas_object_size_hint_align_set(gl, -1.0, -1.0);
2321 evas_object_size_hint_weight_set(gl, 1.0, 1.0);
2322 evas_object_show(gl);
2323
2324 itc1.item_style = "default";
2325 itc1.func.label_get = gl_label_get;
2326 itc1.func.icon_get = gl_icon_get;
2327 itc1.func.state_get = gl_state_get;
2328 itc1.func.del = gl_del;
2329
2330 gli[0] = elm_genlist_item_append(gl, &itc1,
2331 (void *)1001/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2332 (void *)1001/* func data */);
2333 gli[1] = elm_genlist_item_append(gl, &itc1,
2334 (void *)1002/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2335 (void *)1002/* func data */);
2336 gli[2] = elm_genlist_item_append(gl, &itc1,
2337 (void *)1003/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2338 (void *)1003/* func data */);
2339 gli[3] = elm_genlist_item_prepend(gl, &itc1,
2340 (void *)1004/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2341 (void *)1004/* func data */);
2342 gli[4] = elm_genlist_item_prepend(gl, &itc1,
2343 (void *)1005/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2344 (void *)1005/* func data */);
2345 gli[5] = elm_genlist_item_insert_before(gl, &itc1,
2346 (void *)1006/* item data */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2347 (void *)1006/* func data */);
2348 gli[6] = elm_genlist_item_insert_after(gl, &itc1,
2349 (void *)1007/* item data */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2350 (void *)1007/* func data */);
2351
2352 elm_box_pack_end(bx, gl);
2353
2354 bx2 = elm_box_add(win);
2355 elm_box_horizontal_set(bx2, 1);
2356 elm_box_homogenous_set(bx2, 1);
2357 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
2358 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
2359
2360 bt = elm_button_add(win);
2361 elm_button_label_set(bt, "/\\");
2362 evas_object_smart_callback_add(bt, "clicked", my_gl_first, gl);
2363 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2364 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2365 elm_box_pack_end(bx2, bt);
2366 evas_object_show(bt);
2367
2368 bt = elm_button_add(win);
2369 elm_button_label_set(bt, "\\/");
2370 evas_object_smart_callback_add(bt, "clicked", my_gl_last, gl);
2371 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2372 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2373 elm_box_pack_end(bx2, bt);
2374 evas_object_show(bt);
2375
2376 bt = elm_button_add(win);
2377 elm_button_label_set(bt, "#");
2378 evas_object_smart_callback_add(bt, "clicked", my_gl_disable, gl);
2379 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2380 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2381 elm_box_pack_end(bx2, bt);
2382 evas_object_show(bt);
2383
2384 bt = elm_button_add(win);
2385 elm_button_label_set(bt, "U");
2386 evas_object_smart_callback_add(bt, "clicked", my_gl_update_all, gl);
2387 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2388 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2389 elm_box_pack_end(bx2, bt);
2390 evas_object_show(bt);
2391
2392 elm_box_pack_end(bx, bx2);
2393 evas_object_show(bx2);
2394
2395 bx2 = elm_box_add(win);
2396 elm_box_horizontal_set(bx2, 1);
2397 elm_box_homogenous_set(bx2, 1);
2398 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
2399 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
2400
2401 bt = elm_button_add(win);
2402 elm_button_label_set(bt, "X");
2403 evas_object_smart_callback_add(bt, "clicked", my_gl_clear, gl);
2404 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2405 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2406 elm_box_pack_end(bx2, bt);
2407 evas_object_show(bt);
2408
2409 bt = elm_button_add(win);
2410 elm_button_label_set(bt, "+");
2411 evas_object_smart_callback_add(bt, "clicked", my_gl_add, gl);
2412 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2413 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2414 elm_box_pack_end(bx2, bt);
2415 evas_object_show(bt);
2416
2417 bt = elm_button_add(win);
2418 elm_button_label_set(bt, "-");
2419 evas_object_smart_callback_add(bt, "clicked", my_gl_del, gl);
2420 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2421 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2422 elm_box_pack_end(bx2, bt);
2423 evas_object_show(bt);
2424
2425 elm_box_pack_end(bx, bx2);
2426 evas_object_show(bx2);
2427
2428 evas_object_resize(win, 320, 320);
2429 evas_object_show(win);
2430}
2431
2432typedef struct _Testitem
2433{
2434 Elm_Genlist_Item *item;
2435 int mode;
2436 int onoff;
2437} Testitem;
2438static Elm_Genlist_Item_Class itc2;
2439char *gl2_label_get(const void *data, Evas_Object *obj, const char *part)
2440{
2441 Testitem *tit = data;
2442 char buf[256];
2443 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
2444 return strdup(buf);
2445}
2446Evas_Object *gl2_icon_get(const void *data, Evas_Object *obj, const char *part)
2447{
2448 Testitem *tit = data;
2449 char buf[PATH_MAX];
2450 Evas_Object *ic = elm_icon_add(obj);
2451 if (!strcmp(part, "elm.swallow.icon"))
2452 {
2453 if ((tit->mode & 0x3) == 0)
2454 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2455 else if ((tit->mode & 0x3) == 1)
2456 snprintf(buf, sizeof(buf), "%s/images/logo.png", PACKAGE_DATA_DIR);
2457 else if ((tit->mode & 0x3) == 2)
2458 snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", PACKAGE_DATA_DIR);
2459 else if ((tit->mode & 0x3) == 3)
2460 snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", PACKAGE_DATA_DIR);
2461 elm_icon_file_set(ic, buf, NULL);
2462 }
2463 else if (!strcmp(part, "elm.swallow.end"))
2464 {
2465 if ((tit->mode & 0x3) == 0)
2466 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", PACKAGE_DATA_DIR);
2467 else if ((tit->mode & 0x3) == 1)
2468 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
2469 else if ((tit->mode & 0x3) == 2)
2470 snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", PACKAGE_DATA_DIR);
2471 else if ((tit->mode & 0x3) == 3)
2472 snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", PACKAGE_DATA_DIR);
2473 elm_icon_file_set(ic, buf, NULL);
2474 }
2475 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2476 return ic;
2477}
2478Eina_Bool gl2_state_get(const void *data, Evas_Object *obj, const char *part)
2479{
2480 return EINA_FALSE;
2481}
2482void gl2_del(const void *data, Evas_Object *obj)
2483{
2484}
2485
2486static void
2487my_gl_update(void *data, Evas_Object *obj, void *event_info)
2488{
2489 Testitem *tit = data;
2490 tit->mode++;
2491 elm_genlist_item_update(tit->item);
2492}
2493
2494static void
2495my_bt_31(void *data, Evas_Object *obj, void *event_info)
2496{
2497 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
2498 static Testitem tit[3];
2499 int i;
2500
2501 win = elm_win_add(NULL, "genlist-3", ELM_WIN_BASIC);
2502 elm_win_title_set(win, "Genlist 3");
2503 elm_win_autodel_set(win, 1);
2504
2505 bg = elm_bg_add(win);
2506 elm_win_resize_object_add(win, bg);
2507 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
2508 evas_object_show(bg);
2509
2510 bx = elm_box_add(win);
2511 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
2512 elm_win_resize_object_add(win, bx);
2513 evas_object_show(bx);
2514
2515 gl = elm_genlist_add(win);
2516 evas_object_size_hint_align_set(gl, -1.0, -1.0);
2517 evas_object_size_hint_weight_set(gl, 1.0, 1.0);
2518 evas_object_show(gl);
2519
2520 itc2.item_style = "default";
2521 itc2.func.label_get = gl2_label_get;
2522 itc2.func.icon_get = gl2_icon_get;
2523 itc2.func.state_get = gl2_state_get;
2524 itc2.func.del = gl2_del;
2525
2526 tit[0].mode = 0;
2527 tit[0].item = elm_genlist_item_append(gl, &itc2,
2528 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2529 NULL/* func data */);
2530 tit[1].mode = 1;
2531 tit[1].item = elm_genlist_item_append(gl, &itc2,
2532 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2533 NULL/* func data */);
2534 tit[2].mode = 2;
2535 tit[2].item = elm_genlist_item_append(gl, &itc2,
2536 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2537 NULL/* func data */);
2538
2539 elm_box_pack_end(bx, gl);
2540 evas_object_show(bx2);
2541
2542 bx2 = elm_box_add(win);
2543 elm_box_horizontal_set(bx2, 1);
2544 elm_box_homogenous_set(bx2, 1);
2545 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
2546 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
2547
2548 bt = elm_button_add(win);
2549 elm_button_label_set(bt, "[1]");
2550 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
2551 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2552 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2553 elm_box_pack_end(bx2, bt);
2554 evas_object_show(bt);
2555
2556 bt = elm_button_add(win);
2557 elm_button_label_set(bt, "[2]");
2558 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
2559 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2560 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2561 elm_box_pack_end(bx2, bt);
2562 evas_object_show(bt);
2563
2564 bt = elm_button_add(win);
2565 elm_button_label_set(bt, "[3]");
2566 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
2567 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2568 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2569 elm_box_pack_end(bx2, bt);
2570 evas_object_show(bt);
2571
2572 elm_box_pack_end(bx, bx2);
2573 evas_object_show(bx2);
2574
2575 evas_object_resize(win, 320, 320);
2576 evas_object_show(win);
2577}
2578
2579static void
2580my_gl_item_check_changed(void *data, Evas_Object *obj, void *event_info)
2581{
2582 Testitem *tit = data;
2583 tit->onoff = elm_check_state_get(obj);
2584 printf("item %p onoff = %i\n", tit, tit->onoff);
2585}
2586
2587static Elm_Genlist_Item_Class itc3;
2588char *gl3_label_get(const void *data, Evas_Object *obj, const char *part)
2589{
2590 Testitem *tit = data;
2591 char buf[256];
2592 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
2593 return strdup(buf);
2594}
2595Evas_Object *gl3_icon_get(const void *data, Evas_Object *obj, const char *part)
2596{
2597 Testitem *tit = data;
2598 char buf[PATH_MAX];
2599 if (!strcmp(part, "elm.swallow.icon"))
2600 {
2601 Evas_Object *bx = elm_box_add(obj);
2602 Evas_Object *ic;
2603 elm_box_horizontal_set(bx, 1);
2604 ic = elm_icon_add(obj);
2605 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2606 elm_icon_file_set(ic, buf, NULL);
2607 elm_icon_scale_set(ic, 0, 0);
2608 evas_object_show(ic);
2609 elm_box_pack_end(bx, ic);
2610 ic = elm_icon_add(obj);
2611 elm_icon_file_set(ic, buf, NULL);
2612 elm_icon_scale_set(ic, 0, 0);
2613 evas_object_show(ic);
2614 elm_box_pack_end(bx, ic);
2615 evas_object_show(bx);
2616 return bx;
2617 }
2618 else if (!strcmp(part, "elm.swallow.end"))
2619 {
2620 Evas_Object *ck;
2621 ck = elm_check_add(obj);
2622 evas_object_propagate_events_set(ck, 0);
2623 elm_check_state_set(ck, tit->onoff);
2624 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed, data);
2625 evas_object_show(ck);
2626 return ck;
2627 }
2628 return NULL;
2629}
2630Eina_Bool gl3_state_get(const void *data, Evas_Object *obj, const char *part)
2631{
2632 return EINA_FALSE;
2633}
2634void gl3_del(const void *data, Evas_Object *obj)
2635{
2636}
2637
2638static void
2639my_bt_32(void *data, Evas_Object *obj, void *event_info)
2640{
2641 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
2642 static Testitem tit[3];
2643 int i;
2644
2645 win = elm_win_add(NULL, "genlist-4", ELM_WIN_BASIC);
2646 elm_win_title_set(win, "Genlist 4");
2647 elm_win_autodel_set(win, 1);
2648
2649 bg = elm_bg_add(win);
2650 elm_win_resize_object_add(win, bg);
2651 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
2652 evas_object_show(bg);
2653
2654 bx = elm_box_add(win);
2655 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
2656 elm_win_resize_object_add(win, bx);
2657 evas_object_show(bx);
2658
2659 gl = elm_genlist_add(win);
2660 elm_genlist_multi_select_set(gl, 1);
2661 evas_object_size_hint_align_set(gl, -1.0, -1.0);
2662 evas_object_size_hint_weight_set(gl, 1.0, 1.0);
2663 evas_object_show(gl);
2664
2665 itc3.item_style = "default";
2666 itc3.func.label_get = gl3_label_get;
2667 itc3.func.icon_get = gl3_icon_get;
2668 itc3.func.state_get = gl3_state_get;
2669 itc3.func.del = gl3_del;
2670
2671 tit[0].mode = 0;
2672 tit[0].item = elm_genlist_item_append(gl, &itc3,
2673 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2674 NULL/* func data */);
2675 tit[1].mode = 1;
2676 tit[1].item = elm_genlist_item_append(gl, &itc3,
2677 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2678 NULL/* func data */);
2679 tit[2].mode = 2;
2680 tit[2].item = elm_genlist_item_append(gl, &itc3,
2681 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
2682 NULL/* func data */);
2683
2684 elm_box_pack_end(bx, gl);
2685 evas_object_show(bx2);
2686
2687 bx2 = elm_box_add(win);
2688 elm_box_horizontal_set(bx2, 1);
2689 elm_box_homogenous_set(bx2, 1);
2690 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
2691 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
2692
2693 bt = elm_button_add(win);
2694 elm_button_label_set(bt, "[1]");
2695 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
2696 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2697 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2698 elm_box_pack_end(bx2, bt);
2699 evas_object_show(bt);
2700
2701 bt = elm_button_add(win);
2702 elm_button_label_set(bt, "[2]");
2703 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
2704 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2705 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2706 elm_box_pack_end(bx2, bt);
2707 evas_object_show(bt);
2708
2709 bt = elm_button_add(win);
2710 elm_button_label_set(bt, "[3]");
2711 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
2712 evas_object_size_hint_align_set(bt, -1.0, -1.0);
2713 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
2714 elm_box_pack_end(bx2, bt);
2715 evas_object_show(bt);
2716
2717 elm_box_pack_end(bx, bx2);
2718 evas_object_show(bx2);
2719
2720 evas_object_resize(win, 320, 320);
2721 evas_object_show(win);
2722}
2723
2724static void
2725my_bt_33(void *data, Evas_Object *obj, void *event_info)
2726{
2727 Evas_Object *win, *bg, *bx, *ic, *ck;
2728 char buf[PATH_MAX];
2729
2730 win = elm_win_add(NULL, "check", ELM_WIN_BASIC);
2731 elm_win_title_set(win, "Checks");
2732 elm_win_autodel_set(win, 1);
2733
2734 bg = elm_bg_add(win);
2735 elm_win_resize_object_add(win, bg);
2736 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
2737 evas_object_show(bg);
2738
2739 bx = elm_box_add(win);
2740 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
2741 elm_win_resize_object_add(win, bx);
2742 evas_object_show(bx);
2743
2744 ic = elm_icon_add(win);
2745 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2746 elm_icon_file_set(ic, buf, NULL);
2747 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2748 ck = elm_check_add(win);
2749 evas_object_size_hint_weight_set(ck, 1.0, 1.0);
2750 evas_object_size_hint_align_set(ck, -1.0, 0.5);
2751 elm_check_label_set(ck, "Icon sized to check");
2752 elm_check_icon_set(ck, ic);
2753 elm_check_state_set(ck, 1);
2754 elm_box_pack_end(bx, ck);
2755 evas_object_show(ck);
2756 evas_object_show(ic);
2757
2758 ic = elm_icon_add(win);
2759 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2760 elm_icon_file_set(ic, buf, NULL);
2761 elm_icon_scale_set(ic, 0, 0);
2762 ck = elm_check_add(win);
2763 elm_check_label_set(ck, "Icon no scale");
2764 elm_check_icon_set(ck, ic);
2765 elm_box_pack_end(bx, ck);
2766 evas_object_show(ck);
2767 evas_object_show(ic);
2768
2769 ck = elm_check_add(win);
2770 elm_check_label_set(ck, "Label Only");
2771 elm_box_pack_end(bx, ck);
2772 evas_object_show(ck);
2773
2774 ic = elm_icon_add(win);
2775 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2776 elm_icon_file_set(ic, buf, NULL);
2777 elm_icon_scale_set(ic, 0, 0);
2778 ck = elm_check_add(win);
2779 elm_check_icon_set(ck, ic);
2780 elm_box_pack_end(bx, ck);
2781 evas_object_show(ck);
2782 evas_object_show(ic);
2783
2784 evas_object_show(win);
2785}
2786
2787static void
2788my_bt_34(void *data, Evas_Object *obj, void *event_info)
2789{
2790 Evas_Object *win, *bg, *bx, *ic, *rd, *rdg;
2791 char buf[PATH_MAX];
2792
2793 win = elm_win_add(NULL, "radio", ELM_WIN_BASIC);
2794 elm_win_title_set(win, "Radios");
2795 elm_win_autodel_set(win, 1);
2796
2797 bg = elm_bg_add(win);
2798 elm_win_resize_object_add(win, bg);
2799 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
2800 evas_object_show(bg);
2801
2802 bx = elm_box_add(win);
2803 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
2804 elm_win_resize_object_add(win, bx);
2805 evas_object_show(bx);
2806
2807 ic = elm_icon_add(win);
2808 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2809 elm_icon_file_set(ic, buf, NULL);
2810 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2811 rd = elm_radio_add(win);
2812 elm_radio_state_value_set(rd, 0);
2813 evas_object_size_hint_weight_set(rd, 1.0, 1.0);
2814 evas_object_size_hint_align_set(rd, -1.0, 0.5);
2815 elm_radio_label_set(rd, "Icon sized to radio");
2816 elm_radio_icon_set(rd, ic);
2817 elm_box_pack_end(bx, rd);
2818 evas_object_show(rd);
2819 evas_object_show(ic);
2820 rdg = rd;
2821
2822 ic = elm_icon_add(win);
2823 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2824 elm_icon_file_set(ic, buf, NULL);
2825 elm_icon_scale_set(ic, 0, 0);
2826 rd = elm_radio_add(win);
2827 elm_radio_state_value_set(rd, 1);
2828 elm_radio_group_add(rd, rdg);
2829 elm_radio_label_set(rd, "Icon no scale");
2830 elm_radio_icon_set(rd, ic);
2831 elm_box_pack_end(bx, rd);
2832 evas_object_show(rd);
2833 evas_object_show(ic);
2834
2835 rd = elm_radio_add(win);
2836 elm_radio_state_value_set(rd, 2);
2837 elm_radio_group_add(rd, rdg);
2838 elm_radio_label_set(rd, "Label Only");
2839 elm_box_pack_end(bx, rd);
2840 evas_object_show(rd);
2841
2842 ic = elm_icon_add(win);
2843 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
2844 elm_icon_file_set(ic, buf, NULL);
2845 elm_icon_scale_set(ic, 0, 0);
2846 rd = elm_radio_add(win);
2847 elm_radio_state_value_set(rd, 3);
2848 elm_radio_group_add(rd, rdg);
2849 elm_radio_icon_set(rd, ic);
2850 elm_box_pack_end(bx, rd);
2851 evas_object_show(rd);
2852 evas_object_show(ic);
2853
2854 elm_radio_value_set(rdg, 2);
2855
2856 evas_object_show(win);
2857}
2858
2859typedef struct _Pginfo Pginfo;
2860
2861struct _Pginfo
2862{
2863 Evas_Object *pager, *pg1, *pg2, *pg3;
2864};
2865
2866static void
2867my_pager_1(void *data, Evas_Object *obj, void *event_info)
2868{
2869 Pginfo *info = data;
2870 elm_pager_content_promote(info->pager, info->pg2);
2871}
2872
2873static void
2874my_pager_2(void *data, Evas_Object *obj, void *event_info)
2875{
2876 Pginfo *info = data;
2877 elm_pager_content_promote(info->pager, info->pg3);
2878}
2879
2880static void
2881my_pager_3(void *data, Evas_Object *obj, void *event_info)
2882{
2883 Pginfo *info = data;
2884 elm_pager_content_promote(info->pager, info->pg1);
2885}
2886
2887static void
2888my_pager_pop(void *data, Evas_Object *obj, void *event_info)
2889{
2890 Pginfo *info = data;
2891 elm_pager_content_pop(info->pager);
2892}
2893
2894static void
2895my_bt_35(void *data, Evas_Object *obj, void *event_info)
2896{
2897 Evas_Object *win, *bg, *pg, *bx, *lb, *bt;
2898 char buf[PATH_MAX];
2899 static Pginfo info;
2900
2901 win = elm_win_add(NULL, "pager", ELM_WIN_BASIC);
2902 elm_win_title_set(win, "Pager");
2903 elm_win_autodel_set(win, 1);
2904
2905 bg = elm_bg_add(win);
2906 elm_win_resize_object_add(win, bg);
2907 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
2908 evas_object_show(bg);
2909
2910 pg = elm_pager_add(win);
2911 elm_win_resize_object_add(win, pg);
2912 evas_object_show(pg);
2913
2914 info.pager = pg;
2915
2916 bx = elm_box_add(win);
2917 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
2918 evas_object_show(bx);
2919
2920 lb = elm_label_add(win);
2921 elm_label_label_set(lb,
2922 "This is page 1 in a pager stack.<br>"
2923 "<br>"
2924 "So what is a pager stack? It is a stack<br>"
2925 "of pages that hold widgets in it. The<br>"
2926 "pages can be pushed and popped on and<br>"
2927 "off the stack, activated and otherwise<br>"
2928 "activated if already in the stack<br>"
2929 "(activated means promoted to the top of<br>"
2930 "the stack).<br>"
2931 "<br>"
2932 "The theme may define the animation how<br>"
2933 "show and hide of pages."
2934 );
2935 elm_box_pack_end(bx, lb);
2936 evas_object_show(lb);
2937 bt = elm_button_add(win);
2938 elm_button_label_set(bt, "Flip to 2");
2939 evas_object_smart_callback_add(bt, "clicked", my_pager_1, &info);
2940 elm_box_pack_end(bx, bt);
2941 evas_object_show(bt);
2942 bt = elm_button_add(win);
2943 elm_button_label_set(bt, "Popme");
2944 evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
2945 elm_box_pack_end(bx, bt);
2946 evas_object_show(bt);
2947 elm_pager_content_push(pg, bx);
2948 info.pg1 = bx;
2949
2950 bx = elm_box_add(win);
2951 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
2952 evas_object_show(bx);
2953 lb = elm_label_add(win);
2954 elm_label_label_set(lb,
2955 "This is page 2 in a pager stack.<br>"
2956 "<br>"
2957 "This is just like the previous page in<br>"
2958 "the pager stack."
2959 );
2960 elm_box_pack_end(bx, lb);
2961 evas_object_show(lb);
2962 bt = elm_button_add(win);
2963 elm_button_label_set(bt, "Flip to 3");
2964 evas_object_smart_callback_add(bt, "clicked", my_pager_2, &info);
2965 elm_box_pack_end(bx, bt);
2966 evas_object_show(bt);
2967 bt = elm_button_add(win);
2968 elm_button_label_set(bt, "Popme");
2969 evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
2970 elm_box_pack_end(bx, bt);
2971 evas_object_show(bt);
2972 elm_pager_content_push(pg, bx);
2973 info.pg2 = bx;
2974
2975 bx = elm_box_add(win);
2976 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
2977 evas_object_show(bx);
2978 lb = elm_label_add(win);
2979 elm_label_label_set(lb,
2980 "This is page 3 in a pager stack.<br>"
2981 "<br>"
2982 "This is just like the previous page in<br>"
2983 "the pager stack."
2984 );
2985 elm_box_pack_end(bx, lb);
2986 evas_object_show(lb);
2987 bt = elm_button_add(win);
2988 elm_button_label_set(bt, "Flip to 1");
2989 evas_object_smart_callback_add(bt, "clicked", my_pager_3, &info);
2990 elm_box_pack_end(bx, bt);
2991 evas_object_show(bt);
2992 bt = elm_button_add(win);
2993 elm_button_label_set(bt, "Popme");
2994 evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
2995 elm_box_pack_end(bx, bt);
2996 evas_object_show(bt);
2997 elm_pager_content_push(pg, bx);
2998 info.pg3 = bx;
2999
3000 evas_object_show(win);
3001}
3002
3003static Elm_Genlist_Item_Class itc4;
3004
3005static void
3006gl4_sel(void *data, Evas_Object *obj, void *event_info)
3007{
3008}
3009static void
3010gl4_exp(void *data, Evas_Object *obj, void *event_info)
3011{
3012 Elm_Genlist_Item *it = event_info;
3013 Evas_Object *gl = elm_genlist_item_genlist_get(it);
3014 int val = (int)elm_genlist_item_data_get(it);
3015 val *= 10;
3016 elm_genlist_item_append(gl, &itc4,
3017 (void *)(val + 1)/* item data */, it/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
3018 NULL/* func data */);
3019 elm_genlist_item_append(gl, &itc4,
3020 (void *)(val + 2)/* item data */, it/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
3021 NULL/* func data */);
3022 elm_genlist_item_append(gl, &itc4,
3023 (void *)(val + 3)/* item data */, it/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
3024 NULL/* func data */);
3025}
3026static void
3027gl4_con(void *data, Evas_Object *obj, void *event_info)
3028{
3029 Elm_Genlist_Item *it = event_info;
3030 elm_genlist_item_subitems_clear(it);
3031}
3032
3033static void
3034gl4_exp_req(void *data, Evas_Object *obj, void *event_info)
3035{
3036 Elm_Genlist_Item *it = event_info;
3037 elm_genlist_item_expanded_set(it, 1);
3038}
3039static void
3040gl4_con_req(void *data, Evas_Object *obj, void *event_info)
3041{
3042 Elm_Genlist_Item *it = event_info;
3043 elm_genlist_item_expanded_set(it, 0);
3044}
3045
3046char *gl4_label_get(const void *data, Evas_Object *obj, const char *part)
3047{
3048 char buf[256];
3049 snprintf(buf, sizeof(buf), "Item mode %i", (int)data);
3050 return strdup(buf);
3051}
3052Evas_Object *gl4_icon_get(const void *data, Evas_Object *obj, const char *part)
3053{
3054 char buf[PATH_MAX];
3055 if (!strcmp(part, "elm.swallow.icon"))
3056 {
3057 Evas_Object *ic = elm_icon_add(obj);
3058 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
3059 elm_icon_file_set(ic, buf, NULL);
3060 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
3061 evas_object_show(ic);
3062 return ic;
3063 }
3064 else if (!strcmp(part, "elm.swallow.end"))
3065 {
3066 Evas_Object *ck;
3067 ck = elm_check_add(obj);
3068 evas_object_show(ck);
3069 return ck;
3070 }
3071 return NULL;
3072}
3073Eina_Bool gl4_state_get(const void *data, Evas_Object *obj, const char *part)
3074{
3075 return EINA_FALSE;
3076}
3077void gl4_del(const void *data, Evas_Object *obj)
3078{
3079}
3080
3081static void
3082my_bt_36(void *data, Evas_Object *obj, void *event_info)
3083{
3084 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
3085
3086 win = elm_win_add(NULL, "genlist-tree", ELM_WIN_BASIC);
3087 elm_win_title_set(win, "Genlist Tree");
3088 elm_win_autodel_set(win, 1);
3089
3090 bg = elm_bg_add(win);
3091 elm_win_resize_object_add(win, bg);
3092 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
3093 evas_object_show(bg);
3094
3095 bx = elm_box_add(win);
3096 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
3097 elm_win_resize_object_add(win, bx);
3098 evas_object_show(bx);
3099
3100 gl = elm_genlist_add(win);
3101 evas_object_size_hint_align_set(gl, -1.0, -1.0);
3102 evas_object_size_hint_weight_set(gl, 1.0, 1.0);
3103 evas_object_show(gl);
3104
3105 itc4.item_style = "default";
3106 itc4.func.label_get = gl4_label_get;
3107 itc4.func.icon_get = gl4_icon_get;
3108 itc4.func.state_get = gl4_state_get;
3109 itc4.func.del = gl4_del;
3110
3111 elm_genlist_item_append(gl, &itc4,
3112 (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
3113 NULL/* func data */);
3114 elm_genlist_item_append(gl, &itc4,
3115 (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
3116 NULL/* func data */);
3117 elm_genlist_item_append(gl, &itc4,
3118 (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
3119 NULL/* func data */);
3120
3121 evas_object_smart_callback_add(gl, "expand,request", gl4_exp_req, gl);
3122 evas_object_smart_callback_add(gl, "contract,request", gl4_con_req, gl);
3123 evas_object_smart_callback_add(gl, "expanded", gl4_exp, gl);
3124 evas_object_smart_callback_add(gl, "contracted", gl4_con, gl);
3125
3126 elm_box_pack_end(bx, gl);
3127 evas_object_show(bx2);
3128
3129 bx2 = elm_box_add(win);
3130 elm_box_horizontal_set(bx2, 1);
3131 elm_box_homogenous_set(bx2, 1);
3132 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
3133 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
3134
3135 bt = elm_button_add(win);
3136 elm_button_label_set(bt, "[1]");
3137// evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
3138 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3139 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3140 elm_box_pack_end(bx2, bt);
3141 evas_object_show(bt);
3142
3143 bt = elm_button_add(win);
3144 elm_button_label_set(bt, "[2]");
3145// evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
3146 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3147 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3148 elm_box_pack_end(bx2, bt);
3149 evas_object_show(bt);
3150
3151 bt = elm_button_add(win);
3152 elm_button_label_set(bt, "[3]");
3153// evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
3154 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3155 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3156 elm_box_pack_end(bx2, bt);
3157 evas_object_show(bt);
3158
3159 elm_box_pack_end(bx, bx2);
3160 evas_object_show(bx2);
3161
3162 evas_object_resize(win, 320, 320);
3163 evas_object_show(win);
3164}
3165
3166static void
3167my_gl_item_check_changed2(void *data, Evas_Object *obj, void *event_info)
3168{
3169 Testitem *tit = data;
3170 tit->onoff = elm_check_state_get(obj);
3171 printf("item %p onoff = %i\n", tit, tit->onoff);
3172}
3173
3174static Elm_Genlist_Item_Class itc5;
3175char *gl5_label_get(const void *data, Evas_Object *obj, const char *part)
3176{
3177 Testitem *tit = data;
3178 char buf[256];
3179 if (!strcmp(part, "elm.text"))
3180 {
3181 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
3182 }
3183 else if (!strcmp(part, "elm.text.sub"))
3184 {
3185 snprintf(buf, sizeof(buf), "%i bottles on the wall", tit->mode);
3186 }
3187 return strdup(buf);
3188}
3189Evas_Object *gl5_icon_get(const void *data, Evas_Object *obj, const char *part)
3190{
3191 Testitem *tit = data;
3192 char buf[PATH_MAX];
3193 if (!strcmp(part, "elm.swallow.icon"))
3194 {
3195 Evas_Object *bx = elm_box_add(obj);
3196 Evas_Object *ic;
3197 elm_box_horizontal_set(bx, 1);
3198 ic = elm_icon_add(obj);
3199 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
3200 elm_icon_file_set(ic, buf, NULL);
3201 elm_icon_scale_set(ic, 0, 0);
3202 evas_object_show(ic);
3203 elm_box_pack_end(bx, ic);
3204 ic = elm_icon_add(obj);
3205 elm_icon_file_set(ic, buf, NULL);
3206 elm_icon_scale_set(ic, 0, 0);
3207 evas_object_show(ic);
3208 elm_box_pack_end(bx, ic);
3209 evas_object_show(bx);
3210 return bx;
3211 }
3212 else if (!strcmp(part, "elm.swallow.end"))
3213 {
3214 Evas_Object *ck;
3215 ck = elm_check_add(obj);
3216 evas_object_propagate_events_set(ck, 0);
3217 elm_check_state_set(ck, tit->onoff);
3218 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed2, data);
3219 evas_object_show(ck);
3220 return ck;
3221 }
3222 return NULL;
3223}
3224Eina_Bool gl5_state_get(const void *data, Evas_Object *obj, const char *part)
3225{
3226 return EINA_FALSE;
3227}
3228void gl5_del(const void *data, Evas_Object *obj)
3229{
3230}
3231
3232static void
3233my_bt_37(void *data, Evas_Object *obj, void *event_info)
3234{
3235 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
3236 static Testitem tit[3];
3237 int i;
3238
3239 win = elm_win_add(NULL, "genlist-5", ELM_WIN_BASIC);
3240 elm_win_title_set(win, "Genlist 5");
3241 elm_win_autodel_set(win, 1);
3242
3243 bg = elm_bg_add(win);
3244 elm_win_resize_object_add(win, bg);
3245 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
3246 evas_object_show(bg);
3247
3248 bx = elm_box_add(win);
3249 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
3250 elm_win_resize_object_add(win, bx);
3251 evas_object_show(bx);
3252
3253 gl = elm_genlist_add(win);
3254 elm_genlist_always_select_mode_set(gl, 1);
3255 evas_object_size_hint_align_set(gl, -1.0, -1.0);
3256 evas_object_size_hint_weight_set(gl, 1.0, 1.0);
3257 evas_object_show(gl);
3258 itc5.item_style = "double_label";
3259 itc5.func.label_get = gl5_label_get;
3260 itc5.func.icon_get = gl5_icon_get;
3261 itc5.func.state_get = gl5_state_get;
3262 itc5.func.del = gl5_del;
3263
3264 tit[0].mode = 0;
3265 tit[0].item = elm_genlist_item_append(gl, &itc5,
3266 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
3267 NULL/* func data */);
3268 tit[1].mode = 1;
3269 tit[1].item = elm_genlist_item_append(gl, &itc5,
3270 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
3271 NULL/* func data */);
3272 tit[2].mode = 2;
3273 tit[2].item = elm_genlist_item_append(gl, &itc5,
3274 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
3275 NULL/* func data */);
3276
3277 elm_box_pack_end(bx, gl);
3278 evas_object_show(bx2);
3279
3280 bx2 = elm_box_add(win);
3281 elm_box_horizontal_set(bx2, 1);
3282 elm_box_homogenous_set(bx2, 1);
3283 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
3284 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
3285
3286 bt = elm_button_add(win);
3287 elm_button_label_set(bt, "[1]");
3288 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
3289 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3290 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3291 elm_box_pack_end(bx2, bt);
3292 evas_object_show(bt);
3293
3294 bt = elm_button_add(win);
3295 elm_button_label_set(bt, "[2]");
3296 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
3297 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3298 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3299 elm_box_pack_end(bx2, bt);
3300 evas_object_show(bt);
3301
3302 bt = elm_button_add(win);
3303 elm_button_label_set(bt, "[3]");
3304 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
3305 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3306 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3307 elm_box_pack_end(bx2, bt);
3308 evas_object_show(bt);
3309
3310 elm_box_pack_end(bx, bx2);
3311 evas_object_show(bx2);
3312
3313 evas_object_resize(win, 320, 320);
3314 evas_object_show(win);
3315}
3316
3317static void
3318my_bt_38_alpha_on(void *data, Evas_Object *obj, void *event_info)
3319{
3320 Evas_Object *win = data;
3321 Evas_Object *bg = evas_object_data_get(win, "bg");
3322 evas_object_hide(bg);
3323 elm_win_alpha_set(win, 1);
3324}
3325
3326static void
3327my_bt_38_alpha_off(void *data, Evas_Object *obj, void *event_info)
3328{
3329 Evas_Object *win = data;
3330 Evas_Object *bg = evas_object_data_get(win, "bg");
3331 evas_object_show(bg);
3332 elm_win_alpha_set(win, 0);
3333}
3334
3335static void
3336my_bt_38_rot_0(void *data, Evas_Object *obj, void *event_info)
3337{
3338 Evas_Object *win = data;
3339 Evas_Object *bg = evas_object_data_get(win, "bg");
3340 elm_win_rotation_set(win, 0);
3341}
3342
3343static void
3344my_bt_38_rot_90(void *data, Evas_Object *obj, void *event_info)
3345{
3346 Evas_Object *win = data;
3347 Evas_Object *bg = evas_object_data_get(win, "bg");
3348 elm_win_rotation_set(win, 90);
3349}
3350
3351static void
3352my_bt_38_rot_180(void *data, Evas_Object *obj, void *event_info)
3353{
3354 Evas_Object *win = data;
3355 Evas_Object *bg = evas_object_data_get(win, "bg");
3356 elm_win_rotation_set(win, 180);
3357}
3358
3359static void
3360my_bt_38_rot_270(void *data, Evas_Object *obj, void *event_info)
3361{
3362 Evas_Object *win = data;
3363 Evas_Object *bg = evas_object_data_get(win, "bg");
3364 elm_win_rotation_set(win, 270);
3365}
3366
3367static void
3368my_bt_38(void *data, Evas_Object *obj, void *event_info)
3369{
3370 Evas_Object *win, *bg, *sl, *bx, *bx2, *bt;
3371 static Testitem tit[3];
3372 int i;
3373
3374 win = elm_win_add(NULL, "window-state", ELM_WIN_BASIC);
3375 elm_win_title_set(win, "Window States");
3376 elm_win_autodel_set(win, 1);
3377
3378 bg = elm_bg_add(win);
3379 elm_win_resize_object_add(win, bg);
3380 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
3381 evas_object_show(bg);
3382 evas_object_data_set(win, "bg", bg);
3383
3384 bx = elm_box_add(win);
3385 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
3386 elm_win_resize_object_add(win, bx);
3387 evas_object_show(bx);
3388
3389 bx2 = elm_box_add(win);
3390 elm_box_horizontal_set(bx2, 1);
3391 elm_box_homogenous_set(bx2, 1);
3392 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
3393 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
3394
3395 bt = elm_button_add(win);
3396 elm_button_label_set(bt, "Alpha On");
3397 evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_on, win);
3398 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3399 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3400 elm_box_pack_end(bx2, bt);
3401 evas_object_show(bt);
3402
3403 bt = elm_button_add(win);
3404 elm_button_label_set(bt, "Alpha Off");
3405 evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_off, win);
3406 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3407 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3408 elm_box_pack_end(bx2, bt);
3409 evas_object_show(bt);
3410
3411 elm_box_pack_end(bx, bx2);
3412 evas_object_show(bx2);
3413
3414 bx2 = elm_box_add(win);
3415 elm_box_horizontal_set(bx2, 1);
3416 elm_box_homogenous_set(bx2, 1);
3417 evas_object_size_hint_weight_set(bx2, 1.0, 1.0);
3418 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
3419
3420 sl = elm_slider_add(win);
3421 elm_slider_label_set(sl, "Test");
3422 elm_slider_span_size_set(sl, 100);
3423 evas_object_size_hint_align_set(sl, 0.5, 0.5);
3424 evas_object_size_hint_weight_set(sl, 1.0, 1.0);
3425 elm_slider_indicator_format_set(sl, "%3.0f");
3426 elm_slider_min_max_set(sl, 50, 150);
3427 elm_slider_value_set(sl, 50);
3428 elm_slider_inverted_set(sl, 1);
3429 elm_box_pack_end(bx2, sl);
3430 evas_object_show(sl);
3431
3432 elm_box_pack_end(bx, bx2);
3433 evas_object_show(bx2);
3434
3435 bx2 = elm_box_add(win);
3436 elm_box_horizontal_set(bx2, 1);
3437 elm_box_homogenous_set(bx2, 1);
3438 evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
3439 evas_object_size_hint_align_set(bx2, -1.0, -1.0);
3440
3441 bt = elm_button_add(win);
3442 elm_button_label_set(bt, "Rot 0");
3443 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_0, win);
3444 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3445 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3446 elm_box_pack_end(bx2, bt);
3447 evas_object_show(bt);
3448 46
3449 bt = elm_button_add(win);
3450 elm_button_label_set(bt, "Rot 90");
3451 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_90, win);
3452 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3453 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3454 elm_box_pack_end(bx2, bt);
3455 evas_object_show(bt);
3456 47
3457 bt = elm_button_add(win);
3458 elm_button_label_set(bt, "Rot 180");
3459 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_180, win);
3460 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3461 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3462 elm_box_pack_end(bx2, bt);
3463 evas_object_show(bt);
3464
3465 bt = elm_button_add(win);
3466 elm_button_label_set(bt, "Rot 270");
3467 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_270, win);
3468 evas_object_size_hint_align_set(bt, -1.0, -1.0);
3469 evas_object_size_hint_weight_set(bt, 1.0, 0.0);
3470 elm_box_pack_end(bx2, bt);
3471 evas_object_show(bt);
3472
3473 elm_box_pack_end(bx, bx2);
3474 evas_object_show(bx2);
3475
3476 evas_object_resize(win, 280, 400);
3477 evas_object_show(win);
3478}
3479
3480typedef struct Progressbar
3481{
3482 Evas_Object *pb1;
3483 Evas_Object *pb2;
3484 Evas_Object *pb3;
3485 Evas_Object *pb4;
3486 Evas_Object *pb5;
3487 Evas_Object *pb6;
3488 Eina_Bool run;
3489 Ecore_Timer *timer;
3490} Progressbar;
3491
3492static Progressbar _test_progressbar;
3493
3494static int
3495_my_bt_39_progressbar_value_set (void *data)
3496{
3497 double progress;
3498
3499 progress = elm_progressbar_value_get (_test_progressbar.pb1);
3500 if (progress < 1.0) progress += 0.0123;
3501 else progress = 0.0;
3502 elm_progressbar_value_set(_test_progressbar.pb1, progress);
3503 elm_progressbar_value_set(_test_progressbar.pb4, progress);
3504 elm_progressbar_value_set(_test_progressbar.pb3, progress);
3505 elm_progressbar_value_set(_test_progressbar.pb6, progress);
3506 if (progress < 1.0) return ECORE_CALLBACK_RENEW;
3507 _test_progressbar.run = 0;
3508 return ECORE_CALLBACK_CANCEL;
3509}
3510
3511static void
3512my_bt_39_test_start(void *data, Evas_Object *obj, void *event_info)
3513{
3514 elm_progressbar_pulse(_test_progressbar.pb2, EINA_TRUE);
3515 elm_progressbar_pulse(_test_progressbar.pb5, EINA_TRUE);
3516 if (!_test_progressbar.run)
3517 {
3518 _test_progressbar.timer = ecore_timer_add(0.1, _my_bt_39_progressbar_value_set, NULL);
3519 _test_progressbar.run = EINA_TRUE;
3520 }
3521}
3522
3523static void
3524my_bt_39_test_stop(void *data, Evas_Object *obj, void *event_info)
3525{
3526 elm_progressbar_pulse(_test_progressbar.pb2, EINA_FALSE);
3527 elm_progressbar_pulse(_test_progressbar.pb5, EINA_FALSE);
3528 if (_test_progressbar.run)
3529 {
3530 ecore_timer_del(_test_progressbar.timer);
3531 _test_progressbar.run = EINA_FALSE;
3532 }
3533}
3534
3535static void
3536my_bt_39_destroy(void *data, Evas_Object *obj, void *event_info)
3537{
3538 my_bt_39_test_stop(NULL, NULL, NULL);
3539 evas_object_del(obj);
3540}
3541
3542static void
3543my_bt_39(void *data, Evas_Object *obj, void *event_info)
3544{
3545 Evas_Object *win, *bg, *pb, *bx, *pbx, *hbx, *bt, *bt_bx, *ic1, *ic2;
3546 Progressbar *test;
3547 char buf[PATH_MAX];
3548
3549 win = elm_win_add(NULL, "progressbar", ELM_WIN_BASIC);
3550 elm_win_title_set(win, "Progressbar");
3551 evas_object_smart_callback_add(win, "delete-request", my_bt_39_destroy, test);
3552
3553 bg = elm_bg_add(win);
3554 elm_win_resize_object_add(win, bg);
3555 evas_object_size_hint_weight_set(bg, 1.0, 1.0);
3556 evas_object_show(bg);
3557
3558 bx = elm_box_add(win);
3559 elm_win_resize_object_add(win, bx);
3560 evas_object_size_hint_weight_set(bx, 1.0, 1.0);
3561 evas_object_show(bx);
3562
3563 pb = elm_progressbar_add(win);
3564 evas_object_size_hint_weight_set(pb, 1.0, 1.0);
3565 evas_object_size_hint_align_set(pb, -1.0, 0.5);
3566 elm_box_pack_end(bx, pb);
3567// elm_progressbar_horizontal_set(pb, EINA_TRUE);
3568// elm_progressbar_label_set(pb, "Progression %");
3569// elm_progressbar_unit_format_set(pb, NULL);
3570 evas_object_show(pb);
3571 _test_progressbar.pb1 = pb;
3572
3573 pb = elm_progressbar_add(win);
3574 evas_object_size_hint_align_set(pb, -1.0, 0.5);
3575 evas_object_size_hint_weight_set(pb, 1.0, 1.0);
3576 elm_progressbar_label_set(pb, "Infinite bounce");
3577 elm_progressbar_pulse_set(pb, EINA_TRUE);
3578 elm_box_pack_end(bx, pb);
3579 evas_object_show(pb);
3580 _test_progressbar.pb2 = pb;
3581
3582 ic1 = elm_icon_add(win);
3583 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
3584 elm_icon_file_set(ic1, buf, NULL);
3585 evas_object_size_hint_aspect_set(ic1, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
3586 pb = elm_progressbar_add(win);
3587 elm_progressbar_label_set(pb, "Label");
3588 elm_progressbar_icon_set(pb, ic1);
3589 elm_progressbar_inverted_set(pb, 1);
3590 elm_progressbar_unit_format_set(pb, "%1.1f units");
3591 elm_progressbar_span_size_set(pb, 200);
3592 evas_object_size_hint_align_set(pb, -1.0, 0.5);
3593 evas_object_size_hint_weight_set(pb, 1.0, 1.0);
3594 elm_box_pack_end(bx, pb);
3595 evas_object_show(ic1);
3596 evas_object_show(pb);
3597 _test_progressbar.pb3 = pb;
3598
3599 hbx = elm_box_add(win);
3600 elm_box_horizontal_set(hbx, EINA_TRUE);
3601 evas_object_size_hint_weight_set(hbx, 1.0, 1.0);
3602 evas_object_size_hint_align_set(hbx, -1.0, -1.0);
3603 elm_box_pack_end(bx, hbx);
3604 evas_object_show(hbx);
3605
3606 pb = elm_progressbar_add(win);
3607 elm_progressbar_horizontal_set(pb, EINA_FALSE);
3608 evas_object_size_hint_align_set(pb, -1.0, -1.0);
3609 evas_object_size_hint_weight_set(pb, 1.0, 1.0);
3610 elm_box_pack_end(hbx, pb);
3611 elm_progressbar_span_size_set(pb, 60);
3612 elm_progressbar_label_set(pb, "percent");
3613 evas_object_show(pb);
3614 _test_progressbar.pb4 = pb;
3615
3616 pb = elm_progressbar_add(win);
3617 elm_progressbar_horizontal_set(pb, EINA_FALSE);
3618 evas_object_size_hint_align_set(pb, -1.0, 0.5);
3619 evas_object_size_hint_weight_set(pb, 1.0, 1.0);
3620 elm_progressbar_span_size_set(pb, 80);
3621 elm_progressbar_pulse_set(pb, EINA_TRUE);
3622 elm_progressbar_unit_format_set(pb, NULL);
3623 elm_progressbar_label_set(pb, "Infinite bounce");
3624 elm_box_pack_end(hbx, pb);
3625 evas_object_show(pb);
3626 _test_progressbar.pb5 = pb;
3627
3628 ic2 = elm_icon_add(win);
3629 elm_icon_file_set(ic2, buf, NULL);
3630 evas_object_size_hint_aspect_set(ic2, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
3631 pb = elm_progressbar_add(win);