1 #include <Elementary.h>
2 #include <Elementary_Cursor.h>
4 # include "elementary_config.h"
6 #ifndef ELM_LIB_QUICKLAUNCH
8 typedef struct _Testitem
10 Elm_Gengrid_Item *item;
16 static Elm_Gengrid_Item_Class gic;
19 grd_lbl_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
21 const Testitem *ti = data;
23 snprintf(buf, sizeof(buf), "Photo %s", ti->path);
28 grd_content_get(void *data, Evas_Object *obj, const char *part)
30 const Testitem *ti = data;
31 if (!strcmp(part, "elm.swallow.icon"))
33 Evas_Object *icon = elm_bg_add(obj);
34 elm_bg_file_set(icon, ti->path, NULL);
35 evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL,
37 evas_object_show(icon);
43 static Elm_Genlist_Item_Class itct;
46 glt_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
48 Elm_Genlist_Item *it = event_info;
49 Evas_Object *gl = elm_gen_item_widget_get(it);
50 int val = (int)(long)elm_genlist_item_data_get(it);
51 Elm_Genlist_Item *it1, *it2, *it3;
54 it1 = elm_genlist_item_append(gl, &itct, (void *)(long)(val + 1), it,
55 ELM_GENLIST_ITEM_NONE, NULL, NULL);
56 it2 = elm_genlist_item_append(gl, &itct, (void *)(long)(val + 2), it,
57 ELM_GENLIST_ITEM_NONE, NULL, NULL);
58 it3 = elm_genlist_item_append(gl, &itct, (void *)(long)(val + 3), it,
59 ELM_GENLIST_ITEM_SUBITEMS, NULL, NULL);
61 elm_genlist_item_cursor_set(it1, ELM_CURSOR_HAND2);
62 elm_genlist_item_cursor_set(it2, ELM_CURSOR_HAND2);
63 elm_genlist_item_cursor_set(it3, ELM_CURSOR_HAND1);
68 glt_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
70 Elm_Genlist_Item *it = event_info;
71 elm_genlist_item_subitems_clear(it);
75 glt_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
77 Elm_Genlist_Item *it = event_info;
78 elm_genlist_item_expanded_set(it, 1);
82 glt_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
84 Elm_Genlist_Item *it = event_info;
85 elm_genlist_item_expanded_set(it, 0);
89 glt_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
92 snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data);
97 test_cursor(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
99 Evas_Object *win, *bg, *bx, *bt, *list, *entry, *ck;
102 win = elm_win_add(NULL, "cursor", ELM_WIN_BASIC);
103 elm_win_title_set(win, "Cursor");
104 elm_win_autodel_set(win, EINA_TRUE);
106 bg = elm_bg_add(win);
107 elm_win_resize_object_add(win, bg);
108 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
109 evas_object_show(bg);
110 elm_object_cursor_set(bg, ELM_CURSOR_CIRCLE);
112 bx = elm_box_add(win);
113 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
114 elm_win_resize_object_add(win, bx);
115 evas_object_show(bx);
117 ck = elm_clock_add(win);
118 elm_object_cursor_set(ck, ELM_CURSOR_CLOCK);
119 elm_box_pack_end(bx, ck);
120 evas_object_show(ck);
122 bt = elm_button_add(win);
123 elm_object_cursor_set(bt, ELM_CURSOR_COFFEE_MUG);
124 elm_object_text_set(bt, "Coffee Mug");
125 elm_box_pack_end(bx, bt);
126 evas_object_show(bt);
128 bt = elm_button_add(win);
129 elm_object_cursor_set(bt, ELM_CURSOR_CLOCK);
130 elm_object_text_set(bt, "Cursor unset");
131 elm_object_cursor_unset(bt);
132 elm_box_pack_end(bx, bt);
133 evas_object_show(bt);
135 list = elm_list_add(win);
136 elm_box_pack_end(bx, list);
137 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
138 evas_object_size_hint_fill_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
139 elm_object_cursor_set(list, ELM_CURSOR_WATCH);
140 lit = elm_list_item_append(list, "watch over list | hand1", NULL, NULL, NULL,
142 elm_list_item_cursor_set(lit, ELM_CURSOR_HAND1);
143 lit = elm_list_item_append(list, "watch over list | hand2", NULL, NULL, NULL,
145 elm_list_item_cursor_set(lit, ELM_CURSOR_HAND2);
147 evas_object_show(list);
149 entry = elm_entry_add(win);
150 elm_entry_scrollable_set(entry, EINA_TRUE);
151 elm_entry_entry_set(entry, "Xterm cursor");
152 elm_entry_single_line_set(entry, EINA_TRUE);
153 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0);
154 evas_object_size_hint_fill_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
155 elm_box_pack_end(bx, entry);
156 evas_object_show(entry);
157 elm_object_cursor_set(entry, ELM_CURSOR_XTERM);
159 evas_object_resize(win, 320, 480);
160 evas_object_show(win);
164 test_cursor2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
166 Evas_Object *win, *bg, *bx, *o, *grid, *gl;
167 Elm_Genlist_Item *it1, *it2, *it3;
168 Elm_Toolbar_Item *tit;
171 static Testitem ti[144];
186 win = elm_win_add(NULL, "cursor2", ELM_WIN_BASIC);
187 elm_win_title_set(win, "Cursor 2");
188 elm_win_autodel_set(win, EINA_TRUE);
190 bg = elm_bg_add(win);
191 elm_win_resize_object_add(win, bg);
192 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
193 evas_object_show(bg);
195 bx = elm_box_add(win);
196 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
197 elm_win_resize_object_add(win, bx);
198 evas_object_show(bx);
200 o = elm_toolbar_add(win);
201 elm_toolbar_homogeneous_set(o, 0);
202 evas_object_size_hint_weight_set(o, 0.0, 0.0);
203 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
204 tit = elm_toolbar_item_append(o, NULL, "Bogosity", NULL, NULL);
205 elm_toolbar_item_cursor_set(tit, ELM_CURSOR_BOGOSITY);
206 tit = elm_toolbar_item_append(o, NULL, "Unset", NULL, NULL);
207 elm_toolbar_item_cursor_set(tit, ELM_CURSOR_BOGOSITY);
208 elm_toolbar_item_cursor_unset(tit);
209 tit = elm_toolbar_item_append(o, NULL, "Xterm", NULL, NULL);
210 elm_toolbar_item_cursor_set(tit, ELM_CURSOR_XTERM);
211 elm_box_pack_end(bx, o);
214 o = elm_list_add(win);
215 elm_box_pack_end(bx, o);
216 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
217 evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
218 lit = elm_list_item_append(o, "cursor bogosity", NULL, NULL, NULL, NULL);
219 elm_list_item_cursor_set(lit, ELM_CURSOR_BOGOSITY);
220 lit = elm_list_item_append(o, "cursor unset", NULL, NULL, NULL, NULL);
221 elm_list_item_cursor_set(lit, ELM_CURSOR_BOGOSITY);
222 elm_list_item_cursor_unset(lit);
223 lit = elm_list_item_append(o, "cursor xterm", NULL, NULL, NULL, NULL);
224 elm_list_item_cursor_set(lit, ELM_CURSOR_XTERM);
228 gl = elm_genlist_add(win);
229 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
230 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
231 evas_object_show(gl);
233 itct.item_style = "default";
234 itct.func.label_get = glt_label_get;
236 it1 = elm_genlist_item_append(gl, &itct, (void *) 1, NULL,
237 ELM_GENLIST_ITEM_SUBITEMS, NULL, NULL);
238 it2 = elm_genlist_item_append(gl, &itct, (void *) 2, NULL,
239 ELM_GENLIST_ITEM_SUBITEMS, NULL, NULL);
240 it3 = elm_genlist_item_append(gl, &itct, (void *) 3, NULL,
241 ELM_GENLIST_ITEM_NONE, NULL, NULL);
243 elm_genlist_item_cursor_set(it1, ELM_CURSOR_HAND1);
244 elm_genlist_item_cursor_set(it2, ELM_CURSOR_HAND1);
245 elm_genlist_item_cursor_set(it3, ELM_CURSOR_CROSS);
247 evas_object_smart_callback_add(gl, "expand,request", glt_exp_req, gl);
248 evas_object_smart_callback_add(gl, "contract,request", glt_con_req, gl);
249 evas_object_smart_callback_add(gl, "expanded", glt_exp, gl);
250 evas_object_smart_callback_add(gl, "contracted", glt_con, gl);
252 elm_box_pack_end(bx, gl);
254 grid = elm_gengrid_add(win);
255 elm_gengrid_item_size_set(grid, 130, 130);
256 elm_gengrid_horizontal_set(grid, EINA_FALSE);
257 elm_gengrid_multi_select_set(grid, EINA_TRUE);
258 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
259 evas_object_size_hint_fill_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
261 gic.item_style = "default";
262 gic.func.label_get = grd_lbl_get;
263 gic.func.content_get = grd_content_get;
266 for (i = 0; i < 3 * 3; i++)
268 snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
271 ti[i].path = eina_stringshare_add(buf);
272 ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), NULL, NULL);
274 elm_gengrid_item_cursor_set(ti[i].item, ELM_CURSOR_HAND1);
276 elm_gengrid_item_cursor_set(ti[i].item, ELM_CURSOR_CLOCK);
278 elm_gen_item_selected_set(ti[i].item, EINA_TRUE);
280 elm_box_pack_end(bx, grid);
281 evas_object_show(grid);
283 evas_object_resize(win, 320, 480);
284 evas_object_show(win);
288 test_cursor3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
290 Evas_Object *win, *bg, *bx, *o;
294 win = elm_win_add(NULL, "cursor3", ELM_WIN_BASIC);
295 elm_win_title_set(win, "Cursor 3");
296 elm_win_autodel_set(win, EINA_TRUE);
298 snprintf(buf, sizeof(buf), "%s/objects/cursors.edj", elm_app_data_dir_get());
299 elm_theme_extension_add(NULL, buf);
301 bg = elm_bg_add(win);
302 elm_win_resize_object_add(win, bg);
303 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
304 evas_object_show(bg);
306 bx = elm_box_add(win);
307 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
308 elm_win_resize_object_add(win, bx);
309 evas_object_show(bx);
311 o = elm_button_add(win);
312 elm_object_cursor_set(o, ELM_CURSOR_HAND1);
313 elm_object_cursor_engine_only_set(o, EINA_FALSE);
314 elm_object_text_set(o, "hand1");
315 elm_box_pack_end(bx, o);
318 o = elm_button_add(win);
319 elm_object_cursor_set(o, ELM_CURSOR_HAND2);
320 elm_object_text_set(o, "hand2 x");
321 elm_box_pack_end(bx, o);
324 o = elm_button_add(win);
325 elm_object_cursor_set(o, ELM_CURSOR_HAND2);
326 elm_object_cursor_engine_only_set(o, EINA_FALSE);
327 elm_object_text_set(o, "hand2");
328 elm_box_pack_end(bx, o);
331 o = elm_button_add(win);
332 elm_object_cursor_set(o, "hand3");
333 elm_object_cursor_engine_only_set(o, EINA_FALSE);
334 elm_object_text_set(o, "hand3");
335 elm_box_pack_end(bx, o);
338 o = elm_button_add(win);
339 elm_object_cursor_set(o, "hand3");
340 elm_object_cursor_engine_only_set(o, EINA_FALSE);
341 elm_object_cursor_style_set(o, "transparent");
342 elm_object_text_set(o, "hand3 transparent");
343 elm_box_pack_end(bx, o);
346 o = elm_button_add(win);
347 elm_object_cursor_set(o, "hand3");
348 elm_object_cursor_engine_only_set(o, EINA_FALSE);
349 elm_object_cursor_unset(o);
350 elm_object_text_set(o, "unset");
351 elm_box_pack_end(bx, o);
354 o = elm_button_add(win);
355 elm_object_cursor_set(o, "hand4");
356 elm_object_text_set(o, "not existent");
357 elm_box_pack_end(bx, o);
360 elm_cursor_engine_only_set(0);
361 o = elm_button_add(win);
362 elm_object_cursor_set(o, "hand2");
363 elm_object_text_set(o, "hand 2 engine only config false");
364 elm_box_pack_end(bx, o);
367 elm_cursor_engine_only_set(1);
368 o = elm_button_add(win);
369 elm_object_cursor_set(o, "hand2");
370 elm_object_text_set(o, "hand 2 engine only config true");
371 elm_box_pack_end(bx, o);
374 o = elm_list_add(win);
375 elm_box_pack_end(bx, o);
376 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
377 evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
378 lit = elm_list_item_append(o, "cursor hand2 x", NULL, NULL, NULL, NULL);
379 elm_list_item_cursor_set(lit, ELM_CURSOR_HAND2);
380 lit = elm_list_item_append(o, "cursor hand2", NULL, NULL, NULL, NULL);
381 elm_list_item_cursor_set(lit, ELM_CURSOR_HAND2);
382 elm_list_item_cursor_engine_only_set(lit, EINA_FALSE);
383 lit = elm_list_item_append(o, "cursor hand3", NULL, NULL, NULL, NULL);
384 elm_list_item_cursor_set(lit, "hand3");
385 elm_list_item_cursor_engine_only_set(lit, EINA_FALSE);
386 lit = elm_list_item_append(o, "cursor hand3 transparent", NULL, NULL,
388 elm_list_item_cursor_set(lit, "hand3");
389 elm_list_item_cursor_style_set(lit, "transparent");
390 elm_list_item_cursor_engine_only_set(lit, EINA_FALSE);
394 evas_object_resize(win, 320, 480);
395 evas_object_show(win);