1 #include <Elementary.h>
2 #include <Elementary_Cursor.h>
5 #include "elementary_config.h"
7 #ifndef ELM_LIB_QUICKLAUNCH
10 unsigned int state; /* What state we are testing */
11 void *box; /* Use this to get box content */
13 typedef struct _api_data api_data;
27 typedef enum _api_state api_state;
30 set_api_state(api_data *api)
32 const Eina_List *items = elm_box_children_get(api->box);
33 if(!eina_list_count(items))
36 Evas_Object *gl = eina_list_nth(items, 0); /* Genlist is the first item */
37 /* use elm_box_children_get() to get list of children */
39 {/* Put all api-changes under switch */
40 case HORIZONTAL_SET: /* 0 */
41 elm_genlist_mode_set(gl, ELM_LIST_LIMIT);
44 case NO_SELECT_MODE_SET: /* 1 */
45 elm_genlist_no_select_mode_set(gl, EINA_TRUE);
46 elm_genlist_mode_set(gl, ELM_LIST_SCROLL); /* Back to default */
49 case COMPRESS_MODE_SET: /* 2 */
50 elm_genlist_no_select_mode_set(gl, EINA_FALSE); /* Back to default */
51 elm_genlist_compress_mode_set(gl, EINA_TRUE);
54 case BOUNCE_SET: /* 3 */
55 elm_genlist_bounce_set(gl, EINA_FALSE, EINA_FALSE);
58 case HOMOGENEOUS_SET: /* 4 */
59 elm_genlist_bounce_set(gl, EINA_TRUE, EINA_TRUE); /* Back to default */
60 elm_genlist_homogeneous_set(gl, EINA_TRUE);
63 case SCROLLER_POLICY_SET: /* 5 */
64 elm_genlist_homogeneous_set(gl, EINA_FALSE); /* Back to default */
65 elm_genlist_scroller_policy_set(gl, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
68 case TOOLTIP_TEXT_SET: /* 6 */
70 elm_genlist_item_tooltip_text_set(elm_genlist_first_item_get(gl), "Tooltip text from API");
71 elm_genlist_item_bring_in(elm_genlist_first_item_get(gl));
75 case ITEM_CURSOR_SET: /* 7 */
76 elm_genlist_item_cursor_set(elm_genlist_first_item_get(gl), ELM_CURSOR_HAND2);
85 _api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
86 { /* Will add here a SWITCH command containing code to modify test-object */
87 /* in accordance a->state value. */
91 printf("clicked event on API Button: api_state=<%d>\n", a->state);
94 sprintf(str, "Next API function (%u)", a->state);
95 elm_object_text_set(obj, str);
96 elm_object_disabled_set(obj, a->state == API_STATE_LAST);
99 * In this example some calls to elm_genlist_item_append() are used which give the
100 * value of an int as 'item data' and 'func data' after casting into (void*). For
101 * sure this works only on architectures where sizeof(int)==sizeof(void*).
102 * For real world usage you should hold a data structure or value in your
103 * application and then give only a pointer to this data as data pointer.
106 typedef struct _Testitem
108 Elm_Object_Item *item;
114 static Elm_Genlist_Item_Class *itc1;
115 static Elm_Genlist_Item_Class *itc15;
116 char *gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
119 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
123 Evas_Object *gl_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
126 Evas_Object *ic = elm_icon_add(obj);
127 if (!strcmp(part, "elm.swallow.end"))
128 snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get());
130 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
131 elm_icon_file_set(ic, buf, NULL);
132 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
136 Eina_Bool gl_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
142 gl_sel(void *data, Evas_Object *obj, void *event_info)
144 printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", data, obj, event_info);
148 _move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
150 Evas_Object *gl = data;
151 Evas_Event_Mouse_Move *ev = event_info;
153 Elm_Object_Item *gli;
154 gli = elm_genlist_at_xy_item_get(gl, ev->cur.canvas.x, ev->cur.canvas.y, &where);
156 printf("over %p, where %i\n", elm_object_item_data_get(gli), where);
158 printf("over none, where %i\n", where);
162 _bt50_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
164 elm_genlist_item_bring_in(data);
168 _bt1500_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
170 elm_genlist_item_middle_bring_in(data);
174 _gl_selected(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
176 printf("selected: %p\n", event_info);
180 _gl_double_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
182 printf("double clicked: %p\n", event_info);
186 _gl_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
188 printf("longpress %p\n", event_info);
192 _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
198 test_genlist(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
200 Evas_Object *win, *gl, *bt_50, *bt_1500, *bx, *bxx, *bt;
202 Elm_Object_Item *gli;
204 api_data *api = calloc(1, sizeof(api_data));
206 win = elm_win_util_standard_add("genlist", "Genlist");
207 elm_win_autodel_set(win, EINA_TRUE);
208 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
210 bxx = elm_box_add(win);
211 elm_win_resize_object_add(win, bxx);
212 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
213 evas_object_show(bxx);
215 bx = elm_box_add(win);
216 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
217 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
219 evas_object_show(bx);
221 bt = elm_button_add(win);
222 elm_object_text_set(bt, "Next API function");
223 evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
224 elm_box_pack_end(bxx, bt);
225 elm_object_disabled_set(bt, api->state == API_STATE_LAST);
226 evas_object_show(bt);
228 elm_box_pack_end(bxx, bx);
230 gl = elm_genlist_add(win);
231 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
232 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
233 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
234 // FIXME: This causes genlist to resize the horiz axis very slowly :(
235 // Reenable this and resize the window horizontally, then try to resize it back
236 //elm_genlist_mode_set(gl, ELM_LIST_LIMIT);
237 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
238 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
239 elm_box_pack_end(bx, gl);
240 evas_object_show(gl);
242 over = evas_object_rectangle_add(evas_object_evas_get(win));
243 evas_object_color_set(over, 0, 0, 0, 0);
244 evas_object_event_callback_add(over, EVAS_CALLBACK_MOUSE_MOVE, _move, gl);
245 evas_object_repeat_events_set(over, 1);
246 evas_object_show(over);
247 evas_object_size_hint_weight_set(over, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
248 elm_win_resize_object_add(win, over);
250 itc1 = elm_genlist_item_class_new();
251 itc1->item_style = "default";
252 itc1->func.text_get = gl_text_get;
253 itc1->func.content_get = gl_content_get;
254 itc1->func.state_get = gl_state_get;
255 itc1->func.del = NULL;
257 bt_50 = elm_button_add(win);
258 elm_object_text_set(bt_50, "Go to 50");
259 evas_object_show(bt_50);
260 elm_box_pack_end(bx, bt_50);
262 bt_1500 = elm_button_add(win);
263 elm_object_text_set(bt_1500, "Go to 1500");
264 evas_object_show(bt_1500);
265 elm_box_pack_end(bx, bt_1500);
267 for (i = 0; i < 2000; i++)
269 gli = elm_genlist_item_append(gl, itc1,
270 (void *)(long)i/* item data */,
272 ELM_GENLIST_ITEM_NONE,
274 (void *)(long)(i * 10)/* func data */);
276 evas_object_smart_callback_add(bt_50, "clicked", _bt50_cb, gli);
278 evas_object_smart_callback_add(bt_1500, "clicked", _bt1500_cb, gli);
280 elm_genlist_item_class_free(itc1);
282 evas_object_resize(win, 480, 800);
283 evas_object_show(win);
289 my_gl_clear(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
291 Evas_Object *gl = data;
292 elm_genlist_clear(gl);
296 my_gl_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
298 Evas_Object *gl = data;
301 itc1->item_style = "default";
302 itc1->func.text_get = gl_text_get;
303 itc1->func.content_get = gl_content_get;
304 itc1->func.state_get = gl_state_get;
305 itc1->func.del = NULL;
307 elm_genlist_item_append(gl, itc1,
308 (void *)(long)i/* item data */,
310 ELM_GENLIST_ITEM_NONE,
312 (void *)(long)(i * 10)/* func data */);
317 my_gl_insert_before(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
319 Evas_Object *gl = data;
321 Elm_Object_Item *gli_selected;
323 itc1->item_style = "default";
324 itc1->func.text_get = gl_text_get;
325 itc1->func.content_get = gl_content_get;
326 itc1->func.state_get = gl_state_get;
327 itc1->func.del = NULL;
329 gli_selected = elm_genlist_selected_item_get(gl);
332 printf("no item selected\n");
336 elm_genlist_item_insert_before(gl, itc1,
337 (void *)(long)i/* item data */,
339 gli_selected /* item before */,
340 ELM_GENLIST_ITEM_NONE,
342 (void *)(long)(i * 10)/* func data */);
347 my_gl_insert_after(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
349 Evas_Object *gl = data;
351 Elm_Object_Item *gli_selected;
353 itc1->item_style = "default";
354 itc1->func.text_get = gl_text_get;
355 itc1->func.content_get = gl_content_get;
356 itc1->func.state_get = gl_state_get;
357 itc1->func.del = NULL;
359 gli_selected = elm_genlist_selected_item_get(gl);
362 printf("no item selected\n");
366 elm_genlist_item_insert_after(gl, itc1,
367 (void *)(long)i/* item data */,
369 gli_selected /* item after */,
370 ELM_GENLIST_ITEM_NONE,
372 (void *)(long)(i * 10)/* func data */);
377 my_gl_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
379 Evas_Object *gl = data;
380 Elm_Object_Item *gli = elm_genlist_selected_item_get(gl);
383 printf("no item selected\n");
386 elm_object_item_del(gli);
390 my_gl_disable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
392 Evas_Object *gl = data;
393 Elm_Object_Item *gli = elm_genlist_selected_item_get(gl);
396 printf("no item selected\n");
399 elm_object_item_disabled_set(gli, EINA_TRUE);
400 elm_genlist_item_selected_set(gli, EINA_FALSE);
401 elm_genlist_item_update(gli);
405 my_gl_update_all(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
407 Evas_Object *gl = data;
409 Elm_Object_Item *it = elm_genlist_first_item_get(gl);
412 elm_genlist_item_update(it);
415 it = elm_genlist_item_next_get(it);
420 my_gl_first(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
422 Evas_Object *gl = data;
423 Elm_Object_Item *gli = elm_genlist_first_item_get(gl);
425 elm_genlist_item_show(gli);
426 elm_genlist_item_selected_set(gli, 1);
430 my_gl_last(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
432 Evas_Object *gl = data;
433 Elm_Object_Item *gli = elm_genlist_last_item_get(gl);
435 elm_genlist_item_show(gli);
436 elm_genlist_item_selected_set(gli, 1);
440 my_gl_flush_delay(void *data __UNUSED__)
442 elm_cache_all_flush();
443 return ECORE_CALLBACK_CANCEL;
447 my_gl_flush(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
449 ecore_timer_add(1.2, my_gl_flush_delay, NULL);
453 test_genlist2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
455 Evas_Object *win, *bg, *gl, *bx, *bx2, *bx3, *bt;
456 Elm_Object_Item *gli[10];
459 win = elm_win_add(NULL, "genlist2", ELM_WIN_BASIC);
460 elm_win_title_set(win, "Genlist 2");
461 elm_win_autodel_set(win, EINA_TRUE);
463 bg = elm_bg_add(win);
464 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
465 elm_bg_file_set(bg, buf, NULL);
466 elm_win_resize_object_add(win, bg);
467 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
468 evas_object_show(bg);
470 bx = elm_box_add(win);
471 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
472 elm_win_resize_object_add(win, bx);
473 evas_object_show(bx);
475 gl = elm_genlist_add(win);
476 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
477 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
478 evas_object_show(gl);
480 itc1 = elm_genlist_item_class_new();
481 itc1->item_style = "default";
482 itc1->func.text_get = gl_text_get;
483 itc1->func.content_get = gl_content_get;
484 itc1->func.state_get = gl_state_get;
485 itc1->func.del = NULL;
487 gli[0] = elm_genlist_item_append(gl, itc1,
488 (void *)1001/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
489 (void *)1001/* func data */);
490 gli[1] = elm_genlist_item_append(gl, itc1,
491 (void *)1002/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
492 (void *)1002/* func data */);
493 gli[2] = elm_genlist_item_append(gl, itc1,
494 (void *)1003/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
495 (void *)1003/* func data */);
496 gli[3] = elm_genlist_item_prepend(gl, itc1,
497 (void *)1004/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
498 (void *)1004/* func data */);
499 gli[4] = elm_genlist_item_prepend(gl, itc1,
500 (void *)1005/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
501 (void *)1005/* func data */);
502 gli[5] = elm_genlist_item_insert_before(gl, itc1,
503 (void *)1006/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
504 gl_sel/* func */, (void *)1006/* func data */);
505 gli[6] = elm_genlist_item_insert_after(gl, itc1,
506 (void *)1007/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
507 gl_sel/* func */, (void *)1007/* func data */);
508 elm_box_pack_end(bx, gl);
510 bx2 = elm_box_add(win);
511 elm_box_horizontal_set(bx2, EINA_TRUE);
512 elm_box_homogeneous_set(bx2, EINA_TRUE);
513 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
514 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
516 bt = elm_button_add(win);
517 elm_object_text_set(bt, "/\\");
518 evas_object_smart_callback_add(bt, "clicked", my_gl_first, gl);
519 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
520 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
521 elm_box_pack_end(bx2, bt);
522 evas_object_show(bt);
524 bt = elm_button_add(win);
525 elm_object_text_set(bt, "\\/");
526 evas_object_smart_callback_add(bt, "clicked", my_gl_last, gl);
527 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
528 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
529 elm_box_pack_end(bx2, bt);
530 evas_object_show(bt);
532 bt = elm_button_add(win);
533 elm_object_text_set(bt, "#");
534 evas_object_smart_callback_add(bt, "clicked", my_gl_disable, gl);
535 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
536 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
537 elm_box_pack_end(bx2, bt);
538 evas_object_show(bt);
540 bt = elm_button_add(win);
541 elm_object_text_set(bt, "U");
542 evas_object_smart_callback_add(bt, "clicked", my_gl_update_all, gl);
543 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
544 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
545 elm_box_pack_end(bx2, bt);
546 evas_object_show(bt);
548 elm_box_pack_end(bx, bx2);
549 evas_object_show(bx2);
551 bx2 = elm_box_add(win);
552 elm_box_horizontal_set(bx2, EINA_TRUE);
553 elm_box_homogeneous_set(bx2, EINA_TRUE);
554 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
555 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
557 bt = elm_button_add(win);
558 elm_object_text_set(bt, "X");
559 evas_object_smart_callback_add(bt, "clicked", my_gl_clear, gl);
560 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
561 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
562 elm_box_pack_end(bx2, bt);
563 evas_object_show(bt);
565 bt = elm_button_add(win);
566 elm_object_text_set(bt, "+");
567 evas_object_smart_callback_add(bt, "clicked", my_gl_add, gl);
568 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
569 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
570 elm_box_pack_end(bx2, bt);
571 evas_object_show(bt);
573 bt = elm_button_add(win);
574 elm_object_text_set(bt, "-");
575 evas_object_smart_callback_add(bt, "clicked", my_gl_del, gl);
576 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
577 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
578 elm_box_pack_end(bx2, bt);
579 evas_object_show(bt);
581 elm_box_pack_end(bx, bx2);
582 evas_object_show(bx2);
584 bx3 = elm_box_add(win);
585 elm_box_horizontal_set(bx3, EINA_TRUE);
586 elm_box_homogeneous_set(bx3, EINA_TRUE);
587 evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0);
588 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL);
590 bt = elm_button_add(win);
591 elm_object_text_set(bt, "+ before");
592 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_before, gl);
593 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
594 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
595 elm_box_pack_end(bx3, bt);
596 evas_object_show(bt);
598 bt = elm_button_add(win);
599 elm_object_text_set(bt, "+ after");
600 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_after, gl);
601 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
602 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
603 elm_box_pack_end(bx3, bt);
604 evas_object_show(bt);
606 bt = elm_button_add(win);
607 elm_object_text_set(bt, "Flush");
608 evas_object_smart_callback_add(bt, "clicked", my_gl_flush, gl);
609 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
610 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
611 elm_box_pack_end(bx3, bt);
612 evas_object_show(bt);
614 elm_box_pack_end(bx, bx3);
615 evas_object_show(bx3);
617 /* item_class_ref is needed for itc1. some items can be added in callbacks */
618 elm_genlist_item_class_ref(itc1);
619 elm_genlist_item_class_free(itc1);
621 evas_object_resize(win, 320, 320);
622 evas_object_show(win);
627 static Elm_Genlist_Item_Class itc2;
629 char *gl2_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
631 const Testitem *tit = data;
633 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
637 Evas_Object *gl2_content_get(void *data, Evas_Object *obj, const char *part)
639 const Testitem *tit = data;
641 Evas_Object *ic = elm_icon_add(obj);
642 if (!strcmp(part, "elm.swallow.icon"))
644 if (!(tit->mode & 0x3))
645 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
646 else if ((tit->mode & 0x3) == 1)
647 snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
648 else if ((tit->mode & 0x3) == 2)
649 snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", elm_app_data_dir_get());
650 else if ((tit->mode & 0x3) == 3)
651 snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get());
652 elm_icon_file_set(ic, buf, NULL);
654 else if (!strcmp(part, "elm.swallow.end"))
656 if (!(tit->mode & 0x3))
657 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
658 else if ((tit->mode & 0x3) == 1)
659 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
660 else if ((tit->mode & 0x3) == 2)
661 snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", elm_app_data_dir_get());
662 else if ((tit->mode & 0x3) == 3)
663 snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", elm_app_data_dir_get());
664 elm_icon_file_set(ic, buf, NULL);
666 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
670 Eina_Bool gl2_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
676 my_gl_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
678 Testitem *tit = data;
680 elm_genlist_item_update(tit->item);
684 my_gl_labels_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
686 Testitem *tit = data;
688 elm_genlist_item_fields_update(tit->item, "*", ELM_GENLIST_ITEM_FIELD_LABEL);
692 my_gl_contents_update(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
694 Testitem *tit = data;
696 elm_genlist_item_fields_update(tit->item, "*", ELM_GENLIST_ITEM_FIELD_CONTENT);
700 test_genlist3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
702 Evas_Object *win, *gl, *bx, *bx2, *bt;
703 static Testitem tit[3];
705 win = elm_win_util_standard_add("genlist3", "Genlist 3");
706 elm_win_autodel_set(win, EINA_TRUE);
708 bx = elm_box_add(win);
709 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
710 elm_win_resize_object_add(win, bx);
711 evas_object_show(bx);
713 gl = elm_genlist_add(win);
714 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
715 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
716 evas_object_show(gl);
718 itc2.item_style = "default";
719 itc2.func.text_get = gl2_text_get;
720 itc2.func.content_get = gl2_content_get;
721 itc2.func.state_get = gl2_state_get;
722 itc2.func.del = NULL;
725 tit[0].item = elm_genlist_item_append(gl, &itc2,
726 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
727 NULL/* func data */);
729 tit[1].item = elm_genlist_item_append(gl, &itc2,
730 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
731 NULL/* func data */);
733 tit[2].item = elm_genlist_item_append(gl, &itc2,
734 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
735 NULL/* func data */);
737 elm_box_pack_end(bx, gl);
738 evas_object_show(bx);
740 bx2 = elm_box_add(win);
741 elm_box_horizontal_set(bx2, EINA_TRUE);
742 elm_box_homogeneous_set(bx2, EINA_TRUE);
743 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
744 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
746 bt = elm_button_add(win);
747 elm_object_text_set(bt, "[1]");
748 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
749 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
750 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
751 elm_box_pack_end(bx2, bt);
752 evas_object_show(bt);
754 bt = elm_button_add(win);
755 elm_object_text_set(bt, "labels");
756 evas_object_smart_callback_add(bt, "clicked", my_gl_labels_update, &(tit[1]));
757 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
758 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
759 elm_box_pack_end(bx2, bt);
760 evas_object_show(bt);
762 bt = elm_button_add(win);
763 elm_object_text_set(bt, "contents");
764 evas_object_smart_callback_add(bt, "clicked", my_gl_contents_update, &(tit[2]));
765 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
766 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
767 elm_box_pack_end(bx2, bt);
768 evas_object_show(bt);
770 elm_box_pack_end(bx, bx2);
771 evas_object_show(bx2);
773 evas_object_resize(win, 320, 320);
774 evas_object_show(win);
780 my_gl_item_check_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__)
782 Testitem *tit = data;
783 tit->onoff = elm_check_state_get(obj);
784 printf("item %p onoff = %i\n", tit, tit->onoff);
787 static Elm_Genlist_Item_Class itc3;
789 char *gl3_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
791 const Testitem *tit = data;
793 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
797 Evas_Object *gl3_content_get(void *data, Evas_Object *obj, const char *part)
799 const Testitem *tit = data;
800 if (!strcmp(part, "elm.swallow.icon"))
804 lb = elm_label_add(obj);
805 elm_label_line_wrap_set(lb, ELM_WRAP_CHAR);
806 elm_label_wrap_width_set(lb, 201);
807 elm_object_text_set(lb, "ashj ascjscjh n asjkl hcjlh ls hzshnn zjh sh zxjcjsnd h dfw sdv edev efe fwefvv vsd cvs ws wf fvwf wd fwe f we wef we wfe rfwewef wfv wswf wefg sdfws w wsdcfwcf wsc vdv sdsd sdcd cv wsc sdcv wsc d sdcdcsd sdcdsc wdvd sdcsd wscxcv wssvd sd");
810 else if (!strcmp(part, "elm.swallow.end"))
813 ck = elm_check_add(obj);
814 evas_object_propagate_events_set(ck, EINA_FALSE);
815 elm_check_state_set(ck, tit->onoff);
816 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed, data);
822 Eina_Bool gl3_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
828 test_genlist4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
830 Evas_Object *win, *gl, *bx, *bx2, *bt;
831 static Testitem tit[3];
833 win = elm_win_util_standard_add("genlist4", "Genlist 4");
834 elm_win_autodel_set(win, EINA_TRUE);
836 bx = elm_box_add(win);
837 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
838 elm_win_resize_object_add(win, bx);
839 evas_object_show(bx);
841 gl = elm_genlist_add(win);
842 elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
843 elm_genlist_multi_select_set(gl, 1);
844 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
845 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
846 evas_object_show(gl);
848 itc3.item_style = "default";
849 itc3.func.text_get = gl3_text_get;
850 itc3.func.content_get = gl3_content_get;
851 itc3.func.state_get = gl3_state_get;
852 itc3.func.del = NULL;
855 tit[0].item = elm_genlist_item_append(gl, &itc3,
856 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
857 NULL/* func data */);
859 tit[1].item = elm_genlist_item_append(gl, &itc3,
860 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
861 NULL/* func data */);
863 tit[2].item = elm_genlist_item_append(gl, &itc3,
864 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
865 NULL/* func data */);
867 elm_box_pack_end(bx, gl);
868 evas_object_show(bx);
870 bx2 = elm_box_add(win);
871 elm_box_horizontal_set(bx2, EINA_TRUE);
872 elm_box_homogeneous_set(bx2, EINA_TRUE);
873 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
874 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
876 bt = elm_button_add(win);
877 elm_object_text_set(bt, "[1]");
878 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
879 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
880 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
881 elm_box_pack_end(bx2, bt);
882 evas_object_show(bt);
884 bt = elm_button_add(win);
885 elm_object_text_set(bt, "[2]");
886 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
887 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
888 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
889 elm_box_pack_end(bx2, bt);
890 evas_object_show(bt);
892 bt = elm_button_add(win);
893 elm_object_text_set(bt, "[3]");
894 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
895 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
896 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
897 elm_box_pack_end(bx2, bt);
898 evas_object_show(bt);
900 elm_box_pack_end(bx, bx2);
901 evas_object_show(bx2);
903 evas_object_resize(win, 320, 320);
904 evas_object_show(win);
910 my_gl_item_check_changed2(void *data, Evas_Object *obj, void *event_info __UNUSED__)
912 Testitem *tit = data;
913 tit->onoff = elm_check_state_get(obj);
914 printf("item %p onoff = %i\n", tit, tit->onoff);
917 static Elm_Genlist_Item_Class itc5;
919 char *gl5_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
921 const Testitem *tit = data;
923 if (!strcmp(part, "elm.text"))
925 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
927 else if (!strcmp(part, "elm.text.sub"))
929 snprintf(buf, sizeof(buf), "%i bottles on the wall", tit->mode);
934 Evas_Object *gl5_content_get(void *data, Evas_Object *obj, const char *part)
936 const Testitem *tit = data;
938 if (!strcmp(part, "elm.swallow.icon"))
940 Evas_Object *bx = elm_box_add(obj);
942 elm_box_horizontal_set(bx, EINA_TRUE);
943 ic = elm_icon_add(obj);
944 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
945 elm_icon_file_set(ic, buf, NULL);
946 elm_icon_scale_set(ic, 0, 0);
947 evas_object_show(ic);
948 elm_box_pack_end(bx, ic);
949 ic = elm_icon_add(obj);
950 elm_icon_file_set(ic, buf, NULL);
951 elm_icon_scale_set(ic, 0, 0);
952 evas_object_show(ic);
953 elm_box_pack_end(bx, ic);
954 elm_box_horizontal_set(bx, EINA_TRUE);
955 evas_object_show(bx);
958 else if (!strcmp(part, "elm.swallow.end"))
961 ck = elm_check_add(obj);
962 evas_object_propagate_events_set(ck, EINA_FALSE);
963 elm_check_state_set(ck, tit->onoff);
964 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed2, data);
965 evas_object_show(ck);
971 Eina_Bool gl5_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
977 item_drag_up(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
983 item_drag_down(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
985 printf("drag down\n");
989 item_drag_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
991 printf("drag left\n");
995 item_drag_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
997 printf("drag right\n");
1001 scroll_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1003 printf("Top edge!\n");
1007 scroll_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1009 printf("Bottom edge!\n");
1013 scroll_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1015 printf("Left edge!\n");
1019 scroll_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1021 printf("Right edge!\n");
1025 item_drag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1031 item_drag_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1033 printf("drag stop\n");
1037 item_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1039 printf("longpress\n");
1043 test_genlist5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1045 Evas_Object *win, *gl, *bx, *bx2, *bt;
1046 static Testitem tit[3];
1048 win = elm_win_util_standard_add("genlist5", "Genlist 5");
1049 elm_win_autodel_set(win, EINA_TRUE);
1051 bx = elm_box_add(win);
1052 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1053 elm_win_resize_object_add(win, bx);
1054 evas_object_show(bx);
1056 gl = elm_genlist_add(win);
1057 elm_genlist_always_select_mode_set(gl, 1);
1058 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1059 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1060 evas_object_show(gl);
1061 itc5.item_style = "double_label";
1062 itc5.func.text_get = gl5_text_get;
1063 itc5.func.content_get = gl5_content_get;
1064 itc5.func.state_get = gl5_state_get;
1065 itc5.func.del = NULL;
1068 tit[0].item = elm_genlist_item_append(gl, &itc5,
1069 &(tit[0])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
1070 NULL/* func data */);
1072 tit[1].item = elm_genlist_item_append(gl, &itc5,
1073 &(tit[1])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
1074 NULL/* func data */);
1076 tit[2].item = elm_genlist_item_append(gl, &itc5,
1077 &(tit[2])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
1078 NULL/* func data */);
1080 elm_box_pack_end(bx, gl);
1081 evas_object_show(bx);
1083 evas_object_smart_callback_add(gl, "drag,start,up", item_drag_up, NULL);
1084 evas_object_smart_callback_add(gl, "drag,start,down", item_drag_down, NULL);
1085 evas_object_smart_callback_add(gl, "drag,start,left", item_drag_left, NULL);
1086 evas_object_smart_callback_add(gl, "drag,start,right", item_drag_right, NULL);
1087 evas_object_smart_callback_add(gl, "scroll,edge,top", scroll_top, NULL);
1088 evas_object_smart_callback_add(gl, "scroll,edge,bottom", scroll_bottom, NULL);
1089 evas_object_smart_callback_add(gl, "scroll,edge,left", scroll_left, NULL);
1090 evas_object_smart_callback_add(gl, "scroll,edge,right", scroll_right, NULL);
1091 evas_object_smart_callback_add(gl, "drag", item_drag, NULL);
1092 evas_object_smart_callback_add(gl, "drag,stop", item_drag_stop, NULL);
1093 evas_object_smart_callback_add(gl, "longpressed", item_longpress, NULL);
1095 bx2 = elm_box_add(win);
1096 elm_box_horizontal_set(bx2, EINA_TRUE);
1097 elm_box_homogeneous_set(bx2, EINA_TRUE);
1098 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1099 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1101 bt = elm_button_add(win);
1102 elm_object_text_set(bt, "[1]");
1103 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
1104 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1105 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1106 elm_box_pack_end(bx2, bt);
1107 evas_object_show(bt);
1109 bt = elm_button_add(win);
1110 elm_object_text_set(bt, "[2]");
1111 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1112 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1113 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1114 elm_box_pack_end(bx2, bt);
1115 evas_object_show(bt);
1117 bt = elm_button_add(win);
1118 elm_object_text_set(bt, "[3]");
1119 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1120 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1121 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1122 elm_box_pack_end(bx2, bt);
1123 evas_object_show(bt);
1125 elm_box_pack_end(bx, bx2);
1126 evas_object_show(bx2);
1128 evas_object_resize(win, 320, 320);
1129 evas_object_show(win);
1134 static Elm_Genlist_Item_Class itc4;
1137 gl4_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1139 Elm_Object_Item *glit = event_info;
1140 int depth = elm_genlist_item_expanded_depth_get(glit);
1141 printf("expanded depth for selected item is %d\n", depth);
1145 gl4_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1147 Elm_Object_Item *glit = event_info;
1148 Evas_Object *gl = elm_object_item_widget_get(glit);
1149 int val = (int)(long) elm_object_item_data_get(glit);
1151 elm_genlist_item_append(gl, &itc4,
1152 (void *)(long) (val + 1)/* item data */,
1153 glit/* parent */, ELM_GENLIST_ITEM_NONE,
1155 NULL/* func data */);
1156 elm_genlist_item_append(gl, &itc4,
1157 (void *)(long) (val + 2)/* item data */,
1158 glit/* parent */, ELM_GENLIST_ITEM_NONE,
1160 NULL/* func data */);
1161 elm_genlist_item_append(gl, &itc4,
1162 (void *)(long) (val + 3)/* item data */,
1164 ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1165 NULL/* func data */);
1168 gl4_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1170 Elm_Object_Item *glit = event_info;
1171 elm_genlist_item_subitems_clear(glit);
1175 gl4_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1177 Elm_Object_Item *glit = event_info;
1178 elm_genlist_item_expanded_set(glit, EINA_TRUE);
1182 gl4_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1184 Elm_Object_Item *glit = event_info;
1185 elm_genlist_item_expanded_set(glit, EINA_FALSE);
1188 char *gl4_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1191 snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data);
1195 Evas_Object *gl4_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1198 if (!strcmp(part, "elm.swallow.icon"))
1200 Evas_Object *ic = elm_icon_add(obj);
1201 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
1202 elm_icon_file_set(ic, buf, NULL);
1203 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1204 evas_object_show(ic);
1207 else if (!strcmp(part, "elm.swallow.end"))
1210 ck = elm_check_add(obj);
1211 evas_object_propagate_events_set(ck, EINA_FALSE);
1212 evas_object_show(ck);
1218 Eina_Bool gl4_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1223 void gl4_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
1225 printf("item deleted.\n");
1229 test_genlist6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1231 Evas_Object *win, *gl, *bx, *bx2, *bt;
1233 win = elm_win_util_standard_add("genlist-tree", "Genlist Tree");
1234 elm_win_autodel_set(win, EINA_TRUE);
1236 bx = elm_box_add(win);
1237 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1238 elm_win_resize_object_add(win, bx);
1239 evas_object_show(bx);
1241 gl = elm_genlist_add(win);
1242 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1243 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1244 evas_object_show(gl);
1246 itc4.item_style = "default";
1247 itc4.func.text_get = gl4_text_get;
1248 itc4.func.content_get = gl4_content_get;
1249 itc4.func.state_get = gl4_state_get;
1250 itc4.func.del = gl4_del;
1252 elm_genlist_item_append(gl, &itc4,
1253 (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1254 NULL/* func data */);
1255 elm_genlist_item_append(gl, &itc4,
1256 (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1257 NULL/* func data */);
1258 elm_genlist_item_append(gl, &itc4,
1259 (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1260 NULL/* func data */);
1262 evas_object_smart_callback_add(gl, "expand,request", gl4_exp_req, gl);
1263 evas_object_smart_callback_add(gl, "contract,request", gl4_con_req, gl);
1264 evas_object_smart_callback_add(gl, "expanded", gl4_exp, gl);
1265 evas_object_smart_callback_add(gl, "contracted", gl4_con, gl);
1267 elm_box_pack_end(bx, gl);
1268 evas_object_show(bx);
1270 bx2 = elm_box_add(win);
1271 elm_box_horizontal_set(bx2, EINA_TRUE);
1272 elm_box_homogeneous_set(bx2, EINA_TRUE);
1273 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1274 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1276 bt = elm_button_add(win);
1277 elm_object_text_set(bt, "[1]");
1278 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
1279 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1280 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1281 elm_box_pack_end(bx2, bt);
1282 evas_object_show(bt);
1284 bt = elm_button_add(win);
1285 elm_object_text_set(bt, "[2]");
1286 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
1287 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1288 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1289 elm_box_pack_end(bx2, bt);
1290 evas_object_show(bt);
1292 bt = elm_button_add(win);
1293 elm_object_text_set(bt, "[3]");
1294 // evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[2]));
1295 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
1296 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1297 elm_box_pack_end(bx2, bt);
1298 evas_object_show(bt);
1300 elm_box_pack_end(bx, bx2);
1301 evas_object_show(bx2);
1303 evas_object_resize(win, 320, 320);
1304 evas_object_show(win);
1309 struct genlist7_data
1311 Evas_Object *win, *naviframe;
1314 static Elm_Genlist_Item_Class itc7;
1317 gl_sel7(void *data, Evas_Object *obj, void *event_info)
1319 if (!event_info) return;
1320 elm_genlist_item_item_class_update(event_info, &itc7);
1321 printf("sel item data [%p] on genlist obj [%p], item pointer [%p], new item style [%s] \n", data, obj, event_info, itc7.item_style);
1325 test_genlist7_back_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1327 struct genlist7_data *info = data;
1330 elm_naviframe_item_pop(info->naviframe);
1334 test_genlist7_swipe(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1336 struct genlist7_data *info = data;
1337 Evas_Object *box, *entry, *button;
1338 char item_data[] = "Just a simple test";
1340 if ((!event_info) || (!data)) return;
1342 box = elm_box_add(info->win);
1343 elm_box_homogeneous_set(box, EINA_FALSE);
1344 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1345 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
1346 evas_object_show(box);
1348 entry = elm_entry_add(info->win);
1349 elm_entry_scrollable_set(entry, EINA_TRUE);
1350 elm_entry_editable_set(entry, EINA_FALSE);
1351 elm_object_text_set(entry, item_data);
1352 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1353 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
1354 evas_object_show(entry);
1356 button = elm_button_add(info->win);
1357 elm_object_text_set(button, "back");
1358 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
1359 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0);
1360 evas_object_smart_callback_add(button, "clicked", test_genlist7_back_cb,
1362 evas_object_show(button);
1364 elm_box_pack_start(box, entry);
1365 elm_box_pack_end(box, button);
1367 elm_naviframe_item_simple_push(info->naviframe, box);
1371 test_genlist7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1373 Evas_Object *win, *gl, *naviframe;
1374 static struct genlist7_data info;
1375 static Testitem tit[3];
1377 win = elm_win_util_standard_add("genlist7", "Genlist 7");
1378 elm_win_autodel_set(win, EINA_TRUE);
1381 naviframe = elm_naviframe_add(win);
1382 elm_win_resize_object_add(win, naviframe);
1383 evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1384 evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL);
1385 evas_object_show(naviframe);
1386 info.naviframe = naviframe;
1388 gl = elm_genlist_add(win);
1389 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1390 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1391 evas_object_smart_callback_add(gl, "swipe", test_genlist7_swipe, &info);
1392 evas_object_show(gl);
1393 elm_naviframe_item_simple_push(naviframe, gl);
1395 itc2.item_style = "default";
1396 itc2.func.text_get = gl2_text_get;
1397 itc2.func.content_get = gl2_content_get;
1398 itc2.func.state_get = gl2_state_get;
1399 itc2.func.del = NULL;
1401 itc7.item_style = "double_label";
1402 itc7.func.text_get = gl5_text_get;
1403 itc7.func.content_get = gl5_content_get;
1404 itc7.func.state_get = gl5_state_get;
1405 itc7.func.del = NULL;
1408 tit[0].item = elm_genlist_item_append(gl, &itc2,
1409 &(tit[0])/* item data */, NULL/* parent */,
1410 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1411 NULL/* func data */);
1413 tit[1].item = elm_genlist_item_append(gl, &itc2,
1414 &(tit[1])/* item data */, NULL/* parent */,
1415 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1416 NULL/* func data */);
1418 tit[2].item = elm_genlist_item_append(gl, &itc2,
1419 &(tit[2])/* item data */, NULL/* parent */,
1420 ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
1421 NULL/* func data */);
1423 evas_object_resize(win, 320, 320);
1424 evas_object_show(win);
1429 static Elm_Genlist_Item_Class itc_group;
1431 char *gl8_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1434 snprintf(buf, sizeof(buf), "Group Index # %i (Item # %i)", (int)((long)data / 10), (int)(long)data);
1439 _bt_show_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1441 elm_genlist_item_top_show(data);
1442 //elm_genlist_item_show(data);
1443 //elm_genlist_item_middle_show(data);
1447 _bt_bring_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1449 elm_genlist_item_top_bring_in(data);
1450 //elm_genlist_item_bring_in(data);
1451 //elm_genlist_item_middle_bring_in(data);
1455 test_genlist8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1457 Evas_Object *win, *gl, *bt[8], *bx, *bx2, *bx3;
1458 Elm_Object_Item *gli = NULL, *git = NULL;
1461 win = elm_win_util_standard_add("genlist-group", "Genlist Group");
1462 elm_win_autodel_set(win, EINA_TRUE);
1464 bx = elm_box_add(win);
1465 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1466 elm_win_resize_object_add(win, bx);
1467 evas_object_show(bx);
1469 gl = elm_genlist_add(win);
1470 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1471 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1472 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1473 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1474 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1475 elm_box_pack_end(bx, gl);
1476 evas_object_show(gl);
1478 itc1 = elm_genlist_item_class_new();
1479 itc1->item_style = "default";
1480 itc1->func.text_get = gl_text_get;
1481 itc1->func.content_get = gl_content_get;
1482 itc1->func.state_get = gl_state_get;
1483 itc1->func.del = NULL;
1485 itc_group.item_style = "group_index";
1486 itc_group.func.text_get = gl8_text_get;
1487 itc_group.func.content_get = NULL;
1488 itc_group.func.state_get = NULL;
1489 itc_group.func.del = NULL;
1491 bx2 = elm_box_add(win);
1492 elm_box_horizontal_set(bx2, EINA_TRUE);
1493 elm_box_homogeneous_set(bx2, EINA_TRUE);
1494 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
1495 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1498 bt[bt_num] = elm_button_add(win);
1499 elm_object_text_set(bt[bt_num], "Show 0");
1500 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1501 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1502 evas_object_show(bt[bt_num]);
1503 elm_box_pack_end(bx2, bt[bt_num]);
1505 bt[++bt_num] = elm_button_add(win);
1506 elm_object_text_set(bt[bt_num], "Show 26");
1507 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1508 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1509 evas_object_show(bt[bt_num]);
1510 elm_box_pack_end(bx2, bt[bt_num]);
1512 bt[++bt_num] = elm_button_add(win);
1513 elm_object_text_set(bt[bt_num], "Show 101");
1514 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1515 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1516 evas_object_show(bt[bt_num]);
1517 elm_box_pack_end(bx2, bt[bt_num]);
1519 bt[++bt_num] = elm_button_add(win);
1520 elm_object_text_set(bt[bt_num], "Show 480");
1521 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1522 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1523 evas_object_show(bt[bt_num]);
1524 elm_box_pack_end(bx2, bt[bt_num]);
1526 elm_box_pack_end(bx, bx2);
1527 evas_object_show(bx2);
1529 bx3 = elm_box_add(win);
1530 elm_box_horizontal_set(bx3, EINA_TRUE);
1531 elm_box_homogeneous_set(bx3, EINA_TRUE);
1532 evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0);
1533 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL);
1535 bt[++bt_num] = elm_button_add(win);
1536 elm_object_text_set(bt[bt_num], "Bring top 0");
1537 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1538 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1539 evas_object_show(bt[bt_num]);
1540 elm_box_pack_end(bx3, bt[bt_num]);
1542 bt[++bt_num] = elm_button_add(win);
1543 elm_object_text_set(bt[bt_num], "Bring top 31");
1544 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1545 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1546 evas_object_show(bt[bt_num]);
1547 elm_box_pack_end(bx3, bt[bt_num]);
1549 bt[++bt_num] = elm_button_add(win);
1550 elm_object_text_set(bt[bt_num], "Bring top 239");
1551 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1552 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1553 evas_object_show(bt[bt_num]);
1554 elm_box_pack_end(bx3, bt[bt_num]);
1556 bt[++bt_num] = elm_button_add(win);
1557 elm_object_text_set(bt[bt_num], "Bring top 477");
1558 evas_object_size_hint_align_set(bt[bt_num], EVAS_HINT_FILL, EVAS_HINT_FILL);
1559 evas_object_size_hint_weight_set(bt[bt_num], EVAS_HINT_EXPAND, 0.0);
1560 evas_object_show(bt[bt_num]);
1561 elm_box_pack_end(bx3, bt[bt_num]);
1563 elm_box_pack_end(bx, bx3);
1564 evas_object_show(bx3);
1566 for (i = 0; i < 500; i++)
1570 gli = git = elm_genlist_item_append(gl, &itc_group,
1571 (void *)(long)i/* item data */,
1573 ELM_GENLIST_ITEM_GROUP,
1575 (void *)(long)(i * 10)/* func data */);
1576 elm_genlist_item_display_only_set(git, EINA_TRUE);
1580 gli = elm_genlist_item_append(gl, itc1,
1581 (void *)(long)i/* item data */,
1583 ELM_GENLIST_ITEM_NONE,
1585 (void *)(long)(i * 10)/* func data */);
1590 evas_object_smart_callback_add(bt[0], "clicked", _bt_show_cb, gli);
1591 evas_object_smart_callback_add(bt[4], "clicked", _bt_bring_cb, gli);
1594 evas_object_smart_callback_add(bt[1], "clicked", _bt_show_cb, gli);
1597 evas_object_smart_callback_add(bt[5], "clicked", _bt_bring_cb, gli);
1600 evas_object_smart_callback_add(bt[2], "clicked", _bt_show_cb, gli);
1603 evas_object_smart_callback_add(bt[6], "clicked", _bt_bring_cb, gli);
1606 evas_object_smart_callback_add(bt[7], "clicked", _bt_bring_cb, gli);
1609 evas_object_smart_callback_add(bt[3], "clicked", _bt_show_cb, gli);
1613 elm_genlist_item_class_free(itc1);
1615 evas_object_resize(win, 480, 800);
1616 evas_object_show(win);
1622 gl9_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1624 Elm_Object_Item *glit = event_info;
1625 Evas_Object *gl = elm_object_item_widget_get(glit);
1626 int val = (int)(long) elm_object_item_data_get(glit);
1628 elm_genlist_item_append(gl, itc1,
1629 (void *)(long) (val + 1)/* item data */,
1631 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1632 NULL/* func data */);
1633 elm_genlist_item_append(gl, itc1,
1634 (void *)(long) (val + 2)/* item data */,
1636 ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1637 NULL/* func data */);
1638 elm_genlist_item_append(gl, itc1,
1639 (void *)(long) (val + 3)/* item data */,
1641 ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1642 NULL/* func data */);
1646 gl9_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1648 Elm_Object_Item *glit = event_info;
1649 elm_genlist_item_subitems_clear(glit);
1653 gl9_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1655 Elm_Object_Item *glit = event_info;
1656 elm_genlist_item_expanded_set(glit, EINA_TRUE);
1660 gl9_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1662 Elm_Object_Item *glit = event_info;
1663 elm_genlist_item_expanded_set(glit, EINA_FALSE);
1667 test_genlist9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1669 Evas_Object *win, *gl, *bx;
1670 Elm_Object_Item *git;
1672 win = elm_win_util_standard_add("genlist-group-tree", "Genlist Group Tree");
1673 elm_win_autodel_set(win, EINA_TRUE);
1675 bx = elm_box_add(win);
1676 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1677 elm_win_resize_object_add(win, bx);
1678 evas_object_show(bx);
1680 gl = elm_genlist_add(win);
1681 evas_object_smart_callback_add(gl, "selected", _gl_selected, NULL);
1682 evas_object_smart_callback_add(gl, "clicked,double", _gl_double_clicked, NULL);
1683 evas_object_smart_callback_add(gl, "longpressed", _gl_longpress, NULL);
1684 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1685 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1686 elm_box_pack_end(bx, gl);
1687 evas_object_show(gl);
1689 itc1 = elm_genlist_item_class_new();
1690 itc1->item_style = "default";
1691 itc1->func.text_get = gl_text_get;
1692 itc1->func.content_get = gl_content_get;
1693 itc1->func.state_get = gl_state_get;
1694 itc1->func.del = NULL;
1696 itc_group.item_style = "group_index";
1697 itc_group.func.text_get = gl8_text_get;
1698 itc_group.func.content_get = NULL;
1699 itc_group.func.state_get = NULL;
1700 itc_group.func.del = NULL;
1702 git = elm_genlist_item_append(gl, &itc_group,
1703 (void *)0/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1704 NULL/* func data */);
1705 elm_genlist_item_display_only_set(git, EINA_TRUE);
1706 elm_genlist_item_append(gl, itc1,
1707 (void *)1/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1708 NULL/* func data */);
1709 elm_genlist_item_append(gl, itc1,
1710 (void *)2/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1711 NULL/* func data */);
1712 elm_genlist_item_append(gl, itc1,
1713 (void *)3/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1714 NULL/* func data */);
1715 git = elm_genlist_item_append(gl, &itc_group,
1716 (void *)4/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
1717 NULL/* func data */);
1718 elm_genlist_item_display_only_set(git, EINA_TRUE);
1719 elm_genlist_item_append(gl, itc1,
1720 (void *)5/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1721 NULL/* func data */);
1722 elm_genlist_item_append(gl, itc1,
1723 (void *)6/* item data */, git/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
1724 NULL/* func data */);
1725 elm_genlist_item_append(gl, itc1,
1726 (void *)7/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
1727 NULL/* func data */);
1728 elm_genlist_item_class_free(itc1);
1730 evas_object_smart_callback_add(gl, "expand,request", gl9_exp_req, gl);
1731 evas_object_smart_callback_add(gl, "contract,request", gl9_con_req, gl);
1732 evas_object_smart_callback_add(gl, "expanded", gl9_exp, gl);
1733 evas_object_smart_callback_add(gl, "contracted", gl9_con, gl);
1735 evas_object_resize(win, 480, 800);
1736 evas_object_show(win);
1741 static Elm_Genlist_Item_Class itc10;
1742 static char *mode_type[] = { "slide", "rotate" };
1744 char *gl10_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
1747 if (!strcmp(part, "elm.text.mode"))
1748 snprintf(buf, sizeof(buf), "Mode # %i", (int)(long)data);
1750 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
1754 Evas_Object *gl10_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
1757 Evas_Object *ic = elm_icon_add(obj);
1758 if (!strcmp(part, "elm.swallow.end"))
1759 snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get());
1761 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
1762 elm_icon_file_set(ic, buf, NULL);
1763 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1768 _gl_sel10(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1771 int v = elm_radio_value_get(data);
1773 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
1777 _my_gl_mode_right(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1780 int v = elm_radio_value_get(data);
1782 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
1786 _my_gl_mode_left(void *data, Evas_Object *obj __UNUSED__, void *event_info)
1789 int v = elm_radio_value_get(data);
1791 elm_genlist_item_mode_set(event_info, mode_type[v], EINA_FALSE);
1795 _my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1797 fprintf(stderr, "drag\n");
1799 int v = elm_radio_value_get(data);
1800 Elm_Object_Item *glit = (Elm_Object_Item *) elm_genlist_mode_item_get(obj);
1801 if (glit) elm_genlist_item_mode_set(glit, mode_type[v], EINA_FALSE);
1805 test_genlist10(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1807 Evas_Object *win, *fr, *lb, *bx, *bx2, *bx3, *rd, *rdg, *gl;
1810 win = elm_win_util_standard_add("genlist10", "Genlist Mode");
1811 elm_win_autodel_set(win, EINA_TRUE);
1813 bx = elm_box_add(win);
1814 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1815 elm_win_resize_object_add(win, bx);
1816 evas_object_show(bx);
1818 fr = elm_frame_add(win);
1819 elm_object_text_set(fr, "Mode Type");
1820 elm_box_pack_end(bx, fr);
1821 evas_object_show(fr);
1823 bx2 = elm_box_add(win);
1824 elm_object_content_set(fr, bx2);
1825 evas_object_show(bx2);
1827 lb = elm_label_add(win);
1828 elm_object_text_set(lb,
1829 "Sweep genlist items to the right.<br/>"
1830 "Test this by changing Mode Type to Slide or Rotate.");
1831 elm_box_pack_end(bx2, lb);
1832 evas_object_show(lb);
1834 bx3 = elm_box_add(win);
1835 elm_box_horizontal_set(bx3, EINA_TRUE);
1836 elm_box_pack_end(bx2, bx3);
1837 evas_object_show(bx3);
1839 rd = elm_radio_add(win);
1840 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1841 elm_radio_state_value_set(rd, 0);
1842 elm_object_text_set(rd, "Slide ");
1843 evas_object_show(rd);
1844 elm_box_pack_end(bx3, rd);
1847 rd = elm_radio_add(win);
1848 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1849 elm_radio_state_value_set(rd, 1);
1850 elm_object_text_set(rd, "Rotate");
1851 elm_radio_group_add(rd, rdg);
1852 evas_object_show(rd);
1853 elm_box_pack_end(bx3, rd);
1855 gl = elm_genlist_add(win);
1856 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1857 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1858 evas_object_smart_callback_add(gl, "drag,start,right", _my_gl_mode_right, rdg);
1859 evas_object_smart_callback_add(gl, "drag,start,left", _my_gl_mode_left, rdg);
1860 evas_object_smart_callback_add(gl, "drag,start,up", _my_gl_mode_cancel, rdg);
1861 evas_object_smart_callback_add(gl, "drag,start,down", _my_gl_mode_cancel, rdg);
1862 evas_object_show(gl);
1864 itc10.item_style = "default";
1865 itc10.mode_item_style = "mode";
1866 itc10.func.text_get = gl10_text_get;
1867 itc10.func.content_get = gl10_content_get;
1868 itc10.func.state_get = gl_state_get;
1869 itc10.func.del = NULL;
1871 for (i = 0; i < 50; i++)
1872 elm_genlist_item_append(gl,
1874 (void *)(long)(1000 + i)/* item data */,
1876 ELM_GENLIST_ITEM_NONE/* flags */,
1877 _gl_sel10/* func */,
1878 rdg/* func data */);
1880 elm_box_pack_end(bx, gl);
1882 evas_object_resize(win, 520, 520);
1883 evas_object_show(win);
1889 _reorder_tg_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1891 elm_genlist_reorder_mode_set(data, elm_check_state_get(obj));
1895 * gl_moved is called after an item was reordered.
1896 * This is only called when reorder mode is enabled.
1898 * @param data : the genlist object passed as data.
1899 * @param obj : the genlist object.
1900 * @param item : the moved item.
1902 * If the move_after is true,
1903 * the item(*item) had been moved after the given relative item(*rel_item) in list.
1904 * If the move_after is false,
1905 * the item(*item) had been moved before the given relative item(*rel_item) in list.
1908 static void gl_moved(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__)
1910 // if needed, add application logic.
1914 test_genlist11(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1916 Evas_Object *win, *fr, *lb, *bx, *tg, *gl;
1919 win = elm_win_util_standard_add("genlist-reorder-mode", "Genlist Reorder Mode");
1920 elm_win_autodel_set(win, EINA_TRUE);
1922 bx = elm_box_add(win);
1923 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1924 elm_win_resize_object_add(win, bx);
1925 evas_object_show(bx);
1927 fr = elm_frame_add(win);
1929 elm_object_text_set(fr, "Reorder Mode");
1930 elm_box_pack_end(bx, fr);
1931 evas_object_show(fr);
1933 lb = elm_label_add(win);
1934 elm_object_text_set(lb,
1935 "Enable reorder mode if you want to move item.<br/>"
1936 "Then long press and drag item.");
1937 elm_object_content_set(fr, lb);
1938 evas_object_show(lb);
1940 gl = elm_genlist_add(win);
1941 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1942 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1943 evas_object_show(gl);
1945 tg = elm_check_add(win);
1946 elm_object_style_set(tg, "toggle");
1947 elm_object_text_set(tg, "Reorder Mode:");
1948 elm_check_state_set(tg, elm_mirrored_get());
1949 evas_object_smart_callback_add(tg, "changed", _reorder_tg_changed_cb, gl);
1950 elm_box_pack_end(bx, tg);
1951 evas_object_show(tg);
1953 itc1 = elm_genlist_item_class_new();
1954 itc1->item_style = "default";
1955 itc1->func.text_get = gl_text_get;
1956 itc1->func.content_get = gl_content_get;
1957 itc1->func.state_get = gl_state_get;
1958 itc1->func.del = NULL;
1959 evas_object_smart_callback_add(gl, "moved", (Evas_Smart_Cb)gl_moved, gl);
1961 for (i = 0; i < 50; i++)
1962 elm_genlist_item_append(gl,
1964 (void *)(long)(1 + i)/* item data */,
1966 ELM_GENLIST_ITEM_NONE/* flags */,
1968 NULL/* func data */);
1970 elm_genlist_item_class_free(itc1);
1972 elm_box_pack_end(bx, gl);
1974 evas_object_resize(win, 400, 500);
1975 evas_object_show(win);
1978 char *gl12_text_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
1980 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).");
1984 test_genlist12(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1986 Evas_Object *win, *bx, *gl;
1989 win = elm_win_util_standard_add("genlist-textblock", "Genlist Textblock");
1990 elm_win_autodel_set(win, EINA_TRUE);
1992 bx = elm_box_add(win);
1993 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1994 elm_win_resize_object_add(win, bx);
1995 evas_object_show(bx);
1997 gl = elm_genlist_add(win);
1998 elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
1999 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2000 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2001 elm_box_pack_end(bx, gl);
2002 evas_object_show(gl);
2004 itc1->item_style = "message";
2005 itc1->func.text_get = gl12_text_get;
2006 itc1->func.content_get = gl_content_get;
2007 itc1->func.state_get = gl_state_get;
2008 itc1->func.del = NULL;
2010 for (i = 0; i < 1000; i++)
2012 elm_genlist_item_append(gl, itc1,
2013 (void *)(long)i/* item data */,
2015 ELM_GENLIST_ITEM_NONE,
2017 (void *)(long)(i * 10)/* func data */);
2019 elm_genlist_item_class_free(itc1);
2021 evas_object_resize(win, 400, 500);
2022 evas_object_show(win);
2026 gl13_cmp(const void *pa, const void *pb)
2028 const Elm_Object_Item *ia = pa, *ib = pb;
2029 int a = (int)(long) elm_object_item_data_get(ia);
2030 int b = (int)(long) elm_object_item_data_get(ib);
2035 test_genlist13(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2037 Elm_Object_Item *pi[6];
2038 Evas_Object *win, *bx, *gl; int i, base, idx[3] = {1, 10, 15};
2040 win = elm_win_util_standard_add("genlist-tree-insert-sorted", "Genlist Tree, Insert Sorted");
2041 elm_win_autodel_set(win, EINA_TRUE);
2043 bx = elm_box_add(win);
2044 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2045 elm_win_resize_object_add(win, bx);
2046 evas_object_show(bx);
2048 gl = elm_genlist_add(win);
2049 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2050 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2051 evas_object_show(gl);
2053 itc4.item_style = "default";
2054 itc4.func.text_get = gl4_text_get;
2055 itc4.func.content_get = NULL;
2056 itc4.func.state_get = NULL;
2057 itc4.func.del = NULL;
2059 /* mixed order to test insert sorted */
2061 for (i = 0; i < 3; i++)
2063 pi[i] = elm_genlist_item_sorted_insert
2064 (gl, &itc4, (void *)(long)idx[i]/* item data */, NULL/* parent */,
2065 ELM_GENLIST_ITEM_SUBITEMS, gl13_cmp/* cmp */,
2066 NULL/* func */, NULL/* func data */);
2069 for (i = 0, base = 100; i < 3; i++, base += 100)
2072 for (j = 0; j < 3; j++)
2074 elm_genlist_item_sorted_insert
2075 (gl, &itc4, (void *)(long)(idx[j] + base)/* item data */,
2076 pi[i]/* parent */, ELM_GENLIST_ITEM_NONE,
2077 gl13_cmp/* cmp */, NULL/* func */, NULL/* func data */);
2081 for (i = 0; i < 3; i++)
2083 pi[i + 3] = elm_genlist_item_sorted_insert
2084 (gl, &itc4, (void *)(long)(idx[i] * 2)/* item data */, NULL/* parent */,
2085 ELM_GENLIST_ITEM_SUBITEMS, gl13_cmp/* cmp */, NULL/* func */,
2086 NULL/* func data */);
2090 for (i = 0, base = 10000; i < 3; i++, base += 10000)
2093 for (j = 0; j < 3; j++)
2095 elm_genlist_item_sorted_insert
2096 (gl, &itc4, (void *)(long)(idx[j] + base)/* item data */,
2097 pi[i + 3]/* parent */, ELM_GENLIST_ITEM_NONE,
2098 gl13_cmp/* cmp */, NULL/* func */, NULL/* func data */);
2102 elm_box_pack_end(bx, gl);
2103 evas_object_show(bx);
2105 evas_object_resize(win, 320, 320);
2106 evas_object_show(win);
2110 my_gl_insert_before_rel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2112 Evas_Object *gl = data;
2113 static int i = 1000;
2114 Elm_Object_Item *gli_selected;
2116 itc1->item_style = "default";
2117 itc1->func.text_get = gl_text_get;
2118 itc1->func.content_get = NULL;
2119 itc1->func.state_get = NULL;
2120 itc1->func.del = NULL;
2122 gli_selected = elm_genlist_selected_item_get(gl);
2125 printf("no item selected\n");
2129 elm_genlist_item_insert_before(gl, itc1,
2130 (void *)(long)i/* item data */,
2131 elm_genlist_item_parent_get(gli_selected),
2132 gli_selected/* item before */,
2133 ELM_GENLIST_ITEM_NONE,
2134 NULL/* func */, NULL/* func data */);
2139 my_gl_insert_after_rel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2141 Evas_Object *gl = data;
2143 Elm_Object_Item *gli_selected;
2145 itc1->item_style = "default";
2146 itc1->func.text_get = gl_text_get;
2147 itc1->func.content_get = NULL;
2148 itc1->func.state_get = NULL;
2149 itc1->func.del = NULL;
2151 gli_selected = elm_genlist_selected_item_get(gl);
2154 printf("no item selected\n");
2158 elm_genlist_item_insert_after(gl, itc1,
2159 (void *)(long)i/* item data */,
2160 elm_genlist_item_parent_get(gli_selected),
2161 gli_selected/* item after */,
2162 ELM_GENLIST_ITEM_NONE,
2163 NULL/* func */, NULL/* func data */);
2168 test_genlist14(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2170 Elm_Object_Item *pi[6];
2171 Evas_Object *win, *bx, *bx2, *bt, *gl;
2173 /* index: 0, 1, 2, 3, 4, 5
2174 * items: 1, 15, 11, 2, 33, 21
2175 * final: 1, 2, 11, 15, 21, 33
2177 const int idx[6] = {1, 15, 11, 2, 33, 21};
2178 const int relative[6] = {
2179 0, /* item '1' - not used */
2180 0, /* item '15' - insert after pi[0], item '1' */
2181 -1, /* item '11' - insert before pi[1], item '15' */
2182 -2, /* item '2' - insert before pi[2], item '11' */
2183 1, /* item '33' - insert after pi[1], item '15' */
2184 -4 /* item '21' - insert before pi[4], item '33' */
2187 win = elm_win_util_standard_add("genlist-tree-insert-relative", "Genlist Tree, Insert Relative");
2188 elm_win_autodel_set(win, EINA_TRUE);
2190 bx = elm_box_add(win);
2191 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2192 elm_win_resize_object_add(win, bx);
2193 evas_object_show(bx);
2195 gl = elm_genlist_add(win);
2196 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2197 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2198 evas_object_show(gl);
2200 itc1 = elm_genlist_item_class_new();
2202 itc4.item_style = "default";
2203 itc4.func.text_get = gl4_text_get;
2204 itc4.func.content_get = NULL;
2205 itc4.func.state_get = NULL;
2206 itc4.func.del = NULL;
2208 /* mixed order to test insert sorted */
2210 // BUG1: should be able to insert before=NULL, prepend
2211 // BUG2: should be able to insert after=NULL, append
2213 pi[0] = elm_genlist_item_append
2214 (gl, &itc4, (void *)(long)idx[0]/* item data */,
2216 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2218 for (i = 1; i < 3; i++)
2220 if (relative[i] < 0)
2221 pi[i] = elm_genlist_item_insert_before
2222 (gl, &itc4, (void *)(long)idx[i]/* item data */,
2223 NULL/* parent */, pi[-relative[i]],
2224 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2226 pi[i] = elm_genlist_item_insert_after
2227 (gl, &itc4, (void *)(long)idx[i]/* item data */,
2228 NULL/* parent */, pi[relative[i]],
2229 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2232 for (i = 0; i < 3; i++)
2234 Elm_Object_Item *sub_glit[6];
2237 base = 1000 * (int)(long) elm_object_item_data_get(pi[i]);
2239 sub_glit[0] = elm_genlist_item_append
2240 (gl, &itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */,
2241 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2243 for (j = 1; j < 6; j++) {
2244 if (relative[j] < 0)
2245 sub_glit[j] = elm_genlist_item_insert_before
2246 (gl, &itc4, (void *)(long) (idx[j] + base)/* item data */,
2247 pi[i]/* parent */, sub_glit[-relative[j]],
2248 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2250 sub_glit[j] = elm_genlist_item_insert_after
2251 (gl, &itc4, (void *)(long) (idx[j] + base)/* item data */,
2252 pi[i]/* parent */, sub_glit[relative[j]],
2253 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2257 for (i = 3; i < 6; i++)
2259 if (relative[i] < 0)
2260 pi[i] = elm_genlist_item_insert_before
2261 (gl, &itc4, (void *)(long) idx[i]/* item data */,
2262 NULL/* parent */, pi[-relative[i]],
2263 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2265 pi[i] = elm_genlist_item_insert_after
2266 (gl, &itc4, (void *)(long) idx[i]/* item data */,
2267 NULL/* parent */, pi[relative[i]],
2268 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2271 for (i = 3; i < 6; i++)
2273 Elm_Object_Item *sub_glit[6];
2276 base = 1000 * (int)(long) elm_object_item_data_get(pi[i]);
2278 sub_glit[0] = elm_genlist_item_append
2279 (gl, &itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */,
2280 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2282 for (j = 1; j < 6; j++) {
2283 if (relative[j] < 0)
2284 sub_glit[j] = elm_genlist_item_insert_before
2285 (gl, &itc4, (void *)(long) (idx[j] + base)/* item data */,
2286 pi[i]/* parent */, sub_glit[-relative[j]],
2287 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2289 sub_glit[j] = elm_genlist_item_insert_after
2290 (gl, &itc4, (void *)(long) (idx[j] + base)/* item data */,
2291 pi[i]/* parent */, sub_glit[relative[j]],
2292 ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
2296 elm_box_pack_end(bx, gl);
2297 evas_object_show(bx);
2299 bx2 = elm_box_add(win);
2300 elm_box_horizontal_set(bx2, EINA_TRUE);
2301 elm_box_homogeneous_set(bx2, EINA_TRUE);
2302 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
2303 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2305 bt = elm_button_add(win);
2306 elm_object_text_set(bt, "+ before");
2307 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_before_rel, gl);
2308 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2309 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2310 elm_box_pack_end(bx2, bt);
2311 evas_object_show(bt);
2313 bt = elm_button_add(win);
2314 elm_object_text_set(bt, "+ after");
2315 evas_object_smart_callback_add(bt, "clicked", my_gl_insert_after_rel, gl);
2316 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2317 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2318 elm_box_pack_end(bx2, bt);
2319 evas_object_show(bt);
2321 elm_box_pack_end(bx, bx2);
2322 evas_object_show(bx2);
2324 /* item_class_ref is needed for itc1. some items can be added in callbacks */
2325 elm_genlist_item_class_ref(itc1);
2326 elm_genlist_item_class_free(itc1);
2328 evas_object_resize(win, 320, 320);
2329 evas_object_show(win);
2332 static void _edit_icon_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2334 Elm_Object_Item *item = (Elm_Object_Item *)data;
2335 elm_object_item_del(item);
2338 char *gl15_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
2340 const Testitem *tit = data;
2342 snprintf(buf, sizeof(buf), "Item #%i", tit->mode);
2346 Evas_Object *gl15_content_get(void *data, Evas_Object *obj, const char *part)
2348 Testitem *tit = data;
2350 Evas_Object *ic = elm_icon_add(obj);
2352 // "edit_default" EDC layout is like below. each part is swallow part.
2353 // the existing item is swllowed to elm.swallow.edit.content part.
2354 // ----------------------------------------------------------------
2355 // | elm.edit.icon.1 | elm.swallow.edit.content | elm.edit.icon,2 |
2356 // ----------------------------------------------------------------
2358 if (!strcmp(part, "elm.swallow.end"))
2360 snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR);
2361 elm_icon_file_set(ic, buf, NULL);
2362 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2365 else if (!strcmp(part, "elm.edit.icon.1"))
2368 ck = elm_check_add(obj);
2369 elm_check_state_pointer_set(ck, &tit->checked);
2370 evas_object_propagate_events_set(ck, EINA_FALSE);
2371 evas_object_show(ck);
2374 else if (!strcmp(part, "elm.edit.icon.2"))
2376 Evas_Object *icn = elm_icon_add(obj);
2377 snprintf(buf, sizeof(buf), "%s/images/icon_06.png", PACKAGE_DATA_DIR);
2378 elm_icon_file_set(icn, buf, NULL);
2379 evas_object_propagate_events_set(icn, EINA_FALSE);
2380 evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
2381 evas_object_smart_callback_add(icn, "clicked", _edit_icon_clicked_cb, (void *)tit->item);
2388 gl15_sel(void *data, Evas_Object *obj, void *event_info __UNUSED__)
2390 Testitem *tit = data;
2391 if (elm_genlist_edit_mode_get(obj))
2393 if (!tit->checked) tit->checked = EINA_TRUE;
2394 else tit->checked = EINA_FALSE;
2396 elm_genlist_item_update(tit->item);
2400 gl15_edit_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2402 elm_genlist_edit_mode_set(data, EINA_TRUE);
2403 elm_genlist_always_select_mode_set(data, EINA_TRUE);
2407 gl15_normal_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2409 elm_genlist_edit_mode_set(data, EINA_FALSE);
2410 elm_genlist_always_select_mode_set(data, EINA_FALSE);
2413 void gl15_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
2415 printf("item deleted.\n");
2419 test_genlist15(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2421 Evas_Object *win, *bg, *bx, *bx2, *bt, *gl;
2423 static Testitem tit[100];
2425 win = elm_win_add(NULL, "genlist15", ELM_WIN_BASIC);
2426 elm_win_title_set(win, "Genlist Edit Mode");
2427 elm_win_autodel_set(win, EINA_TRUE);
2429 bg = elm_bg_add(win);
2430 elm_win_resize_object_add(win, bg);
2431 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2432 evas_object_show(bg);
2434 bx = elm_box_add(win);
2435 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2436 elm_win_resize_object_add(win, bx);
2437 evas_object_show(bx);
2439 gl = elm_genlist_add(win);
2440 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
2441 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2442 evas_object_show(gl);
2444 itc15 = elm_genlist_item_class_new();
2445 itc15->item_style = "default";
2446 itc15->func.text_get = gl15_text_get;
2447 itc15->func.content_get = gl15_content_get;
2448 itc15->func.state_get = gl_state_get;
2449 itc15->func.del = gl15_del;
2450 itc15->edit_item_style = "edit";
2452 for (i = 0; i < 100; i++)
2455 tit[i].item = elm_genlist_item_append(gl, itc15,
2456 &(tit[i])/* item data */,
2458 ELM_GENLIST_ITEM_NONE/* flags */,
2460 (void *)(long)&(tit[i])/* func data */);
2462 elm_genlist_item_class_free(itc15);
2463 elm_box_pack_end(bx, gl);
2464 evas_object_show(bx);
2466 bx2 = elm_box_add(win);
2467 elm_box_horizontal_set(bx2, EINA_TRUE);
2468 elm_box_homogeneous_set(bx2, EINA_TRUE);
2469 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
2470 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2472 bt = elm_button_add(win);
2473 elm_object_text_set(bt, "Edit mode");
2474 evas_object_smart_callback_add(bt, "clicked", gl15_edit_mode, gl);
2475 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2476 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2477 elm_box_pack_end(bx2, bt);
2478 evas_object_show(bt);
2480 bt = elm_button_add(win);
2481 elm_object_text_set(bt, "Normal mode");
2482 evas_object_smart_callback_add(bt, "clicked", gl15_normal_mode,gl);
2483 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
2484 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
2485 elm_box_pack_end(bx2, bt);
2486 evas_object_show(bt);
2488 elm_box_pack_end(bx, bx2);
2489 evas_object_show(bx2);
2491 evas_object_resize(win, 520, 520);
2492 evas_object_show(win);