1 #include <Elementary.h>
3 #include <Elementary_Cursor.h>
5 # include "elementary_config.h"
7 #ifndef ELM_LIB_QUICKLAUNCH
10 unsigned int state; /* What state we are testing */
13 typedef struct _api_data api_data;
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 */
37 typedef enum _api_state api_state;
40 set_api_state(api_data *api)
42 /** HOW TO TEST ************************
51 5 POLICY ON, BOUNCE_SET(TRUE, TRUE)
56 9 Curosr set on last item
57 10 Cursor style set last item
63 16 VERT MODE, BOUNCE(TRUE, FALSE) try to bounce on Y-axis
65 *** HOW TO TEST ***********************/
66 Evas_Object *li = api->list;
69 { /* Put all api-changes under switch */
70 case ITEM_PREPEND: /* 0 */
72 const Eina_List *items = elm_list_items_get(li);
73 elm_list_item_prepend(li, "PREPEND", NULL, NULL, NULL, NULL);
75 elm_list_item_bring_in(eina_list_nth(items, 0));
79 case ITEM_INSERT_BEFORE: /* 1 */
81 const Eina_List *items = elm_list_items_get(li);
82 if (eina_list_count(items))
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);
88 elm_list_item_bring_in(eina_list_data_get(eina_list_last(items)));
93 case ITEM_INSERT_AFTER: /* 2 */
95 const Eina_List *items = elm_list_items_get(li);
96 if (eina_list_count(items))
98 elm_list_item_insert_after(li,
99 eina_list_nth(items, eina_list_count(items)-2),
100 "insert-after", NULL, NULL, NULL, NULL);
102 elm_list_item_bring_in(eina_list_data_get(eina_list_last(items)));
107 case ITEM_SEPARATOR_SET: /* 3 */
109 const Eina_List *items = elm_list_items_get(li);
110 if (eina_list_count(items))
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));
119 case LIST_ITEM_DEL: /* 4 */
121 const Eina_List *items = elm_list_items_get(li);
122 if (eina_list_count(items))
124 elm_object_item_del(eina_list_data_get(eina_list_last(items)));
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);
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);
138 case TOOLTIP_TEXT_SET: /* 7 */
140 const Eina_List *items = elm_list_items_get(li);
141 if (eina_list_count(items))
143 elm_object_item_tooltip_text_set(eina_list_data_get(eina_list_last(items)), "Tooltip set from API");
145 elm_list_scroller_policy_set(li, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
149 case TOOLTIP_UNSET: /* 8 */
151 const Eina_List *items = elm_list_items_get(li);
152 if (eina_list_count(items))
154 elm_object_item_tooltip_unset(eina_list_data_get(eina_list_last(items)));
159 case ITEM_CURSOR_SET: /* 9 */
161 const Eina_List *items = elm_list_items_get(li);
162 if (eina_list_count(items))
164 elm_object_item_cursor_set(eina_list_data_get(eina_list_last(items)), ELM_CURSOR_HAND2);
169 case ITEM_CURSOR_STYLE_SET: /* 10 */
171 const Eina_List *items = elm_list_items_get(li);
172 if (eina_list_count(items))
174 elm_object_item_cursor_style_set(eina_list_data_get(eina_list_last(items)), "transparent");
179 case DISABLED_SET: /* 11 */
181 const Eina_List *items = elm_list_items_get(li);
182 if (eina_list_count(items))
184 elm_object_item_disabled_set(eina_list_data_get(eina_list_last(items)), EINA_TRUE);
189 case MODE_SET_COMPRESS: /* 12 */
190 elm_list_mode_set(li, ELM_LIST_COMPRESS);
193 case MODE_SET_LIMIT: /* 13 */
194 elm_list_mode_set(li, ELM_LIST_LIMIT);
197 case MODE_SET_EXPAND: /* 14 */
198 elm_list_mode_set(li, ELM_LIST_EXPAND);
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);
206 case BOUNCE_SET: /* 16 */
207 elm_list_horizontal_set(li, EINA_FALSE);
208 elm_list_bounce_set(li, EINA_TRUE, EINA_FALSE);
211 case LIST_CLEAR: /* 17 */
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. */
230 printf("clicked event on API Button: api_state=<%d>\n", 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);
239 my_show_it(void *data,
240 Evas_Object *obj __UNUSED__,
241 void *event_info __UNUSED__)
243 elm_list_item_show(data);
247 scroll_top(void *data __UNUSED__,
248 Evas_Object *obj __UNUSED__,
249 void *event_info __UNUSED__)
251 printf("Top edge!\n");
255 scroll_bottom(void *data __UNUSED__,
256 Evas_Object *obj __UNUSED__,
257 void *event_info __UNUSED__)
259 printf("Bottom edge!\n");
263 scroll_left(void *data __UNUSED__,
264 Evas_Object *obj __UNUSED__,
265 void *event_info __UNUSED__)
267 printf("Left edge!\n");
271 scroll_right(void *data __UNUSED__,
272 Evas_Object *obj __UNUSED__,
273 void *event_info __UNUSED__)
275 printf("Right edge!\n");
279 _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
285 test_list(void *data __UNUSED__,
286 Evas_Object *obj __UNUSED__,
287 void *event_info __UNUSED__)
289 Evas_Object *win, *li, *ic, *ic2, *bx, *tb2, *bt, *bxx;
291 Elm_Object_Item *list_it1, *list_it2, *list_it3, *list_it4, *list_it5;
292 api_data *api = calloc(1, sizeof(api_data));
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);
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);
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);
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);
316 elm_box_pack_end(bxx, li);
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);
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);
341 bx = elm_box_add(win);
342 elm_box_horizontal_set(bx, EINA_TRUE);
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);
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);
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);
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);
385 evas_object_show(li);
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);
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);
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);
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);
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);
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);
431 evas_object_show(tb2);
433 evas_object_resize(win, 320, 300);
434 evas_object_show(win);
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);
443 test_list_horizontal(void *data __UNUSED__,
444 Evas_Object *obj __UNUSED__,
445 void *event_info __UNUSED__)
447 Evas_Object *win, *li, *ic, *ic2, *bx, *tb2, *bt;
449 Elm_Object_Item *list_it1, *list_it2, *list_it3, *list_it4;
451 win = elm_win_util_standard_add("list-horizontal", "List Horizontal");
452 elm_win_autodel_set(win, EINA_TRUE);
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);
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);
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);
483 bx = elm_box_add(win);
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);
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);
501 elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
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);
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);
520 evas_object_show(li);
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);
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);
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);
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);
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);
558 evas_object_show(tb2);
560 evas_object_resize(win, 320, 300);
561 evas_object_show(win);
567 my_li2_clear(void *data,
568 Evas_Object *obj __UNUSED__,
569 void *event_info __UNUSED__)
571 elm_list_clear(data);
575 my_li2_sel(void *data __UNUSED__,
577 void *event_info __UNUSED__)
579 Elm_Object_Item *list_it = elm_list_selected_item_get(obj);
580 elm_list_item_selected_set(list_it, 0);
584 test_list2(void *data __UNUSED__,
585 Evas_Object *obj __UNUSED__,
586 void *event_info __UNUSED__)
588 Evas_Object *win, *bg, *li, *ic, *ic2, *bx, *bx2, *bt;
590 Elm_Object_Item *list_it;
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);
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);
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);
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);
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);
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);
637 bx2 = elm_box_add(win);
638 elm_box_horizontal_set(bx2, EINA_TRUE);
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);
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);
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);
672 elm_box_pack_end(bx, li);
673 evas_object_show(li);
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);
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);
689 elm_box_pack_end(bx, bx2);
690 evas_object_show(bx2);
692 evas_object_resize(win, 320, 300);
693 evas_object_show(win);
699 _bt_clicked(void *data __UNUSED__,
700 Evas_Object *obj __UNUSED__,
701 void *event_info __UNUSED__)
703 printf("button was clicked\n");
707 _it_clicked(void *data __UNUSED__,
708 Evas_Object *obj __UNUSED__,
709 void *event_info __UNUSED__)
711 printf("item was clicked\n");
715 test_list3(void *data __UNUSED__,
716 Evas_Object *obj __UNUSED__,
717 void *event_info __UNUSED__)
719 Evas_Object *win, *li, *ic, *ic2, *bx;
722 win = elm_win_util_standard_add("list3", "List 3");
723 elm_win_autodel_set(win, EINA_TRUE);
725 li = elm_list_add(win);
726 elm_win_resize_object_add(win, li);
727 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
728 elm_list_mode_set(li, ELM_LIST_COMPRESS);
730 ic = elm_icon_add(win);
731 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
732 elm_icon_resizable_set(ic, 0, 0);
733 elm_icon_file_set(ic, buf, NULL);
734 ic2 = elm_button_add(win);
735 elm_object_text_set(ic2, "Click me");
736 evas_object_smart_callback_add(ic2, "clicked", _bt_clicked, NULL);
737 evas_object_propagate_events_set(ic2, 0);
738 elm_list_item_append(li, "Hello", ic, ic2, _it_clicked, NULL);
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 elm_list_item_append(li, "world", ic, ic2, _it_clicked, NULL);
749 ic = elm_icon_add(win);
750 elm_icon_standard_set(ic, "edit");
751 elm_icon_resizable_set(ic, 0, 0);
752 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
754 ic = elm_icon_add(win);
755 elm_icon_standard_set(ic, "delete");
756 elm_icon_resizable_set(ic, 0, 0);
757 ic2 = elm_icon_add(win);
758 elm_icon_standard_set(ic2, "clock");
759 elm_icon_resizable_set(ic2, 0, 0);
760 elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
762 bx = elm_box_add(win);
763 elm_box_horizontal_set(bx, EINA_TRUE);
765 ic = elm_icon_add(win);
766 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
767 elm_icon_file_set(ic, buf, NULL);
768 elm_icon_resizable_set(ic, 0, 0);
769 evas_object_size_hint_align_set(ic, 0.5, 0.5);
770 elm_box_pack_end(bx, ic);
771 evas_object_show(ic);
773 ic = elm_icon_add(win);
774 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
775 elm_icon_file_set(ic, buf, NULL);
776 elm_icon_resizable_set(ic, 0, 0);
777 evas_object_size_hint_align_set(ic, 0.5, 0.0);
778 elm_box_pack_end(bx, ic);
779 evas_object_show(ic);
781 ic = elm_icon_add(win);
782 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
783 elm_icon_file_set(ic, buf, NULL);
784 elm_icon_resizable_set(ic, 0, 0);
785 evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND);
786 elm_box_pack_end(bx, ic);
787 evas_object_show(ic);
789 elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
790 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
791 elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
792 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
793 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
794 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
795 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
796 elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
797 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
798 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
799 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
800 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
801 elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL);
802 elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL);
806 evas_object_show(li);
808 evas_object_resize(win, 320, 300);
809 evas_object_show(win);
812 ///////////////////////////////////////////////////////////////////////////////////////
816 Evas_Object *naviframe, *win;
820 test_list4_back_cb(void *data,
821 Evas_Object *obj __UNUSED__,
822 void *event_info __UNUSED__)
824 struct Pginfo *info = data;
827 elm_naviframe_item_pop(info->naviframe);
831 test_list4_swipe(void *data,
832 Evas_Object *obj __UNUSED__,
835 Evas_Object *box, *entry, *button;
836 struct Pginfo *info = data;
838 if ((!event_info) || (!data)) return;
840 item_data = elm_object_item_data_get(event_info);
842 box = elm_box_add(info->win);
843 elm_box_horizontal_set(box, EINA_FALSE);
844 elm_box_homogeneous_set(box, EINA_FALSE);
845 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
846 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
847 evas_object_show(box);
849 entry = elm_entry_add(info->win);
850 elm_entry_scrollable_set(entry, EINA_TRUE);
851 elm_entry_editable_set(entry, EINA_FALSE);
852 elm_object_text_set(entry, item_data);
853 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
854 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
855 evas_object_show(entry);
857 button = elm_button_add(info->win);
858 elm_object_text_set(button, "back");
859 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
860 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0);
861 evas_object_smart_callback_add(button, "clicked", test_list4_back_cb, info);
862 evas_object_show(button);
864 elm_box_pack_start(box, entry);
865 elm_box_pack_end(box, button);
867 elm_naviframe_item_simple_push(info->naviframe, box);
871 test_list4(void *data __UNUSED__,
872 Evas_Object *obj __UNUSED__,
873 void *event_info __UNUSED__)
875 Evas_Object *win, *li, *ic, *ic2, *naviframe;
876 static struct Pginfo info = {NULL, NULL};
879 win = elm_win_util_standard_add("list4", "List 4");
880 elm_win_autodel_set(win, EINA_TRUE);
883 naviframe = elm_naviframe_add(win);
884 elm_win_resize_object_add(win, naviframe);
885 evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
886 evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL);
887 evas_object_show(naviframe);
888 info.naviframe = naviframe;
890 li = elm_list_add(win);
891 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
892 elm_list_mode_set(li, ELM_LIST_COMPRESS);
893 evas_object_smart_callback_add(li, "swipe", test_list4_swipe, &info);
894 elm_naviframe_item_simple_push(naviframe, li);
896 static char pf_data[] = "Pink Floyd were formed in 1965, and originally consisted of university" \
897 "students Roger Waters, Nick Mason, Richard Wright, and Syd Barrett. The group were a popular" \
898 "fixture on London's underground music scene, and under Barrett's leadership released two " \
899 "charting singles, \"Arnold Layne\" and \"See Emily Play\", and a successful debut album, " \
900 "ThePiper at the Gates of Dawn. In 1968, guitarist and singer David Gilmour joined the " \
901 "line-up. Barrett was soon removed, due to his increasingly erratic behaviour. Following " \
902 "Barrett's departure, bass player and singer Roger Waters became the band's lyricist and " \
903 "conceptual leader, with Gilmour assuming lead guitar and much of the vocals. With this " \
904 "line-up, Floyd went on to achieve worldwide critical and commercial success with the " \
905 "conceptalbums The Dark Side of the Moon, Wish You Were Here, Animals, and The Wall.";
906 ic = elm_icon_add(win);
907 snprintf(buf, sizeof(buf), "%s/images/mystrale.jpg", elm_app_data_dir_get());
908 elm_icon_resizable_set(ic, 0, 0);
909 elm_icon_file_set(ic, buf, NULL);
910 elm_list_item_append(li, "Pink Floyd", ic, NULL, NULL, &pf_data);
912 static char ds_data[] = "Dire Straits were a British rock band, formed by Mark Knopfler " \
913 "(lead vocals and lead guitar), his younger brother David Knopfler (rhythm guitar and " \
914 "backing vocals), John Illsley (bass guitar and backing vocals), and Pick Withers (drums " \
915 "and percussion), and managed by Ed Bicknell, active between 1977 and 1995. Although the " \
916 "band was formed in an era when punk rock was at the forefront, Dire Straits played a more "
917 "bluesy style, albeit with a stripped-down sound that appealed to audiences weary of the " \
918 "overproduced stadium rock of the 1970s.[citation needed] In their early days, Mark and " \
919 "David requested that pub owners turn down their sound so that patrons could converse " \
920 "while the band played, an indication of their unassuming demeanor. Despite this oddly " \
921 "self-effacing approach to rock and roll, Dire Straits soon became hugely successful, with " \
922 "their first album going multi-platinum globally.";
923 ic = elm_icon_add(win);
924 snprintf(buf, sizeof(buf), "%s/images/mystrale_2.jpg", elm_app_data_dir_get());
925 elm_icon_resizable_set(ic, 0, 0);
926 elm_icon_file_set(ic, buf, NULL);
927 elm_list_item_append(li, "Dire Straits", ic, NULL, NULL, &ds_data);
929 static char uh_data[] = "Uriah Heep are an English hard rock band. The band released several " \
930 "commercially successful albums in the 1970s such as Uriah Heep Live (1973), but their " \
931 "audience declined by the 1980s, to the point where they became essentially a cult band in " \
932 "the United States and United Kingdom. Uriah Heep maintain a significant following in " \
933 "Germany, the Netherlands, Scandinavia, the Balkans, Japan and Russia, where they still " \
934 "perform at stadium-sized venues.";
935 ic = elm_icon_add(win);
936 snprintf(buf, sizeof(buf), "%s/images/icon_17.png", elm_app_data_dir_get());
937 elm_icon_resizable_set(ic, 1, 1);
938 elm_icon_file_set(ic, buf, NULL);
939 elm_list_item_append(li, "Uriah Heep", ic, NULL, NULL, &uh_data);
941 static char r_data[] = "Rush is a Canadian rock band formed in August 1968, in the Willowdale " \
942 "neighbourhood of Toronto, Ontario. The band is composed of bassist, keyboardist, and lead " \
943 "vocalist Geddy Lee, guitarist Alex Lifeson, and drummer and lyricist Neil Peart. The band " \
944 "and its membership went through a number of re-configurations between 1968 and 1974, " \
945 "achieving their current form when Peart replaced original drummer John Rutsey in July 1974, " \
946 "two weeks before the group's first United States tour.";
947 ic = elm_icon_add(win);
948 snprintf(buf, sizeof(buf), "%s/images/icon_21.png", elm_app_data_dir_get());
949 elm_icon_resizable_set(ic, 0, 0);
950 elm_icon_file_set(ic, buf, NULL);
951 ic2 = elm_icon_add(win);
952 elm_icon_standard_set(ic2, "clock");
953 elm_icon_resizable_set(ic2, 0, 0);
954 elm_list_item_append(li, "Rush", ic, ic2, NULL, &r_data);
958 evas_object_show(li);
959 evas_object_resize(win, 320, 300);
960 evas_object_show(win);
963 /////////////////////////////////////////////////////////////////////////////////////////
966 Evas_Object *win, *list;
970 test_list5_item_del(void *data,
971 Evas_Object *obj __UNUSED__,
972 void *event_info __UNUSED__)
974 elm_object_item_del(data);
978 test_list5_swipe(void *data __UNUSED__,
979 Evas_Object *obj __UNUSED__,
983 struct list5_data_cb *info = elm_object_item_data_get(event_info);
985 if (elm_object_item_part_content_get(event_info, "end")) return;
987 button = elm_button_add(info->win);
988 elm_object_text_set(button, "delete");
989 evas_object_propagate_events_set(button, 0);
990 evas_object_smart_callback_add(button, "clicked", test_list5_item_del,
992 elm_object_item_part_content_set(event_info, "end", button);
996 test_list5(void *data __UNUSED__,
997 Evas_Object *obj __UNUSED__,
998 void *event_info __UNUSED__)
1000 Evas_Object *win, *li;
1001 static struct list5_data_cb info;
1003 win = elm_win_util_standard_add("list5", "List 5");
1004 elm_win_autodel_set(win, EINA_TRUE);
1007 li = elm_list_add(win);
1008 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1009 elm_list_mode_set(li, ELM_LIST_COMPRESS);
1010 evas_object_smart_callback_add(li, "swipe", test_list5_swipe, NULL);
1011 elm_win_resize_object_add(win, li);
1012 evas_object_show(li);
1015 elm_list_item_append(li, "Network", NULL, NULL, NULL, &info);
1016 elm_list_item_append(li, "Audio", NULL, NULL, NULL, &info);
1019 evas_object_resize(win, 320, 300);
1020 evas_object_show(win);