aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/bin/test_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/elementary/src/bin/test_list.c')
-rw-r--r--libraries/elementary/src/bin/test_list.c1178
1 files changed, 1178 insertions, 0 deletions
diff --git a/libraries/elementary/src/bin/test_list.c b/libraries/elementary/src/bin/test_list.c
new file mode 100644
index 0000000..b057815
--- /dev/null
+++ b/libraries/elementary/src/bin/test_list.c
@@ -0,0 +1,1178 @@
1#include "test.h"
2#include <Elementary_Cursor.h>
3#ifdef HAVE_CONFIG_H
4# include "elementary_config.h"
5#endif
6#include <Elementary.h>
7#ifndef ELM_LIB_QUICKLAUNCH
8struct _api_data
9{
10 unsigned int state; /* What state we are testing */
11 void *list;
12};
13typedef struct _api_data api_data;
14
15enum _api_state
16{
17 ITEM_PREPEND, /* 0 */
18 ITEM_INSERT_BEFORE, /* 1 */
19 ITEM_INSERT_AFTER, /* 2 */
20 ITEM_SEPARATOR_SET, /* 3 */
21 LIST_ITEM_DEL, /* 4 */
22 SCROLLER_POLICY_SET_ON,
23 SCROLLER_POLICY_SET_OFF, /* Back to AUTO next */
24 TOOLTIP_TEXT_SET, /* 7 */
25 TOOLTIP_UNSET, /* 8 */
26 ITEM_CURSOR_SET, /* 9 */
27 ITEM_CURSOR_STYLE_SET,
28 DISABLED_SET, /* 11 */
29 MODE_SET_COMPRESS, /* 12 */
30 MODE_SET_LIMIT, /* 13 */
31 MODE_SET_EXPAND, /* 14 */
32 HORIZONTAL_SET, /* 15 */
33 BOUNCE_SET, /* 16 */
34 LIST_CLEAR, /* 17 */
35 API_STATE_LAST
36};
37typedef enum _api_state api_state;
38
39static void
40set_api_state(api_data *api)
41{
42/** HOW TO TEST ************************
430 ITEM PREPEND
44Scroll to end
451 INSERT BEFORE
46Scroll to end
472 INSERT AFTER
483 INSERT SEPERATOR
49Scroll to end
504 ITEM DEL
515 POLICY ON, BOUNCE_SET(TRUE, TRUE)
526 POLICY OFF
53Scroll to end
547 TOOLTIP last-item
558 Cancel tootip
569 Curosr set on last item
5710 Cursor style set last item
5811 DISABLE last item
5912 MODE COMPRESS
6013 MODE LIMIT
6114 MODE EXPAND
6215 HORIZ SET
6316 VERT MODE, BOUNCE(TRUE, FALSE) try to bounce on Y-axis
6417 List clear
65*** HOW TO TEST ***********************/
66 Evas_Object *li = api->list;
67
68 switch(api->state)
69 { /* Put all api-changes under switch */
70 case ITEM_PREPEND: /* 0 */
71 {
72 const Eina_List *items = elm_list_items_get(li);
73 elm_list_item_prepend(li, "PREPEND", NULL, NULL, NULL, NULL);
74 elm_list_go(li);
75 elm_list_item_bring_in(eina_list_nth(items, 0));
76 }
77 break;
78
79 case ITEM_INSERT_BEFORE: /* 1 */
80 {
81 const Eina_List *items = elm_list_items_get(li);
82 if (eina_list_count(items))
83 {
84 elm_list_item_insert_before(li,
85 eina_list_nth(items, eina_list_count(items)-1),
86 "1-before-last", NULL, NULL, NULL, NULL);
87 elm_list_go(li);
88 elm_list_item_bring_in(eina_list_data_get(eina_list_last(items)));
89 }
90 }
91 break;
92
93 case ITEM_INSERT_AFTER: /* 2 */
94 {
95 const Eina_List *items = elm_list_items_get(li);
96 if (eina_list_count(items))
97 {
98 elm_list_item_insert_after(li,
99 eina_list_nth(items, eina_list_count(items)-2),
100 "insert-after", NULL, NULL, NULL, NULL);
101 elm_list_go(li);
102 elm_list_item_bring_in(eina_list_data_get(eina_list_last(items)));
103 }
104 }
105 break;
106
107 case ITEM_SEPARATOR_SET: /* 3 */
108 {
109 const Eina_List *items = elm_list_items_get(li);
110 if (eina_list_count(items))
111 {
112 elm_list_item_separator_set(eina_list_nth(items, eina_list_count(items)-3), EINA_TRUE);
113 elm_list_item_bring_in(eina_list_nth(items, eina_list_count(items)-3));
114 elm_list_go(li);
115 }
116 }
117 break;
118
119 case LIST_ITEM_DEL: /* 4 */
120 {
121 const Eina_List *items = elm_list_items_get(li);
122 if (eina_list_count(items))
123 {
124 elm_object_item_del(eina_list_data_get(eina_list_last(items)));
125 }
126 }
127 break;
128
129 case SCROLLER_POLICY_SET_ON: /* 5 */
130 elm_list_bounce_set(li, EINA_TRUE, EINA_TRUE);
131 elm_list_scroller_policy_set(li, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
132 break;
133
134 case SCROLLER_POLICY_SET_OFF: /* Back to AUTO next (6) */
135 elm_list_scroller_policy_set(li, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
136 break;
137
138 case TOOLTIP_TEXT_SET: /* 7 */
139 {
140 const Eina_List *items = elm_list_items_get(li);
141 if (eina_list_count(items))
142 {
143 elm_object_item_tooltip_text_set(eina_list_data_get(eina_list_last(items)), "Tooltip set from API");
144 }
145 elm_list_scroller_policy_set(li, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
146 }
147 break;
148
149 case TOOLTIP_UNSET: /* 8 */
150 {
151 const Eina_List *items = elm_list_items_get(li);
152 if (eina_list_count(items))
153 {
154 elm_object_item_tooltip_unset(eina_list_data_get(eina_list_last(items)));
155 }
156 }
157 break;
158
159 case ITEM_CURSOR_SET: /* 9 */
160 {
161 const Eina_List *items = elm_list_items_get(li);
162 if (eina_list_count(items))
163 {
164 elm_object_item_cursor_set(eina_list_data_get(eina_list_last(items)), ELM_CURSOR_HAND2);
165 }
166 }
167 break;
168
169 case ITEM_CURSOR_STYLE_SET: /* 10 */
170 {
171 const Eina_List *items = elm_list_items_get(li);
172 if (eina_list_count(items))
173 {
174 elm_object_item_cursor_style_set(eina_list_data_get(eina_list_last(items)), "transparent");
175 }
176 }
177 break;
178
179 case DISABLED_SET: /* 11 */
180 {
181 const Eina_List *items = elm_list_items_get(li);
182 if (eina_list_count(items))
183 {
184 elm_object_item_disabled_set(eina_list_data_get(eina_list_last(items)), EINA_TRUE);
185 }
186 }
187 break;
188
189 case MODE_SET_COMPRESS: /* 12 */
190 elm_list_mode_set(li, ELM_LIST_COMPRESS);
191 break;
192
193 case MODE_SET_LIMIT: /* 13 */
194 elm_list_mode_set(li, ELM_LIST_LIMIT);
195 break;
196
197 case MODE_SET_EXPAND: /* 14 */
198 elm_list_mode_set(li, ELM_LIST_EXPAND);
199 break;
200
201 case HORIZONTAL_SET: /* 15 */
202 elm_list_mode_set(li, ELM_LIST_SCROLL); /* return to default mode */
203 elm_list_horizontal_set(li, EINA_TRUE);
204 break;
205
206 case BOUNCE_SET: /* 16 */
207 elm_list_horizontal_set(li, EINA_FALSE);
208 elm_list_bounce_set(li, EINA_TRUE, EINA_FALSE);
209 break;
210
211 case LIST_CLEAR: /* 17 */
212 elm_list_clear(li);
213 break;
214
215 case API_STATE_LAST:
216 break;
217
218 default:
219 return;
220 }
221}
222
223static void
224_api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
225{ /* Will add here a SWITCH command containing code to modify test-object */
226 /* in accordance a->state value. */
227 api_data *a = data;
228 char str[128];
229
230 printf("clicked event on API Button: api_state=<%d>\n", a->state);
231 set_api_state(a);
232 a->state++;
233 sprintf(str, "Next API function (%u)", a->state);
234 elm_object_text_set(obj, str);
235 elm_object_disabled_set(obj, a->state == API_STATE_LAST);
236}
237
238static void
239my_show_it(void *data,
240 Evas_Object *obj __UNUSED__,
241 void *event_info __UNUSED__)
242{
243 elm_list_item_show(data);
244}
245
246static void
247scroll_top(void *data __UNUSED__,
248 Evas_Object *obj __UNUSED__,
249 void *event_info __UNUSED__)
250{
251 printf("Top edge!\n");
252}
253
254static void
255scroll_bottom(void *data __UNUSED__,
256 Evas_Object *obj __UNUSED__,
257 void *event_info __UNUSED__)
258{
259 printf("Bottom edge!\n");
260}
261
262static void
263scroll_left(void *data __UNUSED__,
264 Evas_Object *obj __UNUSED__,
265 void *event_info __UNUSED__)
266{
267 printf("Left edge!\n");
268}
269
270static void
271scroll_right(void *data __UNUSED__,
272 Evas_Object *obj __UNUSED__,
273 void *event_info __UNUSED__)
274{
275 printf("Right edge!\n");
276}
277
278static void
279_cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
280{
281 free(data);
282}
283
284void
285test_list(void *data __UNUSED__,
286 Evas_Object *obj __UNUSED__,
287 void *event_info __UNUSED__)
288{
289 Evas_Object *win, *li, *ic, *ic2, *bx, *tb2, *bt, *bxx;
290 char buf[PATH_MAX];
291 Elm_Object_Item *list_it1, *list_it2, *list_it3, *list_it4, *list_it5;
292 api_data *api = calloc(1, sizeof(api_data));
293
294 win = elm_win_util_standard_add("list", "List");
295 elm_win_autodel_set(win, EINA_TRUE);
296 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
297
298 bxx = elm_box_add(win);
299 elm_win_resize_object_add(win, bxx);
300 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
301 evas_object_show(bxx);
302
303 li = elm_list_add(win);
304 elm_list_mode_set(li, ELM_LIST_LIMIT);
305 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
306 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
307 api->list = li;
308
309 bt = elm_button_add(win);
310 elm_object_text_set(bt, "Next API function");
311 evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
312 elm_box_pack_end(bxx, bt);
313 elm_object_disabled_set(bt, api->state == API_STATE_LAST);
314 evas_object_show(bt);
315
316 elm_box_pack_end(bxx, li);
317
318 ic = elm_icon_add(win);
319 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
320 elm_icon_file_set(ic, buf, NULL);
321 elm_icon_resizable_set(ic, 1, 1);
322 list_it1 = elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL);
323 ic = elm_icon_add(win);
324 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
325 elm_icon_resizable_set(ic, 0, 0);
326 elm_icon_file_set(ic, buf, NULL);
327 elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
328 ic = elm_icon_add(win);
329 elm_icon_standard_set(ic, "edit");
330 elm_icon_resizable_set(ic, 0, 0);
331 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
332
333 ic = elm_icon_add(win);
334 elm_icon_standard_set(ic, "delete");
335 elm_icon_resizable_set(ic, 0, 0);
336 ic2 = elm_icon_add(win);
337 elm_icon_standard_set(ic2, "clock");
338 elm_icon_resizable_set(ic2, 0, 0);
339 list_it2 = elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
340
341 bx = elm_box_add(win);
342 elm_box_horizontal_set(bx, EINA_TRUE);
343
344 ic = elm_icon_add(win);
345 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
346 elm_icon_file_set(ic, buf, NULL);
347 elm_icon_resizable_set(ic, 0, 0);
348 evas_object_size_hint_align_set(ic, 0.5, 0.5);
349 elm_box_pack_end(bx, ic);
350 evas_object_show(ic);
351
352 ic = elm_icon_add(win);
353 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
354 elm_icon_file_set(ic, buf, NULL);
355 elm_icon_resizable_set(ic, 0, 0);
356 evas_object_size_hint_align_set(ic, 0.5, 0.0);
357 elm_box_pack_end(bx, ic);
358 evas_object_show(ic);
359
360 ic = elm_icon_add(win);
361 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
362 elm_icon_file_set(ic, buf, NULL);
363 elm_icon_resizable_set(ic, 0, 0);
364 evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND);
365 elm_box_pack_end(bx, ic);
366 evas_object_show(ic);
367 elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
368
369 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
370 list_it3 = elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
371 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
372 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
373 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
374 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
375 list_it4 = elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
376 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
377 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
378 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
379 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
380 elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL);
381 list_it5 = elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL);
382
383 elm_list_go(li);
384
385 evas_object_show(li);
386
387 tb2 = elm_table_add(win);
388 evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
389 elm_win_resize_object_add(win, tb2);
390
391 bt = elm_button_add(win);
392 elm_object_text_set(bt, "Hello");
393 evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it1);
394 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
395 evas_object_size_hint_align_set(bt, 0.9, 0.5);
396 elm_table_pack(tb2, bt, 0, 0, 1, 1);
397 evas_object_show(bt);
398
399 bt = elm_button_add(win);
400 elm_object_text_set(bt, "How");
401 evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it2);
402 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
403 evas_object_size_hint_align_set(bt, 0.9, 0.5);
404 elm_table_pack(tb2, bt, 0, 1, 1, 1);
405 evas_object_show(bt);
406
407 bt = elm_button_add(win);
408 elm_object_text_set(bt, "doing");
409 evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it3);
410 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
411 evas_object_size_hint_align_set(bt, 0.9, 0.5);
412 elm_table_pack(tb2, bt, 0, 2, 1, 1);
413 evas_object_show(bt);
414
415 bt = elm_button_add(win);
416 elm_object_text_set(bt, "Here");
417 evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it4);
418 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
419 evas_object_size_hint_align_set(bt, 0.9, 0.5);
420 elm_table_pack(tb2, bt, 0, 3, 1, 1);
421 evas_object_show(bt);
422
423 bt = elm_button_add(win);
424 elm_object_text_set(bt, "Maybe this...");
425 evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it5);
426 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
427 evas_object_size_hint_align_set(bt, 0.9, 0.5);
428 elm_table_pack(tb2, bt, 0, 4, 1, 1);
429 evas_object_show(bt);
430
431 evas_object_show(tb2);
432
433 evas_object_resize(win, 320, 300);
434 evas_object_show(win);
435
436 evas_object_smart_callback_add(li, "scroll,edge,top", scroll_top, NULL);
437 evas_object_smart_callback_add(li, "scroll,edge,bottom", scroll_bottom, NULL);
438 evas_object_smart_callback_add(li, "scroll,edge,left", scroll_left, NULL);
439 evas_object_smart_callback_add(li, "scroll,edge,right", scroll_right, NULL);
440}
441
442void
443test_list_horizontal(void *data __UNUSED__,
444 Evas_Object *obj __UNUSED__,
445 void *event_info __UNUSED__)
446{
447 Evas_Object *win, *li, *ic, *ic2, *bx, *tb2, *bt;
448 char buf[PATH_MAX];
449 Elm_Object_Item *list_it1, *list_it2, *list_it3, *list_it4;
450
451 win = elm_win_util_standard_add("list-horizontal", "List Horizontal");
452 elm_win_autodel_set(win, EINA_TRUE);
453
454 li = elm_list_add(win);
455 elm_list_horizontal_set(li, EINA_TRUE);
456 elm_list_mode_set(li, ELM_LIST_LIMIT);
457 elm_win_resize_object_add(win, li);
458 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
459
460 ic = elm_icon_add(win);
461 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
462 elm_icon_file_set(ic, buf, NULL);
463 elm_icon_resizable_set(ic, 1, 1);
464 list_it1 = elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL);
465 ic = elm_icon_add(win);
466 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
467 elm_icon_resizable_set(ic, 0, 0);
468 elm_icon_file_set(ic, buf, NULL);
469 elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
470 ic = elm_icon_add(win);
471 elm_icon_standard_set(ic, "edit");
472 elm_icon_resizable_set(ic, 0, 0);
473 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
474
475 ic = elm_icon_add(win);
476 elm_icon_standard_set(ic, "delete");
477 elm_icon_resizable_set(ic, 0, 0);
478 ic2 = elm_icon_add(win);
479 elm_icon_standard_set(ic2, "clock");
480 elm_icon_resizable_set(ic2, 0, 0);
481 list_it2 = elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
482
483 bx = elm_box_add(win);
484
485 ic = elm_icon_add(win);
486 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
487 elm_icon_file_set(ic, buf, NULL);
488 elm_icon_resizable_set(ic, 0, 0);
489 evas_object_size_hint_align_set(ic, 0.5, 0.5);
490 elm_box_pack_end(bx, ic);
491 evas_object_show(ic);
492
493 ic = elm_icon_add(win);
494 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
495 elm_icon_file_set(ic, buf, NULL);
496 elm_icon_resizable_set(ic, 0, 0);
497 evas_object_size_hint_align_set(ic, 0.5, 0.0);
498 elm_box_pack_end(bx, ic);
499 evas_object_show(ic);
500
501 elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
502
503 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
504 list_it3 = elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
505 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
506 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
507 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
508 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
509
510 list_it4 = elm_list_item_append(li, "And", NULL, NULL, NULL, NULL);
511 elm_list_item_append(li, "here", NULL, NULL, NULL, NULL);
512 elm_list_item_append(li, "we", NULL, NULL, NULL, NULL);
513 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
514 elm_list_item_append(li, "done", NULL, NULL, NULL, NULL);
515 elm_list_item_append(li, "with", NULL, NULL, NULL, NULL);
516 elm_list_item_append(li, "items.", NULL, NULL, NULL, NULL);
517
518 elm_list_go(li);
519
520 evas_object_show(li);
521
522 tb2 = elm_table_add(win);
523 evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
524 elm_win_resize_object_add(win, tb2);
525
526 bt = elm_button_add(win);
527 elm_object_text_set(bt, "Hello");
528 evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it1);
529 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
530 evas_object_size_hint_align_set(bt, 0.5, 0.9);
531 elm_table_pack(tb2, bt, 0, 0, 1, 1);
532 evas_object_show(bt);
533
534 bt = elm_button_add(win);
535 elm_object_text_set(bt, "How");
536 evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it2);
537 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
538 evas_object_size_hint_align_set(bt, 0.5, 0.9);
539 elm_table_pack(tb2, bt, 1, 0, 1, 1);
540 evas_object_show(bt);
541
542 bt = elm_button_add(win);
543 elm_object_text_set(bt, "doing");
544 evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it3);
545 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
546 evas_object_size_hint_align_set(bt, 0.5, 0.9);
547 elm_table_pack(tb2, bt, 2, 0, 1, 1);
548 evas_object_show(bt);
549
550 bt = elm_button_add(win);
551 elm_object_text_set(bt, "And");
552 evas_object_smart_callback_add(bt, "clicked", my_show_it, list_it4);
553 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
554 evas_object_size_hint_align_set(bt, 0.5, 0.9);
555 elm_table_pack(tb2, bt, 3, 0, 1, 1);
556 evas_object_show(bt);
557
558 evas_object_show(tb2);
559
560 evas_object_resize(win, 320, 300);
561 evas_object_show(win);
562}
563
564/***********/
565
566static void
567my_li2_clear(void *data,
568 Evas_Object *obj __UNUSED__,
569 void *event_info __UNUSED__)
570{
571 elm_list_clear(data);
572}
573
574static void
575my_li2_sel(void *data __UNUSED__,
576 Evas_Object *obj,
577 void *event_info __UNUSED__)
578{
579 Elm_Object_Item *list_it = elm_list_selected_item_get(obj);
580 elm_list_item_selected_set(list_it, 0);
581}
582
583void
584test_list2(void *data __UNUSED__,
585 Evas_Object *obj __UNUSED__,
586 void *event_info __UNUSED__)
587{
588 Evas_Object *win, *bg, *li, *ic, *ic2, *bx, *bx2, *bt;
589 char buf[PATH_MAX];
590 Elm_Object_Item *list_it;
591
592 win = elm_win_add(NULL, "list2", ELM_WIN_BASIC);
593 elm_win_title_set(win, "List 2");
594 elm_win_autodel_set(win, EINA_TRUE);
595
596 bg = elm_bg_add(win);
597 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
598 elm_bg_file_set(bg, buf, NULL);
599 elm_win_resize_object_add(win, bg);
600 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
601 evas_object_show(bg);
602
603 bx = elm_box_add(win);
604 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
605 elm_win_resize_object_add(win, bx);
606 evas_object_show(bx);
607
608 li = elm_list_add(win);
609 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
610 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
611 elm_list_mode_set(li, ELM_LIST_LIMIT);
612// elm_list_multi_select_set(li, 1);
613
614 ic = elm_icon_add(win);
615 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
616 elm_icon_file_set(ic, buf, NULL);
617 list_it = elm_list_item_append(li, "Hello", ic, NULL, my_li2_sel, NULL);
618 elm_list_item_selected_set(list_it, EINA_TRUE);
619 ic = elm_icon_add(win);
620 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
621 elm_icon_resizable_set(ic, 0, 0);
622 elm_icon_file_set(ic, buf, NULL);
623 elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
624 ic = elm_icon_add(win);
625 elm_icon_standard_set(ic, "edit");
626 elm_icon_resizable_set(ic, 0, 0);
627 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
628
629 ic = elm_icon_add(win);
630 elm_icon_standard_set(ic, "delete");
631 elm_icon_resizable_set(ic, 0, 0);
632 ic2 = elm_icon_add(win);
633 elm_icon_standard_set(ic2, "clock");
634 elm_icon_resizable_set(ic2, 0, 0);
635 elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
636
637 bx2 = elm_box_add(win);
638 elm_box_horizontal_set(bx2, EINA_TRUE);
639
640 ic = elm_icon_add(win);
641 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
642 elm_icon_file_set(ic, buf, NULL);
643 elm_icon_resizable_set(ic, 0, 0);
644 evas_object_size_hint_align_set(ic, 0.5, 0.5);
645 elm_box_pack_end(bx2, ic);
646 evas_object_show(ic);
647
648 ic = elm_icon_add(win);
649 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
650 elm_icon_file_set(ic, buf, NULL);
651 elm_icon_resizable_set(ic, 0, 0);
652 evas_object_size_hint_align_set(ic, 0.5, 0.0);
653 elm_box_pack_end(bx2, ic);
654 evas_object_show(ic);
655 elm_list_item_append(li, "are", bx2, NULL, NULL, NULL);
656
657 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
658 elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
659 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
660 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
661 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
662 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
663 elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
664 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
665 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
666 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
667 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
668 elm_list_item_append(li, "Longer label.", NULL, NULL, NULL, NULL);
669
670 elm_list_go(li);
671
672 elm_box_pack_end(bx, li);
673 evas_object_show(li);
674
675 bx2 = elm_box_add(win);
676 elm_box_horizontal_set(bx2, EINA_TRUE);
677 elm_box_homogeneous_set(bx2, EINA_TRUE);
678 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
679 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
680
681 bt = elm_button_add(win);
682 elm_object_text_set(bt, "Clear");
683 evas_object_smart_callback_add(bt, "clicked", my_li2_clear, li);
684 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
685 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
686 elm_box_pack_end(bx2, bt);
687 evas_object_show(bt);
688
689 elm_box_pack_end(bx, bx2);
690 evas_object_show(bx2);
691
692 evas_object_resize(win, 320, 300);
693 evas_object_show(win);
694}
695
696/***********/
697
698static void
699_bt_clicked(void *data __UNUSED__,
700 Evas_Object *obj __UNUSED__,
701 void *event_info __UNUSED__)
702{
703 printf("button was clicked\n");
704}
705
706static void
707_it_clicked(void *data, Evas_Object *obj __UNUSED__,
708 void *event_info __UNUSED__)
709{
710 printf("item was clicked\n");
711 if (!data) return;
712 Evas_Object *li = (Evas_Object *) data;
713 Evas_Object *lb;
714 char str[128];
715
716 Elm_Object_Item *lit = elm_list_selected_item_get(li);
717 if (!lit) return;
718 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
719
720 lb = evas_object_data_get(li, "label");
721 elm_object_text_set(lb, str);
722}
723
724void
725test_list3(void *data __UNUSED__,
726 Evas_Object *obj __UNUSED__,
727 void *event_info __UNUSED__)
728{
729 Evas_Object *win, *li, *ic, *ic2, *bx;
730 char buf[PATH_MAX];
731
732 win = elm_win_util_standard_add("list3", "List 3");
733 elm_win_autodel_set(win, EINA_TRUE);
734
735 li = elm_list_add(win);
736 elm_win_resize_object_add(win, li);
737 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
738 elm_list_mode_set(li, ELM_LIST_COMPRESS);
739
740 ic = elm_icon_add(win);
741 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
742 elm_icon_resizable_set(ic, 0, 0);
743 elm_icon_file_set(ic, buf, NULL);
744 ic2 = elm_button_add(win);
745 elm_object_text_set(ic2, "Click me");
746 evas_object_smart_callback_add(ic2, "clicked", _bt_clicked, NULL);
747 evas_object_propagate_events_set(ic2, 0);
748 elm_list_item_append(li, "Hello", ic, ic2, _it_clicked, NULL);
749
750 ic = elm_icon_add(win);
751 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
752 elm_icon_resizable_set(ic, 0, 0);
753 elm_icon_file_set(ic, buf, NULL);
754 ic2 = elm_button_add(win);
755 elm_object_text_set(ic2, "Click me");
756 evas_object_smart_callback_add(ic2, "clicked", _bt_clicked, NULL);
757 elm_list_item_append(li, "world", ic, ic2, _it_clicked, NULL);
758
759 ic = elm_icon_add(win);
760 elm_icon_standard_set(ic, "edit");
761 elm_icon_resizable_set(ic, 0, 0);
762 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
763
764 ic = elm_icon_add(win);
765 elm_icon_standard_set(ic, "delete");
766 elm_icon_resizable_set(ic, 0, 0);
767 ic2 = elm_icon_add(win);
768 elm_icon_standard_set(ic2, "clock");
769 elm_icon_resizable_set(ic2, 0, 0);
770 elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
771
772 bx = elm_box_add(win);
773 elm_box_horizontal_set(bx, EINA_TRUE);
774
775 ic = elm_icon_add(win);
776 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
777 elm_icon_file_set(ic, buf, NULL);
778 elm_icon_resizable_set(ic, 0, 0);
779 evas_object_size_hint_align_set(ic, 0.5, 0.5);
780 elm_box_pack_end(bx, ic);
781 evas_object_show(ic);
782
783 ic = elm_icon_add(win);
784 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
785 elm_icon_file_set(ic, buf, NULL);
786 elm_icon_resizable_set(ic, 0, 0);
787 evas_object_size_hint_align_set(ic, 0.5, 0.0);
788 elm_box_pack_end(bx, ic);
789 evas_object_show(ic);
790
791 ic = elm_icon_add(win);
792 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
793 elm_icon_file_set(ic, buf, NULL);
794 elm_icon_resizable_set(ic, 0, 0);
795 evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND);
796 elm_box_pack_end(bx, ic);
797 evas_object_show(ic);
798
799 elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
800 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
801 elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
802 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
803 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
804 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
805 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
806 elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
807 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
808 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
809 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
810 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
811 elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL);
812 elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL);
813
814 elm_list_go(li);
815
816 evas_object_show(li);
817
818 evas_object_resize(win, 320, 300);
819 evas_object_show(win);
820}
821
822///////////////////////////////////////////////////////////////////////////////////////
823
824struct Pginfo
825{
826 Evas_Object *naviframe, *win;
827};
828
829static void
830test_list4_back_cb(void *data,
831 Evas_Object *obj __UNUSED__,
832 void *event_info __UNUSED__)
833{
834 struct Pginfo *info = data;
835 if (!info) return;
836
837 elm_naviframe_item_pop(info->naviframe);
838}
839
840static void
841test_list4_swipe(void *data,
842 Evas_Object *obj __UNUSED__,
843 void *event_info)
844{
845 Evas_Object *box, *entry, *button;
846 struct Pginfo *info = data;
847 char *item_data;
848 if ((!event_info) || (!data)) return;
849
850 item_data = elm_object_item_data_get(event_info);
851
852 box = elm_box_add(info->win);
853 elm_box_horizontal_set(box, EINA_FALSE);
854 elm_box_homogeneous_set(box, EINA_FALSE);
855 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
856 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
857 evas_object_show(box);
858
859 entry = elm_entry_add(info->win);
860 elm_entry_scrollable_set(entry, EINA_TRUE);
861 elm_entry_editable_set(entry, EINA_FALSE);
862 elm_object_text_set(entry, item_data);
863 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
864 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
865 evas_object_show(entry);
866
867 button = elm_button_add(info->win);
868 elm_object_text_set(button, "back");
869 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
870 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0);
871 evas_object_smart_callback_add(button, "clicked", test_list4_back_cb, info);
872 evas_object_show(button);
873
874 elm_box_pack_start(box, entry);
875 elm_box_pack_end(box, button);
876
877 elm_naviframe_item_simple_push(info->naviframe, box);
878}
879
880void
881test_list4(void *data __UNUSED__,
882 Evas_Object *obj __UNUSED__,
883 void *event_info __UNUSED__)
884{
885 Evas_Object *win, *li, *ic, *ic2, *naviframe;
886 static struct Pginfo info = {NULL, NULL};
887 char buf[PATH_MAX];
888
889 win = elm_win_util_standard_add("list4", "List 4");
890 elm_win_autodel_set(win, EINA_TRUE);
891 info.win = win;
892
893 naviframe = elm_naviframe_add(win);
894 elm_win_resize_object_add(win, naviframe);
895 evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
896 evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL);
897 evas_object_show(naviframe);
898 info.naviframe = naviframe;
899
900 li = elm_list_add(win);
901 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
902 elm_list_mode_set(li, ELM_LIST_COMPRESS);
903 evas_object_smart_callback_add(li, "swipe", test_list4_swipe, &info);
904 elm_naviframe_item_simple_push(naviframe, li);
905
906 static char pf_data[] = "Pink Floyd were formed in 1965, and originally consisted of university" \
907 "students Roger Waters, Nick Mason, Richard Wright, and Syd Barrett. The group were a popular" \
908 "fixture on London's underground music scene, and under Barrett's leadership released two " \
909 "charting singles, \"Arnold Layne\" and \"See Emily Play\", and a successful debut album, " \
910 "ThePiper at the Gates of Dawn. In 1968, guitarist and singer David Gilmour joined the " \
911 "line-up. Barrett was soon removed, due to his increasingly erratic behaviour. Following " \
912 "Barrett's departure, bass player and singer Roger Waters became the band's lyricist and " \
913 "conceptual leader, with Gilmour assuming lead guitar and much of the vocals. With this " \
914 "line-up, Floyd went on to achieve worldwide critical and commercial success with the " \
915 "conceptalbums The Dark Side of the Moon, Wish You Were Here, Animals, and The Wall.";
916 ic = elm_icon_add(win);
917 snprintf(buf, sizeof(buf), "%s/images/mystrale.jpg", elm_app_data_dir_get());
918 elm_icon_resizable_set(ic, 0, 0);
919 elm_icon_file_set(ic, buf, NULL);
920 elm_list_item_append(li, "Pink Floyd", ic, NULL, NULL, &pf_data);
921
922 static char ds_data[] = "Dire Straits were a British rock band, formed by Mark Knopfler " \
923 "(lead vocals and lead guitar), his younger brother David Knopfler (rhythm guitar and " \
924 "backing vocals), John Illsley (bass guitar and backing vocals), and Pick Withers (drums " \
925 "and percussion), and managed by Ed Bicknell, active between 1977 and 1995. Although the " \
926 "band was formed in an era when punk rock was at the forefront, Dire Straits played a more "
927 "bluesy style, albeit with a stripped-down sound that appealed to audiences weary of the " \
928 "overproduced stadium rock of the 1970s.[citation needed] In their early days, Mark and " \
929 "David requested that pub owners turn down their sound so that patrons could converse " \
930 "while the band played, an indication of their unassuming demeanor. Despite this oddly " \
931 "self-effacing approach to rock and roll, Dire Straits soon became hugely successful, with " \
932 "their first album going multi-platinum globally.";
933 ic = elm_icon_add(win);
934 snprintf(buf, sizeof(buf), "%s/images/mystrale_2.jpg", elm_app_data_dir_get());
935 elm_icon_resizable_set(ic, 0, 0);
936 elm_icon_file_set(ic, buf, NULL);
937 elm_list_item_append(li, "Dire Straits", ic, NULL, NULL, &ds_data);
938
939 static char uh_data[] = "Uriah Heep are an English hard rock band. The band released several " \
940 "commercially successful albums in the 1970s such as Uriah Heep Live (1973), but their " \
941 "audience declined by the 1980s, to the point where they became essentially a cult band in " \
942 "the United States and United Kingdom. Uriah Heep maintain a significant following in " \
943 "Germany, the Netherlands, Scandinavia, the Balkans, Japan and Russia, where they still " \
944 "perform at stadium-sized venues.";
945 ic = elm_icon_add(win);
946 snprintf(buf, sizeof(buf), "%s/images/icon_17.png", elm_app_data_dir_get());
947 elm_icon_resizable_set(ic, 1, 1);
948 elm_icon_file_set(ic, buf, NULL);
949 elm_list_item_append(li, "Uriah Heep", ic, NULL, NULL, &uh_data);
950
951 static char r_data[] = "Rush is a Canadian rock band formed in August 1968, in the Willowdale " \
952 "neighbourhood of Toronto, Ontario. The band is composed of bassist, keyboardist, and lead " \
953 "vocalist Geddy Lee, guitarist Alex Lifeson, and drummer and lyricist Neil Peart. The band " \
954 "and its membership went through a number of re-configurations between 1968 and 1974, " \
955 "achieving their current form when Peart replaced original drummer John Rutsey in July 1974, " \
956 "two weeks before the group's first United States tour.";
957 ic = elm_icon_add(win);
958 snprintf(buf, sizeof(buf), "%s/images/icon_21.png", elm_app_data_dir_get());
959 elm_icon_resizable_set(ic, 0, 0);
960 elm_icon_file_set(ic, buf, NULL);
961 ic2 = elm_icon_add(win);
962 elm_icon_standard_set(ic2, "clock");
963 elm_icon_resizable_set(ic2, 0, 0);
964 elm_list_item_append(li, "Rush", ic, ic2, NULL, &r_data);
965
966 elm_list_go(li);
967
968 evas_object_show(li);
969 evas_object_resize(win, 320, 300);
970 evas_object_show(win);
971}
972
973/////////////////////////////////////////////////////////////////////////////////////////
974struct list5_data_cb
975{
976 Evas_Object *win, *list;
977};
978
979static void
980test_list5_item_del(void *data,
981 Evas_Object *obj __UNUSED__,
982 void *event_info __UNUSED__)
983{
984 elm_object_item_del(data);
985}
986
987static void
988test_list5_swipe(void *data __UNUSED__,
989 Evas_Object *obj __UNUSED__,
990 void *event_info)
991{
992 Evas_Object *button;
993 struct list5_data_cb *info = elm_object_item_data_get(event_info);
994
995 if (elm_object_item_part_content_get(event_info, "end")) return;
996
997 button = elm_button_add(info->win);
998 elm_object_text_set(button, "delete");
999 evas_object_propagate_events_set(button, 0);
1000 evas_object_smart_callback_add(button, "clicked", test_list5_item_del,
1001 event_info);
1002 elm_object_item_part_content_set(event_info, "end", button);
1003}
1004
1005void
1006test_list5(void *data __UNUSED__,
1007 Evas_Object *obj __UNUSED__,
1008 void *event_info __UNUSED__)
1009{
1010 Evas_Object *win, *li;
1011 static struct list5_data_cb info;
1012
1013 win = elm_win_util_standard_add("list5", "List 5");
1014 elm_win_autodel_set(win, EINA_TRUE);
1015 info.win = win;
1016
1017 li = elm_list_add(win);
1018 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1019 elm_list_mode_set(li, ELM_LIST_COMPRESS);
1020 evas_object_smart_callback_add(li, "swipe", test_list5_swipe, NULL);
1021 elm_win_resize_object_add(win, li);
1022 evas_object_show(li);
1023 info.list = li;
1024
1025 elm_list_item_append(li, "Network", NULL, NULL, NULL, &info);
1026 elm_list_item_append(li, "Audio", NULL, NULL, NULL, &info);
1027
1028 elm_list_go(li);
1029 evas_object_resize(win, 320, 300);
1030 evas_object_show(win);
1031}
1032
1033static void
1034_first_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
1035 void *event_info __UNUSED__)
1036{
1037 char str[128];
1038 Evas_Object *li = data, *lb;
1039 Elm_Object_Item *lit = elm_list_first_item_get(li);
1040 if (!lit) return;
1041
1042 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
1043 elm_list_item_bring_in(lit);
1044 elm_list_item_selected_set(lit, EINA_TRUE);
1045
1046 lb = evas_object_data_get(li, "label");
1047 elm_object_text_set(lb, str);
1048}
1049
1050static void
1051_prev_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
1052 void *event_info __UNUSED__)
1053{
1054 char str[128];
1055 Evas_Object *li = data, *lb;
1056
1057 Elm_Object_Item *lit = elm_list_selected_item_get(li);
1058 if (!lit) return;
1059 lit = elm_list_item_prev(lit);
1060 if (!lit) return;
1061
1062 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
1063 elm_list_item_bring_in(lit);
1064 elm_list_item_selected_set(lit, EINA_TRUE);
1065
1066 lb = evas_object_data_get(li, "label");
1067 elm_object_text_set(lb, str);
1068}
1069
1070static void
1071_next_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
1072 void *event_info __UNUSED__)
1073{
1074 char str[128];
1075 Evas_Object *li = data, *lb;
1076
1077 Elm_Object_Item *lit = elm_list_selected_item_get(li);
1078 if (!lit) return;
1079 lit = elm_list_item_next(lit);
1080 if (!lit) return;
1081
1082 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
1083 elm_list_item_bring_in(lit);
1084 elm_list_item_selected_set(lit, EINA_TRUE);
1085
1086 lb = evas_object_data_get(li, "label");
1087 elm_object_text_set(lb, str);
1088}
1089
1090static void
1091_last_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
1092 void *event_info __UNUSED__)
1093{
1094 char str[128];
1095 Evas_Object *li = data, *lb;
1096 Elm_Object_Item *lit = elm_list_last_item_get(li);
1097 if (!lit) return;
1098
1099 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
1100 elm_list_item_bring_in(lit);
1101 elm_list_item_selected_set(lit, EINA_TRUE);
1102
1103 lb = evas_object_data_get(li, "label");
1104 elm_object_text_set(lb, str);
1105}
1106
1107void
1108test_list6(void *data __UNUSED__,
1109 Evas_Object *obj __UNUSED__,
1110 void *event_info __UNUSED__)
1111{
1112 Evas_Object *win, *gd, *bt, *li, *lb;
1113
1114 win = elm_win_util_standard_add("list6", "List 6");
1115 elm_win_autodel_set(win, EINA_TRUE);
1116
1117 gd = elm_grid_add(win);
1118 elm_grid_size_set(gd, 100, 100);
1119 elm_win_resize_object_add(win, gd);
1120 evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1121
1122 li = elm_list_add(win);
1123 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1124 elm_list_mode_set(li, ELM_LIST_COMPRESS);
1125 elm_grid_pack(gd, li, 4, 4, 92, 72);
1126 evas_object_show(li);
1127
1128 elm_list_item_append(li, "Eina", NULL, NULL, _it_clicked, li);
1129 elm_list_item_append(li, "Eet", NULL, NULL, _it_clicked, li);
1130 elm_list_item_append(li, "Evas", NULL, NULL, _it_clicked, li);
1131 elm_list_item_append(li, "Ecore", NULL, NULL, _it_clicked, li);
1132 elm_list_item_append(li, "Embryo", NULL, NULL, _it_clicked, li);
1133 elm_list_item_append(li, "Edje", NULL, NULL, _it_clicked, li);
1134 elm_list_item_append(li, "Efreet", NULL, NULL, _it_clicked, li);
1135 elm_list_item_append(li, "E_dbus", NULL, NULL, _it_clicked, li);
1136 elm_list_item_append(li, "Eeze", NULL, NULL, _it_clicked, li);
1137 elm_list_item_append(li, "Expedite", NULL, NULL, _it_clicked, li);
1138 elm_list_item_append(li, "Emotion", NULL, NULL, _it_clicked, li);
1139 elm_list_item_append(li, "Ethumb", NULL, NULL, _it_clicked, li);
1140 elm_list_item_append(li, "Elementary", NULL, NULL, _it_clicked, li);
1141 elm_list_go(li);
1142
1143 bt = elm_button_add(win);
1144 elm_object_text_set(bt, "First");
1145 evas_object_smart_callback_add(bt, "clicked", _first_bt_clicked, li);
1146 elm_grid_pack(gd, bt, 4, 80, 20, 10);
1147 evas_object_show(bt);
1148
1149 bt = elm_button_add(win);
1150 elm_object_text_set(bt, "Prev");
1151 evas_object_smart_callback_add(bt, "clicked", _prev_bt_clicked, li);
1152 elm_grid_pack(gd, bt, 28, 80, 20, 10);
1153 evas_object_show(bt);
1154
1155 bt = elm_button_add(win);
1156 elm_object_text_set(bt, "Next");
1157 evas_object_smart_callback_add(bt, "clicked", _next_bt_clicked, li);
1158 elm_grid_pack(gd, bt, 52, 80, 20, 10);
1159 evas_object_show(bt);
1160
1161 bt = elm_button_add(win);
1162 elm_object_text_set(bt, "Last");
1163 evas_object_smart_callback_add(bt, "clicked", _last_bt_clicked, li);
1164 elm_grid_pack(gd, bt, 76, 80, 20, 10);
1165 evas_object_show(bt);
1166
1167 lb = elm_label_add(win);
1168 elm_object_text_set(lb, "Nothing is selected");
1169 elm_grid_pack(gd, lb, 4, 90, 92, 10);
1170 evas_object_show(lb);
1171
1172 evas_object_data_set(li, "label", lb);
1173
1174 evas_object_show(gd);
1175 evas_object_resize(win, 480, 480);
1176 evas_object_show(win);
1177}
1178#endif