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");
683 evas_object_show(lb);
686 else if (!strcmp(part, "elm.swallow.end"))
689 ck = elm_check_add(obj);
690 evas_object_propagate_events_set(ck, 0);
691 elm_check_state_set(ck, tit->onoff);
692 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed, data);
693 evas_object_show(ck);
698 Eina_Bool gl3_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
702 void gl3_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
707 test_genlist4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
709 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
710 static Testitem tit[3];
712 win = elm_win_add(NULL, "genlist4", ELM_WIN_BASIC);
713 elm_win_title_set(win, "Genlist 4");
714 elm_win_autodel_set(win, 1);
716 bg = elm_bg_add(win);
717 elm_win_resize_object_add(win, bg);
718 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
719 evas_object_show(bg);
721 bx = elm_box_add(win);
722 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
723 elm_win_resize_object_add(win, bx);
724 evas_object_show(bx);
726 gl = elm_genlist_add(win);
727 elm_genlist_multi_select_set(gl, 1);
728 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
729 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
730 evas_object_show(gl);
732 itc3.item_style = "default";
733 itc3.func.label_get = gl3_label_get;
734 itc3.func.icon_get = gl3_icon_get;
735 itc3.func.state_get = gl3_state_get;
736 itc3.func.del = gl3_del;
739 tit[0].item = elm_genlist_item_append(gl, &itc3,
740 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
741 NULL/* func data */);
743 tit[1].item = elm_genlist_item_append(gl, &itc3,
744 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
745 NULL/* func data */);
747 tit[2].item = elm_genlist_item_append(gl, &itc3,
748 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
749 NULL/* func data */);
751 elm_box_pack_end(bx, gl);
752 evas_object_show(bx);
754 bx2 = elm_box_add(win);
755 elm_box_horizontal_set(bx2, EINA_TRUE);
756 elm_box_homogeneous_set(bx2, EINA_TRUE);
757 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
758 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
760 bt = elm_button_add(win);
761 elm_button_label_set(bt, "[1]");
762 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
763 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
764 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
765 elm_box_pack_end(bx2, bt);
766 evas_object_show(bt);
768 bt = elm_button_add(win);
769 elm_button_label_set(bt, "[2]");
770 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
771 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
772 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
773 elm_box_pack_end(bx2, bt);
774 evas_object_show(bt);
776 bt = elm_button_add(win);
777 elm_button_label_set(bt, "[3]");
778 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
779 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
780 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
781 elm_box_pack_end(bx2, bt);
782 evas_object_show(bt);
784 elm_box_pack_end(bx, bx2);
785 evas_object_show(bx2);
787 evas_object_resize(win, 320, 320);
788 evas_object_show(win);
794 my_gl_item_check_changed2(void *data, Evas_Object *obj, void *event_info __UNUSED__)
796 Testitem *tit = data;
797 tit->onoff = elm_check_state_get(obj);
798 printf("item %p onoff = %i\n", tit, tit->onoff);
801 static Elm_Genlist_Item_Class itc5;
802 char *gl5_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
804 const Testitem *tit = data;
806 if (!strcmp(part, "elm.text"))
808 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
810 else if (!strcmp(part, "elm.text.sub"))
812 snprintf(buf, sizeof(buf), "%i bottles on the wall", tit->mode);
816 Evas_Object *gl5_icon_get(void *data, Evas_Object *obj, const char *part)
818 const Testitem *tit = data;
820 if (!strcmp(part, "elm.swallow.icon"))
822 Evas_Object *bx = elm_box_add(obj);
824 elm_box_horizontal_set(bx, EINA_TRUE);
825 ic = elm_icon_add(obj);
826 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
827 elm_icon_file_set(ic, buf, NULL);
828 elm_icon_scale_set(ic, 0, 0);
829 evas_object_show(ic);
830 elm_box_pack_end(bx, ic);
831 ic = elm_icon_add(obj);
832 elm_icon_file_set(ic, buf, NULL);
833 elm_icon_scale_set(ic, 0, 0);
834 evas_object_show(ic);
835 elm_box_pack_end(bx, ic);
836 elm_box_horizontal_set(bx, EINA_TRUE);
837 evas_object_show(bx);
840 else if (!strcmp(part, "elm.swallow.end"))
843 ck = elm_check_add(obj);
844 evas_object_propagate_events_set(ck, 0);
845 elm_check_state_set(ck, tit->onoff);
846 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed2, data);
847 evas_object_show(ck);
852 Eina_Bool gl5_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
856 void gl5_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
861 item_drag_up(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
867 item_drag_down(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
869 printf("drag down\n");
873 item_drag_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
875 printf("drag left\n");
879 item_drag_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
881 printf("drag right\n");
885 scroll_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
887 printf("Top edge!\n");
891 scroll_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
893 printf("Bottom edge!\n");
897 scroll_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
899 printf("Left edge!\n");
903 scroll_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
905 printf("Right edge!\n");
909 item_drag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
915 item_drag_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
917 printf("drag stop\n");
921 item_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
923 printf("longpress\n");
927 test_genlist5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
929 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
930 static Testitem tit[3];
932 win = elm_win_add(NULL, "genlist5", ELM_WIN_BASIC);
933 elm_win_title_set(win, "Genlist 5");
934 elm_win_autodel_set(win, 1);
936 bg = elm_bg_add(win);
937 elm_win_resize_object_add(win, bg);
938 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
939 evas_object_show(bg);
941 bx = elm_box_add(win);
942 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
943 elm_win_resize_object_add(win, bx);
944 evas_object_show(bx);
946 gl = elm_genlist_add(win);
947 elm_genlist_always_select_mode_set(gl, 1);
948 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
949 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
950 evas_object_show(gl);
951 itc5.item_style = "double_label";
952 itc5.func.label_get = gl5_label_get;
953 itc5.func.icon_get = gl5_icon_get;
954 itc5.func.state_get = gl5_state_get;
955 itc5.func.del = gl5_del;
958 tit[0].item = elm_genlist_item_append(gl, &itc5,
959 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
960 NULL/* func data */);
962 tit[1].item = elm_genlist_item_append(gl, &itc5,
963 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
964 NULL/* func data */);
966 tit[2].item = elm_genlist_item_append(gl, &itc5,
967 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
968 NULL/* func data */);
970 elm_box_pack_end(bx, gl);
971 evas_object_show(bx);
973 evas_object_smart_callback_add(gl, "drag,start,up", item_drag_up, NULL);
974 evas_object_smart_callback_add(gl, "drag,start,down", item_drag_down, NULL);
975 evas_object_smart_callback_add(gl, "drag,start,left", item_drag_left, NULL);
976 evas_object_smart_callback_add(gl, "drag,start,right", item_drag_right, NULL);
977 evas_object_smart_callback_add(gl, "scroll,edge,top", scroll_top, NULL);
978 evas_object_smart_callback_add(gl, "scroll,edge,bottom", scroll_bottom, NULL);
979 evas_object_smart_callback_add(gl, "scroll,edge,left", scroll_left, NULL);
980 evas_object_smart_callback_add(gl, "scroll,edge,right", scroll_right, NULL);
981 evas_object_smart_callback_add(gl, "drag", item_drag, NULL);
982 evas_object_smart_callback_add(gl, "drag,stop", item_drag_stop, NULL);
983 evas_object_smart_callback_add(gl, "longpressed", item_longpress, NULL);
985 bx2 = elm_box_add(win);
986 elm_box_horizontal_set(bx2, EINA_TRUE);
987 elm_box_homogeneous_set(bx2, EINA_TRUE);
988 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
989 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
991 bt = elm_button_add(win);
992 elm_button_label_set(bt, "[1]");
993 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
994 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
995 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
996 elm_box_pack_end(bx2, bt);
997 evas_object_show(bt);
999 bt = elm_button_add(win);
1000 elm_button_label_set(bt, "[2]");
1001 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1002 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1003 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1004 elm_box_pack_end(bx2, bt);
1005 evas_object_show(bt);
1007 bt = elm_button_add(win);
1008 elm_button_label_set(bt, "[3]");
1009 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1010 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1011 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1012 elm_box_pack_end(bx2, bt);
1013 evas_object_show(bt);
1015 elm_box_pack_end(bx, bx2);
1016 evas_object_show(bx2);
1018 evas_object_resize(win, 320, 320);
1019 evas_object_show(win);
1024 static Elm_Genlist_Item_Class itc4;
1027 gl4_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1029 Elm_Genlist_Item *it = (Elm_Genlist_Item *)event_info;
1032 depth = elm_genlist_item_expanded_depth_get(it);
1033 printf("expanded depth for selected item is %d\n", depth);
1037 gl4_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1039 Elm_Genlist_Item *it = event_info;
1040 Evas_Object *gl = elm_genlist_item_genlist_get(it);
1041 int val = (int)(long)elm_genlist_item_data_get(it);
1043 elm_genlist_item_append(gl, &itc4,
1044 (void *)(long)(val + 1)/* item data */, it/* parent */,
1045 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1046 NULL/* func data */);
1047 elm_genlist_item_append(gl, &itc4,
1048 (void *)(long)(val + 2)/* item data */, it/* parent */,
1049 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1050 NULL/* func data */);
1051 elm_genlist_item_append(gl, &itc4,
1052 (void *)(long)(val + 3)/* item data */, it/* parent */,
1053 ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1054 NULL/* func data */);
1057 gl4_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1059 Elm_Genlist_Item *it = event_info;
1060 elm_genlist_item_subitems_clear(it);
1064 gl4_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1066 Elm_Genlist_Item *it = event_info;
1067 elm_genlist_item_expanded_set(it, 1);
1070 gl4_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1072 Elm_Genlist_Item *it = event_info;
1073 elm_genlist_item_expanded_set(it, 0);
1076 char *gl4_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1079 snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data);
1082 Evas_Object *gl4_icon_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1085 if (!strcmp(part, "elm.swallow.icon"))
1087 Evas_Object *ic = elm_icon_add(obj);
1088 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1089 elm_icon_file_set(ic, buf, NULL);
1090 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1091 evas_object_show(ic);
1094 else if (!strcmp(part, "elm.swallow.end"))
1097 ck = elm_check_add(obj);
1098 evas_object_show(ck);
1103 Eina_Bool gl4_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1107 void gl4_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
1112 test_genlist6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1114 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
1116 win = elm_win_add(NULL, "genlist-tree", ELM_WIN_BASIC);
1117 elm_win_title_set(win, "Genlist Tree");
1118 elm_win_autodel_set(win, 1);
1120 bg = elm_bg_add(win);
1121 elm_win_resize_object_add(win, bg);
1122 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1123 evas_object_show(bg);
1125 bx = elm_box_add(win);
1126 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1127 elm_win_resize_object_add(win, bx);
1128 evas_object_show(bx);
1130 gl = elm_genlist_add(win);
1131 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1132 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1133 evas_object_show(gl);
1135 itc4.item_style = "default";
1136 itc4.func.label_get = gl4_label_get;
1137 itc4.func.icon_get = gl4_icon_get;
1138 itc4.func.state_get = gl4_state_get;
1139 itc4.func.del = gl4_del;
1141 elm_genlist_item_append(gl, &itc4,
1142 (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1143 NULL/* func data */);
1144 elm_genlist_item_append(gl, &itc4,
1145 (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1146 NULL/* func data */);
1147 elm_genlist_item_append(gl, &itc4,
1148 (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1149 NULL/* func data */);
1151 evas_object_smart_callback_add(gl, "expand,request", gl4_exp_req, gl);
1152 evas_object_smart_callback_add(gl, "contract,request", gl4_con_req, gl);
1153 evas_object_smart_callback_add(gl, "expanded", gl4_exp, gl);
1154 evas_object_smart_callback_add(gl, "contracted", gl4_con, gl);
1156 elm_box_pack_end(bx, gl);
1157 evas_object_show(bx);
1159 bx2 = elm_box_add(win);
1160 elm_box_horizontal_set(bx2, EINA_TRUE);
1161 elm_box_homogeneous_set(bx2, EINA_TRUE);
1162 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1163 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1165 bt = elm_button_add(win);
1166 elm_button_label_set(bt, "[1]");
1167 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
1168 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1169 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1170 elm_box_pack_end(bx2, bt);
1171 evas_object_show(bt);
1173 bt = elm_button_add(win);
1174 elm_button_label_set(bt, "[2]");
1175 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1176 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1177 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1178 elm_box_pack_end(bx2, bt);
1179 evas_object_show(bt);
1181 bt = elm_button_add(win);
1182 elm_button_label_set(bt, "[3]");
1183 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1184 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1185 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1186 elm_box_pack_end(bx2, bt);
1187 evas_object_show(bt);
1189 elm_box_pack_end(bx, bx2);
1190 evas_object_show(bx2);
1192 evas_object_resize(win, 320, 320);
1193 evas_object_show(win);
1198 struct genlist7_data
1200 Evas_Object *win, *pager;
1203 static Elm_Genlist_Item_Class itc7;
1205 gl_sel7(void *data, Evas_Object *obj, void *event_info)
1207 if (!event_info) return;
1208 elm_genlist_item_item_class_update(event_info, &itc7);
1209 printf("sel item data [%p] on genlist obj [%p], item pointer [%p], new item style [%s] \n", data, obj, event_info, itc7.item_style);
1213 test_genlist7_back_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1215 struct genlist7_data *info = data;
1218 elm_pager_content_pop(info->pager);
1222 test_genlist7_swipe(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1224 struct genlist7_data *info = data;
1225 Evas_Object *box, *entry, *button;
1226 char item_data[] = "Just a simple test";
1228 if ((!event_info) || (!data)) return;
1230 box = elm_box_add(info->win);
1231 elm_box_homogeneous_set(box, EINA_FALSE);
1232 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1233 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
1234 evas_object_show(box);
1236 entry = elm_scrolled_entry_add(info->win);
1237 elm_scrolled_entry_editable_set(entry, EINA_FALSE);
1238 elm_scrolled_entry_entry_set(entry, item_data);
1239 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1240 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
1241 evas_object_show(entry);
1243 button = elm_button_add(info->win);
1244 elm_button_label_set(button, "back");
1245 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
1246 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0);
1247 evas_object_smart_callback_add(button, "clicked", test_genlist7_back_cb,
1249 evas_object_show(button);
1251 elm_box_pack_start(box, entry);
1252 elm_box_pack_end(box, button);
1254 elm_pager_content_push(info->pager, box);
1258 test_genlist7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1260 Evas_Object *win, *bg, *gl, *pager;
1261 static struct genlist7_data info;
1262 static Testitem tit[3];
1264 win = elm_win_add(NULL, "genlist7", ELM_WIN_BASIC);
1265 elm_win_title_set(win, "Genlist 7");
1266 elm_win_autodel_set(win, 1);
1269 bg = elm_bg_add(win);
1270 elm_win_resize_object_add(win, bg);
1271 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1272 evas_object_show(bg);
1274 pager = elm_pager_add(win);
1275 elm_win_resize_object_add(win, pager);
1276 evas_object_size_hint_weight_set(pager, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1277 evas_object_size_hint_align_set(pager, EVAS_HINT_FILL, EVAS_HINT_FILL);
1278 evas_object_show(pager);
1281 gl = elm_genlist_add(win);
1282 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1283 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1284 evas_object_smart_callback_add(gl, "swipe", test_genlist7_swipe, &info);
1285 evas_object_show(gl);
1286 elm_pager_content_push(pager, gl);
1288 itc2.item_style = "default";
1289 itc2.func.label_get = gl2_label_get;
1290 itc2.func.icon_get = gl2_icon_get;
1291 itc2.func.state_get = gl2_state_get;
1292 itc2.func.del = gl2_del;
1294 itc7.item_style = "double_label";
1295 itc7.func.label_get = gl5_label_get;
1296 itc7.func.icon_get = gl5_icon_get;
1297 itc7.func.state_get = gl5_state_get;
1298 itc7.func.del = gl5_del;
1301 tit[0].item = elm_genlist_item_append(gl, &itc2,
1302 &(tit[0])/* item data */, NULL/* parent */,
1303 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1304 NULL/* func data */);
1306 tit[1].item = elm_genlist_item_append(gl, &itc2,
1307 &(tit[1])/* item data */, NULL/* parent */,
1308 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1309 NULL/* func data */);
1311 tit[2].item = elm_genlist_item_append(gl, &itc2,
1312 &(tit[2])/* item data */, NULL/* parent */,
1313 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1314 NULL/* func data */);
1316 evas_object_resize(win, 320, 320);
1317 evas_object_show(win);
1322 static Elm_Genlist_Item_Class itc_group;
1323 char *gl8_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1326 snprintf(buf, sizeof(buf), "Group Index # %i (Item # %i)", (int)((long)data / 10), (int)(long)data);
1331 _bt_show_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1333 elm_genlist_item_top_show(data);
1334 //elm_genlist_item_show(data);
1335 //elm_genlist_item_middle_show(data);
1338 _bt_bring_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1340 elm_genlist_item_top_bring_in(data);
1341 //elm_genlist_item_bring_in(data);
1342 //elm_genlist_item_middle_bring_in(data);
1346 test_genlist8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1348 Evas_Object *win, *bg, *gl, *bt[8], *bx, *bx2, *bx3;
1349 Elm_Genlist_Item *gli = NULL, *git = NULL;
1350 int i, bt_count, bt_num;
1352 win = elm_win_add(NULL, "genlist-group", ELM_WIN_BASIC);
1353 elm_win_title_set(win, "Genlist Group");
1354 elm_win_autodel_set(win, 1);
1356 bg = elm_bg_add(win);
1357 elm_win_resize_object_add(win, bg);
1358 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1359 evas_object_show(bg);
1361 bx = elm_box_add(win);
1362 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1363 elm_win_resize_object_add(win, bx);
1364 evas_object_show(bx);
1366 gl = elm_genlist_add(win);
1367 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1368 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1369 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1370 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1371 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1372 elm_box_pack_end(bx, gl);
1373 evas_object_show(gl);
1375 itc1.item_style = "default";
1376 itc1.func.label_get = gl_label_get;
1377 itc1.func.icon_get = gl_icon_get;
1378 itc1.func.state_get = gl_state_get;
1379 itc1.func.del = gl_del;
1381 itc_group.item_style = "group_index";
1382 itc_group.func.label_get = gl8_label_get;
1383 itc_group.func.icon_get = NULL;
1384 itc_group.func.state_get = NULL;
1385 itc_group.func.del = gl_del;
1387 bx2 = elm_box_add(win);
1388 elm_box_horizontal_set(bx2, EINA_TRUE);
1389 elm_box_homogeneous_set(bx2, EINA_TRUE);
1390 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1391 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1394 bt[bt_num] = elm_button_add(win);
1395 elm_button_label_set(bt[bt_num], "Show 0");
1396 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1397 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1398 evas_object_show(bt[bt_num]);
1399 elm_box_pack_end(bx2, bt[bt_num]);
1401 bt[++bt_num] = elm_button_add(win);
1402 elm_button_label_set(bt[bt_num], "Show 26");
1403 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1404 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1405 evas_object_show(bt[bt_num]);
1406 elm_box_pack_end(bx2, bt[bt_num]);
1408 bt[++bt_num] = elm_button_add(win);
1409 elm_button_label_set(bt[bt_num], "Show 101");
1410 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1411 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1412 evas_object_show(bt[bt_num]);
1413 elm_box_pack_end(bx2, bt[bt_num]);
1415 bt[++bt_num] = elm_button_add(win);
1416 elm_button_label_set(bt[bt_num], "Show 480");
1417 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1418 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1419 evas_object_show(bt[bt_num]);
1420 elm_box_pack_end(bx2, bt[bt_num]);
1422 elm_box_pack_end(bx, bx2);
1423 evas_object_show(bx2);
1425 bx3 = elm_box_add(win);
1426 elm_box_horizontal_set(bx3, EINA_TRUE);
1427 elm_box_homogeneous_set(bx3, EINA_TRUE);
1428 evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0);
1429 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL);
1431 bt[++bt_num] = elm_button_add(win);
1432 elm_button_label_set(bt[bt_num], "Bring top 0");
1433 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1434 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1435 evas_object_show(bt[bt_num]);
1436 elm_box_pack_end(bx3, bt[bt_num]);
1438 bt[++bt_num] = elm_button_add(win);
1439 elm_button_label_set(bt[bt_num], "Bring top 31");
1440 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1441 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1442 evas_object_show(bt[bt_num]);
1443 elm_box_pack_end(bx3, bt[bt_num]);
1445 bt[++bt_num] = elm_button_add(win);
1446 elm_button_label_set(bt[bt_num], "Bring top 239");
1447 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1448 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1449 evas_object_show(bt[bt_num]);
1450 elm_box_pack_end(bx3, bt[bt_num]);
1452 bt[++bt_num] = elm_button_add(win);
1453 elm_button_label_set(bt[bt_num], "Bring top 477");
1454 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1455 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1456 evas_object_show(bt[bt_num]);
1457 elm_box_pack_end(bx3, bt[bt_num]);
1459 elm_box_pack_end(bx, bx3);
1460 evas_object_show(bx3);
1463 for (i = 0; i < 500; i++)
1467 gli = git = elm_genlist_item_append(gl, &itc_group,
1468 (void *)(long)i/* item data */,
1470 ELM_GENLIST_ITEM_GROUP,
1472 (void *)(long)(i * 10)/* func data */);
1473 elm_genlist_item_display_only_set(git, EINA_TRUE);
1477 gli = elm_genlist_item_append(gl, &itc1,
1478 (void *)(long)i/* item data */,
1480 ELM_GENLIST_ITEM_NONE,
1482 (void *)(long)(i * 10)/* func data */);
1487 evas_object_smart_callback_add(bt[0], "clicked", _bt_show_cb, gli);
1488 evas_object_smart_callback_add(bt[4], "clicked", _bt_bring_cb, gli);
1491 evas_object_smart_callback_add(bt[1], "clicked", _bt_show_cb, gli);
1494 evas_object_smart_callback_add(bt[5], "clicked", _bt_bring_cb, gli);
1497 evas_object_smart_callback_add(bt[2], "clicked", _bt_show_cb, gli);
1500 evas_object_smart_callback_add(bt[6], "clicked", _bt_bring_cb, gli);
1503 evas_object_smart_callback_add(bt[7], "clicked", _bt_bring_cb, gli);
1506 evas_object_smart_callback_add(bt[3], "clicked", _bt_show_cb, gli);
1511 evas_object_resize(win, 480, 800);
1512 evas_object_show(win);
1518 gl9_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1520 Elm_Genlist_Item *it = event_info;
1521 Evas_Object *gl = elm_genlist_item_genlist_get(it);
1522 int val = (int)(long)elm_genlist_item_data_get(it);
1524 elm_genlist_item_append(gl, &itc1,
1525 (void *)(long)(val + 1)/* item data */, it/* parent */,
1526 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1527 NULL/* func data */);
1528 elm_genlist_item_append(gl, &itc1,
1529 (void *)(long)(val + 2)/* item data */, it/* parent */,
1530 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1531 NULL/* func data */);
1532 elm_genlist_item_append(gl, &itc1,
1533 (void *)(long)(val + 3)/* item data */, it/* parent */,
1534 ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1535 NULL/* func data */);
1538 gl9_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1540 Elm_Genlist_Item *it = event_info;
1541 elm_genlist_item_subitems_clear(it);
1545 gl9_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1547 Elm_Genlist_Item *it = event_info;
1548 elm_genlist_item_expanded_set(it, EINA_TRUE);
1551 gl9_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1553 Elm_Genlist_Item *it = event_info;
1554 elm_genlist_item_expanded_set(it, EINA_FALSE);
1558 test_genlist9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1560 Evas_Object *win, *bg, *gl, *bx;
1561 Elm_Genlist_Item *git;
1563 win = elm_win_add(NULL, "genlist-group-tree", ELM_WIN_BASIC);
1564 elm_win_title_set(win, "Genlist Group Tree");
1565 elm_win_autodel_set(win, 1);
1567 bg = elm_bg_add(win);
1568 elm_win_resize_object_add(win, bg);
1569 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1570 evas_object_show(bg);
1572 bx = elm_box_add(win);
1573 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1574 elm_win_resize_object_add(win, bx);
1575 evas_object_show(bx);
1577 gl = elm_genlist_add(win);
1578 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1579 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1580 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1581 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1582 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1583 elm_box_pack_end(bx, gl);
1584 evas_object_show(gl);
1586 itc1.item_style = "default";
1587 itc1.func.label_get = gl_label_get;
1588 itc1.func.icon_get = gl_icon_get;
1589 itc1.func.state_get = gl_state_get;
1590 itc1.func.del = gl_del;
1592 itc_group.item_style = "group_index";
1593 itc_group.func.label_get = gl8_label_get;
1594 itc_group.func.icon_get = NULL;
1595 itc_group.func.state_get = NULL;
1596 itc_group.func.del = gl_del;
1598 git = elm_genlist_item_append(gl, &itc_group,
1599 (void *)0/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1600 NULL/* func data */);
1601 elm_genlist_item_display_only_set(git, EINA_TRUE);
1602 elm_genlist_item_append(gl, &itc1,
1603 (void *)1/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1604 NULL/* func data */);
1605 elm_genlist_item_append(gl, &itc1,
1606 (void *)2/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1607 NULL/* func data */);
1608 elm_genlist_item_append(gl, &itc1,
1609 (void *)3/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1610 NULL/* func data */);
1611 git = elm_genlist_item_append(gl, &itc_group,
1612 (void *)4/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1613 NULL/* func data */);
1614 elm_genlist_item_display_only_set(git, EINA_TRUE);
1615 elm_genlist_item_append(gl, &itc1,
1616 (void *)5/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1617 NULL/* func data */);
1618 elm_genlist_item_append(gl, &itc1,
1619 (void *)6/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1620 NULL/* func data */);
1621 elm_genlist_item_append(gl, &itc1,
1622 (void *)7/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1623 NULL/* func data */);
1625 evas_object_smart_callback_add(gl, "expand,request", gl9_exp_req, gl);
1626 evas_object_smart_callback_add(gl, "contract,request", gl9_con_req, gl);
1627 evas_object_smart_callback_add(gl, "expanded", gl9_exp, gl);
1628 evas_object_smart_callback_add(gl, "contracted", gl9_con, gl);
1630 evas_object_resize(win, 480, 800);
1631 evas_object_show(win);
1636 static Elm_Genlist_Item_Class itc10;
1637 static char *mode_type[] = { "slide", "rotate" };
1638 char *gl10_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
1641 if (!strcmp(part, "elm.text.mode"))
1642 snprintf(buf, sizeof(buf), "Mode # %i", (int)(long)data);
1644 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
1648 Evas_Object *gl10_icon_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1651 Evas_Object *ic = elm_icon_add(obj);
1652 if (!strcmp(part, "elm.swallow.end"))
1653 snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR);
1655 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1656 elm_icon_file_set(ic, buf, NULL);
1657 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1661 _gl_sel10(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1664 int v = elm_radio_value_get(data);
1666 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
1670 _my_gl_mode_right(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1673 int v = elm_radio_value_get(data);
1675 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
1679 _my_gl_mode_left(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1682 int v = elm_radio_value_get(data);
1684 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_FALSE);
1688 _my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1690 fprintf(stderr, "drag\n");
1692 int v = elm_radio_value_get(data);
1693 Elm_Genlist_Item *it = (Elm_Genlist_Item *)elm_genlist_mode_item_get(obj);
1695 elm_genlist_item_mode_set(it, mode_type[v], EINA_FALSE);
1699 test_genlist10(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1701 Evas_Object *win, *bg, *fr, *lb, *bx, *bx2, *bx3, *rd, *rdg, *gl;
1704 win = elm_win_add(NULL, "genlist10", ELM_WIN_BASIC);
1705 elm_win_title_set(win, "Genlist Mode");
1706 elm_win_autodel_set(win, 1);
1708 bg = elm_bg_add(win);
1709 elm_win_resize_object_add(win, bg);
1710 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1711 evas_object_show(bg);
1713 bx = elm_box_add(win);
1714 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1715 elm_win_resize_object_add(win, bx);
1716 evas_object_show(bx);
1718 fr = elm_frame_add(win);
1719 elm_frame_label_set(fr, "Mode Type");
1720 elm_box_pack_end(bx, fr);
1721 evas_object_show(fr);
1723 bx2 = elm_box_add(win);
1724 elm_frame_content_set(fr, bx2);
1725 evas_object_show(bx2);
1727 lb = elm_label_add(win);
1728 elm_label_label_set(lb,
1729 "Sweep genlist items to the right.<br>"
1730 "Test this by changing Mode Type to Slide or Rotate.");
1731 elm_box_pack_end(bx2, lb);
1732 evas_object_show(lb);
1734 bx3 = elm_box_add(win);
1735 elm_box_horizontal_set(bx3, EINA_TRUE);
1736 elm_box_pack_end(bx2, bx3);
1737 evas_object_show(bx3);
1739 rd = elm_radio_add(win);
1740 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1741 elm_radio_state_value_set(rd, 0);
1742 elm_radio_label_set(rd, "Slide ");
1743 evas_object_show(rd);
1744 elm_box_pack_end(bx3, rd);
1747 rd = elm_radio_add(win);
1748 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1749 elm_radio_state_value_set(rd, 1);
1750 elm_radio_label_set(rd, "Rotate");
1751 elm_radio_group_add(rd, rdg);
1752 evas_object_show(rd);
1753 elm_box_pack_end(bx3, rd);
1755 gl = elm_genlist_add(win);
1756 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1757 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1758 evas_object_smart_callback_add(gl, "drag,start,right", _my_gl_mode_right, rdg);
1759 evas_object_smart_callback_add(gl, "drag,start,left", _my_gl_mode_left, rdg);
1760 evas_object_smart_callback_add(gl, "drag,start,up", _my_gl_mode_cancel, rdg);
1761 evas_object_smart_callback_add(gl, "drag,start,down", _my_gl_mode_cancel, rdg);
1762 evas_object_show(gl);
1764 itc10.item_style = "default";
1765 itc10.func.label_get = gl10_label_get;
1766 itc10.func.icon_get = gl10_icon_get;
1767 itc10.func.state_get = gl_state_get;
1768 itc10.func.del = gl_del;
1769 itc10.mode_item_style = "mode";
1771 for (i = 0; i < 50; i++)
1772 elm_genlist_item_append(gl,
1774 (void *)(1000 + i)/* item data */,
1776 ELM_GENLIST_ITEM_NONE/* flags */,
1777 _gl_sel10/* func */,
1778 rdg/* func data */);
1780 elm_box_pack_end(bx, gl);
1782 evas_object_resize(win, 520, 520);
1783 evas_object_show(win);
1788 static Elm_Genlist_Item_Class itc11;
1790 char *gl11_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1793 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
1797 Evas_Object *gl11_icon_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1800 Evas_Object *ic = elm_icon_add(obj);
1801 if (!strcmp(part, "elm.swallow.end"))
1802 snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR);
1804 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
1805 elm_icon_file_set(ic, buf, NULL);
1806 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1811 _reorder_tg_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1813 elm_genlist_reorder_mode_set(data, elm_toggle_state_get(obj));
1817 * gl_moved is called after an item was reordered.
1818 * This is only called when reorder mode is enabled.
1820 * @param obj : the genlist object.
1821 * @param item : the moved item.
1822 * @param rel_item : the relative item.
1823 * @param move_after : whether or not the rel_item is after item.
1825 * If the move_after is true,
1826 * the item(*item) had been moved after the given relative item(*rel_item) in list.
1827 * If the move_after is false,
1828 * the item(*item) had been moved before the given relative item(*rel_item) in list.
1831 static void _gl_moved(Evas_Object *obj, Elm_Genlist_Item *item, Elm_Genlist_Item *rel_item, Eina_Bool move_after)
1833 // if needed, add application logic.
1837 test_genlist11(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1839 Evas_Object *win, *bg, *fr, *lb, *bx, *tg, *gl;
1842 win = elm_win_add(NULL, "genlist11", ELM_WIN_BASIC);
1843 elm_win_title_set(win, "Genlist Reorder Mode");
1844 elm_win_autodel_set(win, 1);
1846 bg = elm_bg_add(win);
1847 elm_win_resize_object_add(win, bg);
1848 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1849 evas_object_show(bg);
1851 bx = elm_box_add(win);
1852 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1853 elm_win_resize_object_add(win, bx);
1854 evas_object_show(bx);
1856 fr = elm_frame_add(win);
1858 elm_frame_label_set(fr, "Reorder Mode");
1859 elm_box_pack_end(bx, fr);
1860 evas_object_show(fr);
1862 lb = elm_label_add(win);
1863 elm_label_label_set(lb,
1864 "Enable reorder mode if you want to move item.<br>"
1865 "Then long press and drag item.");
1866 elm_frame_content_set(fr, lb);
1867 evas_object_show(lb);
1869 gl = elm_genlist_add(win);
1870 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1871 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1872 evas_object_show(gl);
1874 tg = elm_toggle_add(win);
1875 elm_toggle_label_set(tg, "Reorder Mode:");
1876 elm_toggle_state_set(tg, elm_mirrored_get());
1877 evas_object_smart_callback_add(tg, "changed", _reorder_tg_changed, gl);
1878 elm_box_pack_end(bx, tg);
1879 evas_object_show(tg);
1881 itc10.item_style = "default";
1882 itc10.func.label_get = gl11_label_get;
1883 itc10.func.icon_get = gl11_icon_get;
1884 itc10.func.state_get = gl_state_get;
1885 itc10.func.del = gl_del;
1887 for (i = 0; i < 50; i++)
1888 elm_genlist_item_append(gl,
1890 (void *)(1 + i)/* item data */,
1892 ELM_GENLIST_ITEM_NONE/* flags */,
1894 NULL/* func data */);
1896 elm_box_pack_end(bx, gl);
1898 evas_object_resize(win, 400, 500);
1899 evas_object_show(win);