1 #include <Elementary_Cursor.h>
4 #include "elementary_config.h"
6 #include <Elementary.h>
7 #ifndef ELM_LIB_QUICKLAUNCH
10 unsigned int state; /* What state we are testing */
11 void *box; /* Use this to get box content */
13 typedef struct _api_data api_data;
27 typedef enum _api_state api_state;
30 set_api_state(api_data *api)
32 const Eina_List *items = elm_box_children_get(api->box);
33 if (!eina_list_count(items))
36 Evas_Object *gl = eina_list_nth(items, 0); /* Genlist is the first item */
37 /* use elm_box_children_get() to get list of children */
39 {/* Put all api-changes under switch */
40 case HORIZONTAL_SET: /* 0 */
41 elm_genlist_mode_set(gl, ELM_LIST_LIMIT);
44 case NO_SELECT_MODE_SET: /* 1 */
45 elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_NONE);
46 elm_genlist_mode_set(gl, ELM_LIST_SCROLL); /* Back to default */
49 case COMPRESS_MODE_SET: /* 2 */
50 elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_DEFAULT);
51 elm_genlist_mode_set(gl, ELM_LIST_COMPRESS);
54 case BOUNCE_SET: /* 3 */
55 elm_genlist_bounce_set(gl, EINA_FALSE, EINA_FALSE);
58 case HOMOGENEOUS_SET: /* 4 */
59 elm_genlist_bounce_set(gl, EINA_TRUE, EINA_TRUE); /* Back to default */
60 elm_genlist_homogeneous_set(gl, EINA_TRUE);
63 case SCROLLER_POLICY_SET: /* 5 */
64 elm_genlist_homogeneous_set(gl, EINA_FALSE); /* Back to default */
65 elm_genlist_scroller_policy_set(gl, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
68 case TOOLTIP_TEXT_SET: /* 6 */
70 elm_genlist_item_tooltip_text_set(elm_genlist_first_item_get(gl), "Tooltip text from API");
71 elm_genlist_item_bring_in(elm_genlist_first_item_get(gl),
72 ELM_GENLIST_ITEM_SCROLLTO_IN);
76 case ITEM_CURSOR_SET: /* 7 */
77 elm_genlist_item_cursor_set(elm_genlist_first_item_get(gl), ELM_CURSOR_HAND2);
86 _api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
87 { /* Will add here a SWITCH command containing code to modify test-object */
88 /* in accordance a->state value. */
92 printf("clicked event on API Button: api_state=<%d>\n", a->state);
95 sprintf(str, "Next API function (%u)", a->state);
96 elm_object_text_set(obj, str);
97 elm_object_disabled_set(obj, a->state == API_STATE_LAST);
100 * In this example some calls to elm_genlist_item_append() are used which give the
101 * value of an int as 'item data' and 'func data' after casting into (void*). For
102 * sure this works only on architectures where sizeof(int)==sizeof(void*).
103 * For real world usage you should hold a data structure or value in your
104 * application and then give only a pointer to this data as data pointer.
107 typedef struct _Testitem
109 Elm_Object_Item *item;
115 static Elm_Genlist_Item_Class *itc1;
116 char *gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
119 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
123 Evas_Object *gl_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
126 Evas_Object *ic = elm_icon_add(obj);
127 if (!strcmp(part, "elm.swallow.end"))
128 snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get());
130 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
131 elm_icon_file_set(ic, buf, NULL);
132 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
136 Eina_Bool gl_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
142 gl_sel(void *data, Evas_Object *obj, void *event_info)
144 printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", data, obj, event_info);
148 _move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
150 Evas_Object *gl = data;
151 Evas_Event_Mouse_Move *ev = event_info;
153 Elm_Object_Item *gli;
154 gli = elm_genlist_at_xy_item_get(gl, ev->cur.canvas.x, ev->cur.canvas.y, &where);
156 printf("over %p, where %i\n", elm_object_item_data_get(gli), where);
158 printf("over none, where %i\n", where);
162 _bt50_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
164 elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_IN);
168 _bt1500_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
170 elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
174 _gl_selected(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
176 printf("selected: %p\n", event_info);
180 _gl_double_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
182 printf("double clicked: %p\n", event_info);
186 _gl_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
188 printf("longpress %p\n", event_info);
192 _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
198 test_genlist(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
200 Evas_Object *win, *gl, *bt_50, *bt_1500, *bx, *bxx, *bt;
202 Elm_Object_Item *gli;
204 api_data *api = calloc(1, sizeof(api_data));
206 win = elm_win_util_standard_add("genlist", "Genlist");
207 elm_win_autodel_set(win, EINA_TRUE);
208 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
210 bxx = elm_box_add(win);
211 elm_win_resize_object_add(win, bxx);
212 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
213 evas_object_show(bxx);
215 bx = elm_box_add(win);
216 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
217 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
219 evas_object_show(bx);
221 bt = elm_button_add(win);
222 elm_object_text_set(bt, "Next API function");
223 evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
224 elm_box_pack_end(bxx, bt);
225 elm_object_disabled_set(bt, api->state == API_STATE_LAST);
226 evas_object_show(bt);
228 elm_box_pack_end(bxx, bx);
230 gl = elm_genlist_add(win);
231 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
232 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
233 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
234 // FIXME: This causes genlist to resize the horiz axis very slowly :(
235 // Reenable this and resize the window horizontally, then try to resize it back
236 //elm_genlist_mode_set(gl, ELM_LIST_LIMIT);
237 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
238 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
239 elm_box_pack_end(bx, gl);
240 evas_object_show(gl);
242 over = evas_object_rectangle_add(evas_object_evas_get(win));
243 evas_object_color_set(over, 0, 0, 0, 0);
244 evas_object_event_callback_add(over, EVAS_CALLBACK_MOUSE_MOVE, _move, gl);
245 evas_object_repeat_events_set(over, 1);
246 evas_object_show(over);
247 evas_object_size_hint_weight_set(over, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
248 elm_win_resize_object_add(win, over);
250 itc1 = elm_genlist_item_class_new();
251 itc1->item_style = "default";
252 itc1->func.text_get = gl_text_get;
253 itc1->func.content_get = gl_content_get;
254 itc1->func.state_get = gl_state_get;
255 itc1->func.del = NULL;
257 bt_50 = elm_button_add(win);
258 elm_object_text_set(bt_50, "Go to 50");
259 evas_object_show(bt_50);
260 elm_box_pack_end(bx, bt_50);
262 bt_1500 = elm_button_add(win);
263 elm_object_text_set(bt_1500, "Go to 1500");
264 evas_object_show(bt_1500);
265 elm_box_pack_end(bx, bt_1500);
267 for (i = 0; i < 2000; i++)
269 gli = elm_genlist_item_append(gl, itc1,
270 (void *)(long)i/* item data */,
272 ELM_GENLIST_ITEM_NONE,
274 (void *)(long)(i * 10)/* func data */);
276 evas_object_smart_callback_add(bt_50, "clicked", _bt50_cb, gli);
278 evas_object_smart_callback_add(bt_1500, "clicked", _bt1500_cb, gli);
280 elm_genlist_item_class_free(itc1);
282 evas_object_resize(win, 480, 800);
283 evas_object_show(win);
289 my_gl_clear(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
291 Evas_Object *gl = data;
292 elm_genlist_clear(gl);
296 my_gl_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
298 Evas_Object *gl = data;
301 itc1->item_style = "default";
302 itc1->func.text_get = gl_text_get;
303 itc1->func.content_get = gl_content_get;
304 itc1->func.state_get = gl_state_get;
305 itc1->func.del = NULL;
307 elm_genlist_item_append(gl, itc1,
308 (void *)(long)i/* item data */,
310 ELM_GENLIST_ITEM_NONE,
312 (void *)(long)(i * 10)/* func data */);
317 my_gl_insert_before(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
319 Evas_Object *gl = data;
321 Elm_Object_Item *gli_selected;
323 itc1->item_style = "default";
324 itc1->func.text_get = gl_text_get;
325 itc1->func.content_get = gl_content_get;
326 itc1->func.state_get = gl_state_get;
327 itc1->func.del = NULL;
329 gli_selected = elm_genlist_selected_item_get(gl);
332 printf("no item selected\n");
336 elm_genlist_item_insert_before(gl, itc1,
337 (void *)(long)i/* item data */,
339 gli_selected /* item before */,
340 ELM_GENLIST_ITEM_NONE,
342 (void *)(long)(i * 10)/* func data */);
347 my_gl_insert_after(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
349 Evas_Object *gl = data;
351 Elm_Object_Item *gli_selected;
353 itc1->item_style = "default";
354 itc1->func.text_get = gl_text_get;
355 itc1->func.content_get = gl_content_get;
356 itc1->func.state_get = gl_state_get;
357 itc1->func.del = NULL;
359 gli_selected = elm_genlist_selected_item_get(gl);
362 printf("no item selected\n");
366 elm_genlist_item_insert_after(gl, itc1,
367 (void *)(long)i/* item data */,
369 gli_selected /* item after */,
370 ELM_GENLIST_ITEM_NONE,
372 (void *)(long)(i * 10)/* func data */);
377 my_gl_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
379 Evas_Object *gl = data;
380 Elm_Object_Item *gli = elm_genlist_selected_item_get(gl);
383 printf("no item selected\n");
386 elm_object_item_del(gli);
390 my_gl_disable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
392 Evas_Object *gl = data;
393 Elm_Object_Item *gli = elm_genlist_selected_item_get(gl);
396 printf("no item selected\n");
399 elm_object_item_disabled_set(gli, EINA_TRUE);
400 elm_genlist_item_selected_set(gli, EINA_FALSE);
401 elm_genlist_item_update(gli);
405 my_gl_update_all(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
407 Evas_Object *gl = data;
409 Elm_Object_Item *it = elm_genlist_first_item_get(gl);
412 elm_genlist_item_update(it);
415 it = elm_genlist_item_next_get(it);
420 my_gl_first(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
422 Evas_Object *gl = data;
423 Elm_Object_Item *gli = elm_genlist_first_item_get(gl);
425 elm_genlist_item_show(gli, ELM_GENLIST_ITEM_SCROLLTO_IN);
426 elm_genlist_item_selected_set(gli, 1);
430 my_gl_last(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
432 Evas_Object *gl = data;
433 Elm_Object_Item *gli = elm_genlist_last_item_get(gl);
435 elm_genlist_item_show(gli, ELM_GENLIST_ITEM_SCROLLTO_IN);
436 elm_genlist_item_selected_set(gli, 1);
440 my_gl_flush_delay(void *data __UNUSED__)
442 elm_cache_all_flush();
443 return ECORE_CALLBACK_CANCEL;
447 my_gl_flush(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
449 ecore_timer_add(1.2, my_gl_flush_delay, NULL);
453 test_genlist2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
455 Evas_Object *win, *bg, *gl, *bx, *bx2, *bx3, *bt;
456 Elm_Object_Item *gli[10];
459 win = elm_win_add(NULL, "genlist2", ELM_WIN_BASIC);
460 elm_win_title_set(win, "Genlist 2");
461 elm_win_autodel_set(win, EINA_TRUE);
463 bg = elm_bg_add(win);
464 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
465 elm_bg_file_set(bg, buf, NULL);
466 elm_win_resize_object_add(win, bg);
467 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
468 evas_object_show(bg);
470 bx = elm_box_add(win);
471 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
472 elm_win_resize_object_add(win, bx);
473 evas_object_show(bx);
475 gl = elm_genlist_add(win);
476 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
477 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
478 evas_object_show(gl);
480 itc1 = elm_genlist_item_class_new();
481 itc1->item_style = "default";
482 itc1->func.text_get = gl_text_get;
483 itc1->func.content_get = gl_content_get;
484 itc1->func.state_get = gl_state_get;
485 itc1->func.del = NULL;
487 gli[0] = elm_genlist_item_append(gl, itc1,
488 (void *)1001/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
489 (void *)1001/* func data */);
490 gli[1] = elm_genlist_item_append(gl, itc1,
491 (void *)1002/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
492 (void *)1002/* func data */);
493 gli[2] = elm_genlist_item_append(gl, itc1,
494 (void *)1003/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
495 (void *)1003/* func data */);
496 gli[3] = elm_genlist_item_prepend(gl, itc1,
497 (void *)1004/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
498 (void *)1004/* func data */);
499 gli[4] = elm_genlist_item_prepend(gl, itc1,
500 (void *)1005/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
501 (void *)1005/* func data */);
502 gli[5] = elm_genlist_item_insert_before(gl, itc1,
503 (void *)1006/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
504 gl_sel/* func */, (void *)1006/* func data */);
505 gli[6] = elm_genlist_item_insert_after(gl, itc1,
506 (void *)1007/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
507 gl_sel/* func */, (void *)1007/* func data */);
508 elm_box_pack_end(bx, gl);
510 bx2 = elm_box_add(win);
511 elm_box_horizontal_set(bx2, EINA_TRUE);
512 elm_box_homogeneous_set(bx2, EINA_TRUE);
513 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
514 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
516 bt = elm_button_add(win);
517 elm_object_text_set(bt, "/\\");
518 evas_object_smart_callback_add(bt, "clicked", my_gl_first, gl);
519 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
520 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
521 elm_box_pack_end(bx2, bt);
522 evas_object_show(bt);
524 bt = elm_button_add(win);
525 elm_object_text_set(bt, "\\/");
526 evas_object_smart_callback_add(bt, "clicked", my_gl_last, gl);
527 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
528 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
529 elm_box_pack_end(bx2, bt);
530 evas_object_show(bt);
532 bt = elm_button_add(win);
533 elm_object_text_set(bt, "#");
534 evas_object_smart_callback_add(bt, "clicked", my_gl_disable, gl);
535 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
536 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
537 elm_box_pack_end(bx2, bt);
538 evas_object_show(bt);
540 bt = elm_button_add(win);
541 elm_object_text_set(bt, "U");
542 evas_object_smart_callback_add(bt, "clicked", my_gl_update_all, gl);
543 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
544 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
545 elm_box_pack_end(bx2, bt);
546 evas_object_show(bt);
548 elm_box_pack_end(bx, bx2);
549 evas_object_show(bx2);
551 bx2 = elm_box_add(win);
552 elm_box_horizontal_set(bx2, EINA_TRUE);
553 elm_box_homogeneous_set(bx2, EINA_TRUE);
554 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
555 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
557 bt = elm_button_add(win);
558 elm_object_text_set(bt, "X");
559 evas_object_smart_callback_add(bt, "clicked", my_gl_clear, gl);
560 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
561 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
562 elm_box_pack_end(bx2, bt);
563 evas_object_show(bt);
565 bt = elm_button_add(win);
566 elm_object_text_set(bt, "+");
567 evas_object_smart_callback_add(bt, "clicked", my_gl_add, gl);
568 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
569 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
570 elm_box_pack_end(bx2, bt);
571 evas_object_show(bt);
573 bt = elm_button_add(win);
574 elm_object_text_set(bt, "-");
575 evas_object_smart_callback_add(bt, "clicked", my_gl_del, gl);
576 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
577 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
578 elm_box_pack_end(bx2, bt);
579 evas_object_show(bt);
581 elm_box_pack_end(bx, bx2);
582 evas_object_show(bx2);
584 bx3 = elm_box_add(win);
585 elm_box_horizontal_set(bx3, EINA_TRUE);
586 elm_box_homogeneous_set(bx3, EINA_TRUE);
587 evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0);
588 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL);
590 bt = elm_button_add(win);
591 elm_object_text_set(bt, "+ before");
592 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_before, gl);
593 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
594 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
595 elm_box_pack_end(bx3, bt);
596 evas_object_show(bt);
598 bt = elm_button_add(win);
599 elm_object_text_set(bt, "+ after");
600 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_after, gl);
601 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
602 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
603 elm_box_pack_end(bx3, bt);
604 evas_object_show(bt);
606 bt = elm_button_add(win);
607 elm_object_text_set(bt, "Flush");
608 evas_object_smart_callback_add(bt, "clicked", my_gl_flush, gl);
609 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
610 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
611 elm_box_pack_end(bx3, bt);
612 evas_object_show(bt);
614 elm_box_pack_end(bx, bx3);
615 evas_object_show(bx3);
617 /* item_class_ref is needed for itc1. some items can be added in callbacks */
618 elm_genlist_item_class_ref(itc1);
619 elm_genlist_item_class_free(itc1);
621 evas_object_resize(win, 320, 320);
622 evas_object_show(win);
627 static Elm_Genlist_Item_Class itc2;
629 char *gl2_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
631 const Testitem *tit = data;
633 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
637 Evas_Object *gl2_content_get(void *data, Evas_Object *obj, const char *part)
639 const Testitem *tit = data;
641 Evas_Object *ic = elm_icon_add(obj);
642 if (!strcmp(part, "elm.swallow.icon"))
644 if (!(tit->mode & 0x3))
645 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
646 else if ((tit->mode & 0x3) == 1)
647 snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
648 else if ((tit->mode & 0x3) == 2)
649 snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", elm_app_data_dir_get());
650 else if ((tit->mode & 0x3) == 3)
651 snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get());
652 elm_icon_file_set(ic, buf, NULL);
654 else if (!strcmp(part, "elm.swallow.end"))
656 if (!(tit->mode & 0x3))
657 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
658 else if ((tit->mode & 0x3) == 1)
659 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
660 else if ((tit->mode & 0x3) == 2)
661 snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", elm_app_data_dir_get());
662 else if ((tit->mode & 0x3) == 3)
663 snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", elm_app_data_dir_get());
664 elm_icon_file_set(ic, buf, NULL);
666 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
670 Eina_Bool gl2_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
676 my_gl_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
678 Testitem *tit = data;
680 elm_genlist_item_update(tit->item);
684 my_gl_labels_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
686 Testitem *tit = data;
688 elm_genlist_item_fields_update(tit->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT);
692 my_gl_contents_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
694 Testitem *tit = data;
696 elm_genlist_item_fields_update(tit->item, "*", ELM_GENLIST_ITEM_FIELD_CONTENT);
700 test_genlist3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
702 Evas_Object *win, *gl, *bx, *bx2, *bt;
703 static Testitem tit[3];
705 win = elm_win_util_standard_add("genlist3", "Genlist 3");
706 elm_win_autodel_set(win, EINA_TRUE);
708 bx = elm_box_add(win);
709 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
710 elm_win_resize_object_add(win, bx);
711 evas_object_show(bx);
713 gl = elm_genlist_add(win);
714 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
715 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
716 evas_object_show(gl);
718 itc2.item_style = "default";
719 itc2.func.text_get = gl2_text_get;
720 itc2.func.content_get = gl2_content_get;
721 itc2.func.state_get = gl2_state_get;
722 itc2.func.del = NULL;
725 tit[0].item = elm_genlist_item_append(gl, &itc2,
726 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
727 NULL/* func data */);
729 tit[1].item = elm_genlist_item_append(gl, &itc2,
730 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
731 NULL/* func data */);
733 tit[2].item = elm_genlist_item_append(gl, &itc2,
734 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
735 NULL/* func data */);
737 elm_box_pack_end(bx, gl);
738 evas_object_show(bx);
740 bx2 = elm_box_add(win);
741 elm_box_horizontal_set(bx2, EINA_TRUE);
742 elm_box_homogeneous_set(bx2, EINA_TRUE);
743 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
744 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
746 bt = elm_button_add(win);
747 elm_object_text_set(bt, "[1]");
748 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
749 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
750 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
751 elm_box_pack_end(bx2, bt);
752 evas_object_show(bt);
754 bt = elm_button_add(win);
755 elm_object_text_set(bt, "labels");
756 evas_object_smart_callback_add(bt, "clicked", my_gl_labels_update, &(tit[1]));
757 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
758 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
759 elm_box_pack_end(bx2, bt);
760 evas_object_show(bt);
762 bt = elm_button_add(win);
763 elm_object_text_set(bt, "contents");
764 evas_object_smart_callback_add(bt, "clicked", my_gl_contents_update, &(tit[2]));
765 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
766 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
767 elm_box_pack_end(bx2, bt);
768 evas_object_show(bt);
770 elm_box_pack_end(bx, bx2);
771 evas_object_show(bx2);
773 evas_object_resize(win, 320, 320);
774 evas_object_show(win);
780 my_gl_item_check_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__)
782 Testitem *tit = data;
783 tit->onoff = elm_check_state_get(obj);
784 printf("item %p onoff = %i\n", tit, tit->onoff);
787 static Elm_Genlist_Item_Class itc3;
789 char *gl3_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
791 const Testitem *tit = data;
793 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
797 Evas_Object *gl3_content_get(void *data, Evas_Object *obj, const char *part)
799 const Testitem *tit = data;
800 if (!strcmp(part, "elm.swallow.icon"))
804 lb = elm_label_add(obj);
805 elm_label_line_wrap_set(lb, ELM_WRAP_CHAR);
806 elm_label_wrap_width_set(lb, 201);
807 elm_object_text_set(lb, "ashj ascjscjh n asjkl hcjlh ls hzshnn zjh sh zxjcjsnd h dfw sdv edev efe fwefvv vsd cvs ws wf fvwf wd fwe f we wef we wfe rfwewef wfv wswf wefg sdfws w wsdcfwcf wsc vdv sdsd sdcd cv wsc sdcv wsc d sdcdcsd sdcdsc wdvd sdcsd wscxcv wssvd sd");
810 else if (!strcmp(part, "elm.swallow.end"))
813 ck = elm_check_add(obj);
814 evas_object_propagate_events_set(ck, EINA_FALSE);
815 elm_check_state_set(ck, tit->onoff);
816 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed, data);
822 Eina_Bool gl3_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
828 test_genlist4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
830 Evas_Object *win, *gl, *bx, *bx2, *bt;
831 static Testitem tit[3];
833 win = elm_win_util_standard_add("genlist4", "Genlist 4");
834 elm_win_autodel_set(win, EINA_TRUE);
836 bx = elm_box_add(win);
837 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
838 elm_win_resize_object_add(win, bx);
839 evas_object_show(bx);
841 gl = elm_genlist_add(win);
842 elm_genlist_mode_set(gl, ELM_LIST_COMPRESS);
843 elm_genlist_multi_select_set(gl, 1);
844 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
845 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
846 evas_object_show(gl);
848 itc3.item_style = "default";
849 itc3.func.text_get = gl3_text_get;
850 itc3.func.content_get = gl3_content_get;
851 itc3.func.state_get = gl3_state_get;
852 itc3.func.del = NULL;
855 tit[0].item = elm_genlist_item_append(gl, &itc3,
856 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
857 NULL/* func data */);
859 tit[1].item = elm_genlist_item_append(gl, &itc3,
860 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
861 NULL/* func data */);
863 tit[2].item = elm_genlist_item_append(gl, &itc3,
864 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
865 NULL/* func data */);
867 elm_box_pack_end(bx, gl);
868 evas_object_show(bx);
870 bx2 = elm_box_add(win);
871 elm_box_horizontal_set(bx2, EINA_TRUE);
872 elm_box_homogeneous_set(bx2, EINA_TRUE);
873 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
874 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
876 bt = elm_button_add(win);
877 elm_object_text_set(bt, "[1]");
878 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
879 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
880 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
881 elm_box_pack_end(bx2, bt);
882 evas_object_show(bt);
884 bt = elm_button_add(win);
885 elm_object_text_set(bt, "[2]");
886 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
887 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
888 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
889 elm_box_pack_end(bx2, bt);
890 evas_object_show(bt);
892 bt = elm_button_add(win);
893 elm_object_text_set(bt, "[3]");
894 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
895 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
896 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
897 elm_box_pack_end(bx2, bt);
898 evas_object_show(bt);
900 elm_box_pack_end(bx, bx2);
901 evas_object_show(bx2);
903 evas_object_resize(win, 320, 320);
904 evas_object_show(win);
910 my_gl_item_check_changed2(void *data, Evas_Object *obj, void *event_info __UNUSED__)
912 Testitem *tit = data;
913 tit->onoff = elm_check_state_get(obj);
914 printf("item %p onoff = %i\n", tit, tit->onoff);
917 static Elm_Genlist_Item_Class itc5;
919 char *gl5_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
921 const Testitem *tit = data;
923 if (!strcmp(part, "elm.text"))
925 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
927 else if (!strcmp(part, "elm.text.sub"))
929 snprintf(buf, sizeof(buf), "%i bottles on the wall", tit->mode);
934 Evas_Object *gl5_content_get(void *data, Evas_Object *obj, const char *part)
936 const Testitem *tit = data;
938 if (!strcmp(part, "elm.swallow.icon"))
940 Evas_Object *bx = elm_box_add(obj);
942 elm_box_horizontal_set(bx, EINA_TRUE);
943 ic = elm_icon_add(obj);
944 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
945 elm_icon_file_set(ic, buf, NULL);
946 elm_icon_resizable_set(ic, 0, 0);
947 evas_object_show(ic);
948 elm_box_pack_end(bx, ic);
949 ic = elm_icon_add(obj);
950 elm_icon_file_set(ic, buf, NULL);
951 elm_icon_resizable_set(ic, 0, 0);
952 evas_object_show(ic);
953 elm_box_pack_end(bx, ic);
954 elm_box_horizontal_set(bx, EINA_TRUE);
955 evas_object_show(bx);
958 else if (!strcmp(part, "elm.swallow.end"))
961 ck = elm_check_add(obj);
962 evas_object_propagate_events_set(ck, EINA_FALSE);
963 elm_check_state_set(ck, tit->onoff);
964 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed2, data);
965 evas_object_show(ck);
971 Eina_Bool gl5_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
977 item_drag_up(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
983 item_drag_down(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
985 printf("drag down\n");
989 item_drag_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
991 printf("drag left\n");
995 item_drag_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
997 printf("drag right\n");
1001 scroll_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1003 printf("Top edge!\n");
1007 scroll_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1009 printf("Bottom edge!\n");
1013 scroll_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1015 printf("Left edge!\n");
1019 scroll_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1021 printf("Right edge!\n");
1025 item_drag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1031 item_drag_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1033 printf("drag stop\n");
1037 item_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1039 printf("longpress\n");
1043 test_genlist5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1045 Evas_Object *win, *gl, *bx, *bx2, *bt;
1046 static Testitem tit[3];
1048 win = elm_win_util_standard_add("genlist5", "Genlist 5");
1049 elm_win_autodel_set(win, EINA_TRUE);
1051 bx = elm_box_add(win);
1052 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1053 elm_win_resize_object_add(win, bx);
1054 evas_object_show(bx);
1056 gl = elm_genlist_add(win);
1057 elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
1058 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1059 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1060 evas_object_show(gl);
1061 itc5.item_style = "double_label";
1062 itc5.func.text_get = gl5_text_get;
1063 itc5.func.content_get = gl5_content_get;
1064 itc5.func.state_get = gl5_state_get;
1065 itc5.func.del = NULL;
1068 tit[0].item = elm_genlist_item_append(gl, &itc5,
1069 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
1070 NULL/* func data */);
1072 tit[1].item = elm_genlist_item_append(gl, &itc5,
1073 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
1074 NULL/* func data */);
1076 tit[2].item = elm_genlist_item_append(gl, &itc5,
1077 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
1078 NULL/* func data */);
1080 elm_box_pack_end(bx, gl);
1081 evas_object_show(bx);
1083 evas_object_smart_callback_add(gl, "drag,start,up", item_drag_up, NULL);
1084 evas_object_smart_callback_add(gl, "drag,start,down", item_drag_down, NULL);
1085 evas_object_smart_callback_add(gl, "drag,start,left", item_drag_left, NULL);
1086 evas_object_smart_callback_add(gl, "drag,start,right", item_drag_right, NULL);
1087 evas_object_smart_callback_add(gl, "scroll,edge,top", scroll_top, NULL);
1088 evas_object_smart_callback_add(gl, "scroll,edge,bottom", scroll_bottom, NULL);
1089 evas_object_smart_callback_add(gl, "scroll,edge,left", scroll_left, NULL);
1090 evas_object_smart_callback_add(gl, "scroll,edge,right", scroll_right, NULL);
1091 evas_object_smart_callback_add(gl, "drag", item_drag, NULL);
1092 evas_object_smart_callback_add(gl, "drag,stop", item_drag_stop, NULL);
1093 evas_object_smart_callback_add(gl, "longpressed", item_longpress, NULL);
1095 bx2 = elm_box_add(win);
1096 elm_box_horizontal_set(bx2, EINA_TRUE);
1097 elm_box_homogeneous_set(bx2, EINA_TRUE);
1098 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1099 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1101 bt = elm_button_add(win);
1102 elm_object_text_set(bt, "[1]");
1103 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
1104 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1105 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1106 elm_box_pack_end(bx2, bt);
1107 evas_object_show(bt);
1109 bt = elm_button_add(win);
1110 elm_object_text_set(bt, "[2]");
1111 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1112 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1113 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1114 elm_box_pack_end(bx2, bt);
1115 evas_object_show(bt);
1117 bt = elm_button_add(win);
1118 elm_object_text_set(bt, "[3]");
1119 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1120 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1121 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1122 elm_box_pack_end(bx2, bt);
1123 evas_object_show(bt);
1125 elm_box_pack_end(bx, bx2);
1126 evas_object_show(bx2);
1128 evas_object_resize(win, 320, 320);
1129 evas_object_show(win);
1134 static Elm_Genlist_Item_Class *itc4;
1137 gl4_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1139 Elm_Object_Item *glit = event_info;
1140 int depth = elm_genlist_item_expanded_depth_get(glit);
1141 printf("expanded depth for selected item is %d\n", depth);
1145 gl4_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1147 Elm_Object_Item *glit = event_info;
1148 Evas_Object *gl = elm_object_item_widget_get(glit);
1149 int val = (int)(long) elm_object_item_data_get(glit);
1151 elm_genlist_item_append(gl, itc4,
1152 (void *)(long) (val + 1)/* item data */,
1153 glit/* parent */, ELM_GENLIST_ITEM_NONE,
1155 NULL/* func data */);
1156 elm_genlist_item_append(gl, itc4,
1157 (void *)(long) (val + 2)/* item data */,
1158 glit/* parent */, ELM_GENLIST_ITEM_NONE,
1160 NULL/* func data */);
1161 elm_genlist_item_append(gl, itc4,
1162 (void *)(long) (val + 3)/* item data */,
1164 ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
1165 NULL/* func data */);
1168 gl4_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1170 Elm_Object_Item *glit = event_info;
1171 elm_genlist_item_subitems_clear(glit);
1175 gl4_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1177 Elm_Object_Item *glit = event_info;
1178 elm_genlist_item_expanded_set(glit, EINA_TRUE);
1182 gl4_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1184 Elm_Object_Item *glit = event_info;
1185 elm_genlist_item_expanded_set(glit, EINA_FALSE);
1188 char *gl4_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1191 snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data);
1195 Evas_Object *gl4_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1198 if (!strcmp(part, "elm.swallow.icon"))
1200 Evas_Object *ic = elm_icon_add(obj);
1201 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
1202 elm_icon_file_set(ic, buf, NULL);
1203 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1204 evas_object_show(ic);
1207 else if (!strcmp(part, "elm.swallow.end"))
1210 ck = elm_check_add(obj);
1211 evas_object_propagate_events_set(ck, EINA_FALSE);
1212 evas_object_show(ck);
1218 Eina_Bool gl4_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1223 void gl4_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
1225 printf("item deleted.\n");
1229 test_genlist6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1231 Evas_Object *win, *gl, *bx, *bx2, *bt;
1233 win = elm_win_util_standard_add("genlist-tree", "Genlist Tree");
1234 elm_win_autodel_set(win, EINA_TRUE);
1236 bx = elm_box_add(win);
1237 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1238 elm_win_resize_object_add(win, bx);
1239 evas_object_show(bx);
1241 gl = elm_genlist_add(win);
1242 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1243 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1244 evas_object_show(gl);
1246 itc4 = elm_genlist_item_class_new();
1247 itc4->item_style = "default";
1248 itc4->func.text_get = gl4_text_get;
1249 itc4->func.content_get = gl4_content_get;
1250 itc4->func.state_get = gl4_state_get;
1251 itc4->func.del = gl4_del;
1253 elm_genlist_item_append(gl, itc4,
1254 (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
1255 NULL/* func data */);
1256 elm_genlist_item_append(gl, itc4,
1257 (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
1258 NULL/* func data */);
1259 elm_genlist_item_append(gl, itc4,
1260 (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1261 NULL/* func data */);
1262 elm_genlist_item_class_free(itc4);
1263 evas_object_smart_callback_add(gl, "expand,request", gl4_exp_req, gl);
1264 evas_object_smart_callback_add(gl, "contract,request", gl4_con_req, gl);
1265 evas_object_smart_callback_add(gl, "expanded", gl4_exp, gl);
1266 evas_object_smart_callback_add(gl, "contracted", gl4_con, gl);
1268 elm_box_pack_end(bx, gl);
1269 evas_object_show(bx);
1271 bx2 = elm_box_add(win);
1272 elm_box_horizontal_set(bx2, EINA_TRUE);
1273 elm_box_homogeneous_set(bx2, EINA_TRUE);
1274 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1275 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1277 bt = elm_button_add(win);
1278 elm_object_text_set(bt, "[1]");
1279 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
1280 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1281 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1282 elm_box_pack_end(bx2, bt);
1283 evas_object_show(bt);
1285 bt = elm_button_add(win);
1286 elm_object_text_set(bt, "[2]");
1287 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1288 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1289 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1290 elm_box_pack_end(bx2, bt);
1291 evas_object_show(bt);
1293 bt = elm_button_add(win);
1294 elm_object_text_set(bt, "[3]");
1295 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1296 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1297 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1298 elm_box_pack_end(bx2, bt);
1299 evas_object_show(bt);
1301 elm_box_pack_end(bx, bx2);
1302 evas_object_show(bx2);
1304 evas_object_resize(win, 320, 320);
1305 evas_object_show(win);
1310 struct genlist7_data
1312 Evas_Object *win, *naviframe;
1315 static Elm_Genlist_Item_Class itc7;
1318 gl_sel7(void *data, Evas_Object *obj, void *event_info)
1320 if (!event_info) return;
1321 elm_genlist_item_item_class_update(event_info, &itc7);
1322 printf("sel item data [%p] on genlist obj [%p], item pointer [%p], new item style [%s] \n", data, obj, event_info, itc7.item_style);
1326 test_genlist7_back_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1328 struct genlist7_data *info = data;
1331 elm_naviframe_item_pop(info->naviframe);
1335 test_genlist7_swipe(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1337 struct genlist7_data *info = data;
1338 Evas_Object *box, *entry, *button;
1339 char item_data[] = "Just a simple test";
1341 if ((!event_info) || (!data)) return;
1343 box = elm_box_add(info->win);
1344 elm_box_homogeneous_set(box, EINA_FALSE);
1345 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1346 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
1347 evas_object_show(box);
1349 entry = elm_entry_add(info->win);
1350 elm_entry_scrollable_set(entry, EINA_TRUE);
1351 elm_entry_editable_set(entry, EINA_FALSE);
1352 elm_object_text_set(entry, item_data);
1353 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1354 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
1355 evas_object_show(entry);
1357 button = elm_button_add(info->win);
1358 elm_object_text_set(button, "back");
1359 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
1360 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0);
1361 evas_object_smart_callback_add(button, "clicked", test_genlist7_back_cb,
1363 evas_object_show(button);
1365 elm_box_pack_start(box, entry);
1366 elm_box_pack_end(box, button);
1368 elm_naviframe_item_simple_push(info->naviframe, box);
1372 test_genlist7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1374 Evas_Object *win, *gl, *naviframe;
1375 static struct genlist7_data info;
1376 static Testitem tit[3];
1378 win = elm_win_util_standard_add("genlist7", "Genlist 7");
1379 elm_win_autodel_set(win, EINA_TRUE);
1382 naviframe = elm_naviframe_add(win);
1383 elm_win_resize_object_add(win, naviframe);
1384 evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1385 evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL);
1386 evas_object_show(naviframe);
1387 info.naviframe = naviframe;
1389 gl = elm_genlist_add(win);
1390 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1391 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1392 evas_object_smart_callback_add(gl, "swipe", test_genlist7_swipe, &info);
1393 evas_object_show(gl);
1394 elm_naviframe_item_simple_push(naviframe, gl);
1396 itc2.item_style = "default";
1397 itc2.func.text_get = gl2_text_get;
1398 itc2.func.content_get = gl2_content_get;
1399 itc2.func.state_get = gl2_state_get;
1400 itc2.func.del = NULL;
1402 itc7.item_style = "double_label";
1403 itc7.func.text_get = gl5_text_get;
1404 itc7.func.content_get = gl5_content_get;
1405 itc7.func.state_get = gl5_state_get;
1406 itc7.func.del = NULL;
1409 tit[0].item = elm_genlist_item_append(gl, &itc2,
1410 &(tit[0])/* item data */, NULL/* parent */,
1411 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1412 NULL/* func data */);
1414 tit[1].item = elm_genlist_item_append(gl, &itc2,
1415 &(tit[1])/* item data */, NULL/* parent */,
1416 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1417 NULL/* func data */);
1419 tit[2].item = elm_genlist_item_append(gl, &itc2,
1420 &(tit[2])/* item data */, NULL/* parent */,
1421 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1422 NULL/* func data */);
1424 evas_object_resize(win, 320, 320);
1425 evas_object_show(win);
1430 static Elm_Genlist_Item_Class itc_group;
1432 char *gl8_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1435 snprintf(buf, sizeof(buf), "Group Index # %i (Item # %i)", (int)((long)data / 10), (int)(long)data);
1440 _bt_show_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1442 elm_genlist_item_show(data, ELM_GENLIST_ITEM_SCROLLTO_TOP);
1446 _bt_bring_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1448 elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_TOP);
1452 test_genlist8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1454 Evas_Object *win, *gl, *bt[8], *bx, *bx2, *bx3;
1455 Elm_Object_Item *gli = NULL, *git = NULL;
1458 win = elm_win_util_standard_add("genlist-group", "Genlist Group");
1459 elm_win_autodel_set(win, EINA_TRUE);
1461 bx = elm_box_add(win);
1462 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1463 elm_win_resize_object_add(win, bx);
1464 evas_object_show(bx);
1466 gl = elm_genlist_add(win);
1467 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1468 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1469 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1470 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1471 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1472 elm_box_pack_end(bx, gl);
1473 evas_object_show(gl);
1475 itc1 = elm_genlist_item_class_new();
1476 itc1->item_style = "default";
1477 itc1->func.text_get = gl_text_get;
1478 itc1->func.content_get = gl_content_get;
1479 itc1->func.state_get = gl_state_get;
1480 itc1->func.del = NULL;
1482 itc_group.item_style = "group_index";
1483 itc_group.func.text_get = gl8_text_get;
1484 itc_group.func.content_get = NULL;
1485 itc_group.func.state_get = NULL;
1486 itc_group.func.del = NULL;
1488 bx2 = elm_box_add(win);
1489 elm_box_horizontal_set(bx2, EINA_TRUE);
1490 elm_box_homogeneous_set(bx2, EINA_TRUE);
1491 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1492 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1495 bt[bt_num] = elm_button_add(win);
1496 elm_object_text_set(bt[bt_num], "Show 0");
1497 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1498 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1499 evas_object_show(bt[bt_num]);
1500 elm_box_pack_end(bx2, bt[bt_num]);
1502 bt[++bt_num] = elm_button_add(win);
1503 elm_object_text_set(bt[bt_num], "Show 26");
1504 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1505 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1506 evas_object_show(bt[bt_num]);
1507 elm_box_pack_end(bx2, bt[bt_num]);
1509 bt[++bt_num] = elm_button_add(win);
1510 elm_object_text_set(bt[bt_num], "Show 101");
1511 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1512 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1513 evas_object_show(bt[bt_num]);
1514 elm_box_pack_end(bx2, bt[bt_num]);
1516 bt[++bt_num] = elm_button_add(win);
1517 elm_object_text_set(bt[bt_num], "Show 480");
1518 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1519 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1520 evas_object_show(bt[bt_num]);
1521 elm_box_pack_end(bx2, bt[bt_num]);
1523 elm_box_pack_end(bx, bx2);
1524 evas_object_show(bx2);
1526 bx3 = elm_box_add(win);
1527 elm_box_horizontal_set(bx3, EINA_TRUE);
1528 elm_box_homogeneous_set(bx3, EINA_TRUE);
1529 evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0);
1530 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL);
1532 bt[++bt_num] = elm_button_add(win);
1533 elm_object_text_set(bt[bt_num], "Bring top 0");
1534 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1535 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1536 evas_object_show(bt[bt_num]);
1537 elm_box_pack_end(bx3, bt[bt_num]);
1539 bt[++bt_num] = elm_button_add(win);
1540 elm_object_text_set(bt[bt_num], "Bring top 31");
1541 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1542 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1543 evas_object_show(bt[bt_num]);
1544 elm_box_pack_end(bx3, bt[bt_num]);
1546 bt[++bt_num] = elm_button_add(win);
1547 elm_object_text_set(bt[bt_num], "Bring top 239");
1548 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1549 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1550 evas_object_show(bt[bt_num]);
1551 elm_box_pack_end(bx3, bt[bt_num]);
1553 bt[++bt_num] = elm_button_add(win);
1554 elm_object_text_set(bt[bt_num], "Bring top 477");
1555 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1556 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1557 evas_object_show(bt[bt_num]);
1558 elm_box_pack_end(bx3, bt[bt_num]);
1560 elm_box_pack_end(bx, bx3);
1561 evas_object_show(bx3);
1563 for (i = 0; i < 500; i++)
1567 gli = git = elm_genlist_item_append(gl, &itc_group,
1568 (void *)(long)i/* item data */,
1570 ELM_GENLIST_ITEM_GROUP,
1572 (void *)(long)(i * 10)/* func data */);
1573 elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1577 gli = elm_genlist_item_append(gl, itc1,
1578 (void *)(long)i/* item data */,
1580 ELM_GENLIST_ITEM_NONE,
1582 (void *)(long)(i * 10)/* func data */);
1587 evas_object_smart_callback_add(bt[0], "clicked", _bt_show_cb, gli);
1588 evas_object_smart_callback_add(bt[4], "clicked", _bt_bring_cb, gli);
1591 evas_object_smart_callback_add(bt[1], "clicked", _bt_show_cb, gli);
1594 evas_object_smart_callback_add(bt[5], "clicked", _bt_bring_cb, gli);
1597 evas_object_smart_callback_add(bt[2], "clicked", _bt_show_cb, gli);
1600 evas_object_smart_callback_add(bt[6], "clicked", _bt_bring_cb, gli);
1603 evas_object_smart_callback_add(bt[7], "clicked", _bt_bring_cb, gli);
1606 evas_object_smart_callback_add(bt[3], "clicked", _bt_show_cb, gli);
1610 elm_genlist_item_class_free(itc1);
1612 evas_object_resize(win, 480, 800);
1613 evas_object_show(win);
1619 gl9_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1621 Elm_Object_Item *glit = event_info;
1622 Evas_Object *gl = elm_object_item_widget_get(glit);
1623 int val = (int)(long) elm_object_item_data_get(glit);
1625 elm_genlist_item_append(gl, itc1,
1626 (void *)(long) (val + 1)/* item data */,
1628 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1629 NULL/* func data */);
1630 elm_genlist_item_append(gl, itc1,
1631 (void *)(long) (val + 2)/* item data */,
1633 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1634 NULL/* func data */);
1635 elm_genlist_item_append(gl, itc1,
1636 (void *)(long) (val + 3)/* item data */,
1638 ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
1639 NULL/* func data */);
1643 gl9_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1645 Elm_Object_Item *glit = event_info;
1646 elm_genlist_item_subitems_clear(glit);
1650 gl9_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1652 Elm_Object_Item *glit = event_info;
1653 elm_genlist_item_expanded_set(glit, EINA_TRUE);
1657 gl9_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1659 Elm_Object_Item *glit = event_info;
1660 elm_genlist_item_expanded_set(glit, EINA_FALSE);
1664 test_genlist9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1666 Evas_Object *win, *gl, *bx;
1667 Elm_Object_Item *git;
1669 win = elm_win_util_standard_add("genlist-group-tree", "Genlist Group Tree");
1670 elm_win_autodel_set(win, EINA_TRUE);
1672 bx = elm_box_add(win);
1673 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1674 elm_win_resize_object_add(win, bx);
1675 evas_object_show(bx);
1677 gl = elm_genlist_add(win);
1678 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1679 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1680 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1681 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1682 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1683 elm_box_pack_end(bx, gl);
1684 evas_object_show(gl);
1686 itc1 = elm_genlist_item_class_new();
1687 itc1->item_style = "default";
1688 itc1->func.text_get = gl_text_get;
1689 itc1->func.content_get = gl_content_get;
1690 itc1->func.state_get = gl_state_get;
1691 itc1->func.del = NULL;
1693 itc_group.item_style = "group_index";
1694 itc_group.func.text_get = gl8_text_get;
1695 itc_group.func.content_get = NULL;
1696 itc_group.func.state_get = NULL;
1697 itc_group.func.del = NULL;
1699 git = elm_genlist_item_append(gl, &itc_group,
1700 (void *)0/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1701 NULL/* func data */);
1702 elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1704 elm_genlist_item_append(gl, itc1,
1705 (void *)1/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
1706 NULL/* func data */);
1707 elm_genlist_item_append(gl, itc1,
1708 (void *)2/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1709 NULL/* func data */);
1710 elm_genlist_item_append(gl, itc1,
1711 (void *)3/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
1712 NULL/* func data */);
1713 git = elm_genlist_item_append(gl, &itc_group,
1714 (void *)4/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1715 NULL/* func data */);
1716 elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1718 elm_genlist_item_append(gl, itc1,
1719 (void *)5/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
1720 NULL/* func data */);
1721 elm_genlist_item_append(gl, itc1,
1722 (void *)6/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1723 NULL/* func data */);
1724 elm_genlist_item_append(gl, itc1,
1725 (void *)7/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
1726 NULL/* func data */);
1727 elm_genlist_item_class_free(itc1);
1729 evas_object_smart_callback_add(gl, "expand,request", gl9_exp_req, gl);
1730 evas_object_smart_callback_add(gl, "contract,request", gl9_con_req, gl);
1731 evas_object_smart_callback_add(gl, "expanded", gl9_exp, gl);
1732 evas_object_smart_callback_add(gl, "contracted", gl9_con, gl);
1734 evas_object_resize(win, 480, 800);
1735 evas_object_show(win);
1740 static Elm_Genlist_Item_Class itc10;
1741 static char *mode_type[] = { "slide", "rotate" };
1743 char *gl10_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
1746 if (!strcmp(part, "elm.text.mode"))
1747 snprintf(buf, sizeof(buf), "Mode # %i", (int)(long)data);
1749 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
1753 Evas_Object *gl10_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1756 Evas_Object *ic = elm_icon_add(obj);
1757 if (!strcmp(part, "elm.swallow.end"))
1758 snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get());
1760 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
1761 elm_icon_file_set(ic, buf, NULL);
1762 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1767 _gl_sel10(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1770 int v = elm_radio_value_get(data);
1772 elm_genlist_item_decorate_mode_set(event_info, mode_type[v], EINA_TRUE);
1776 _my_gl_mode_right(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1779 int v = elm_radio_value_get(data);
1781 elm_genlist_item_decorate_mode_set(event_info, mode_type[v], EINA_TRUE);
1785 _my_gl_mode_left(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1788 int v = elm_radio_value_get(data);
1790 elm_genlist_item_decorate_mode_set(event_info, mode_type[v], EINA_FALSE);
1794 _my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1796 fprintf(stderr, "drag\n");
1798 int v = elm_radio_value_get(data);
1799 Elm_Object_Item *glit = (Elm_Object_Item *) elm_genlist_decorated_item_get(obj);
1800 if (glit) elm_genlist_item_decorate_mode_set(glit, mode_type[v], EINA_FALSE);
1804 test_genlist10(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1806 Evas_Object *win, *fr, *bx, *bx2, *rd, *rdg, *gl;
1809 win = elm_win_util_standard_add("genlist-decorate-item-mode", "Genlist Decorate Item Mode");
1810 elm_win_autodel_set(win, EINA_TRUE);
1812 bx = elm_box_add(win);
1813 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1814 elm_win_resize_object_add(win, bx);
1815 evas_object_show(bx);
1817 fr = elm_frame_add(win);
1818 elm_object_text_set(fr, "Decorate Mode Type");
1819 elm_box_pack_end(bx, fr);
1820 evas_object_show(fr);
1822 bx2 = elm_box_add(win);
1823 elm_object_content_set(fr, bx2);
1824 evas_object_show(bx2);
1826 rd = elm_radio_add(win);
1827 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1828 elm_radio_state_value_set(rd, 0);
1829 elm_object_text_set(rd, "Slide : Sweep genlist items to the right.");
1830 evas_object_show(rd);
1831 elm_box_pack_end(bx2, rd);
1834 rd = elm_radio_add(win);
1835 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1836 elm_radio_state_value_set(rd, 1);
1837 elm_object_text_set(rd, "Rotate : Click each item.");
1838 elm_radio_group_add(rd, rdg);
1839 evas_object_show(rd);
1840 elm_box_pack_end(bx2, rd);
1842 gl = elm_genlist_add(win);
1843 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1844 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1845 evas_object_smart_callback_add(gl, "drag,start,right", _my_gl_mode_right, rdg);
1846 evas_object_smart_callback_add(gl, "drag,start,left", _my_gl_mode_left, rdg);
1847 evas_object_smart_callback_add(gl, "drag,start,up", _my_gl_mode_cancel, rdg);
1848 evas_object_smart_callback_add(gl, "drag,start,down", _my_gl_mode_cancel, rdg);
1849 evas_object_show(gl);
1851 itc10.item_style = "default";
1852 itc10.decorate_item_style = "mode";
1853 itc10.func.text_get = gl10_text_get;
1854 itc10.func.content_get = gl10_content_get;
1855 itc10.func.state_get = gl_state_get;
1856 itc10.func.del = NULL;
1858 for (i = 0; i < 50; i++)
1859 elm_genlist_item_append(gl,
1861 (void *)(long)(1000 + i)/* item data */,
1863 ELM_GENLIST_ITEM_NONE/* flags */,
1864 _gl_sel10/* func */,
1865 rdg/* func data */);
1867 elm_box_pack_end(bx, gl);
1869 evas_object_resize(win, 520, 520);
1870 evas_object_show(win);
1876 _reorder_tg_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1878 elm_genlist_reorder_mode_set(data, elm_check_state_get(obj));
1882 * gl_moved is called after an item was reordered.
1883 * This is only called when reorder mode is enabled.
1885 * @param data : the genlist object passed as data.
1886 * @param obj : the genlist object.
1887 * @param item : the moved item.
1889 * the item(*item) had been moved
1892 static void gl_moved(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__)
1894 // if needed, add application logic.
1898 * gl_moved_after is called after an item was reordered.
1899 * This is only called when reorder mode is enabled.
1901 * @param data : the genlist object passed as data.
1902 * @param obj : the genlist object.
1903 * @param item : the moved item.
1905 * the item(*item) had been moved after the given relative item(*rel_item) in list.
1908 static void gl_moved_after(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__)
1910 // if needed, add application logic.
1911 Elm_Object_Item *it;
1912 it = elm_genlist_item_prev_get(item);
1913 printf("it=%p, prev_it=%p\n",item,it);
1917 * gl_moved_before is called after an item was reordered.
1918 * This is only called when reorder mode is enabled.
1920 * @param data : the genlist object passed as data.
1921 * @param obj : the genlist object.
1922 * @param item : the moved item.
1924 * the item(*item) had been moved before the given relative item(*rel_item) in list.
1927 static void gl_moved_before(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__)
1929 // if needed, add application logic.
1930 Elm_Object_Item *it;
1931 it = elm_genlist_item_next_get(item);
1932 printf("it=%p, next_it=%p\n",item,it);
1936 test_genlist11(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1938 Evas_Object *win, *fr, *lb, *bx, *tg, *gl;
1941 win = elm_win_util_standard_add("genlist-reorder-mode", "Genlist Reorder Mode");
1942 elm_win_autodel_set(win, EINA_TRUE);
1944 bx = elm_box_add(win);
1945 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1946 elm_win_resize_object_add(win, bx);
1947 evas_object_show(bx);
1949 fr = elm_frame_add(win);
1951 elm_object_text_set(fr, "Reorder Mode");
1952 elm_box_pack_end(bx, fr);
1953 evas_object_show(fr);
1955 lb = elm_label_add(win);
1956 elm_object_text_set(lb,
1957 "Enable reorder mode if you want to move item.<br/>"
1958 "Then long press and drag item.");
1959 elm_object_content_set(fr, lb);
1960 evas_object_show(lb);
1962 gl = elm_genlist_add(win);
1963 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1964 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1965 evas_object_show(gl);
1967 tg = elm_check_add(win);
1968 elm_object_style_set(tg, "toggle");
1969 elm_object_text_set(tg, "Reorder Mode:");
1970 elm_check_state_set(tg, elm_config_mirrored_get());
1971 evas_object_smart_callback_add(tg, "changed", _reorder_tg_changed_cb, gl);
1972 elm_box_pack_end(bx, tg);
1973 evas_object_show(tg);
1975 itc1 = elm_genlist_item_class_new();
1976 itc1->item_style = "default";
1977 itc1->func.text_get = gl_text_get;
1978 itc1->func.content_get = gl_content_get;
1979 itc1->func.state_get = gl_state_get;
1980 itc1->func.del = NULL;
1981 evas_object_smart_callback_add(gl, "moved", (Evas_Smart_Cb)gl_moved, gl);
1982 evas_object_smart_callback_add(gl, "moved,after", (Evas_Smart_Cb)gl_moved_after, gl);
1983 evas_object_smart_callback_add(gl, "moved,before", (Evas_Smart_Cb)gl_moved_before, gl);
1985 for (i = 0; i < 50; i++)
1986 elm_genlist_item_append(gl,
1988 (void *)(long)(1 + i)/* item data */,
1990 ELM_GENLIST_ITEM_NONE/* flags */,
1992 NULL/* func data */);
1994 elm_genlist_item_class_free(itc1);
1996 elm_box_pack_end(bx, gl);
1998 evas_object_resize(win, 400, 500);
1999 evas_object_show(win);
2002 char *gl12_text_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
2004 return strdup("Enlightenment is not just a window manager for Linux/X11 and others, but also a whole suite of libraries to help you create beautiful user interfaces with much less work than doing it the old fashioned way and fighting with traditional toolkits, not to mention a traditional window manager. It covers uses from small mobile devices like phones all the way to powerful multi-core desktops (which are the primary development environment).");
2008 test_genlist12(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2010 Evas_Object *win, *bx, *gl;
2013 win = elm_win_util_standard_add("genlist-textblock", "Genlist Textblock");
2014 elm_win_autodel_set(win, EINA_TRUE);
2016 bx = elm_box_add(win);
2017 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2018 elm_win_resize_object_add(win, bx);
2019 evas_object_show(bx);
2021 gl = elm_genlist_add(win);
2022 elm_genlist_mode_set(gl, ELM_LIST_COMPRESS);
2023 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2024 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2025 elm_box_pack_end(bx, gl);
2026 evas_object_show(gl);
2028 itc1 = elm_genlist_item_class_new();
2029 itc1->item_style = "message";
2030 itc1->func.text_get = gl12_text_get;
2031 itc1->func.content_get = gl_content_get;
2032 itc1->func.state_get = gl_state_get;
2033 itc1->func.del = NULL;
2035 for (i = 0; i < 1000; i++)
2037 elm_genlist_item_append(gl, itc1,
2038 (void *)(long)i/* item data */,
2040 ELM_GENLIST_ITEM_NONE,
2042 (void *)(long)(i * 10)/* func data */);
2044 elm_genlist_item_class_free(itc1);
2046 evas_object_resize(win, 400, 500);
2047 evas_object_show(win);
2051 gl13_cmp(const void *pa, const void *pb)
2053 const Elm_Object_Item *ia = pa, *ib = pb;
2054 int a = (int)(long) elm_object_item_data_get(ia);
2055 int b = (int)(long) elm_object_item_data_get(ib);
2060 test_genlist13(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2062 Elm_Object_Item *pi[6];
2063 Evas_Object *win, *bx, *gl; int i, base, idx[3] = {1, 10, 15};
2065 win = elm_win_util_standard_add("genlist-tree-insert-sorted", "Genlist Tree, Insert Sorted");
2066 elm_win_autodel_set(win, EINA_TRUE);
2068 bx = elm_box_add(win);
2069 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2070 elm_win_resize_object_add(win, bx);
2071 evas_object_show(bx);
2073 gl = elm_genlist_add(win);
2074 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2075 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2076 evas_object_show(gl);
2078 itc4 = elm_genlist_item_class_new();
2079 itc4->item_style = "default";
2080 itc4->func.text_get = gl4_text_get;
2081 itc4->func.content_get = NULL;
2082 itc4->func.state_get = NULL;
2083 itc4->func.del = NULL;
2085 /* mixed order to test insert sorted */
2087 for (i = 0; i < 3; i++)
2089 pi[i] = elm_genlist_item_sorted_insert
2090 (gl, itc4, (void *)(long)idx[i]/* item data */, NULL/* parent */,
2091 ELM_GENLIST_ITEM_TREE, gl13_cmp/* cmp */,
2092 NULL/* func */, NULL/* func data */);
2095 for (i = 0, base = 100; i < 3; i++, base += 100)
2098 for (j = 0; j < 3; j++)
2100 elm_genlist_item_sorted_insert
2101 (gl, itc4, (void *)(long)(idx[j] + base)/* item data */,
2102 pi[i]/* parent */, ELM_GENLIST_ITEM_NONE,
2103 gl13_cmp/* cmp */, NULL/* func */, NULL/* func data */);
2107 for (i = 0; i < 3; i++)
2109 pi[i + 3] = elm_genlist_item_sorted_insert
2110 (gl, itc4, (void *)(long)(idx[i] * 2)/* item data */, NULL/* parent */,
2111 ELM_GENLIST_ITEM_TREE, gl13_cmp/* cmp */, NULL/* func */,
2112 NULL/* func data */);
2116 for (i = 0, base = 10000; i < 3; i++, base += 10000)
2119 for (j = 0; j < 3; j++)
2121 elm_genlist_item_sorted_insert
2122 (gl, itc4, (void *)(long)(idx[j] + base)/* item data */,
2123 pi[i + 3]/* parent */, ELM_GENLIST_ITEM_NONE,
2124 gl13_cmp/* cmp */, NULL/* func */, NULL/* func data */);
2127 elm_genlist_item_class_free(itc4);
2128 elm_box_pack_end(bx, gl);
2129 evas_object_show(bx);
2131 evas_object_resize(win, 320, 320);
2132 evas_object_show(win);
2136 my_gl_insert_before_rel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2138 Evas_Object *gl = data;
2139 static int i = 1000;
2140 Elm_Object_Item *gli_selected;
2142 itc1->item_style = "default";
2143 itc1->func.text_get = gl_text_get;
2144 itc1->func.content_get = NULL;
2145 itc1->func.state_get = NULL;
2146 itc1->func.del = NULL;
2148 gli_selected = elm_genlist_selected_item_get(gl);
2151 printf("no item selected\n");
2155 elm_genlist_item_insert_before(gl, itc1,
2156 (void *)(long)i/* item data */,
2157 elm_genlist_item_parent_get(gli_selected),
2158 gli_selected/* item before */,
2159 ELM_GENLIST_ITEM_NONE,
2160 NULL/* func */, NULL/* func data */);
2165 my_gl_insert_after_rel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2167 Evas_Object *gl = data;
2169 Elm_Object_Item *gli_selected;
2171 itc1->item_style = "default";
2172 itc1->func.text_get = gl_text_get;
2173 itc1->func.content_get = NULL;
2174 itc1->func.state_get = NULL;
2175 itc1->func.del = NULL;
2177 gli_selected = elm_genlist_selected_item_get(gl);
2180 printf("no item selected\n");
2184 elm_genlist_item_insert_after(gl, itc1,
2185 (void *)(long)i/* item data */,
2186 elm_genlist_item_parent_get(gli_selected),
2187 gli_selected/* item after */,
2188 ELM_GENLIST_ITEM_NONE,
2189 NULL/* func */, NULL/* func data */);
2194 test_genlist14(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2196 Elm_Object_Item *pi[6];
2197 Evas_Object *win, *bx, *bx2, *bt, *gl;
2199 /* index: 0, 1, 2, 3, 4, 5
2200 * items: 1, 15, 11, 2, 33, 21
2201 * final: 1, 2, 11, 15, 21, 33
2203 const int idx[6] = {1, 15, 11, 2, 33, 21};
2204 const int relative[6] = {
2205 0, /* item '1' - not used */
2206 0, /* item '15' - insert after pi[0], item '1' */
2207 -1, /* item '11' - insert before pi[1], item '15' */
2208 -2, /* item '2' - insert before pi[2], item '11' */
2209 1, /* item '33' - insert after pi[1], item '15' */
2210 -4 /* item '21' - insert before pi[4], item '33' */
2213 win = elm_win_util_standard_add("genlist-tree-insert-relative", "Genlist Tree, Insert Relative");
2214 elm_win_autodel_set(win, EINA_TRUE);
2216 bx = elm_box_add(win);
2217 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2218 elm_win_resize_object_add(win, bx);
2219 evas_object_show(bx);
2221 gl = elm_genlist_add(win);
2222 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2223 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2224 evas_object_show(gl);
2226 itc4 = elm_genlist_item_class_new();
2227 itc4->item_style = "default";
2228 itc4->func.text_get = gl4_text_get;
2229 itc4->func.content_get = NULL;
2230 itc4->func.state_get = NULL;
2231 itc4->func.del = NULL;
2233 /* mixed order to test insert sorted */
2235 // BUG1: should be able to insert before=NULL, prepend
2236 // BUG2: should be able to insert after=NULL, append
2238 pi[0] = elm_genlist_item_append
2239 (gl, itc4, (void *)(long)idx[0]/* item data */,
2241 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2243 for (i = 1; i < 3; i++)
2245 if (relative[i] < 0)
2246 pi[i] = elm_genlist_item_insert_before
2247 (gl, itc4, (void *)(long)idx[i]/* item data */,
2248 NULL/* parent */, pi[-relative[i]],
2249 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2251 pi[i] = elm_genlist_item_insert_after
2252 (gl, itc4, (void *)(long)idx[i]/* item data */,
2253 NULL/* parent */, pi[relative[i]],
2254 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2257 for (i = 0; i < 3; i++)
2259 Elm_Object_Item *sub_glit[6];
2262 base = 1000 * (int)(long) elm_object_item_data_get(pi[i]);
2264 sub_glit[0] = elm_genlist_item_append
2265 (gl, itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */,
2266 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2268 for (j = 1; j < 6; j++) {
2269 if (relative[j] < 0)
2270 sub_glit[j] = elm_genlist_item_insert_before
2271 (gl, itc4, (void *)(long) (idx[j] + base)/* item data */,
2272 pi[i]/* parent */, sub_glit[-relative[j]],
2273 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2275 sub_glit[j] = elm_genlist_item_insert_after
2276 (gl, itc4, (void *)(long) (idx[j] + base)/* item data */,
2277 pi[i]/* parent */, sub_glit[relative[j]],
2278 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2282 for (i = 3; i < 6; i++)
2284 if (relative[i] < 0)
2285 pi[i] = elm_genlist_item_insert_before
2286 (gl, itc4, (void *)(long) idx[i]/* item data */,
2287 NULL/* parent */, pi[-relative[i]],
2288 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2290 pi[i] = elm_genlist_item_insert_after
2291 (gl, itc4, (void *)(long) idx[i]/* item data */,
2292 NULL/* parent */, pi[relative[i]],
2293 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2296 for (i = 3; i < 6; i++)
2298 Elm_Object_Item *sub_glit[6];
2301 base = 1000 * (int)(long) elm_object_item_data_get(pi[i]);
2303 sub_glit[0] = elm_genlist_item_append
2304 (gl, itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */,
2305 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2307 for (j = 1; j < 6; j++) {
2308 if (relative[j] < 0)
2309 sub_glit[j] = elm_genlist_item_insert_before
2310 (gl, itc4, (void *)(long) (idx[j] + base)/* item data */,
2311 pi[i]/* parent */, sub_glit[-relative[j]],
2312 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2314 sub_glit[j] = elm_genlist_item_insert_after
2315 (gl, itc4, (void *)(long) (idx[j] + base)/* item data */,
2316 pi[i]/* parent */, sub_glit[relative[j]],
2317 ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
2321 elm_box_pack_end(bx, gl);
2322 evas_object_show(bx);
2324 bx2 = elm_box_add(win);
2325 elm_box_horizontal_set(bx2, EINA_TRUE);
2326 elm_box_homogeneous_set(bx2, EINA_TRUE);
2327 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
2328 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2330 bt = elm_button_add(win);
2331 elm_object_text_set(bt, "+ before");
2332 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_before_rel, gl);
2333 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2334 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2335 elm_box_pack_end(bx2, bt);
2336 evas_object_show(bt);
2338 bt = elm_button_add(win);
2339 elm_object_text_set(bt, "+ after");
2340 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_after_rel, gl);
2341 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2342 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2343 elm_box_pack_end(bx2, bt);
2344 evas_object_show(bt);
2346 elm_box_pack_end(bx, bx2);
2347 evas_object_show(bx2);
2349 /* item_class_ref is needed for itc4. some items can be added in callbacks */
2350 elm_genlist_item_class_ref(itc4);
2351 elm_genlist_item_class_free(itc4);
2353 evas_object_resize(win, 320, 320);
2354 evas_object_show(win);
2357 static void _edit_icon_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2359 Elm_Object_Item *item = (Elm_Object_Item *)data;
2360 elm_object_item_del(item);
2363 char *gl15_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
2365 const Testitem *tit = data;
2367 snprintf(buf, sizeof(buf), "Item #%i", tit->mode);
2371 Evas_Object *gl15_content_get(void *data, Evas_Object *obj, const char *part)
2373 Testitem *tit = data;
2376 // "decorate_default" EDC layout is like below. each part is swallow part.
2377 // the existing item is swllowed to elm.swallow.edit.content part.
2378 // ----------------------------------------------------------------
2379 // | elm.decorate.icon.1 | elm.swallow.decorate.content | elm.decorate.icon,2 |
2380 // ----------------------------------------------------------------
2382 if (!strcmp(part, "elm.swallow.end"))
2384 Evas_Object *ic = elm_icon_add(obj);
2385 snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR);
2386 elm_icon_file_set(ic, buf, NULL);
2387 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2390 else if (!strcmp(part, "elm.decorate.icon.1"))
2393 ck = elm_check_add(obj);
2394 elm_check_state_pointer_set(ck, &tit->checked);
2395 evas_object_propagate_events_set(ck, EINA_FALSE);
2396 evas_object_show(ck);
2399 else if (!strcmp(part, "elm.decorate.icon.2"))
2401 Evas_Object *icn = elm_icon_add(obj);
2402 snprintf(buf, sizeof(buf), "%s/images/icon_06.png", PACKAGE_DATA_DIR);
2403 elm_icon_file_set(icn, buf, NULL);
2404 evas_object_propagate_events_set(icn, EINA_FALSE);
2405 evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2406 evas_object_smart_callback_add(icn, "clicked", _edit_icon_clicked_cb, (void *)tit->item);
2413 gl15_sel(void *data, Evas_Object *obj, void *event_info __UNUSED__)
2415 Testitem *tit = data;
2416 if (elm_genlist_decorate_mode_get(obj))
2418 if (!tit->checked) tit->checked = EINA_TRUE;
2419 else tit->checked = EINA_FALSE;
2421 elm_genlist_item_update(tit->item);
2425 gl15_deco_all_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2427 elm_genlist_decorate_mode_set(data, EINA_TRUE);
2428 elm_genlist_select_mode_set(data, ELM_OBJECT_SELECT_MODE_ALWAYS);
2432 gl15_normal_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2434 elm_genlist_decorate_mode_set(data, EINA_FALSE);
2435 elm_genlist_select_mode_set(data, ELM_OBJECT_SELECT_MODE_DEFAULT);
2438 void gl15_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
2440 printf("item deleted.\n");
2443 static Elm_Genlist_Item_Class *itc15;
2445 test_genlist15(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2447 Evas_Object *win, *bx, *bx2, *bt, *gl;
2449 static Testitem tit[100];
2451 win = elm_win_util_standard_add("genlist-decorate-all-mode", "Genlist Decorate All Mode");
2452 elm_win_autodel_set(win, EINA_TRUE);
2454 bx = elm_box_add(win);
2455 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2456 elm_win_resize_object_add(win, bx);
2457 evas_object_show(bx);
2459 gl = elm_genlist_add(win);
2460 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2461 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2462 evas_object_show(gl);
2464 itc15 = elm_genlist_item_class_new();
2465 itc15->item_style = "default";
2466 itc15->func.text_get = gl15_text_get;
2467 itc15->func.content_get = gl15_content_get;
2468 itc15->func.state_get = gl_state_get;
2469 itc15->func.del = gl15_del;
2470 itc15->decorate_all_item_style = "edit";
2472 for (i = 0; i < 100; i++)
2475 tit[i].item = elm_genlist_item_append(gl, itc15,
2476 &(tit[i])/* item data */,
2478 ELM_GENLIST_ITEM_NONE/* flags */,
2480 (void *)(long)&(tit[i])/* func data */);
2482 elm_genlist_item_class_free(itc15);
2483 elm_box_pack_end(bx, gl);
2484 evas_object_show(bx);
2486 bx2 = elm_box_add(win);
2487 elm_box_horizontal_set(bx2, EINA_TRUE);
2488 elm_box_homogeneous_set(bx2, EINA_TRUE);
2489 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
2490 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2492 bt = elm_button_add(win);
2493 elm_object_text_set(bt, "Decorate All mode");
2494 evas_object_smart_callback_add(bt, "clicked", gl15_deco_all_mode, gl);
2495 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2496 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2497 elm_box_pack_end(bx2, bt);
2498 evas_object_show(bt);
2500 bt = elm_button_add(win);
2501 elm_object_text_set(bt, "Normal mode");
2502 evas_object_smart_callback_add(bt, "clicked", gl15_normal_mode,gl);
2503 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2504 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2505 elm_box_pack_end(bx2, bt);
2506 evas_object_show(bt);
2508 elm_box_pack_end(bx, bx2);
2509 evas_object_show(bx2);
2511 evas_object_resize(win, 520, 520);
2512 evas_object_show(win);
2515 static void _flip_icon_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2517 const Testitem *tit = data;
2519 if (elm_genlist_item_flip_get(tit->item))
2520 elm_genlist_item_flip_set(tit->item, EINA_FALSE);
2522 elm_genlist_item_flip_set(tit->item, EINA_TRUE);
2525 char *gl16_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
2527 const Testitem *tit = data;
2529 snprintf(buf, sizeof(buf), "Item #%i", tit->mode);
2533 Evas_Object *gl16_content_get(void *data, Evas_Object *obj, const char *part)
2535 Testitem *tit = data;
2538 if (!strcmp(part, "elm.text.flip"))
2540 Evas_Object *btn = elm_button_add(obj);
2541 elm_object_text_set(btn, "flipped content placement");
2542 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
2543 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
2544 evas_object_smart_callback_add(btn, "clicked", _flip_icon_clicked_cb, (void *)tit);
2545 evas_object_show(btn);
2548 else if (!strcmp(part, "elm.decorate.icon.1"))
2550 Evas_Object *icn = elm_icon_add(obj);
2551 snprintf(buf, sizeof(buf), "%s/images/icon_04.png", PACKAGE_DATA_DIR);
2552 elm_icon_file_set(icn, buf, NULL);
2553 evas_object_propagate_events_set(icn, EINA_FALSE);
2554 evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2557 else if (!strcmp(part, "elm.decorate.icon.2"))
2559 Evas_Object *icn = elm_icon_add(obj);
2560 snprintf(buf, sizeof(buf), "%s/images/icon_09.png", PACKAGE_DATA_DIR);
2561 elm_icon_file_set(icn, buf, NULL);
2562 evas_object_propagate_events_set(icn, EINA_FALSE);
2563 evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2564 evas_object_smart_callback_add(icn, "clicked", _flip_icon_clicked_cb, (void *)tit);
2571 test_genlist16(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2573 Evas_Object *win, *bx, *gl;
2575 static Testitem tit[100];
2577 win = elm_win_util_standard_add("genlist-flip-mode", "Genlist Flip Mode");
2578 elm_win_autodel_set(win, EINA_TRUE);
2580 bx = elm_box_add(win);
2581 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2582 elm_win_resize_object_add(win, bx);
2583 evas_object_show(bx);
2585 gl = elm_genlist_add(win);
2586 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2587 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2588 evas_object_show(gl);
2590 /* note: flip mode can be used with/without edit mode */
2591 elm_genlist_decorate_mode_set(gl, EINA_TRUE);
2592 elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
2594 itc15 = elm_genlist_item_class_new();
2595 itc15->item_style = "default";
2596 itc15->func.text_get = gl16_text_get;
2597 itc15->func.content_get = gl16_content_get;
2598 itc15->func.state_get = gl_state_get;
2599 itc15->func.del = NULL;
2600 itc15->decorate_all_item_style = "edit";
2602 for (i = 0; i < 100; i++)
2605 tit[i].item = elm_genlist_item_append(gl, itc15,
2606 &(tit[i])/* item data */,
2608 ELM_GENLIST_ITEM_NONE/* flags */,
2610 (void *)(long)&(tit[i])/* func data */);
2612 elm_genlist_item_class_free(itc15);
2613 elm_box_pack_end(bx, gl);
2614 evas_object_show(bx);
2616 evas_object_resize(win, 520, 520);
2617 evas_object_show(win);
2620 static Elm_Genlist_Item_Class itc17;
2623 gl17_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2625 Elm_Object_Item *glit = event_info;
2626 int depth = elm_genlist_item_expanded_depth_get(glit);
2627 printf("expanded depth for selected item is %d\n", depth);
2631 gl17_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2633 Elm_Object_Item *glit = event_info;
2634 Evas_Object *gl = elm_object_item_widget_get(glit);
2635 int val = (int)(long) elm_object_item_data_get(glit);
2637 elm_genlist_item_append(gl, &itc17,
2638 (void *)(long) (val + 1)/* item data */,
2640 ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
2641 NULL/* func data */);
2642 elm_genlist_item_append(gl, &itc17,
2643 (void *)(long) (val + 2)/* item data */,
2645 ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
2646 NULL/* func data */);
2647 elm_genlist_item_append(gl, &itc17,
2648 (void *)(long) (val + 3)/* item data */,
2650 ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
2651 NULL/* func data */);
2652 elm_genlist_item_append(gl, &itc17,
2653 (void *)(long) (val + 4)/* item data */,
2655 ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
2656 NULL/* func data */);
2657 elm_genlist_item_append(gl, &itc17,
2658 (void *)(long) (val + 5)/* item data */,
2660 ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
2661 NULL/* func data */);
2662 elm_genlist_item_append(gl, &itc17,
2663 (void *)(long) (val + 6)/* item data */,
2665 ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
2666 NULL/* func data */);
2670 gl17_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2672 Elm_Object_Item *glit = event_info;
2673 elm_genlist_item_subitems_clear(glit);
2677 gl17_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2679 Elm_Object_Item *glit = event_info;
2680 elm_genlist_item_expanded_set(glit, EINA_TRUE);
2684 gl17_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2686 Elm_Object_Item *glit = event_info;
2687 elm_genlist_item_expanded_set(glit, EINA_FALSE);
2690 char *gl17_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
2693 snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data);
2697 Evas_Object *gl17_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
2700 if (!strcmp(part, "elm.swallow.icon"))
2702 Evas_Object *ic = elm_icon_add(obj);
2703 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
2704 elm_icon_file_set(ic, buf, NULL);
2705 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2706 evas_object_show(ic);
2709 else if (!strcmp(part, "elm.swallow.end"))
2712 ck = elm_check_add(obj);
2713 evas_object_propagate_events_set(ck, EINA_FALSE);
2714 evas_object_show(ck);
2720 Eina_Bool gl17_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
2725 void gl17_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
2727 printf("item deleted.\n");
2731 gl17_enabled_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2733 elm_genlist_tree_effect_enabled_set(data, EINA_TRUE);
2737 gl17_disabled_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2739 elm_genlist_tree_effect_enabled_set(data, EINA_FALSE);
2743 test_genlist17(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2745 Evas_Object *win, *gl, *bx, *bx2, *bt;
2747 win = elm_win_util_standard_add("genlist17", "Genlist Tree Effect");
2748 elm_win_autodel_set(win, EINA_TRUE);
2750 bx = elm_box_add(win);
2751 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2752 elm_win_resize_object_add(win, bx);
2753 evas_object_show(bx);
2755 gl = elm_genlist_add(win);
2756 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2757 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2758 evas_object_show(gl);
2760 elm_genlist_tree_effect_enabled_set(gl,EINA_TRUE);
2762 itc17.item_style = "tree_effect";
2763 itc17.func.text_get = gl17_text_get;
2764 itc17.func.content_get = gl17_content_get;
2765 itc17.func.state_get = gl17_state_get;
2766 itc17.func.del = gl17_del;
2768 elm_genlist_item_append(gl, &itc17,
2769 (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
2770 NULL/* func data */);
2771 elm_genlist_item_append(gl, &itc17,
2772 (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
2773 NULL/* func data */);
2774 elm_genlist_item_append(gl, &itc17,
2775 (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
2776 NULL/* func data */);
2778 evas_object_smart_callback_add(gl, "expand,request", gl17_exp_req, gl);
2779 evas_object_smart_callback_add(gl, "contract,request", gl17_con_req, gl);
2780 evas_object_smart_callback_add(gl, "expanded", gl17_exp, gl);
2781 evas_object_smart_callback_add(gl, "contracted", gl17_con, gl);
2783 elm_box_pack_end(bx, gl);
2784 evas_object_show(bx);
2786 bx2 = elm_box_add(win);
2787 elm_box_horizontal_set(bx2, EINA_TRUE);
2788 elm_box_homogeneous_set(bx2, EINA_TRUE);
2789 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
2790 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2792 bt = elm_button_add(win);
2793 elm_object_text_set(bt, "Enable");
2794 evas_object_smart_callback_add(bt, "clicked", gl17_enabled_set, gl);
2795 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2796 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2797 elm_box_pack_end(bx2, bt);
2798 evas_object_show(bt);
2800 bt = elm_button_add(win);
2801 elm_object_text_set(bt, "Disable");
2802 evas_object_smart_callback_add(bt, "clicked", gl17_disabled_set, gl);
2803 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2804 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2805 elm_box_pack_end(bx2, bt);
2806 evas_object_show(bt);
2808 elm_box_pack_end(bx, bx2);
2809 evas_object_show(bx2);
2811 evas_object_resize(win, 320, 320);
2812 evas_object_show(win);