2 //gcc -g `pkg-config --cflags --libs elementary` genlist_example_01.c -o genlist_example_01
4 #include <Elementary.h>
6 # include "elementary_config.h"
14 static Elm_Genlist_Item_Class _itc;
17 _item_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
19 static Elm_Genlist_Item_Class *_itc = NULL;
22 _item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
23 >>>>>>> remotes/origin/upstream
26 snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data);
31 _item_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
33 Evas_Object *ic = elm_icon_add(obj);
35 if (!strcmp(part, "elm.swallow.icon"))
36 elm_icon_standard_set(ic, "clock");
38 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
43 _item_sel_cb(void *data, Evas_Object *obj, void *event_info)
45 printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n",
46 data, obj, event_info);
50 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
52 Evas_Object *win, *bg;
56 win = elm_win_add(NULL, "icon", ELM_WIN_BASIC);
57 elm_win_title_set(win, "Icon");
58 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
59 elm_win_autodel_set(win, EINA_TRUE);
62 elm_bg_color_set(bg, 255,255 ,255);
63 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
64 elm_win_resize_object_add(win, bg);
68 _itc.item_style = "default";
69 _itc.func.text_get = _item_text_get;
70 _itc.func.content_get = _item_content_get;
71 _itc.func.state_get = NULL;
76 _itc = elm_genlist_item_class_new();
77 _itc->item_style = "default";
78 _itc->func.text_get = _item_label_get;
79 _itc->func.content_get = _item_content_get;
80 _itc->func.state_get = NULL;
81 _itc->func.del = NULL;
83 >>>>>>> remotes/origin/upstream
85 list = elm_genlist_add(win);
87 for (i = 0; i < N_ITEMS; i++)
90 elm_genlist_item_append(list, &_itc,
92 elm_genlist_item_append(list, _itc,
93 >>>>>>> remotes/origin/upstream
94 (void *)(long)i, NULL,
95 ELM_GENLIST_ITEM_NONE,
99 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
100 elm_win_resize_object_add(win, list);
101 evas_object_show(list);
103 evas_object_size_hint_min_set(bg, 160, 160);
104 evas_object_size_hint_max_set(bg, 640, 640);
105 evas_object_resize(win, 320, 320);
106 evas_object_show(win);