1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 * In this example some calls to elm_genlist_item_append() are used which give the
9 * value of an int as 'item data' and 'func data' after casting into (void*). For
10 * sure this works only on architectures where sizeof(int)==sizeof(void*).
11 * For real world usage you should hold a data structure or value in your
12 * application and then give only a pointer to this data as data pointer.
15 typedef struct _Testitem
17 Elm_Genlist_Item *item;
23 static Elm_Genlist_Item_Class itc1;
24 char *gl_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
27 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
31 Evas_Object *gl_icon_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
34 Evas_Object *ic = elm_icon_add(obj);
35 if (!strcmp(part, "elm.swallow.end"))
36 snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR);
38 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
39 elm_icon_file_set(ic, buf, NULL);
40 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
43 Eina_Bool gl_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
47 void gl_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
52 gl_sel(void *data, Evas_Object *obj, void *event_info)
54 printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", data, obj, event_info);
58 _move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
60 Evas_Object *gl = data;
61 Evas_Event_Mouse_Move *ev = event_info;
63 Elm_Genlist_Item *gli;
64 gli = elm_genlist_at_xy_item_get(gl, ev->cur.canvas.x, ev->cur.canvas.y, &where);
66 printf("over %p, where %i\n", elm_genlist_item_data_get(gli), where);
68 printf("over none, where %i\n", where);
72 _bt50_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
74 elm_genlist_item_bring_in(data);
78 _bt1500_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
80 elm_genlist_item_middle_bring_in(data);
84 _gl_selected(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
86 printf("selected: %p\n", event_info);
90 _gl_double_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
92 printf("double clicked: %p\n", event_info);
96 _gl_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
98 printf("longpress %p\n", event_info);
102 test_genlist(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
104 Evas_Object *win, *bg, *gl, *bt_50, *bt_1500, *bx;
106 Elm_Genlist_Item *gli;
109 win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
110 elm_win_title_set(win, "Genlist");
111 elm_win_autodel_set(win, 1);
113 bg = elm_bg_add(win);
114 elm_win_resize_object_add(win, bg);
115 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
116 evas_object_show(bg);
118 bx = elm_box_add(win);
119 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
120 elm_win_resize_object_add(win, bx);
121 evas_object_show(bx);
123 gl = elm_genlist_add(win);
124 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
125 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
126 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
127 // FIXME: This causes genlist to resize the horiz axis very slowly :(
128 // Reenable this and resize the window horizontally, then try to resize it back
129 //elm_genlist_horizontal_mode_set(gl, ELM_LIST_LIMIT);
130 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
131 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
132 elm_box_pack_end(bx, gl);
133 evas_object_show(gl);
135 over = evas_object_rectangle_add(evas_object_evas_get(win));
136 evas_object_color_set(over, 0, 0, 0, 0);
137 evas_object_event_callback_add(over, EVAS_CALLBACK_MOUSE_MOVE, _move, gl);
138 evas_object_repeat_events_set(over, 1);
139 evas_object_show(over);
140 evas_object_size_hint_weight_set(over, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
141 elm_win_resize_object_add(win, over);
143 itc1.item_style = "default";
144 itc1.func.label_get = gl_label_get;
145 itc1.func.icon_get = gl_icon_get;
146 itc1.func.state_get = gl_state_get;
147 itc1.func.del = gl_del;
149 bt_50 = elm_button_add(win);
150 elm_button_label_set(bt_50, "Go to 50");
151 evas_object_show(bt_50);
152 elm_box_pack_end(bx, bt_50);
154 bt_1500 = elm_button_add(win);
155 elm_button_label_set(bt_1500, "Go to 1500");
156 evas_object_show(bt_1500);
157 elm_box_pack_end(bx, bt_1500);
159 for (i = 0; i < 2000; i++)
161 gli = elm_genlist_item_append(gl, &itc1,
162 (void *)(long)i/* item data */,
164 ELM_GENLIST_ITEM_NONE,
166 (void *)(long)(i * 10)/* func data */);
168 evas_object_smart_callback_add(bt_50, "clicked", _bt50_cb, gli);
170 evas_object_smart_callback_add(bt_1500, "clicked", _bt1500_cb, gli);
172 evas_object_resize(win, 480, 800);
173 evas_object_show(win);
179 my_gl_clear(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
181 Evas_Object *gl = data;
182 elm_genlist_clear(gl);
186 my_gl_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
188 Evas_Object *gl = data;
191 itc1.item_style = "default";
192 itc1.func.label_get = gl_label_get;
193 itc1.func.icon_get = gl_icon_get;
194 itc1.func.state_get = gl_state_get;
195 itc1.func.del = gl_del;
197 elm_genlist_item_append(gl, &itc1,
198 (void *)(long)i/* item data */,
200 ELM_GENLIST_ITEM_NONE,
202 (void *)(long)(i * 10)/* func data */);
207 my_gl_insert_before(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
209 Evas_Object *gl = data;
211 Elm_Genlist_Item *gli_selected;
213 itc1.item_style = "default";
214 itc1.func.label_get = gl_label_get;
215 itc1.func.icon_get = gl_icon_get;
216 itc1.func.state_get = gl_state_get;
217 itc1.func.del = gl_del;
219 gli_selected = elm_genlist_selected_item_get(gl);
222 printf("no item selected\n");
226 elm_genlist_item_insert_before(gl, &itc1,
227 (void *)(long)i/* item data */,
229 gli_selected /* item before */,
230 ELM_GENLIST_ITEM_NONE,
232 (void *)(long)(i * 10)/* func data */);
237 my_gl_insert_after(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
239 Evas_Object *gl = data;
241 Elm_Genlist_Item *gli_selected;
243 itc1.item_style = "default";
244 itc1.func.label_get = gl_label_get;
245 itc1.func.icon_get = gl_icon_get;
246 itc1.func.state_get = gl_state_get;
247 itc1.func.del = gl_del;
249 gli_selected = elm_genlist_selected_item_get(gl);
252 printf("no item selected\n");
256 elm_genlist_item_insert_after(gl, &itc1,
257 (void *)(long)i/* item data */,
259 gli_selected /* item after */,
260 ELM_GENLIST_ITEM_NONE,
262 (void *)(long)(i * 10)/* func data */);
267 my_gl_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
269 Evas_Object *gl = data;
270 Elm_Genlist_Item *gli = elm_genlist_selected_item_get(gl);
273 printf("no item selected\n");
276 elm_genlist_item_del(gli);
280 my_gl_disable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
282 Evas_Object *gl = data;
283 Elm_Genlist_Item *gli = elm_genlist_selected_item_get(gl);
286 printf("no item selected\n");
289 elm_genlist_item_disabled_set(gli, 1);
290 elm_genlist_item_selected_set(gli, 0);
291 elm_genlist_item_update(gli);
295 my_gl_update_all(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
297 Evas_Object *gl = data;
299 Elm_Genlist_Item *it = elm_genlist_first_item_get(gl);
302 elm_genlist_item_update(it);
305 it = elm_genlist_item_next_get(it);
310 my_gl_first(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
312 Evas_Object *gl = data;
313 Elm_Genlist_Item *gli = elm_genlist_first_item_get(gl);
315 elm_genlist_item_show(gli);
316 elm_genlist_item_selected_set(gli, 1);
320 my_gl_last(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
322 Evas_Object *gl = data;
323 Elm_Genlist_Item *gli = elm_genlist_last_item_get(gl);
325 elm_genlist_item_show(gli);
326 elm_genlist_item_selected_set(gli, 1);
330 my_gl_flush_delay(void *data __UNUSED__)
333 return ECORE_CALLBACK_CANCEL;
337 my_gl_flush(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
339 ecore_timer_add(1.2, my_gl_flush_delay, NULL);
343 test_genlist2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
345 Evas_Object *win, *bg, *gl, *bx, *bx2, *bx3, *bt;
346 Elm_Genlist_Item *gli[10];
349 win = elm_win_add(NULL, "genlist2", ELM_WIN_BASIC);
350 elm_win_title_set(win, "Genlist 2");
351 elm_win_autodel_set(win, 1);
353 bg = elm_bg_add(win);
354 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
355 elm_bg_file_set(bg, buf, NULL);
356 elm_win_resize_object_add(win, bg);
357 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
358 evas_object_show(bg);
360 bx = elm_box_add(win);
361 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
362 elm_win_resize_object_add(win, bx);
363 evas_object_show(bx);
365 gl = elm_genlist_add(win);
366 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
367 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
368 evas_object_show(gl);
370 itc1.item_style = "default";
371 itc1.func.label_get = gl_label_get;
372 itc1.func.icon_get = gl_icon_get;
373 itc1.func.state_get = gl_state_get;
374 itc1.func.del = gl_del;
376 gli[0] = elm_genlist_item_append(gl, &itc1,
377 (void *)1001/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
378 (void *)1001/* func data */);
379 gli[1] = elm_genlist_item_append(gl, &itc1,
380 (void *)1002/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
381 (void *)1002/* func data */);
382 gli[2] = elm_genlist_item_append(gl, &itc1,
383 (void *)1003/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
384 (void *)1003/* func data */);
385 gli[3] = elm_genlist_item_prepend(gl, &itc1,
386 (void *)1004/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
387 (void *)1004/* func data */);
388 gli[4] = elm_genlist_item_prepend(gl, &itc1,
389 (void *)1005/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
390 (void *)1005/* func data */);
391 gli[5] = elm_genlist_item_insert_before(gl, &itc1,
392 (void *)1006/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
393 gl_sel/* func */, (void *)1006/* func data */);
394 gli[6] = elm_genlist_item_insert_after(gl, &itc1,
395 (void *)1007/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
396 gl_sel/* func */, (void *)1007/* func data */);
398 elm_box_pack_end(bx, gl);
400 bx2 = elm_box_add(win);
401 elm_box_horizontal_set(bx2, EINA_TRUE);
402 elm_box_homogeneous_set(bx2, EINA_TRUE);
403 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
404 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
406 bt = elm_button_add(win);
407 elm_button_label_set(bt, "/\\");
408 evas_object_smart_callback_add(bt, "clicked", my_gl_first, gl);
409 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
410 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
411 elm_box_pack_end(bx2, bt);
412 evas_object_show(bt);
414 bt = elm_button_add(win);
415 elm_button_label_set(bt, "\\/");
416 evas_object_smart_callback_add(bt, "clicked", my_gl_last, gl);
417 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
418 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
419 elm_box_pack_end(bx2, bt);
420 evas_object_show(bt);
422 bt = elm_button_add(win);
423 elm_button_label_set(bt, "#");
424 evas_object_smart_callback_add(bt, "clicked", my_gl_disable, gl);
425 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
426 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
427 elm_box_pack_end(bx2, bt);
428 evas_object_show(bt);
430 bt = elm_button_add(win);
431 elm_button_label_set(bt, "U");
432 evas_object_smart_callback_add(bt, "clicked", my_gl_update_all, gl);
433 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
434 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
435 elm_box_pack_end(bx2, bt);
436 evas_object_show(bt);
438 elm_box_pack_end(bx, bx2);
439 evas_object_show(bx2);
441 bx2 = elm_box_add(win);
442 elm_box_horizontal_set(bx2, EINA_TRUE);
443 elm_box_homogeneous_set(bx2, EINA_TRUE);
444 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
445 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
447 bt = elm_button_add(win);
448 elm_button_label_set(bt, "X");
449 evas_object_smart_callback_add(bt, "clicked", my_gl_clear, gl);
450 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
451 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
452 elm_box_pack_end(bx2, bt);
453 evas_object_show(bt);
455 bt = elm_button_add(win);
456 elm_button_label_set(bt, "+");
457 evas_object_smart_callback_add(bt, "clicked", my_gl_add, gl);
458 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
459 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
460 elm_box_pack_end(bx2, bt);
461 evas_object_show(bt);
463 bt = elm_button_add(win);
464 elm_button_label_set(bt, "-");
465 evas_object_smart_callback_add(bt, "clicked", my_gl_del, gl);
466 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
467 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
468 elm_box_pack_end(bx2, bt);
469 evas_object_show(bt);
471 elm_box_pack_end(bx, bx2);
472 evas_object_show(bx2);
474 bx3 = elm_box_add(win);
475 elm_box_horizontal_set(bx3, EINA_TRUE);
476 elm_box_homogeneous_set(bx3, EINA_TRUE);
477 evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0);
478 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL);
480 bt = elm_button_add(win);
481 elm_button_label_set(bt, "+ before");
482 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_before, gl);
483 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
484 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
485 elm_box_pack_end(bx3, bt);
486 evas_object_show(bt);
488 bt = elm_button_add(win);
489 elm_button_label_set(bt, "+ after");
490 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_after, gl);
491 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
492 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
493 elm_box_pack_end(bx3, bt);
494 evas_object_show(bt);
496 bt = elm_button_add(win);
497 elm_button_label_set(bt, "Flush");
498 evas_object_smart_callback_add(bt, "clicked", my_gl_flush, gl);
499 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
500 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
501 elm_box_pack_end(bx3, bt);
502 evas_object_show(bt);
504 elm_box_pack_end(bx, bx3);
505 evas_object_show(bx3);
508 evas_object_resize(win, 320, 320);
509 evas_object_show(win);
514 static Elm_Genlist_Item_Class itc2;
515 char *gl2_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
517 const Testitem *tit = data;
519 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
522 Evas_Object *gl2_icon_get(void *data, Evas_Object *obj, const char *part)
524 const Testitem *tit = data;
526 Evas_Object *ic = elm_icon_add(obj);
527 if (!strcmp(part, "elm.swallow.icon"))
529 if (!(tit->mode & 0x3))
530 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
531 else if ((tit->mode & 0x3) == 1)
532 snprintf(buf, sizeof(buf), "%s/images/logo.png", PACKAGE_DATA_DIR);
533 else if ((tit->mode & 0x3) == 2)
534 snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", PACKAGE_DATA_DIR);
535 else if ((tit->mode & 0x3) == 3)
536 snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", PACKAGE_DATA_DIR);
537 elm_icon_file_set(ic, buf, NULL);
539 else if (!strcmp(part, "elm.swallow.end"))
541 if (!(tit->mode & 0x3))
542 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", PACKAGE_DATA_DIR);
543 else if ((tit->mode & 0x3) == 1)
544 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
545 else if ((tit->mode & 0x3) == 2)
546 snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", PACKAGE_DATA_DIR);
547 else if ((tit->mode & 0x3) == 3)
548 snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", PACKAGE_DATA_DIR);
549 elm_icon_file_set(ic, buf, NULL);
551 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
554 Eina_Bool gl2_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
558 void gl2_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
563 my_gl_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
565 Testitem *tit = data;
567 elm_genlist_item_update(tit->item);
571 test_genlist3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
573 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
574 static Testitem tit[3];
576 win = elm_win_add(NULL, "genlist3", ELM_WIN_BASIC);
577 elm_win_title_set(win, "Genlist 3");
578 elm_win_autodel_set(win, 1);
580 bg = elm_bg_add(win);
581 elm_win_resize_object_add(win, bg);
582 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
583 evas_object_show(bg);
585 bx = elm_box_add(win);
586 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
587 elm_win_resize_object_add(win, bx);
588 evas_object_show(bx);
590 gl = elm_genlist_add(win);
591 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
592 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
593 evas_object_show(gl);
595 itc2.item_style = "default";
596 itc2.func.label_get = gl2_label_get;
597 itc2.func.icon_get = gl2_icon_get;
598 itc2.func.state_get = gl2_state_get;
599 itc2.func.del = gl2_del;
602 tit[0].item = elm_genlist_item_append(gl, &itc2,
603 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
604 NULL/* func data */);
606 tit[1].item = elm_genlist_item_append(gl, &itc2,
607 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
608 NULL/* func data */);
610 tit[2].item = elm_genlist_item_append(gl, &itc2,
611 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
612 NULL/* func data */);
614 elm_box_pack_end(bx, gl);
615 evas_object_show(bx);
617 bx2 = elm_box_add(win);
618 elm_box_horizontal_set(bx2, EINA_TRUE);
619 elm_box_homogeneous_set(bx2, EINA_TRUE);
620 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
621 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
623 bt = elm_button_add(win);
624 elm_button_label_set(bt, "[1]");
625 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
626 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
627 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
628 elm_box_pack_end(bx2, bt);
629 evas_object_show(bt);
631 bt = elm_button_add(win);
632 elm_button_label_set(bt, "[2]");
633 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
634 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
635 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
636 elm_box_pack_end(bx2, bt);
637 evas_object_show(bt);
639 bt = elm_button_add(win);
640 elm_button_label_set(bt, "[3]");
641 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
642 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
643 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
644 elm_box_pack_end(bx2, bt);
645 evas_object_show(bt);
647 elm_box_pack_end(bx, bx2);
648 evas_object_show(bx2);
650 evas_object_resize(win, 320, 320);
651 evas_object_show(win);
657 my_gl_item_check_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__)
659 Testitem *tit = data;
660 tit->onoff = elm_check_state_get(obj);
661 printf("item %p onoff = %i\n", tit, tit->onoff);
664 static Elm_Genlist_Item_Class itc3;
665 char *gl3_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
667 const Testitem *tit = data;
669 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
672 Evas_Object *gl3_icon_get(void *data, Evas_Object *obj, const char *part)
674 const Testitem *tit = data;
675 if (!strcmp(part, "elm.swallow.icon"))
679 lb = elm_label_add(obj);
680 elm_label_line_wrap_set(lb, 1);
681 elm_label_wrap_width_set(lb, 201);
682 elm_label_label_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");
685 else if (!strcmp(part, "elm.swallow.end"))
688 ck = elm_check_add(obj);
689 evas_object_propagate_events_set(ck, 0);
690 elm_check_state_set(ck, tit->onoff);
691 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed, data);
696 Eina_Bool gl3_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
700 void gl3_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
705 test_genlist4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
707 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
708 static Testitem tit[3];
710 win = elm_win_add(NULL, "genlist4", ELM_WIN_BASIC);
711 elm_win_title_set(win, "Genlist 4");
712 elm_win_autodel_set(win, 1);
714 bg = elm_bg_add(win);
715 elm_win_resize_object_add(win, bg);
716 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
717 evas_object_show(bg);
719 bx = elm_box_add(win);
720 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
721 elm_win_resize_object_add(win, bx);
722 evas_object_show(bx);
724 gl = elm_genlist_add(win);
725 elm_genlist_multi_select_set(gl, 1);
726 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
727 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
728 evas_object_show(gl);
730 itc3.item_style = "default";
731 itc3.func.label_get = gl3_label_get;
732 itc3.func.icon_get = gl3_icon_get;
733 itc3.func.state_get = gl3_state_get;
734 itc3.func.del = gl3_del;
737 tit[0].item = elm_genlist_item_append(gl, &itc3,
738 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
739 NULL/* func data */);
741 tit[1].item = elm_genlist_item_append(gl, &itc3,
742 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
743 NULL/* func data */);
745 tit[2].item = elm_genlist_item_append(gl, &itc3,
746 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
747 NULL/* func data */);
749 elm_box_pack_end(bx, gl);
750 evas_object_show(bx);
752 bx2 = elm_box_add(win);
753 elm_box_horizontal_set(bx2, EINA_TRUE);
754 elm_box_homogeneous_set(bx2, EINA_TRUE);
755 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
756 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
758 bt = elm_button_add(win);
759 elm_button_label_set(bt, "[1]");
760 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
761 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
762 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
763 elm_box_pack_end(bx2, bt);
764 evas_object_show(bt);
766 bt = elm_button_add(win);
767 elm_button_label_set(bt, "[2]");
768 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
769 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
770 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
771 elm_box_pack_end(bx2, bt);
772 evas_object_show(bt);
774 bt = elm_button_add(win);
775 elm_button_label_set(bt, "[3]");
776 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
777 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
778 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
779 elm_box_pack_end(bx2, bt);
780 evas_object_show(bt);
782 elm_box_pack_end(bx, bx2);
783 evas_object_show(bx2);
785 evas_object_resize(win, 320, 320);
786 evas_object_show(win);
792 my_gl_item_check_changed2(void *data, Evas_Object *obj, void *event_info __UNUSED__)
794 Testitem *tit = data;
795 tit->onoff = elm_check_state_get(obj);
796 printf("item %p onoff = %i\n", tit, tit->onoff);
799 static Elm_Genlist_Item_Class itc5;
800 char *gl5_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
802 const Testitem *tit = data;
804 if (!strcmp(part, "elm.text"))
806 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
808 else if (!strcmp(part, "elm.text.sub"))
810 snprintf(buf, sizeof(buf), "%i bottles on the wall", tit->mode);
814 Evas_Object *gl5_icon_get(void *data, Evas_Object *obj, const char *part)
816 const Testitem *tit = data;
818 if (!strcmp(part, "elm.swallow.icon"))
820 Evas_Object *bx = elm_box_add(obj);
822 elm_box_horizontal_set(bx, EINA_TRUE);
823 ic = elm_icon_add(obj);
824 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
825 elm_icon_file_set(ic, buf, NULL);
826 elm_icon_scale_set(ic, 0, 0);
827 evas_object_show(ic);
828 elm_box_pack_end(bx, ic);
829 ic = elm_icon_add(obj);
830 elm_icon_file_set(ic, buf, NULL);
831 elm_icon_scale_set(ic, 0, 0);
832 evas_object_show(ic);
833 elm_box_pack_end(bx, ic);
834 elm_box_horizontal_set(bx, EINA_TRUE);
835 evas_object_show(bx);
838 else if (!strcmp(part, "elm.swallow.end"))
841 ck = elm_check_add(obj);
842 evas_object_propagate_events_set(ck, 0);
843 elm_check_state_set(ck, tit->onoff);
844 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed2, data);
845 evas_object_show(ck);
850 Eina_Bool gl5_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
854 void gl5_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
859 item_drag_up(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
865 item_drag_down(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
867 printf("drag down\n");
871 item_drag_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
873 printf("drag left\n");
877 item_drag_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
879 printf("drag right\n");
883 scroll_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
885 printf("Top edge!\n");
889 scroll_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
891 printf("Bottom edge!\n");
895 scroll_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
897 printf("Left edge!\n");
901 scroll_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
903 printf("Right edge!\n");
907 item_drag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
913 item_drag_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
915 printf("drag stop\n");
919 item_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
921 printf("longpress\n");
925 test_genlist5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
927 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
928 static Testitem tit[3];
930 win = elm_win_add(NULL, "genlist5", ELM_WIN_BASIC);
931 elm_win_title_set(win, "Genlist 5");
932 elm_win_autodel_set(win, 1);
934 bg = elm_bg_add(win);
935 elm_win_resize_object_add(win, bg);
936 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
937 evas_object_show(bg);
939 bx = elm_box_add(win);
940 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
941 elm_win_resize_object_add(win, bx);
942 evas_object_show(bx);
944 gl = elm_genlist_add(win);
945 elm_genlist_always_select_mode_set(gl, 1);
946 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
947 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
948 evas_object_show(gl);
949 itc5.item_style = "double_label";
950 itc5.func.label_get = gl5_label_get;
951 itc5.func.icon_get = gl5_icon_get;
952 itc5.func.state_get = gl5_state_get;
953 itc5.func.del = gl5_del;
956 tit[0].item = elm_genlist_item_append(gl, &itc5,
957 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
958 NULL/* func data */);
960 tit[1].item = elm_genlist_item_append(gl, &itc5,
961 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
962 NULL/* func data */);
964 tit[2].item = elm_genlist_item_append(gl, &itc5,
965 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
966 NULL/* func data */);
968 elm_box_pack_end(bx, gl);
969 evas_object_show(bx);
971 evas_object_smart_callback_add(gl, "drag,start,up", item_drag_up, NULL);
972 evas_object_smart_callback_add(gl, "drag,start,down", item_drag_down, NULL);
973 evas_object_smart_callback_add(gl, "drag,start,left", item_drag_left, NULL);
974 evas_object_smart_callback_add(gl, "drag,start,right", item_drag_right, NULL);
975 evas_object_smart_callback_add(gl, "scroll,edge,top", scroll_top, NULL);
976 evas_object_smart_callback_add(gl, "scroll,edge,bottom", scroll_bottom, NULL);
977 evas_object_smart_callback_add(gl, "scroll,edge,left", scroll_left, NULL);
978 evas_object_smart_callback_add(gl, "scroll,edge,right", scroll_right, NULL);
979 evas_object_smart_callback_add(gl, "drag", item_drag, NULL);
980 evas_object_smart_callback_add(gl, "drag,stop", item_drag_stop, NULL);
981 evas_object_smart_callback_add(gl, "longpressed", item_longpress, NULL);
983 bx2 = elm_box_add(win);
984 elm_box_horizontal_set(bx2, EINA_TRUE);
985 elm_box_homogeneous_set(bx2, EINA_TRUE);
986 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
987 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
989 bt = elm_button_add(win);
990 elm_button_label_set(bt, "[1]");
991 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
992 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
993 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
994 elm_box_pack_end(bx2, bt);
995 evas_object_show(bt);
997 bt = elm_button_add(win);
998 elm_button_label_set(bt, "[2]");
999 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1000 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1001 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1002 elm_box_pack_end(bx2, bt);
1003 evas_object_show(bt);
1005 bt = elm_button_add(win);
1006 elm_button_label_set(bt, "[3]");
1007 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1008 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1009 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1010 elm_box_pack_end(bx2, bt);
1011 evas_object_show(bt);
1013 elm_box_pack_end(bx, bx2);
1014 evas_object_show(bx2);
1016 evas_object_resize(win, 320, 320);
1017 evas_object_show(win);
1022 static Elm_Genlist_Item_Class itc4;
1025 gl4_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1027 Elm_Genlist_Item *it = (Elm_Genlist_Item *)event_info;
1030 depth = elm_genlist_item_expanded_depth_get(it);
1031 printf("expanded depth for selected item is %d\n", depth);
1035 gl4_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1037 Elm_Genlist_Item *it = event_info;
1038 Evas_Object *gl = elm_genlist_item_genlist_get(it);
1039 int val = (int)(long)elm_genlist_item_data_get(it);
1041 elm_genlist_item_append(gl, &itc4,
1042 (void *)(long)(val + 1)/* item data */, it/* parent */,
1043 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1044 NULL/* func data */);
1045 elm_genlist_item_append(gl, &itc4,
1046 (void *)(long)(val + 2)/* item data */, it/* parent */,
1047 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1048 NULL/* func data */);
1049 elm_genlist_item_append(gl, &itc4,
1050 (void *)(long)(val + 3)/* item data */, it/* parent */,
1051 ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1052 NULL/* func data */);
1055 gl4_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1057 Elm_Genlist_Item *it = event_info;
1058 elm_genlist_item_subitems_clear(it);
1062 gl4_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1064 Elm_Genlist_Item *it = event_info;
1065 elm_genlist_item_expanded_set(it, 1);
1068 gl4_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1070 Elm_Genlist_Item *it = event_info;
1071 elm_genlist_item_expanded_set(it, 0);
1074 char *gl4_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1077 snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data);
1080 Evas_Object *gl4_icon_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1083 if (!strcmp(part, "elm.swallow.icon"))
1085 Evas_Object *ic = elm_icon_add(obj);
1086 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1087 elm_icon_file_set(ic, buf, NULL);
1088 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1089 evas_object_show(ic);
1092 else if (!strcmp(part, "elm.swallow.end"))
1095 ck = elm_check_add(obj);
1096 evas_object_show(ck);
1101 Eina_Bool gl4_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1105 void gl4_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
1110 test_genlist6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1112 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
1114 win = elm_win_add(NULL, "genlist-tree", ELM_WIN_BASIC);
1115 elm_win_title_set(win, "Genlist Tree");
1116 elm_win_autodel_set(win, 1);
1118 bg = elm_bg_add(win);
1119 elm_win_resize_object_add(win, bg);
1120 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1121 evas_object_show(bg);
1123 bx = elm_box_add(win);
1124 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1125 elm_win_resize_object_add(win, bx);
1126 evas_object_show(bx);
1128 gl = elm_genlist_add(win);
1129 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1130 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1131 evas_object_show(gl);
1133 itc4.item_style = "default";
1134 itc4.func.label_get = gl4_label_get;
1135 itc4.func.icon_get = gl4_icon_get;
1136 itc4.func.state_get = gl4_state_get;
1137 itc4.func.del = gl4_del;
1139 elm_genlist_item_append(gl, &itc4,
1140 (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1141 NULL/* func data */);
1142 elm_genlist_item_append(gl, &itc4,
1143 (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1144 NULL/* func data */);
1145 elm_genlist_item_append(gl, &itc4,
1146 (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1147 NULL/* func data */);
1149 evas_object_smart_callback_add(gl, "expand,request", gl4_exp_req, gl);
1150 evas_object_smart_callback_add(gl, "contract,request", gl4_con_req, gl);
1151 evas_object_smart_callback_add(gl, "expanded", gl4_exp, gl);
1152 evas_object_smart_callback_add(gl, "contracted", gl4_con, gl);
1154 elm_box_pack_end(bx, gl);
1155 evas_object_show(bx);
1157 bx2 = elm_box_add(win);
1158 elm_box_horizontal_set(bx2, EINA_TRUE);
1159 elm_box_homogeneous_set(bx2, EINA_TRUE);
1160 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1161 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1163 bt = elm_button_add(win);
1164 elm_button_label_set(bt, "[1]");
1165 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
1166 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1167 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1168 elm_box_pack_end(bx2, bt);
1169 evas_object_show(bt);
1171 bt = elm_button_add(win);
1172 elm_button_label_set(bt, "[2]");
1173 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1174 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1175 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1176 elm_box_pack_end(bx2, bt);
1177 evas_object_show(bt);
1179 bt = elm_button_add(win);
1180 elm_button_label_set(bt, "[3]");
1181 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1182 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1183 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1184 elm_box_pack_end(bx2, bt);
1185 evas_object_show(bt);
1187 elm_box_pack_end(bx, bx2);
1188 evas_object_show(bx2);
1190 evas_object_resize(win, 320, 320);
1191 evas_object_show(win);
1196 struct genlist7_data
1198 Evas_Object *win, *pager;
1201 static Elm_Genlist_Item_Class itc7;
1203 gl_sel7(void *data, Evas_Object *obj, void *event_info)
1205 if (!event_info) return;
1206 elm_genlist_item_item_class_update(event_info, &itc7);
1207 printf("sel item data [%p] on genlist obj [%p], item pointer [%p], new item style [%s] \n", data, obj, event_info, itc7.item_style);
1211 test_genlist7_back_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1213 struct genlist7_data *info = data;
1216 elm_pager_content_pop(info->pager);
1220 test_genlist7_swipe(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1222 struct genlist7_data *info = data;
1223 Evas_Object *box, *entry, *button;
1224 char item_data[] = "Just a simple test";
1226 if ((!event_info) || (!data)) return;
1228 box = elm_box_add(info->win);
1229 elm_box_homogeneous_set(box, EINA_FALSE);
1230 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1231 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
1232 evas_object_show(box);
1234 entry = elm_scrolled_entry_add(info->win);
1235 elm_scrolled_entry_editable_set(entry, EINA_FALSE);
1236 elm_scrolled_entry_entry_set(entry, item_data);
1237 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1238 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
1239 evas_object_show(entry);
1241 button = elm_button_add(info->win);
1242 elm_button_label_set(button, "back");
1243 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
1244 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0);
1245 evas_object_smart_callback_add(button, "clicked", test_genlist7_back_cb,
1247 evas_object_show(button);
1249 elm_box_pack_start(box, entry);
1250 elm_box_pack_end(box, button);
1252 elm_pager_content_push(info->pager, box);
1256 test_genlist7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1258 Evas_Object *win, *bg, *gl, *pager;
1259 static struct genlist7_data info;
1260 static Testitem tit[3];
1262 win = elm_win_add(NULL, "genlist7", ELM_WIN_BASIC);
1263 elm_win_title_set(win, "Genlist 7");
1264 elm_win_autodel_set(win, 1);
1267 bg = elm_bg_add(win);
1268 elm_win_resize_object_add(win, bg);
1269 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1270 evas_object_show(bg);
1272 pager = elm_pager_add(win);
1273 elm_win_resize_object_add(win, pager);
1274 evas_object_size_hint_weight_set(pager, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1275 evas_object_size_hint_align_set(pager, EVAS_HINT_FILL, EVAS_HINT_FILL);
1276 evas_object_show(pager);
1279 gl = elm_genlist_add(win);
1280 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1281 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1282 evas_object_smart_callback_add(gl, "swipe", test_genlist7_swipe, &info);
1283 evas_object_show(gl);
1284 elm_pager_content_push(pager, gl);
1286 itc2.item_style = "default";
1287 itc2.func.label_get = gl2_label_get;
1288 itc2.func.icon_get = gl2_icon_get;
1289 itc2.func.state_get = gl2_state_get;
1290 itc2.func.del = gl2_del;
1292 itc7.item_style = "double_label";
1293 itc7.func.label_get = gl5_label_get;
1294 itc7.func.icon_get = gl5_icon_get;
1295 itc7.func.state_get = gl5_state_get;
1296 itc7.func.del = gl5_del;
1299 tit[0].item = elm_genlist_item_append(gl, &itc2,
1300 &(tit[0])/* item data */, NULL/* parent */,
1301 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1302 NULL/* func data */);
1304 tit[1].item = elm_genlist_item_append(gl, &itc2,
1305 &(tit[1])/* item data */, NULL/* parent */,
1306 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1307 NULL/* func data */);
1309 tit[2].item = elm_genlist_item_append(gl, &itc2,
1310 &(tit[2])/* item data */, NULL/* parent */,
1311 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1312 NULL/* func data */);
1314 evas_object_resize(win, 320, 320);
1315 evas_object_show(win);
1320 static Elm_Genlist_Item_Class itc_group;
1321 char *gl8_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1324 snprintf(buf, sizeof(buf), "Group Index # %i (Item # %i)", (int)((long)data / 10), (int)(long)data);
1329 _bt_show_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1331 elm_genlist_item_top_show(data);
1332 //elm_genlist_item_show(data);
1333 //elm_genlist_item_middle_show(data);
1336 _bt_bring_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1338 elm_genlist_item_top_bring_in(data);
1339 //elm_genlist_item_bring_in(data);
1340 //elm_genlist_item_middle_bring_in(data);
1344 test_genlist8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1346 Evas_Object *win, *bg, *gl, *bt[8], *bx, *bx2, *bx3;
1347 Elm_Genlist_Item *gli = NULL, *git = NULL;
1348 int i, bt_count, bt_num;
1350 win = elm_win_add(NULL, "genlist-group", ELM_WIN_BASIC);
1351 elm_win_title_set(win, "Genlist Group");
1352 elm_win_autodel_set(win, 1);
1354 bg = elm_bg_add(win);
1355 elm_win_resize_object_add(win, bg);
1356 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1357 evas_object_show(bg);
1359 bx = elm_box_add(win);
1360 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1361 elm_win_resize_object_add(win, bx);
1362 evas_object_show(bx);
1364 gl = elm_genlist_add(win);
1365 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1366 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1367 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1368 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1369 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1370 elm_box_pack_end(bx, gl);
1371 evas_object_show(gl);
1373 itc1.item_style = "default";
1374 itc1.func.label_get = gl_label_get;
1375 itc1.func.icon_get = gl_icon_get;
1376 itc1.func.state_get = gl_state_get;
1377 itc1.func.del = gl_del;
1379 itc_group.item_style = "group_index";
1380 itc_group.func.label_get = gl8_label_get;
1381 itc_group.func.icon_get = NULL;
1382 itc_group.func.state_get = NULL;
1383 itc_group.func.del = gl_del;
1385 bx2 = elm_box_add(win);
1386 elm_box_horizontal_set(bx2, EINA_TRUE);
1387 elm_box_homogeneous_set(bx2, EINA_TRUE);
1388 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1389 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1392 bt[bt_num] = elm_button_add(win);
1393 elm_button_label_set(bt[bt_num], "Show 0");
1394 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1395 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1396 evas_object_show(bt[bt_num]);
1397 elm_box_pack_end(bx2, bt[bt_num]);
1399 bt[++bt_num] = elm_button_add(win);
1400 elm_button_label_set(bt[bt_num], "Show 26");
1401 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1402 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1403 evas_object_show(bt[bt_num]);
1404 elm_box_pack_end(bx2, bt[bt_num]);
1406 bt[++bt_num] = elm_button_add(win);
1407 elm_button_label_set(bt[bt_num], "Show 101");
1408 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1409 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1410 evas_object_show(bt[bt_num]);
1411 elm_box_pack_end(bx2, bt[bt_num]);
1413 bt[++bt_num] = elm_button_add(win);
1414 elm_button_label_set(bt[bt_num], "Show 480");
1415 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1416 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1417 evas_object_show(bt[bt_num]);
1418 elm_box_pack_end(bx2, bt[bt_num]);
1420 elm_box_pack_end(bx, bx2);
1421 evas_object_show(bx2);
1423 bx3 = elm_box_add(win);
1424 elm_box_horizontal_set(bx3, EINA_TRUE);
1425 elm_box_homogeneous_set(bx3, EINA_TRUE);
1426 evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0);
1427 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL);
1429 bt[++bt_num] = elm_button_add(win);
1430 elm_button_label_set(bt[bt_num], "Bring top 0");
1431 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1432 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1433 evas_object_show(bt[bt_num]);
1434 elm_box_pack_end(bx3, bt[bt_num]);
1436 bt[++bt_num] = elm_button_add(win);
1437 elm_button_label_set(bt[bt_num], "Bring top 31");
1438 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1439 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1440 evas_object_show(bt[bt_num]);
1441 elm_box_pack_end(bx3, bt[bt_num]);
1443 bt[++bt_num] = elm_button_add(win);
1444 elm_button_label_set(bt[bt_num], "Bring top 239");
1445 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1446 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1447 evas_object_show(bt[bt_num]);
1448 elm_box_pack_end(bx3, bt[bt_num]);
1450 bt[++bt_num] = elm_button_add(win);
1451 elm_button_label_set(bt[bt_num], "Bring top 477");
1452 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1453 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1454 evas_object_show(bt[bt_num]);
1455 elm_box_pack_end(bx3, bt[bt_num]);
1457 elm_box_pack_end(bx, bx3);
1458 evas_object_show(bx3);
1461 for (i = 0; i < 500; i++)
1465 gli = git = elm_genlist_item_append(gl, &itc_group,
1466 (void *)(long)i/* item data */,
1468 ELM_GENLIST_ITEM_GROUP,
1470 (void *)(long)(i * 10)/* func data */);
1471 elm_genlist_item_display_only_set(git, EINA_TRUE);
1475 gli = elm_genlist_item_append(gl, &itc1,
1476 (void *)(long)i/* item data */,
1478 ELM_GENLIST_ITEM_NONE,
1480 (void *)(long)(i * 10)/* func data */);
1485 evas_object_smart_callback_add(bt[0], "clicked", _bt_show_cb, gli);
1486 evas_object_smart_callback_add(bt[4], "clicked", _bt_bring_cb, gli);
1489 evas_object_smart_callback_add(bt[1], "clicked", _bt_show_cb, gli);
1492 evas_object_smart_callback_add(bt[5], "clicked", _bt_bring_cb, gli);
1495 evas_object_smart_callback_add(bt[2], "clicked", _bt_show_cb, gli);
1498 evas_object_smart_callback_add(bt[6], "clicked", _bt_bring_cb, gli);
1501 evas_object_smart_callback_add(bt[7], "clicked", _bt_bring_cb, gli);
1504 evas_object_smart_callback_add(bt[3], "clicked", _bt_show_cb, gli);
1509 evas_object_resize(win, 480, 800);
1510 evas_object_show(win);
1516 gl9_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1518 Elm_Genlist_Item *it = event_info;
1519 Evas_Object *gl = elm_genlist_item_genlist_get(it);
1520 int val = (int)(long)elm_genlist_item_data_get(it);
1522 elm_genlist_item_append(gl, &itc1,
1523 (void *)(long)(val + 1)/* item data */, it/* parent */,
1524 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1525 NULL/* func data */);
1526 elm_genlist_item_append(gl, &itc1,
1527 (void *)(long)(val + 2)/* item data */, it/* parent */,
1528 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1529 NULL/* func data */);
1530 elm_genlist_item_append(gl, &itc1,
1531 (void *)(long)(val + 3)/* item data */, it/* parent */,
1532 ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1533 NULL/* func data */);
1536 gl9_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1538 Elm_Genlist_Item *it = event_info;
1539 elm_genlist_item_subitems_clear(it);
1543 gl9_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1545 Elm_Genlist_Item *it = event_info;
1546 elm_genlist_item_expanded_set(it, EINA_TRUE);
1549 gl9_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1551 Elm_Genlist_Item *it = event_info;
1552 elm_genlist_item_expanded_set(it, EINA_FALSE);
1556 test_genlist9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1558 Evas_Object *win, *bg, *gl, *bx;
1559 Elm_Genlist_Item *git;
1561 win = elm_win_add(NULL, "genlist-group-tree", ELM_WIN_BASIC);
1562 elm_win_title_set(win, "Genlist Group Tree");
1563 elm_win_autodel_set(win, 1);
1565 bg = elm_bg_add(win);
1566 elm_win_resize_object_add(win, bg);
1567 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1568 evas_object_show(bg);
1570 bx = elm_box_add(win);
1571 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1572 elm_win_resize_object_add(win, bx);
1573 evas_object_show(bx);
1575 gl = elm_genlist_add(win);
1576 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1577 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1578 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1579 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1580 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1581 elm_box_pack_end(bx, gl);
1582 evas_object_show(gl);
1584 itc1.item_style = "default";
1585 itc1.func.label_get = gl_label_get;
1586 itc1.func.icon_get = gl_icon_get;
1587 itc1.func.state_get = gl_state_get;
1588 itc1.func.del = gl_del;
1590 itc_group.item_style = "group_index";
1591 itc_group.func.label_get = gl8_label_get;
1592 itc_group.func.icon_get = NULL;
1593 itc_group.func.state_get = NULL;
1594 itc_group.func.del = gl_del;
1596 git = elm_genlist_item_append(gl, &itc_group,
1597 (void *)0/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1598 NULL/* func data */);
1599 elm_genlist_item_display_only_set(git, EINA_TRUE);
1600 elm_genlist_item_append(gl, &itc1,
1601 (void *)1/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1602 NULL/* func data */);
1603 elm_genlist_item_append(gl, &itc1,
1604 (void *)2/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1605 NULL/* func data */);
1606 elm_genlist_item_append(gl, &itc1,
1607 (void *)3/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1608 NULL/* func data */);
1609 git = elm_genlist_item_append(gl, &itc_group,
1610 (void *)4/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1611 NULL/* func data */);
1612 elm_genlist_item_display_only_set(git, EINA_TRUE);
1613 elm_genlist_item_append(gl, &itc1,
1614 (void *)5/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1615 NULL/* func data */);
1616 elm_genlist_item_append(gl, &itc1,
1617 (void *)6/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1618 NULL/* func data */);
1619 elm_genlist_item_append(gl, &itc1,
1620 (void *)7/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1621 NULL/* func data */);
1623 evas_object_smart_callback_add(gl, "expand,request", gl9_exp_req, gl);
1624 evas_object_smart_callback_add(gl, "contract,request", gl9_con_req, gl);
1625 evas_object_smart_callback_add(gl, "expanded", gl9_exp, gl);
1626 evas_object_smart_callback_add(gl, "contracted", gl9_con, gl);
1628 evas_object_resize(win, 480, 800);
1629 evas_object_show(win);
1634 static Elm_Genlist_Item_Class itc10;
1635 static char *mode_type[] = { "slide", "rotate" };
1636 char *gl10_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
1639 if (!strcmp(part, "elm.text.mode"))
1640 snprintf(buf, sizeof(buf), "Mode # %i", (int)(long)data);
1642 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
1646 Evas_Object *gl10_icon_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1649 Evas_Object *ic = elm_icon_add(obj);
1650 if (!strcmp(part, "elm.swallow.end"))
1651 snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR);
1653 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1654 elm_icon_file_set(ic, buf, NULL);
1655 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1659 _gl_sel10(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1662 int v = elm_radio_value_get(data);
1664 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
1668 _my_gl_mode_right(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1671 int v = elm_radio_value_get(data);
1673 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
1677 _my_gl_mode_left(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1680 int v = elm_radio_value_get(data);
1682 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_FALSE);
1686 _my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1688 fprintf(stderr, "drag\n");
1690 int v = elm_radio_value_get(data);
1691 Elm_Genlist_Item *it = (Elm_Genlist_Item *)elm_genlist_mode_item_get(obj);
1693 elm_genlist_item_mode_set(it, mode_type[v], EINA_FALSE);
1697 test_genlist10(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1699 Evas_Object *win, *bg, *fr, *lb, *bx, *bx2, *bx3, *rd, *rdg, *gl;
1702 win = elm_win_add(NULL, "genlist10", ELM_WIN_BASIC);
1703 elm_win_title_set(win, "Genlist Mode");
1704 elm_win_autodel_set(win, 1);
1706 bg = elm_bg_add(win);
1707 elm_win_resize_object_add(win, bg);
1708 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1709 evas_object_show(bg);
1711 bx = elm_box_add(win);
1712 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1713 elm_win_resize_object_add(win, bx);
1714 evas_object_show(bx);
1716 fr = elm_frame_add(win);
1717 elm_frame_label_set(fr, "Mode Type");
1718 elm_box_pack_end(bx, fr);
1719 evas_object_show(fr);
1721 bx2 = elm_box_add(win);
1722 elm_frame_content_set(fr, bx2);
1723 evas_object_show(bx2);
1725 lb = elm_label_add(win);
1726 elm_label_label_set(lb,
1727 "Sweep genlist items to the right.<br>"
1728 "Test this by changing Mode Type to Slide or Rotate.");
1729 elm_box_pack_end(bx2, lb);
1730 evas_object_show(lb);
1732 bx3 = elm_box_add(win);
1733 elm_box_horizontal_set(bx3, EINA_TRUE);
1734 elm_box_pack_end(bx2, bx3);
1735 evas_object_show(bx3);
1737 rd = elm_radio_add(win);
1738 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1739 elm_radio_state_value_set(rd, 0);
1740 elm_radio_label_set(rd, "Slide ");
1741 evas_object_show(rd);
1742 elm_box_pack_end(bx3, rd);
1745 rd = elm_radio_add(win);
1746 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1747 elm_radio_state_value_set(rd, 1);
1748 elm_radio_label_set(rd, "Rotate");
1749 elm_radio_group_add(rd, rdg);
1750 evas_object_show(rd);
1751 elm_box_pack_end(bx3, rd);
1753 gl = elm_genlist_add(win);
1754 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1755 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1756 evas_object_smart_callback_add(gl, "drag,start,right", _my_gl_mode_right, rdg);
1757 evas_object_smart_callback_add(gl, "drag,start,left", _my_gl_mode_left, rdg);
1758 evas_object_smart_callback_add(gl, "drag,start,up", _my_gl_mode_cancel, rdg);
1759 evas_object_smart_callback_add(gl, "drag,start,down", _my_gl_mode_cancel, rdg);
1760 evas_object_show(gl);
1762 itc10.item_style = "default";
1763 itc10.func.label_get = gl10_label_get;
1764 itc10.func.icon_get = gl10_icon_get;
1765 itc10.func.state_get = gl_state_get;
1766 itc10.func.del = gl_del;
1767 itc10.mode_item_style = "mode";
1769 for (i = 0; i < 50; i++)
1770 elm_genlist_item_append(gl,
1772 (void *)(1000 + i)/* item data */,
1774 ELM_GENLIST_ITEM_NONE/* flags */,
1775 _gl_sel10/* func */,
1776 rdg/* func data */);
1778 elm_box_pack_end(bx, gl);
1780 evas_object_resize(win, 520, 520);
1781 evas_object_show(win);
1787 _reorder_tg_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1789 elm_genlist_reorder_mode_set(data, elm_toggle_state_get(obj));
1793 * gl_moved is called after an item was reordered.
1794 * This is only called when reorder mode is enabled.
1796 * @param obj : the genlist object.
1797 * @param item : the moved item.
1798 * @param rel_item : the relative item.
1799 * @param move_after : whether or not the rel_item is after item.
1801 * If the move_after is true,
1802 * the item(*item) had been moved after the given relative item(*rel_item) in list.
1803 * If the move_after is false,
1804 * the item(*item) had been moved before the given relative item(*rel_item) in list.
1807 static void gl_moved(Evas_Object *obj __UNUSED__, Elm_Genlist_Item *item __UNUSED__, Elm_Genlist_Item *rel_item __UNUSED__, Eina_Bool move_after __UNUSED__)
1809 // if needed, add application logic.
1813 test_genlist11(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1815 Evas_Object *win, *bg, *fr, *lb, *bx, *tg, *gl;
1818 win = elm_win_add(NULL, "genlist-reorder-mode", ELM_WIN_BASIC);
1819 elm_win_title_set(win, "Genlist Reorder Mode");
1820 elm_win_autodel_set(win, 1);
1822 bg = elm_bg_add(win);
1823 elm_win_resize_object_add(win, bg);
1824 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1825 evas_object_show(bg);
1827 bx = elm_box_add(win);
1828 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1829 elm_win_resize_object_add(win, bx);
1830 evas_object_show(bx);
1832 fr = elm_frame_add(win);
1834 elm_frame_label_set(fr, "Reorder Mode");
1835 elm_box_pack_end(bx, fr);
1836 evas_object_show(fr);
1838 lb = elm_label_add(win);
1839 elm_label_label_set(lb,
1840 "Enable reorder mode if you want to move item.<br>"
1841 "Then long press and drag item.");
1842 elm_frame_content_set(fr, lb);
1843 evas_object_show(lb);
1845 gl = elm_genlist_add(win);
1846 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1847 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1848 evas_object_show(gl);
1850 tg = elm_toggle_add(win);
1851 elm_toggle_label_set(tg, "Reorder Mode:");
1852 elm_toggle_state_set(tg, elm_mirrored_get());
1853 evas_object_smart_callback_add(tg, "changed", _reorder_tg_changed_cb, gl);
1854 elm_box_pack_end(bx, tg);
1855 evas_object_show(tg);
1857 itc1.item_style = "default";
1858 itc1.func.label_get = gl_label_get;
1859 itc1.func.icon_get = gl_icon_get;
1860 itc1.func.state_get = gl_state_get;
1861 itc1.func.del = gl_del;
1862 itc1.func.moved = gl_moved;
1864 for (i = 0; i < 50; i++)
1865 elm_genlist_item_append(gl,
1867 (void *)(1 + i)/* item data */,
1869 ELM_GENLIST_ITEM_NONE/* flags */,
1871 NULL/* func data */);
1873 elm_box_pack_end(bx, gl);
1875 evas_object_resize(win, 400, 500);
1876 evas_object_show(win);