1 #include <Elementary.h>
2 #ifndef ELM_LIB_QUICKLAUNCH
4 my_show_it(void *data, Evas_Object *obj, void *event_info)
6 elm_list_item_show(data);
10 test_list(void *data, Evas_Object *obj, void *event_info)
12 Evas_Object *win, *bg, *li, *ic, *ic2, *bx, *tb2, *bt;
14 Elm_List_Item *it1, *it2, *it3, *it4, *it5;
16 win = elm_win_add(NULL, "list", ELM_WIN_BASIC);
17 elm_win_title_set(win, "List");
18 elm_win_autodel_set(win, 1);
21 elm_win_resize_object_add(win, bg);
22 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
25 li = elm_list_add(win);
26 elm_win_resize_object_add(win, li);
27 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
29 ic = elm_icon_add(win);
30 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
31 elm_icon_file_set(ic, buf, NULL);
32 elm_icon_scale_set(ic, 1, 1);
33 it1 = elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL);
34 ic = elm_icon_add(win);
35 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
36 elm_icon_scale_set(ic, 0, 0);
37 elm_icon_file_set(ic, buf, NULL);
38 elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
39 ic = elm_icon_add(win);
40 elm_icon_standard_set(ic, "edit");
41 elm_icon_scale_set(ic, 0, 0);
42 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
44 ic = elm_icon_add(win);
45 elm_icon_standard_set(ic, "delete");
46 elm_icon_scale_set(ic, 0, 0);
47 ic2 = elm_icon_add(win);
48 elm_icon_standard_set(ic2, "clock");
49 elm_icon_scale_set(ic2, 0, 0);
50 it2 = elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
52 bx = elm_box_add(win);
53 elm_box_horizontal_set(bx, 1);
55 ic = elm_icon_add(win);
56 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
57 elm_icon_file_set(ic, buf, NULL);
58 elm_icon_scale_set(ic, 0, 0);
59 evas_object_size_hint_align_set(ic, 0.5, 0.5);
60 elm_box_pack_end(bx, ic);
63 ic = elm_icon_add(win);
64 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
65 elm_icon_file_set(ic, buf, NULL);
66 elm_icon_scale_set(ic, 0, 0);
67 evas_object_size_hint_align_set(ic, 0.5, 0.0);
68 elm_box_pack_end(bx, ic);
71 ic = elm_icon_add(win);
72 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
73 elm_icon_file_set(ic, buf, NULL);
74 elm_icon_scale_set(ic, 0, 0);
75 evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND);
76 elm_box_pack_end(bx, ic);
78 elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
80 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
81 it3 = elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
82 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
83 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
84 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
85 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
86 it4 = elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
87 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
88 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
89 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
90 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
91 elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL);
92 it5 = elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL);
98 tb2 = elm_table_add(win);
99 evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
100 elm_win_resize_object_add(win, tb2);
102 bt = elm_button_add(win);
103 elm_button_label_set(bt, "Hello");
104 evas_object_smart_callback_add(bt, "clicked", my_show_it, it1);
105 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
106 evas_object_size_hint_align_set(bt, 0.9, 0.5);
107 elm_table_pack(tb2, bt, 0, 0, 1, 1);
108 evas_object_show(bt);
110 bt = elm_button_add(win);
111 elm_button_label_set(bt, "How");
112 evas_object_smart_callback_add(bt, "clicked", my_show_it, it2);
113 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
114 evas_object_size_hint_align_set(bt, 0.9, 0.5);
115 elm_table_pack(tb2, bt, 0, 1, 1, 1);
116 evas_object_show(bt);
118 bt = elm_button_add(win);
119 elm_button_label_set(bt, "doing");
120 evas_object_smart_callback_add(bt, "clicked", my_show_it, it3);
121 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
122 evas_object_size_hint_align_set(bt, 0.9, 0.5);
123 elm_table_pack(tb2, bt, 0, 2, 1, 1);
124 evas_object_show(bt);
126 bt = elm_button_add(win);
127 elm_button_label_set(bt, "Here");
128 evas_object_smart_callback_add(bt, "clicked", my_show_it, it4);
129 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
130 evas_object_size_hint_align_set(bt, 0.9, 0.5);
131 elm_table_pack(tb2, bt, 0, 3, 1, 1);
132 evas_object_show(bt);
134 bt = elm_button_add(win);
135 elm_button_label_set(bt, "Maybe this...");
136 evas_object_smart_callback_add(bt, "clicked", my_show_it, it5);
137 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
138 evas_object_size_hint_align_set(bt, 0.9, 0.5);
139 elm_table_pack(tb2, bt, 0, 4, 1, 1);
140 evas_object_show(bt);
142 evas_object_show(tb2);
144 evas_object_resize(win, 320, 300);
145 evas_object_show(win);
151 my_li2_clear(void *data, Evas_Object *obj, void *event_info)
153 elm_list_clear(data);
157 my_li2_sel(void *data, Evas_Object *obj, void *event_info)
159 Elm_List_Item *it = elm_list_selected_item_get(obj);
160 elm_list_item_selected_set(it, 0);
161 // elm_list_item_selected_set(event_info, 0);
165 test_list2(void *data, Evas_Object *obj, void *event_info)
167 Evas_Object *win, *bg, *li, *ic, *ic2, *bx, *bx2, *bt;
171 win = elm_win_add(NULL, "list-2", ELM_WIN_BASIC);
172 elm_win_title_set(win, "List 2");
173 elm_win_autodel_set(win, 1);
175 bg = elm_bg_add(win);
176 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
177 elm_bg_file_set(bg, buf, NULL);
178 elm_win_resize_object_add(win, bg);
179 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
180 evas_object_show(bg);
182 bx = elm_box_add(win);
183 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
184 elm_win_resize_object_add(win, bx);
185 evas_object_show(bx);
187 li = elm_list_add(win);
188 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
189 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
190 elm_list_mode_set(li, ELM_LIST_LIMIT);
191 // elm_list_multi_select_set(li, 1);
193 ic = elm_icon_add(win);
194 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
195 elm_icon_file_set(ic, buf, NULL);
196 it = elm_list_item_append(li, "Hello", ic, NULL, my_li2_sel, NULL);
197 elm_list_item_selected_set(it, 1);
198 ic = elm_icon_add(win);
199 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
200 elm_icon_scale_set(ic, 0, 0);
201 elm_icon_file_set(ic, buf, NULL);
202 elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
203 ic = elm_icon_add(win);
204 elm_icon_standard_set(ic, "edit");
205 elm_icon_scale_set(ic, 0, 0);
206 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
208 ic = elm_icon_add(win);
209 elm_icon_standard_set(ic, "delete");
210 elm_icon_scale_set(ic, 0, 0);
211 ic2 = elm_icon_add(win);
212 elm_icon_standard_set(ic2, "clock");
213 elm_icon_scale_set(ic2, 0, 0);
214 elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
216 bx2 = elm_box_add(win);
217 elm_box_horizontal_set(bx2, 1);
219 ic = elm_icon_add(win);
220 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
221 elm_icon_file_set(ic, buf, NULL);
222 elm_icon_scale_set(ic, 0, 0);
223 evas_object_size_hint_align_set(ic, 0.5, 0.5);
224 elm_box_pack_end(bx2, ic);
225 evas_object_show(ic);
227 ic = elm_icon_add(win);
228 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
229 elm_icon_file_set(ic, buf, NULL);
230 elm_icon_scale_set(ic, 0, 0);
231 evas_object_size_hint_align_set(ic, 0.5, 0.0);
232 elm_box_pack_end(bx2, ic);
233 evas_object_show(ic);
234 elm_list_item_append(li, "are", bx2, NULL, NULL, NULL);
236 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
237 elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
238 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
239 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
240 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
241 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
242 elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
243 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
244 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
245 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
246 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
247 elm_list_item_append(li, "Longer label.", NULL, NULL, NULL, NULL);
251 elm_box_pack_end(bx, li);
252 evas_object_show(li);
254 bx2 = elm_box_add(win);
255 elm_box_horizontal_set(bx2, 1);
256 elm_box_homogenous_set(bx2, 1);
257 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
258 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
260 bt = elm_button_add(win);
261 elm_button_label_set(bt, "Clear");
262 evas_object_smart_callback_add(bt, "clicked", my_li2_clear, li);
263 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
264 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
265 elm_box_pack_end(bx2, bt);
266 evas_object_show(bt);
268 elm_box_pack_end(bx, bx2);
269 evas_object_show(bx2);
271 evas_object_resize(win, 320, 300);
272 evas_object_show(win);
278 test_list3(void *data, Evas_Object *obj, void *event_info)
280 Evas_Object *win, *bg, *li, *ic, *ic2, *bx;
283 win = elm_win_add(NULL, "list-3", ELM_WIN_BASIC);
284 elm_win_title_set(win, "List 3");
285 elm_win_autodel_set(win, 1);
287 bg = elm_bg_add(win);
288 elm_win_resize_object_add(win, bg);
289 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
290 evas_object_show(bg);
292 li = elm_list_add(win);
293 elm_win_resize_object_add(win, li);
294 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
295 elm_list_mode_set(li, ELM_LIST_COMPRESS);
297 ic = elm_icon_add(win);
298 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
299 elm_icon_file_set(ic, buf, NULL);
300 elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL);
301 ic = elm_icon_add(win);
302 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
303 elm_icon_scale_set(ic, 0, 0);
304 elm_icon_file_set(ic, buf, NULL);
305 elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
306 ic = elm_icon_add(win);
307 elm_icon_standard_set(ic, "edit");
308 elm_icon_scale_set(ic, 0, 0);
309 elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
311 ic = elm_icon_add(win);
312 elm_icon_standard_set(ic, "delete");
313 elm_icon_scale_set(ic, 0, 0);
314 ic2 = elm_icon_add(win);
315 elm_icon_standard_set(ic2, "clock");
316 elm_icon_scale_set(ic2, 0, 0);
317 elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
319 bx = elm_box_add(win);
320 elm_box_horizontal_set(bx, 1);
322 ic = elm_icon_add(win);
323 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
324 elm_icon_file_set(ic, buf, NULL);
325 elm_icon_scale_set(ic, 0, 0);
326 evas_object_size_hint_align_set(ic, 0.5, 0.5);
327 elm_box_pack_end(bx, ic);
328 evas_object_show(ic);
330 ic = elm_icon_add(win);
331 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
332 elm_icon_file_set(ic, buf, NULL);
333 elm_icon_scale_set(ic, 0, 0);
334 evas_object_size_hint_align_set(ic, 0.5, 0.0);
335 elm_box_pack_end(bx, ic);
336 evas_object_show(ic);
338 ic = elm_icon_add(win);
339 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
340 elm_icon_file_set(ic, buf, NULL);
341 elm_icon_scale_set(ic, 0, 0);
342 evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND);
343 elm_box_pack_end(bx, ic);
344 evas_object_show(ic);
346 elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
347 elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
348 elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
349 elm_list_item_append(li, "out", NULL, NULL, NULL, NULL);
350 elm_list_item_append(li, "there", NULL, NULL, NULL, NULL);
351 elm_list_item_append(li, "today", NULL, NULL, NULL, NULL);
352 elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
353 elm_list_item_append(li, "Here", NULL, NULL, NULL, NULL);
354 elm_list_item_append(li, "are", NULL, NULL, NULL, NULL);
355 elm_list_item_append(li, "some", NULL, NULL, NULL, NULL);
356 elm_list_item_append(li, "more", NULL, NULL, NULL, NULL);
357 elm_list_item_append(li, "items", NULL, NULL, NULL, NULL);
358 elm_list_item_append(li, "Is this label long enough?", NULL, NULL, NULL, NULL);
359 elm_list_item_append(li, "Maybe this one is even longer so we can test long long items.", NULL, NULL, NULL, NULL);
363 evas_object_show(li);
365 evas_object_resize(win, 320, 300);
366 evas_object_show(win);