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_content_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", elm_app_data_dir_get());
38 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
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, EINA_TRUE);
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.content_get = gl_content_get;
146 itc1.func.state_get = gl_state_get;
147 itc1.func.del = gl_del;
149 bt_50 = elm_button_add(win);
150 elm_object_text_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_object_text_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.content_get = gl_content_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.content_get = gl_content_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.content_get = gl_content_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, EINA_TRUE);
353 bg = elm_bg_add(win);
354 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
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.content_get = gl_content_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_object_text_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_object_text_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_object_text_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_object_text_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_object_text_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_object_text_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_object_text_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_object_text_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_object_text_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_object_text_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_content_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", elm_app_data_dir_get());
531 else if ((tit->mode & 0x3) == 1)
532 snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
533 else if ((tit->mode & 0x3) == 2)
534 snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", elm_app_data_dir_get());
535 else if ((tit->mode & 0x3) == 3)
536 snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get());
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", elm_app_data_dir_get());
543 else if ((tit->mode & 0x3) == 1)
544 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
545 else if ((tit->mode & 0x3) == 2)
546 snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", elm_app_data_dir_get());
547 else if ((tit->mode & 0x3) == 3)
548 snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", elm_app_data_dir_get());
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 my_gl_labels_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
573 Testitem *tit = data;
575 elm_genlist_item_fields_update(tit->item, "*", ELM_GENLIST_ITEM_FIELD_LABEL);
579 my_gl_contents_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
581 Testitem *tit = data;
583 elm_genlist_item_fields_update(tit->item, "*", ELM_GENLIST_ITEM_FIELD_CONTENT);
587 test_genlist3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
589 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
590 static Testitem tit[3];
592 win = elm_win_add(NULL, "genlist3", ELM_WIN_BASIC);
593 elm_win_title_set(win, "Genlist 3");
594 elm_win_autodel_set(win, EINA_TRUE);
596 bg = elm_bg_add(win);
597 elm_win_resize_object_add(win, bg);
598 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
599 evas_object_show(bg);
601 bx = elm_box_add(win);
602 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
603 elm_win_resize_object_add(win, bx);
604 evas_object_show(bx);
606 gl = elm_genlist_add(win);
607 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
608 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
609 evas_object_show(gl);
611 itc2.item_style = "default";
612 itc2.func.label_get = gl2_label_get;
613 itc2.func.content_get = gl2_content_get;
614 itc2.func.state_get = gl2_state_get;
615 itc2.func.del = gl2_del;
618 tit[0].item = elm_genlist_item_append(gl, &itc2,
619 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
620 NULL/* func data */);
622 tit[1].item = elm_genlist_item_append(gl, &itc2,
623 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
624 NULL/* func data */);
626 tit[2].item = elm_genlist_item_append(gl, &itc2,
627 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
628 NULL/* func data */);
630 elm_box_pack_end(bx, gl);
631 evas_object_show(bx);
633 bx2 = elm_box_add(win);
634 elm_box_horizontal_set(bx2, EINA_TRUE);
635 elm_box_homogeneous_set(bx2, EINA_TRUE);
636 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
637 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
639 bt = elm_button_add(win);
640 elm_object_text_set(bt, "[1]");
641 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
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 bt = elm_button_add(win);
648 elm_object_text_set(bt, "labels");
649 evas_object_smart_callback_add(bt, "clicked", my_gl_labels_update, &(tit[1]));
650 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
651 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
652 elm_box_pack_end(bx2, bt);
653 evas_object_show(bt);
655 bt = elm_button_add(win);
656 elm_object_text_set(bt, "contents");
657 evas_object_smart_callback_add(bt, "clicked", my_gl_contents_update, &(tit[2]));
658 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
659 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
660 elm_box_pack_end(bx2, bt);
661 evas_object_show(bt);
663 elm_box_pack_end(bx, bx2);
664 evas_object_show(bx2);
666 evas_object_resize(win, 320, 320);
667 evas_object_show(win);
673 my_gl_item_check_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__)
675 Testitem *tit = data;
676 tit->onoff = elm_check_state_get(obj);
677 printf("item %p onoff = %i\n", tit, tit->onoff);
680 static Elm_Genlist_Item_Class itc3;
681 char *gl3_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
683 const Testitem *tit = data;
685 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
688 Evas_Object *gl3_content_get(void *data, Evas_Object *obj, const char *part)
690 const Testitem *tit = data;
691 if (!strcmp(part, "elm.swallow.icon"))
695 lb = elm_label_add(obj);
696 elm_label_line_wrap_set(lb, ELM_WRAP_CHAR);
697 elm_label_wrap_width_set(lb, 201);
698 elm_object_text_set(lb, "ashj ascjscjh n asjkl hcjlh ls hzshnn zjh sh zxjcjsnd h dfw sdv edev efe fwefvv vsd cvs ws wf fvwf wd fwe f we wef we wfe rfwewef wfv wswf wefg sdfws w wsdcfwcf wsc vdv sdsd sdcd cv wsc sdcv wsc d sdcdcsd sdcdsc wdvd sdcsd wscxcv wssvd sd");
701 else if (!strcmp(part, "elm.swallow.end"))
704 ck = elm_check_add(obj);
705 evas_object_propagate_events_set(ck, EINA_FALSE);
706 elm_check_state_set(ck, tit->onoff);
707 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed, data);
712 Eina_Bool gl3_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
716 void gl3_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
721 test_genlist4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
723 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
724 static Testitem tit[3];
726 win = elm_win_add(NULL, "genlist4", ELM_WIN_BASIC);
727 elm_win_title_set(win, "Genlist 4");
728 elm_win_autodel_set(win, EINA_TRUE);
730 bg = elm_bg_add(win);
731 elm_win_resize_object_add(win, bg);
732 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
733 evas_object_show(bg);
735 bx = elm_box_add(win);
736 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
737 elm_win_resize_object_add(win, bx);
738 evas_object_show(bx);
740 gl = elm_genlist_add(win);
741 elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
742 elm_genlist_multi_select_set(gl, 1);
743 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
744 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
745 evas_object_show(gl);
747 itc3.item_style = "default";
748 itc3.func.label_get = gl3_label_get;
749 itc3.func.content_get = gl3_content_get;
750 itc3.func.state_get = gl3_state_get;
751 itc3.func.del = gl3_del;
754 tit[0].item = elm_genlist_item_append(gl, &itc3,
755 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
756 NULL/* func data */);
758 tit[1].item = elm_genlist_item_append(gl, &itc3,
759 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
760 NULL/* func data */);
762 tit[2].item = elm_genlist_item_append(gl, &itc3,
763 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
764 NULL/* func data */);
766 elm_box_pack_end(bx, gl);
767 evas_object_show(bx);
769 bx2 = elm_box_add(win);
770 elm_box_horizontal_set(bx2, EINA_TRUE);
771 elm_box_homogeneous_set(bx2, EINA_TRUE);
772 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
773 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
775 bt = elm_button_add(win);
776 elm_object_text_set(bt, "[1]");
777 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
778 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
779 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
780 elm_box_pack_end(bx2, bt);
781 evas_object_show(bt);
783 bt = elm_button_add(win);
784 elm_object_text_set(bt, "[2]");
785 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
786 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
787 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
788 elm_box_pack_end(bx2, bt);
789 evas_object_show(bt);
791 bt = elm_button_add(win);
792 elm_object_text_set(bt, "[3]");
793 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
794 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
795 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
796 elm_box_pack_end(bx2, bt);
797 evas_object_show(bt);
799 elm_box_pack_end(bx, bx2);
800 evas_object_show(bx2);
802 evas_object_resize(win, 320, 320);
803 evas_object_show(win);
809 my_gl_item_check_changed2(void *data, Evas_Object *obj, void *event_info __UNUSED__)
811 Testitem *tit = data;
812 tit->onoff = elm_check_state_get(obj);
813 printf("item %p onoff = %i\n", tit, tit->onoff);
816 static Elm_Genlist_Item_Class itc5;
817 char *gl5_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
819 const Testitem *tit = data;
821 if (!strcmp(part, "elm.text"))
823 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
825 else if (!strcmp(part, "elm.text.sub"))
827 snprintf(buf, sizeof(buf), "%i bottles on the wall", tit->mode);
831 Evas_Object *gl5_content_get(void *data, Evas_Object *obj, const char *part)
833 const Testitem *tit = data;
835 if (!strcmp(part, "elm.swallow.icon"))
837 Evas_Object *bx = elm_box_add(obj);
839 elm_box_horizontal_set(bx, EINA_TRUE);
840 ic = elm_icon_add(obj);
841 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
842 elm_icon_file_set(ic, buf, NULL);
843 elm_icon_scale_set(ic, 0, 0);
844 evas_object_show(ic);
845 elm_box_pack_end(bx, ic);
846 ic = elm_icon_add(obj);
847 elm_icon_file_set(ic, buf, NULL);
848 elm_icon_scale_set(ic, 0, 0);
849 evas_object_show(ic);
850 elm_box_pack_end(bx, ic);
851 elm_box_horizontal_set(bx, EINA_TRUE);
852 evas_object_show(bx);
855 else if (!strcmp(part, "elm.swallow.end"))
858 ck = elm_check_add(obj);
859 evas_object_propagate_events_set(ck, EINA_FALSE);
860 elm_check_state_set(ck, tit->onoff);
861 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed2, data);
862 evas_object_show(ck);
867 Eina_Bool gl5_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
871 void gl5_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
876 item_drag_up(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
882 item_drag_down(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
884 printf("drag down\n");
888 item_drag_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
890 printf("drag left\n");
894 item_drag_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
896 printf("drag right\n");
900 scroll_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
902 printf("Top edge!\n");
906 scroll_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
908 printf("Bottom edge!\n");
912 scroll_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
914 printf("Left edge!\n");
918 scroll_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
920 printf("Right edge!\n");
924 item_drag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
930 item_drag_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
932 printf("drag stop\n");
936 item_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
938 printf("longpress\n");
942 test_genlist5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
944 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
945 static Testitem tit[3];
947 win = elm_win_add(NULL, "genlist5", ELM_WIN_BASIC);
948 elm_win_title_set(win, "Genlist 5");
949 elm_win_autodel_set(win, EINA_TRUE);
951 bg = elm_bg_add(win);
952 elm_win_resize_object_add(win, bg);
953 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
954 evas_object_show(bg);
956 bx = elm_box_add(win);
957 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
958 elm_win_resize_object_add(win, bx);
959 evas_object_show(bx);
961 gl = elm_genlist_add(win);
962 elm_genlist_always_select_mode_set(gl, 1);
963 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
964 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
965 evas_object_show(gl);
966 itc5.item_style = "double_label";
967 itc5.func.label_get = gl5_label_get;
968 itc5.func.content_get = gl5_content_get;
969 itc5.func.state_get = gl5_state_get;
970 itc5.func.del = gl5_del;
973 tit[0].item = elm_genlist_item_append(gl, &itc5,
974 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
975 NULL/* func data */);
977 tit[1].item = elm_genlist_item_append(gl, &itc5,
978 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
979 NULL/* func data */);
981 tit[2].item = elm_genlist_item_append(gl, &itc5,
982 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
983 NULL/* func data */);
985 elm_box_pack_end(bx, gl);
986 evas_object_show(bx);
988 evas_object_smart_callback_add(gl, "drag,start,up", item_drag_up, NULL);
989 evas_object_smart_callback_add(gl, "drag,start,down", item_drag_down, NULL);
990 evas_object_smart_callback_add(gl, "drag,start,left", item_drag_left, NULL);
991 evas_object_smart_callback_add(gl, "drag,start,right", item_drag_right, NULL);
992 evas_object_smart_callback_add(gl, "scroll,edge,top", scroll_top, NULL);
993 evas_object_smart_callback_add(gl, "scroll,edge,bottom", scroll_bottom, NULL);
994 evas_object_smart_callback_add(gl, "scroll,edge,left", scroll_left, NULL);
995 evas_object_smart_callback_add(gl, "scroll,edge,right", scroll_right, NULL);
996 evas_object_smart_callback_add(gl, "drag", item_drag, NULL);
997 evas_object_smart_callback_add(gl, "drag,stop", item_drag_stop, NULL);
998 evas_object_smart_callback_add(gl, "longpressed", item_longpress, NULL);
1000 bx2 = elm_box_add(win);
1001 elm_box_horizontal_set(bx2, EINA_TRUE);
1002 elm_box_homogeneous_set(bx2, EINA_TRUE);
1003 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1004 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1006 bt = elm_button_add(win);
1007 elm_object_text_set(bt, "[1]");
1008 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
1009 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1010 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1011 elm_box_pack_end(bx2, bt);
1012 evas_object_show(bt);
1014 bt = elm_button_add(win);
1015 elm_object_text_set(bt, "[2]");
1016 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1017 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1018 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1019 elm_box_pack_end(bx2, bt);
1020 evas_object_show(bt);
1022 bt = elm_button_add(win);
1023 elm_object_text_set(bt, "[3]");
1024 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1025 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1026 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1027 elm_box_pack_end(bx2, bt);
1028 evas_object_show(bt);
1030 elm_box_pack_end(bx, bx2);
1031 evas_object_show(bx2);
1033 evas_object_resize(win, 320, 320);
1034 evas_object_show(win);
1039 static Elm_Genlist_Item_Class itc4;
1042 gl4_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1044 Elm_Genlist_Item *it = (Elm_Genlist_Item *)event_info;
1047 depth = elm_genlist_item_expanded_depth_get(it);
1048 printf("expanded depth for selected item is %d\n", depth);
1052 gl4_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1054 Elm_Genlist_Item *it = event_info;
1055 Evas_Object *gl = elm_genlist_item_genlist_get(it);
1056 int val = (int)(long)elm_genlist_item_data_get(it);
1058 elm_genlist_item_append(gl, &itc4,
1059 (void *)(long)(val + 1)/* item data */, it/* parent */,
1060 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1061 NULL/* func data */);
1062 elm_genlist_item_append(gl, &itc4,
1063 (void *)(long)(val + 2)/* item data */, it/* parent */,
1064 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1065 NULL/* func data */);
1066 elm_genlist_item_append(gl, &itc4,
1067 (void *)(long)(val + 3)/* item data */, it/* parent */,
1068 ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1069 NULL/* func data */);
1072 gl4_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1074 Elm_Genlist_Item *it = event_info;
1075 elm_genlist_item_subitems_clear(it);
1079 gl4_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1081 Elm_Genlist_Item *it = event_info;
1082 elm_genlist_item_expanded_set(it, 1);
1085 gl4_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1087 Elm_Genlist_Item *it = event_info;
1088 elm_genlist_item_expanded_set(it, 0);
1091 char *gl4_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1094 snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data);
1097 Evas_Object *gl4_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1100 if (!strcmp(part, "elm.swallow.icon"))
1102 Evas_Object *ic = elm_icon_add(obj);
1103 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
1104 elm_icon_file_set(ic, buf, NULL);
1105 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1106 evas_object_show(ic);
1109 else if (!strcmp(part, "elm.swallow.end"))
1112 ck = elm_check_add(obj);
1113 evas_object_propagate_events_set(ck, EINA_FALSE);
1114 evas_object_show(ck);
1119 Eina_Bool gl4_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1123 void gl4_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
1128 test_genlist6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1130 Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
1132 win = elm_win_add(NULL, "genlist-tree", ELM_WIN_BASIC);
1133 elm_win_title_set(win, "Genlist Tree");
1134 elm_win_autodel_set(win, EINA_TRUE);
1136 bg = elm_bg_add(win);
1137 elm_win_resize_object_add(win, bg);
1138 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1139 evas_object_show(bg);
1141 bx = elm_box_add(win);
1142 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1143 elm_win_resize_object_add(win, bx);
1144 evas_object_show(bx);
1146 gl = elm_genlist_add(win);
1147 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1148 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1149 evas_object_show(gl);
1151 itc4.item_style = "default";
1152 itc4.func.label_get = gl4_label_get;
1153 itc4.func.content_get = gl4_content_get;
1154 itc4.func.state_get = gl4_state_get;
1155 itc4.func.del = gl4_del;
1157 elm_genlist_item_append(gl, &itc4,
1158 (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1159 NULL/* func data */);
1160 elm_genlist_item_append(gl, &itc4,
1161 (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1162 NULL/* func data */);
1163 elm_genlist_item_append(gl, &itc4,
1164 (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1165 NULL/* func data */);
1167 evas_object_smart_callback_add(gl, "expand,request", gl4_exp_req, gl);
1168 evas_object_smart_callback_add(gl, "contract,request", gl4_con_req, gl);
1169 evas_object_smart_callback_add(gl, "expanded", gl4_exp, gl);
1170 evas_object_smart_callback_add(gl, "contracted", gl4_con, gl);
1172 elm_box_pack_end(bx, gl);
1173 evas_object_show(bx);
1175 bx2 = elm_box_add(win);
1176 elm_box_horizontal_set(bx2, EINA_TRUE);
1177 elm_box_homogeneous_set(bx2, EINA_TRUE);
1178 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1179 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1181 bt = elm_button_add(win);
1182 elm_object_text_set(bt, "[1]");
1183 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
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 bt = elm_button_add(win);
1190 elm_object_text_set(bt, "[2]");
1191 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1192 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1193 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1194 elm_box_pack_end(bx2, bt);
1195 evas_object_show(bt);
1197 bt = elm_button_add(win);
1198 elm_object_text_set(bt, "[3]");
1199 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1200 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1201 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1202 elm_box_pack_end(bx2, bt);
1203 evas_object_show(bt);
1205 elm_box_pack_end(bx, bx2);
1206 evas_object_show(bx2);
1208 evas_object_resize(win, 320, 320);
1209 evas_object_show(win);
1214 struct genlist7_data
1216 Evas_Object *win, *pager;
1219 static Elm_Genlist_Item_Class itc7;
1221 gl_sel7(void *data, Evas_Object *obj, void *event_info)
1223 if (!event_info) return;
1224 elm_genlist_item_item_class_update(event_info, &itc7);
1225 printf("sel item data [%p] on genlist obj [%p], item pointer [%p], new item style [%s] \n", data, obj, event_info, itc7.item_style);
1229 test_genlist7_back_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1231 struct genlist7_data *info = data;
1234 elm_pager_content_pop(info->pager);
1238 test_genlist7_swipe(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1240 struct genlist7_data *info = data;
1241 Evas_Object *box, *entry, *button;
1242 char item_data[] = "Just a simple test";
1244 if ((!event_info) || (!data)) return;
1246 box = elm_box_add(info->win);
1247 elm_box_homogeneous_set(box, EINA_FALSE);
1248 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1249 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
1250 evas_object_show(box);
1252 entry = elm_entry_add(info->win);
1253 elm_entry_scrollable_set(entry, EINA_TRUE);
1254 elm_entry_editable_set(entry, EINA_FALSE);
1255 elm_entry_entry_set(entry, item_data);
1256 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1257 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
1258 evas_object_show(entry);
1260 button = elm_button_add(info->win);
1261 elm_object_text_set(button, "back");
1262 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
1263 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0);
1264 evas_object_smart_callback_add(button, "clicked", test_genlist7_back_cb,
1266 evas_object_show(button);
1268 elm_box_pack_start(box, entry);
1269 elm_box_pack_end(box, button);
1271 elm_pager_content_push(info->pager, box);
1275 test_genlist7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1277 Evas_Object *win, *bg, *gl, *pager;
1278 static struct genlist7_data info;
1279 static Testitem tit[3];
1281 win = elm_win_add(NULL, "genlist7", ELM_WIN_BASIC);
1282 elm_win_title_set(win, "Genlist 7");
1283 elm_win_autodel_set(win, EINA_TRUE);
1286 bg = elm_bg_add(win);
1287 elm_win_resize_object_add(win, bg);
1288 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1289 evas_object_show(bg);
1291 pager = elm_pager_add(win);
1292 elm_win_resize_object_add(win, pager);
1293 evas_object_size_hint_weight_set(pager, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1294 evas_object_size_hint_align_set(pager, EVAS_HINT_FILL, EVAS_HINT_FILL);
1295 evas_object_show(pager);
1298 gl = elm_genlist_add(win);
1299 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1300 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1301 evas_object_smart_callback_add(gl, "swipe", test_genlist7_swipe, &info);
1302 evas_object_show(gl);
1303 elm_pager_content_push(pager, gl);
1305 itc2.item_style = "default";
1306 itc2.func.label_get = gl2_label_get;
1307 itc2.func.content_get = gl2_content_get;
1308 itc2.func.state_get = gl2_state_get;
1309 itc2.func.del = gl2_del;
1311 itc7.item_style = "double_label";
1312 itc7.func.label_get = gl5_label_get;
1313 itc7.func.content_get = gl5_content_get;
1314 itc7.func.state_get = gl5_state_get;
1315 itc7.func.del = gl5_del;
1318 tit[0].item = elm_genlist_item_append(gl, &itc2,
1319 &(tit[0])/* item data */, NULL/* parent */,
1320 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1321 NULL/* func data */);
1323 tit[1].item = elm_genlist_item_append(gl, &itc2,
1324 &(tit[1])/* item data */, NULL/* parent */,
1325 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1326 NULL/* func data */);
1328 tit[2].item = elm_genlist_item_append(gl, &itc2,
1329 &(tit[2])/* item data */, NULL/* parent */,
1330 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1331 NULL/* func data */);
1333 evas_object_resize(win, 320, 320);
1334 evas_object_show(win);
1339 static Elm_Genlist_Item_Class itc_group;
1340 char *gl8_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1343 snprintf(buf, sizeof(buf), "Group Index # %i (Item # %i)", (int)((long)data / 10), (int)(long)data);
1348 _bt_show_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1350 elm_genlist_item_top_show(data);
1351 //elm_genlist_item_show(data);
1352 //elm_genlist_item_middle_show(data);
1355 _bt_bring_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1357 elm_genlist_item_top_bring_in(data);
1358 //elm_genlist_item_bring_in(data);
1359 //elm_genlist_item_middle_bring_in(data);
1363 test_genlist8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1365 Evas_Object *win, *bg, *gl, *bt[8], *bx, *bx2, *bx3;
1366 Elm_Genlist_Item *gli = NULL, *git = NULL;
1369 win = elm_win_add(NULL, "genlist-group", ELM_WIN_BASIC);
1370 elm_win_title_set(win, "Genlist Group");
1371 elm_win_autodel_set(win, EINA_TRUE);
1373 bg = elm_bg_add(win);
1374 elm_win_resize_object_add(win, bg);
1375 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1376 evas_object_show(bg);
1378 bx = elm_box_add(win);
1379 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1380 elm_win_resize_object_add(win, bx);
1381 evas_object_show(bx);
1383 gl = elm_genlist_add(win);
1384 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1385 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1386 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1387 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1388 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1389 elm_box_pack_end(bx, gl);
1390 evas_object_show(gl);
1392 itc1.item_style = "default";
1393 itc1.func.label_get = gl_label_get;
1394 itc1.func.content_get = gl_content_get;
1395 itc1.func.state_get = gl_state_get;
1396 itc1.func.del = gl_del;
1398 itc_group.item_style = "group_index";
1399 itc_group.func.label_get = gl8_label_get;
1400 itc_group.func.content_get = NULL;
1401 itc_group.func.state_get = NULL;
1402 itc_group.func.del = gl_del;
1404 bx2 = elm_box_add(win);
1405 elm_box_horizontal_set(bx2, EINA_TRUE);
1406 elm_box_homogeneous_set(bx2, EINA_TRUE);
1407 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1408 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1411 bt[bt_num] = elm_button_add(win);
1412 elm_object_text_set(bt[bt_num], "Show 0");
1413 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1414 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1415 evas_object_show(bt[bt_num]);
1416 elm_box_pack_end(bx2, bt[bt_num]);
1418 bt[++bt_num] = elm_button_add(win);
1419 elm_object_text_set(bt[bt_num], "Show 26");
1420 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1421 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1422 evas_object_show(bt[bt_num]);
1423 elm_box_pack_end(bx2, bt[bt_num]);
1425 bt[++bt_num] = elm_button_add(win);
1426 elm_object_text_set(bt[bt_num], "Show 101");
1427 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1428 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1429 evas_object_show(bt[bt_num]);
1430 elm_box_pack_end(bx2, bt[bt_num]);
1432 bt[++bt_num] = elm_button_add(win);
1433 elm_object_text_set(bt[bt_num], "Show 480");
1434 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1435 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1436 evas_object_show(bt[bt_num]);
1437 elm_box_pack_end(bx2, bt[bt_num]);
1439 elm_box_pack_end(bx, bx2);
1440 evas_object_show(bx2);
1442 bx3 = elm_box_add(win);
1443 elm_box_horizontal_set(bx3, EINA_TRUE);
1444 elm_box_homogeneous_set(bx3, EINA_TRUE);
1445 evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0);
1446 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL);
1448 bt[++bt_num] = elm_button_add(win);
1449 elm_object_text_set(bt[bt_num], "Bring top 0");
1450 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1451 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1452 evas_object_show(bt[bt_num]);
1453 elm_box_pack_end(bx3, bt[bt_num]);
1455 bt[++bt_num] = elm_button_add(win);
1456 elm_object_text_set(bt[bt_num], "Bring top 31");
1457 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1458 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1459 evas_object_show(bt[bt_num]);
1460 elm_box_pack_end(bx3, bt[bt_num]);
1462 bt[++bt_num] = elm_button_add(win);
1463 elm_object_text_set(bt[bt_num], "Bring top 239");
1464 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1465 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1466 evas_object_show(bt[bt_num]);
1467 elm_box_pack_end(bx3, bt[bt_num]);
1469 bt[++bt_num] = elm_button_add(win);
1470 elm_object_text_set(bt[bt_num], "Bring top 477");
1471 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1472 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1473 evas_object_show(bt[bt_num]);
1474 elm_box_pack_end(bx3, bt[bt_num]);
1476 elm_box_pack_end(bx, bx3);
1477 evas_object_show(bx3);
1479 for (i = 0; i < 500; i++)
1483 gli = git = elm_genlist_item_append(gl, &itc_group,
1484 (void *)(long)i/* item data */,
1486 ELM_GENLIST_ITEM_GROUP,
1488 (void *)(long)(i * 10)/* func data */);
1489 elm_genlist_item_display_only_set(git, EINA_TRUE);
1493 gli = elm_genlist_item_append(gl, &itc1,
1494 (void *)(long)i/* item data */,
1496 ELM_GENLIST_ITEM_NONE,
1498 (void *)(long)(i * 10)/* func data */);
1503 evas_object_smart_callback_add(bt[0], "clicked", _bt_show_cb, gli);
1504 evas_object_smart_callback_add(bt[4], "clicked", _bt_bring_cb, gli);
1507 evas_object_smart_callback_add(bt[1], "clicked", _bt_show_cb, gli);
1510 evas_object_smart_callback_add(bt[5], "clicked", _bt_bring_cb, gli);
1513 evas_object_smart_callback_add(bt[2], "clicked", _bt_show_cb, gli);
1516 evas_object_smart_callback_add(bt[6], "clicked", _bt_bring_cb, gli);
1519 evas_object_smart_callback_add(bt[7], "clicked", _bt_bring_cb, gli);
1522 evas_object_smart_callback_add(bt[3], "clicked", _bt_show_cb, gli);
1527 evas_object_resize(win, 480, 800);
1528 evas_object_show(win);
1534 gl9_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1536 Elm_Genlist_Item *it = event_info;
1537 Evas_Object *gl = elm_genlist_item_genlist_get(it);
1538 int val = (int)(long)elm_genlist_item_data_get(it);
1540 elm_genlist_item_append(gl, &itc1,
1541 (void *)(long)(val + 1)/* item data */, it/* parent */,
1542 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1543 NULL/* func data */);
1544 elm_genlist_item_append(gl, &itc1,
1545 (void *)(long)(val + 2)/* item data */, it/* parent */,
1546 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1547 NULL/* func data */);
1548 elm_genlist_item_append(gl, &itc1,
1549 (void *)(long)(val + 3)/* item data */, it/* parent */,
1550 ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1551 NULL/* func data */);
1554 gl9_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1556 Elm_Genlist_Item *it = event_info;
1557 elm_genlist_item_subitems_clear(it);
1561 gl9_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1563 Elm_Genlist_Item *it = event_info;
1564 elm_genlist_item_expanded_set(it, EINA_TRUE);
1567 gl9_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1569 Elm_Genlist_Item *it = event_info;
1570 elm_genlist_item_expanded_set(it, EINA_FALSE);
1574 test_genlist9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1576 Evas_Object *win, *bg, *gl, *bx;
1577 Elm_Genlist_Item *git;
1579 win = elm_win_add(NULL, "genlist-group-tree", ELM_WIN_BASIC);
1580 elm_win_title_set(win, "Genlist Group Tree");
1581 elm_win_autodel_set(win, EINA_TRUE);
1583 bg = elm_bg_add(win);
1584 elm_win_resize_object_add(win, bg);
1585 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1586 evas_object_show(bg);
1588 bx = elm_box_add(win);
1589 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1590 elm_win_resize_object_add(win, bx);
1591 evas_object_show(bx);
1593 gl = elm_genlist_add(win);
1594 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1595 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1596 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1597 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1598 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1599 elm_box_pack_end(bx, gl);
1600 evas_object_show(gl);
1602 itc1.item_style = "default";
1603 itc1.func.label_get = gl_label_get;
1604 itc1.func.content_get = gl_content_get;
1605 itc1.func.state_get = gl_state_get;
1606 itc1.func.del = gl_del;
1608 itc_group.item_style = "group_index";
1609 itc_group.func.label_get = gl8_label_get;
1610 itc_group.func.content_get = NULL;
1611 itc_group.func.state_get = NULL;
1612 itc_group.func.del = gl_del;
1614 git = elm_genlist_item_append(gl, &itc_group,
1615 (void *)0/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1616 NULL/* func data */);
1617 elm_genlist_item_display_only_set(git, EINA_TRUE);
1618 elm_genlist_item_append(gl, &itc1,
1619 (void *)1/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1620 NULL/* func data */);
1621 elm_genlist_item_append(gl, &itc1,
1622 (void *)2/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1623 NULL/* func data */);
1624 elm_genlist_item_append(gl, &itc1,
1625 (void *)3/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1626 NULL/* func data */);
1627 git = elm_genlist_item_append(gl, &itc_group,
1628 (void *)4/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1629 NULL/* func data */);
1630 elm_genlist_item_display_only_set(git, EINA_TRUE);
1631 elm_genlist_item_append(gl, &itc1,
1632 (void *)5/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1633 NULL/* func data */);
1634 elm_genlist_item_append(gl, &itc1,
1635 (void *)6/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1636 NULL/* func data */);
1637 elm_genlist_item_append(gl, &itc1,
1638 (void *)7/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1639 NULL/* func data */);
1641 evas_object_smart_callback_add(gl, "expand,request", gl9_exp_req, gl);
1642 evas_object_smart_callback_add(gl, "contract,request", gl9_con_req, gl);
1643 evas_object_smart_callback_add(gl, "expanded", gl9_exp, gl);
1644 evas_object_smart_callback_add(gl, "contracted", gl9_con, gl);
1646 evas_object_resize(win, 480, 800);
1647 evas_object_show(win);
1652 static Elm_Genlist_Item_Class itc10;
1653 static char *mode_type[] = { "slide", "rotate" };
1654 char *gl10_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
1657 if (!strcmp(part, "elm.text.mode"))
1658 snprintf(buf, sizeof(buf), "Mode # %i", (int)(long)data);
1660 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
1664 Evas_Object *gl10_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1667 Evas_Object *ic = elm_icon_add(obj);
1668 if (!strcmp(part, "elm.swallow.end"))
1669 snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get());
1671 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
1672 elm_icon_file_set(ic, buf, NULL);
1673 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1677 _gl_sel10(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1680 int v = elm_radio_value_get(data);
1682 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
1686 _my_gl_mode_right(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1689 int v = elm_radio_value_get(data);
1691 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
1695 _my_gl_mode_left(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1698 int v = elm_radio_value_get(data);
1700 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_FALSE);
1704 _my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1706 fprintf(stderr, "drag\n");
1708 int v = elm_radio_value_get(data);
1709 Elm_Genlist_Item *it = (Elm_Genlist_Item *)elm_genlist_mode_item_get(obj);
1711 elm_genlist_item_mode_set(it, mode_type[v], EINA_FALSE);
1715 test_genlist10(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1717 Evas_Object *win, *bg, *fr, *lb, *bx, *bx2, *bx3, *rd, *rdg, *gl;
1720 win = elm_win_add(NULL, "genlist10", ELM_WIN_BASIC);
1721 elm_win_title_set(win, "Genlist Mode");
1722 elm_win_autodel_set(win, EINA_TRUE);
1724 bg = elm_bg_add(win);
1725 elm_win_resize_object_add(win, bg);
1726 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1727 evas_object_show(bg);
1729 bx = elm_box_add(win);
1730 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1731 elm_win_resize_object_add(win, bx);
1732 evas_object_show(bx);
1734 fr = elm_frame_add(win);
1735 elm_object_text_set(fr, "Mode Type");
1736 elm_box_pack_end(bx, fr);
1737 evas_object_show(fr);
1739 bx2 = elm_box_add(win);
1740 elm_object_content_set(fr, bx2);
1741 evas_object_show(bx2);
1743 lb = elm_label_add(win);
1744 elm_object_text_set(lb,
1745 "Sweep genlist items to the right.<br>"
1746 "Test this by changing Mode Type to Slide or Rotate.");
1747 elm_box_pack_end(bx2, lb);
1748 evas_object_show(lb);
1750 bx3 = elm_box_add(win);
1751 elm_box_horizontal_set(bx3, EINA_TRUE);
1752 elm_box_pack_end(bx2, bx3);
1753 evas_object_show(bx3);
1755 rd = elm_radio_add(win);
1756 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1757 elm_radio_state_value_set(rd, 0);
1758 elm_object_text_set(rd, "Slide ");
1759 evas_object_show(rd);
1760 elm_box_pack_end(bx3, rd);
1763 rd = elm_radio_add(win);
1764 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1765 elm_radio_state_value_set(rd, 1);
1766 elm_object_text_set(rd, "Rotate");
1767 elm_radio_group_add(rd, rdg);
1768 evas_object_show(rd);
1769 elm_box_pack_end(bx3, rd);
1771 gl = elm_genlist_add(win);
1772 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1773 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1774 evas_object_smart_callback_add(gl, "drag,start,right", _my_gl_mode_right, rdg);
1775 evas_object_smart_callback_add(gl, "drag,start,left", _my_gl_mode_left, rdg);
1776 evas_object_smart_callback_add(gl, "drag,start,up", _my_gl_mode_cancel, rdg);
1777 evas_object_smart_callback_add(gl, "drag,start,down", _my_gl_mode_cancel, rdg);
1778 evas_object_show(gl);
1780 itc10.item_style = "default";
1781 itc10.func.label_get = gl10_label_get;
1782 itc10.func.content_get = gl10_content_get;
1783 itc10.func.state_get = gl_state_get;
1784 itc10.func.del = gl_del;
1785 elm_genlist_mode_item_style_set(gl, "mode");
1787 for (i = 0; i < 50; i++)
1788 elm_genlist_item_append(gl,
1790 (void *)(1000 + i)/* item data */,
1792 ELM_GENLIST_ITEM_NONE/* flags */,
1793 _gl_sel10/* func */,
1794 rdg/* func data */);
1796 elm_box_pack_end(bx, gl);
1798 evas_object_resize(win, 520, 520);
1799 evas_object_show(win);
1805 _reorder_tg_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1807 elm_genlist_reorder_mode_set(data, elm_check_state_get(obj));
1811 * gl_moved is called after an item was reordered.
1812 * This is only called when reorder mode is enabled.
1814 * @param data : the genlist object passed as data.
1815 * @param obj : the genlist object.
1816 * @param item : the moved item.
1818 * If the move_after is true,
1819 * the item(*item) had been moved after the given relative item(*rel_item) in list.
1820 * If the move_after is false,
1821 * the item(*item) had been moved before the given relative item(*rel_item) in list.
1824 static void gl_moved(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Genlist_Item *item __UNUSED__)
1826 // if needed, add application logic.
1830 test_genlist11(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1832 Evas_Object *win, *bg, *fr, *lb, *bx, *tg, *gl;
1835 win = elm_win_add(NULL, "genlist-reorder-mode", ELM_WIN_BASIC);
1836 elm_win_title_set(win, "Genlist Reorder Mode");
1837 elm_win_autodel_set(win, EINA_TRUE);
1839 bg = elm_bg_add(win);
1840 elm_win_resize_object_add(win, bg);
1841 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1842 evas_object_show(bg);
1844 bx = elm_box_add(win);
1845 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1846 elm_win_resize_object_add(win, bx);
1847 evas_object_show(bx);
1849 fr = elm_frame_add(win);
1851 elm_object_text_set(fr, "Reorder Mode");
1852 elm_box_pack_end(bx, fr);
1853 evas_object_show(fr);
1855 lb = elm_label_add(win);
1856 elm_object_text_set(lb,
1857 "Enable reorder mode if you want to move item.<br>"
1858 "Then long press and drag item.");
1859 elm_object_content_set(fr, lb);
1860 evas_object_show(lb);
1862 gl = elm_genlist_add(win);
1863 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1864 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1865 evas_object_show(gl);
1867 tg = elm_check_add(win);
1868 elm_object_style_set(tg, "toggle");
1869 elm_object_text_set(tg, "Reorder Mode:");
1870 elm_check_state_set(tg, elm_mirrored_get());
1871 evas_object_smart_callback_add(tg, "changed", _reorder_tg_changed_cb, gl);
1872 elm_box_pack_end(bx, tg);
1873 evas_object_show(tg);
1875 itc1.item_style = "default";
1876 itc1.func.label_get = gl_label_get;
1877 itc1.func.content_get = gl_content_get;
1878 itc1.func.state_get = gl_state_get;
1879 itc1.func.del = gl_del;
1880 evas_object_smart_callback_add(gl, "moved", (Evas_Smart_Cb)gl_moved, gl);
1882 for (i = 0; i < 50; i++)
1883 elm_genlist_item_append(gl,
1885 (void *)(1 + i)/* item data */,
1887 ELM_GENLIST_ITEM_NONE/* flags */,
1889 NULL/* func data */);
1891 elm_box_pack_end(bx, gl);
1893 evas_object_resize(win, 400, 500);
1894 evas_object_show(win);
1897 char *gl12_label_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1899 return strdup("Enlightenment is not just a window manager for Linux/X11 and others, but also a whole suite of libraries to help you create beautiful user interfaces with much less work than doing it the old fashioned way and fighting with traditional toolkits, not to mention a traditional window manager. It covers uses from small mobile devices like phones all the way to powerful multi-core desktops (which are the primary development environment).");
1903 test_genlist12(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1905 Evas_Object *win, *bg, *bx, *gl;
1908 win = elm_win_add(NULL, "genlist-textblock", ELM_WIN_BASIC);
1909 elm_win_title_set(win, "Genlist Textblock");
1910 elm_win_autodel_set(win, EINA_TRUE);
1912 bg = elm_bg_add(win);
1913 elm_win_resize_object_add(win, bg);
1914 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1915 evas_object_show(bg);
1917 bx = elm_box_add(win);
1918 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1919 elm_win_resize_object_add(win, bx);
1920 evas_object_show(bx);
1922 gl = elm_genlist_add(win);
1923 elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
1924 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1925 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1926 elm_box_pack_end(bx, gl);
1927 evas_object_show(gl);
1929 itc1.item_style = "message";
1930 itc1.func.label_get = gl12_label_get;
1931 itc1.func.content_get = gl_content_get;
1932 itc1.func.state_get = gl_state_get;
1933 itc1.func.del = gl_del;
1935 for (i = 0; i < 1000; i++)
1937 elm_genlist_item_append(gl, &itc1,
1938 (void *)(long)i/* item data */,
1940 ELM_GENLIST_ITEM_NONE,
1942 (void *)(long)(i * 10)/* func data */);
1945 evas_object_resize(win, 400, 500);
1946 evas_object_show(win);