diff options
Diffstat (limited to 'libraries/elementary/src/bin/test_tooltip.c')
-rw-r--r-- | libraries/elementary/src/bin/test_tooltip.c | 605 |
1 files changed, 605 insertions, 0 deletions
diff --git a/libraries/elementary/src/bin/test_tooltip.c b/libraries/elementary/src/bin/test_tooltip.c new file mode 100644 index 0000000..7d4cb97 --- /dev/null +++ b/libraries/elementary/src/bin/test_tooltip.c | |||
@@ -0,0 +1,605 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "elementary_config.h" | ||
3 | #endif | ||
4 | #include <Elementary.h> | ||
5 | #ifndef ELM_LIB_QUICKLAUNCH | ||
6 | |||
7 | typedef struct _Testitem | ||
8 | { | ||
9 | Elm_Object_Item *item; | ||
10 | const char *path; | ||
11 | int mode; | ||
12 | int onoff; | ||
13 | } Testitem; | ||
14 | |||
15 | static Elm_Gengrid_Item_Class gic; | ||
16 | |||
17 | char * | ||
18 | grdt_lbl_get(void *data, | ||
19 | Evas_Object *obj __UNUSED__, | ||
20 | const char *part __UNUSED__) | ||
21 | { | ||
22 | const Testitem *ti = data; | ||
23 | char buf[256]; | ||
24 | snprintf(buf, sizeof(buf), "Photo %s", ti->path); | ||
25 | return strdup(buf); | ||
26 | } | ||
27 | |||
28 | Evas_Object * | ||
29 | grdt_content_get(void *data, | ||
30 | Evas_Object *obj, | ||
31 | const char *part) | ||
32 | { | ||
33 | const Testitem *ti = data; | ||
34 | if (!strcmp(part, "elm.swallow.icon")) | ||
35 | { | ||
36 | Evas_Object *icon = elm_bg_add(obj); | ||
37 | elm_bg_file_set(icon, ti->path, NULL); | ||
38 | evas_object_size_hint_aspect_set(icon, | ||
39 | EVAS_ASPECT_CONTROL_VERTICAL, | ||
40 | 1, 1); | ||
41 | evas_object_show(icon); | ||
42 | return icon; | ||
43 | } | ||
44 | return NULL; | ||
45 | } | ||
46 | |||
47 | static Elm_Genlist_Item_Class itct; | ||
48 | |||
49 | static void | ||
50 | gltt_exp(void *data __UNUSED__, | ||
51 | Evas_Object *obj __UNUSED__, | ||
52 | void *event_info) | ||
53 | { | ||
54 | Elm_Object_Item *glit = event_info; | ||
55 | Evas_Object *gl = elm_object_item_widget_get(glit); | ||
56 | int val = (int)(long) elm_object_item_data_get(glit); | ||
57 | Elm_Object_Item *glit1, *glit2, *glit3; | ||
58 | |||
59 | val *= 10; | ||
60 | glit1 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 1), glit, | ||
61 | ELM_GENLIST_ITEM_NONE, NULL, NULL); | ||
62 | glit2 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 2), glit, | ||
63 | ELM_GENLIST_ITEM_NONE, NULL, NULL); | ||
64 | glit3 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 3), glit, | ||
65 | ELM_GENLIST_ITEM_TREE, NULL, NULL); | ||
66 | |||
67 | elm_genlist_item_tooltip_text_set(glit1, "Testing A"); | ||
68 | elm_genlist_item_tooltip_text_set(glit2, "Testing B"); | ||
69 | elm_genlist_item_tooltip_text_set(glit3, "Testing C"); | ||
70 | } | ||
71 | |||
72 | static void | ||
73 | gltt_con(void *data __UNUSED__, | ||
74 | Evas_Object *obj __UNUSED__, | ||
75 | void *event_info) | ||
76 | { | ||
77 | Elm_Object_Item *glit = event_info; | ||
78 | elm_genlist_item_subitems_clear(glit); | ||
79 | } | ||
80 | |||
81 | static void | ||
82 | gltt_exp_req(void *data __UNUSED__, | ||
83 | Evas_Object *obj __UNUSED__, | ||
84 | void *event_info) | ||
85 | { | ||
86 | Elm_Object_Item *glit = event_info; | ||
87 | elm_genlist_item_expanded_set(glit, EINA_TRUE); | ||
88 | } | ||
89 | |||
90 | static void | ||
91 | gltt_con_req(void *data __UNUSED__, | ||
92 | Evas_Object *obj __UNUSED__, | ||
93 | void *event_info) | ||
94 | { | ||
95 | Elm_Object_Item *glit = event_info; | ||
96 | elm_genlist_item_expanded_set(glit, EINA_FALSE); | ||
97 | } | ||
98 | |||
99 | char * | ||
100 | gltt_text_get(void *data, | ||
101 | Evas_Object *obj __UNUSED__, | ||
102 | const char *part __UNUSED__) | ||
103 | { | ||
104 | char buf[256]; | ||
105 | snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data); | ||
106 | return strdup(buf); | ||
107 | } | ||
108 | |||
109 | static Evas_Object * | ||
110 | _tt_item_icon(void *data __UNUSED__, | ||
111 | Evas_Object *obj __UNUSED__, | ||
112 | Evas_Object *tt, | ||
113 | void *item __UNUSED__) | ||
114 | { | ||
115 | Evas_Object *ic = elm_icon_add(tt); | ||
116 | char buf[PATH_MAX]; | ||
117 | snprintf(buf, sizeof(buf), "%s/images/logo_small.png", | ||
118 | elm_app_data_dir_get()); | ||
119 | elm_icon_file_set(ic, buf, NULL); | ||
120 | elm_icon_resizable_set(ic, 0, 0); | ||
121 | evas_object_resize(ic, 64, 64); | ||
122 | return ic; | ||
123 | } | ||
124 | |||
125 | static Evas_Object * | ||
126 | _tt_item_icon2(void *data __UNUSED__, | ||
127 | Evas_Object *obj __UNUSED__, | ||
128 | Evas_Object *tt, | ||
129 | void *item __UNUSED__) | ||
130 | { | ||
131 | Evas_Object *ic = elm_icon_add(tt); | ||
132 | char buf[PATH_MAX]; | ||
133 | snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); | ||
134 | elm_icon_file_set(ic, buf, NULL); | ||
135 | elm_icon_resizable_set(ic, 0, 0); | ||
136 | return ic; | ||
137 | } | ||
138 | |||
139 | static Evas_Object * | ||
140 | _tt_item_icon3(void *data __UNUSED__, | ||
141 | Evas_Object *obj __UNUSED__, | ||
142 | Evas_Object *tt, | ||
143 | void *item __UNUSED__) | ||
144 | { | ||
145 | int w, h, sw, sh; | ||
146 | Evas_Object *ic = elm_icon_add(tt); | ||
147 | |||
148 | char buf[PATH_MAX]; | ||
149 | snprintf(buf, sizeof(buf), "%s/images/insanely_huge_test_image.jpg", elm_app_data_dir_get()); | ||
150 | elm_icon_file_set(ic, buf, NULL); | ||
151 | elm_icon_size_get(ic, &w, &h); | ||
152 | elm_icon_resizable_set(ic, 0, 0); | ||
153 | elm_win_screen_size_get(tt, NULL, NULL, &sw, &sh); | ||
154 | if ((w > sw) || (h > sh)) | ||
155 | { | ||
156 | float sc = 0; | ||
157 | if ((float)w / (float)sw >= 0.8) | ||
158 | sc = ((float)sw * 0.8) / (float)w; | ||
159 | else if ((float)h / (float)sh >= 0.8) | ||
160 | sc = ((float)sh * 0.8) / (float)h; | ||
161 | if (sc) elm_object_scale_set(ic, sc); | ||
162 | } | ||
163 | return ic; | ||
164 | } | ||
165 | |||
166 | static Evas_Object * | ||
167 | _tt_item_label(void *data __UNUSED__, | ||
168 | Evas_Object *obj __UNUSED__, | ||
169 | Evas_Object *tt, | ||
170 | void *item __UNUSED__) | ||
171 | { | ||
172 | Evas_Object *l = elm_label_add(tt); | ||
173 | elm_object_text_set(l, "Something useful here?<ps/>" | ||
174 | "No probably not, but this is a super long label<ps/>" | ||
175 | "which probably breaks on your system, now doesn't it?<ps/>" | ||
176 | "Yeah, I thought so."); | ||
177 | elm_label_line_wrap_set(l, ELM_WRAP_MIXED); | ||
178 | return l; | ||
179 | } | ||
180 | |||
181 | static void | ||
182 | _tt_item_icon_del(void *data, | ||
183 | Evas_Object *obj __UNUSED__, | ||
184 | void *event_info) | ||
185 | { | ||
186 | // test to check for del_cb behavior! | ||
187 | printf("_tt_icon_del: data=%ld (== 456?), event_info=%p\n", | ||
188 | (long)data, event_info); | ||
189 | } | ||
190 | |||
191 | static void | ||
192 | _tt_text_replace(void *data __UNUSED__, | ||
193 | Evas_Object *obj, | ||
194 | void *event_info __UNUSED__) | ||
195 | { | ||
196 | static int count = 0; | ||
197 | char buf[64]; | ||
198 | snprintf(buf, sizeof(buf), "count=%d", count); | ||
199 | count++; | ||
200 | elm_object_tooltip_text_set(obj, buf); | ||
201 | } | ||
202 | |||
203 | static void | ||
204 | _tt_timer_del(void *data __UNUSED__, | ||
205 | Evas *e __UNUSED__, | ||
206 | Evas_Object *obj, | ||
207 | void *event_info __UNUSED__) | ||
208 | { | ||
209 | Ecore_Timer *timer = evas_object_data_del(obj, "test-timer"); | ||
210 | if (!timer) return; | ||
211 | ecore_timer_del(timer); | ||
212 | } | ||
213 | |||
214 | static Eina_Bool | ||
215 | _tt_text_replace_timer_cb(void *data) | ||
216 | { | ||
217 | _tt_text_replace(NULL, data, NULL); | ||
218 | return EINA_TRUE; | ||
219 | } | ||
220 | |||
221 | static void | ||
222 | _tt_text_replace_timed(void *data __UNUSED__, | ||
223 | Evas_Object *obj, | ||
224 | void *event_info __UNUSED__) | ||
225 | { | ||
226 | Ecore_Timer *timer = evas_object_data_get(obj, "test-timer"); | ||
227 | if (timer) | ||
228 | { | ||
229 | ecore_timer_del(timer); | ||
230 | evas_object_data_del(obj, "test-timer"); | ||
231 | elm_object_text_set(obj, "Simple text tooltip, click to start" | ||
232 | " changed timed"); | ||
233 | return; | ||
234 | } | ||
235 | |||
236 | timer = ecore_timer_add(1.5, _tt_text_replace_timer_cb, obj); | ||
237 | evas_object_data_set(obj, "test-timer", timer); | ||
238 | elm_object_text_set(obj, "Simple text tooltip, click to stop changed" | ||
239 | " timed"); | ||
240 | } | ||
241 | |||
242 | static Evas_Object * | ||
243 | _tt_icon(void *data __UNUSED__, | ||
244 | Evas_Object *obj __UNUSED__, | ||
245 | Evas_Object *tt) | ||
246 | { | ||
247 | Evas_Object *ic = elm_icon_add(tt); | ||
248 | char buf[PATH_MAX]; | ||
249 | snprintf(buf, sizeof(buf), "%s/images/logo_small.png", | ||
250 | elm_app_data_dir_get()); | ||
251 | elm_icon_file_set(ic, buf, NULL); | ||
252 | elm_icon_resizable_set(ic, 0, 0); | ||
253 | evas_object_resize(ic, 64, 64); | ||
254 | return ic; | ||
255 | } | ||
256 | |||
257 | static Evas_Object * | ||
258 | _tt_icon2(void *data __UNUSED__, | ||
259 | Evas_Object *obj __UNUSED__, | ||
260 | Evas_Object *tt) | ||
261 | { | ||
262 | Evas_Object *ic = elm_icon_add(tt); | ||
263 | char buf[PATH_MAX]; | ||
264 | snprintf(buf, sizeof(buf), "%s/images/icon_00.png", elm_app_data_dir_get()); | ||
265 | elm_icon_file_set(ic, buf, NULL); | ||
266 | elm_icon_resizable_set(ic, 0, 0); | ||
267 | evas_object_resize(ic, 64, 64); | ||
268 | return ic; | ||
269 | } | ||
270 | |||
271 | static void | ||
272 | _tt_icon_del(void *data, | ||
273 | Evas_Object *obj __UNUSED__, | ||
274 | void *event_info) | ||
275 | { | ||
276 | // test to check for del_cb behavior! | ||
277 | printf("_tt_icon_del: data=%ld (== 123?), event_info=%p\n", | ||
278 | (long)data, event_info); | ||
279 | } | ||
280 | |||
281 | static Eina_Bool | ||
282 | _tt_icon_replace_timer_cb(void *data) | ||
283 | { | ||
284 | static int current = 0; | ||
285 | |||
286 | elm_object_tooltip_content_cb_set | ||
287 | (data, current ? _tt_icon2 : _tt_icon, NULL, NULL); | ||
288 | |||
289 | current = !current; | ||
290 | return EINA_TRUE; | ||
291 | } | ||
292 | |||
293 | static void | ||
294 | _tt_icon_replace_timed(void *data __UNUSED__, | ||
295 | Evas_Object *obj, | ||
296 | void *event_info __UNUSED__) | ||
297 | { | ||
298 | Ecore_Timer *timer = evas_object_data_get(obj, "test-timer"); | ||
299 | if (timer) | ||
300 | { | ||
301 | ecore_timer_del(timer); | ||
302 | evas_object_data_del(obj, "test-timer"); | ||
303 | elm_object_text_set(obj, "Icon tooltip, click to start changed" | ||
304 | " timed"); | ||
305 | return; | ||
306 | } | ||
307 | |||
308 | timer = ecore_timer_add(1.5, _tt_icon_replace_timer_cb, obj); | ||
309 | evas_object_data_set(obj, "test-timer", timer); | ||
310 | elm_object_text_set(obj, "Icon tooltip, click to stop changed timed"); | ||
311 | } | ||
312 | |||
313 | static Eina_Bool | ||
314 | _tt_style_replace_timer_cb(void *data) | ||
315 | { | ||
316 | static int current = 0; | ||
317 | elm_object_tooltip_style_set(data, current ? NULL : "transparent"); | ||
318 | current = !current; | ||
319 | return EINA_TRUE; | ||
320 | } | ||
321 | |||
322 | static void | ||
323 | _tt_style_replace_timed(void *data __UNUSED__, | ||
324 | Evas_Object *obj, | ||
325 | void *event_info __UNUSED__) | ||
326 | { | ||
327 | Ecore_Timer *timer = evas_object_data_get(obj, "test-timer"); | ||
328 | if (timer) | ||
329 | { | ||
330 | ecore_timer_del(timer); | ||
331 | evas_object_data_del(obj, "test-timer"); | ||
332 | elm_object_text_set(obj, "Icon tooltip style, click to start" | ||
333 | " changed timed"); | ||
334 | return; | ||
335 | } | ||
336 | |||
337 | timer = ecore_timer_add(1.5, _tt_style_replace_timer_cb, obj); | ||
338 | evas_object_data_set(obj, "test-timer", timer); | ||
339 | elm_object_text_set(obj, "Icon tooltip style, click to stop changed" | ||
340 | " timed"); | ||
341 | } | ||
342 | |||
343 | static void | ||
344 | _tt_visible_lock_toggle(void *data __UNUSED__, | ||
345 | Evas_Object *obj, | ||
346 | void *event_info __UNUSED__) | ||
347 | { | ||
348 | static int locked = 0; | ||
349 | |||
350 | locked = !locked; | ||
351 | if (locked) | ||
352 | { | ||
353 | elm_object_text_set(obj, "Locked tooltip visibility"); | ||
354 | elm_object_tooltip_text_set(obj, "This tooltip is locked" | ||
355 | " visible,<br/> click the button" | ||
356 | " to unlock!"); | ||
357 | elm_object_tooltip_show(obj); | ||
358 | } | ||
359 | else | ||
360 | { | ||
361 | elm_object_text_set(obj, "Unlocked tooltip visibility"); | ||
362 | elm_object_tooltip_text_set(obj, "This tooltip is unlocked" | ||
363 | " visible,<br/> click the button" | ||
364 | " to lock!"); | ||
365 | elm_object_tooltip_hide(obj); | ||
366 | } | ||
367 | } | ||
368 | |||
369 | void | ||
370 | test_tooltip(void *data __UNUSED__, | ||
371 | Evas_Object *obj __UNUSED__, | ||
372 | void *event_info __UNUSED__) | ||
373 | { | ||
374 | Evas_Object *win, *bx, *tb, *bt, *se, *lst; | ||
375 | Elm_Object_Item *tb_it; | ||
376 | Elm_Object_Item *lit; | ||
377 | |||
378 | win = elm_win_util_standard_add("tooltip", "Tooltip"); | ||
379 | elm_win_autodel_set(win, EINA_TRUE); | ||
380 | |||
381 | bx = elm_box_add(win); | ||
382 | evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, | ||
383 | EVAS_HINT_EXPAND); | ||
384 | elm_win_resize_object_add(win, bx); | ||
385 | evas_object_show(bx); | ||
386 | |||
387 | tb = elm_toolbar_add(win); | ||
388 | elm_toolbar_homogeneous_set(tb, 0); | ||
389 | evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0); | ||
390 | evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); | ||
391 | elm_box_pack_end(bx, tb); | ||
392 | evas_object_show(tb); | ||
393 | |||
394 | tb_it = elm_toolbar_item_append(tb, NULL, "Open", NULL, NULL); | ||
395 | elm_object_item_tooltip_text_set(tb_it, "Opens a file"); | ||
396 | |||
397 | tb_it = elm_toolbar_item_append(tb, NULL, "Icon", NULL, NULL); | ||
398 | elm_object_item_tooltip_content_cb_set | ||
399 | (tb_it, _tt_item_icon, (void *)456L, _tt_item_icon_del); | ||
400 | elm_object_item_tooltip_style_set(tb_it, "transparent"); | ||
401 | |||
402 | bt = elm_button_add(win); | ||
403 | elm_object_text_set(bt, "Simple text tooltip"); | ||
404 | elm_object_tooltip_text_set(bt, "Simple text tooltip"); | ||
405 | elm_box_pack_end(bx, bt); | ||
406 | evas_object_show(bt); | ||
407 | |||
408 | bt = elm_button_add(win); | ||
409 | elm_object_text_set(bt, "Simple text tooltip, click to change"); | ||
410 | elm_object_tooltip_text_set(bt, "Initial"); | ||
411 | evas_object_smart_callback_add(bt, "clicked", _tt_text_replace, NULL); | ||
412 | elm_box_pack_end(bx, bt); | ||
413 | evas_object_show(bt); | ||
414 | |||
415 | bt = elm_button_add(win); | ||
416 | elm_object_text_set(bt, "Simple text tooltip, click to start" | ||
417 | " changed timed"); | ||
418 | elm_object_tooltip_text_set(bt, "Initial"); | ||
419 | evas_object_smart_callback_add(bt, "clicked", _tt_text_replace_timed, | ||
420 | NULL); | ||
421 | elm_box_pack_end(bx, bt); | ||
422 | evas_object_show(bt); | ||
423 | evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _tt_timer_del, | ||
424 | NULL); | ||
425 | |||
426 | bt = elm_button_add(win); | ||
427 | elm_object_text_set(bt, "Icon tooltip"); | ||
428 | elm_object_tooltip_content_cb_set(bt, _tt_icon, (void *)123L, | ||
429 | _tt_icon_del); | ||
430 | elm_box_pack_end(bx, bt); | ||
431 | evas_object_show(bt); | ||
432 | |||
433 | bt = elm_button_add(win); | ||
434 | elm_object_text_set(bt, "Icon tooltip, click to start changed timed"); | ||
435 | elm_object_tooltip_content_cb_set(bt, _tt_icon, NULL, NULL); | ||
436 | evas_object_smart_callback_add(bt, "clicked", _tt_icon_replace_timed, | ||
437 | NULL); | ||
438 | elm_box_pack_end(bx, bt); | ||
439 | evas_object_show(bt); | ||
440 | evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _tt_timer_del, | ||
441 | NULL); | ||
442 | |||
443 | bt = elm_button_add(win); | ||
444 | elm_object_text_set(bt, "Transparent Icon tooltip"); | ||
445 | elm_object_tooltip_content_cb_set(bt, _tt_icon, NULL, NULL); | ||
446 | elm_object_tooltip_style_set(bt, "transparent"); | ||
447 | elm_box_pack_end(bx, bt); | ||
448 | evas_object_show(bt); | ||
449 | |||
450 | bt = elm_button_add(win); | ||
451 | elm_object_text_set(bt, "Icon tooltip style, click to start changed" | ||
452 | " timed"); | ||
453 | elm_object_tooltip_content_cb_set(bt, _tt_icon, NULL, NULL); | ||
454 | evas_object_smart_callback_add(bt, "clicked", _tt_style_replace_timed, | ||
455 | NULL); | ||
456 | elm_box_pack_end(bx, bt); | ||
457 | evas_object_show(bt); | ||
458 | evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _tt_timer_del, | ||
459 | NULL); | ||
460 | |||
461 | bt = elm_button_add(win); | ||
462 | elm_object_text_set(bt, "Unlocked tooltip visibility"); | ||
463 | elm_object_tooltip_text_set(bt, "This tooltip is unlocked visible,<br/>" | ||
464 | " click the button to lock!"); | ||
465 | evas_object_smart_callback_add(bt, "clicked", _tt_visible_lock_toggle, | ||
466 | NULL); | ||
467 | elm_box_pack_end(bx, bt); | ||
468 | evas_object_show(bt); | ||
469 | |||
470 | se = elm_entry_add(win); | ||
471 | elm_entry_scrollable_set(se, EINA_TRUE); | ||
472 | evas_object_size_hint_weight_set(se, EVAS_HINT_EXPAND, 0.0); | ||
473 | evas_object_size_hint_align_set(se, EVAS_HINT_FILL, 0.5); | ||
474 | elm_entry_scrollbar_policy_set(se, ELM_SCROLLER_POLICY_OFF, | ||
475 | ELM_SCROLLER_POLICY_OFF); | ||
476 | elm_object_text_set(se, "Hello, some entry here!"); | ||
477 | elm_object_tooltip_text_set(se, "Type something here!"); | ||
478 | elm_entry_single_line_set(se, EINA_TRUE); | ||
479 | elm_box_pack_end(bx, se); | ||
480 | evas_object_show(se); | ||
481 | |||
482 | lst = elm_list_add(win); | ||
483 | lit = elm_list_item_append(lst, "Hello", NULL, NULL, NULL, NULL); | ||
484 | elm_object_item_tooltip_content_cb_set(lit, _tt_item_label, NULL, NULL); | ||
485 | elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE); | ||
486 | lit = elm_list_item_append(lst, "Icon Tooltip", NULL, NULL, NULL, NULL); | ||
487 | elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon, NULL, NULL); | ||
488 | lit = elm_list_item_append(lst, "Big Icon Tooltip", NULL, NULL, NULL, NULL); | ||
489 | elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon2, NULL, NULL); | ||
490 | elm_object_item_tooltip_style_set(lit, "transparent"); | ||
491 | elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE); | ||
492 | lit = elm_list_item_append(lst, "Insanely Big Icon Tooltip", NULL, NULL, NULL, NULL); | ||
493 | elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon3, NULL, NULL); | ||
494 | elm_object_item_tooltip_style_set(lit, "transparent"); | ||
495 | elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE); | ||
496 | evas_object_size_hint_weight_set(lst, EVAS_HINT_EXPAND, | ||
497 | EVAS_HINT_EXPAND); | ||
498 | evas_object_size_hint_align_set(lst, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
499 | evas_object_size_hint_min_set(lst, 100, 100); | ||
500 | elm_list_go(lst); | ||
501 | elm_box_pack_end(bx, lst); | ||
502 | evas_object_show(lst); | ||
503 | |||
504 | evas_object_resize(win, 320, 580); | ||
505 | evas_object_show(win); | ||
506 | } | ||
507 | |||
508 | void | ||
509 | test_tooltip2(void *data __UNUSED__, | ||
510 | Evas_Object *obj __UNUSED__, | ||
511 | void *event_info __UNUSED__) | ||
512 | { | ||
513 | Evas_Object *win, *bx, *grid, *gl; | ||
514 | Elm_Object_Item *glit1, *glit2, *glit3; | ||
515 | static Testitem ti[144]; | ||
516 | int i, n; | ||
517 | char buf[PATH_MAX]; | ||
518 | const char *img[9] = | ||
519 | { | ||
520 | "panel_01.jpg", | ||
521 | "plant_01.jpg", | ||
522 | "rock_01.jpg", | ||
523 | "rock_02.jpg", | ||
524 | "sky_01.jpg", | ||
525 | "sky_02.jpg", | ||
526 | "sky_03.jpg", | ||
527 | "sky_04.jpg", | ||
528 | "wood_01.jpg", | ||
529 | }; | ||
530 | |||
531 | win = elm_win_util_standard_add("tooltip2", "Tooltip 2"); | ||
532 | elm_win_autodel_set(win, EINA_TRUE); | ||
533 | |||
534 | bx = elm_box_add(win); | ||
535 | evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, | ||
536 | EVAS_HINT_EXPAND); | ||
537 | elm_win_resize_object_add(win, bx); | ||
538 | evas_object_show(bx); | ||
539 | |||
540 | grid = elm_gengrid_add(win); | ||
541 | elm_gengrid_item_size_set(grid, 100, 100); | ||
542 | elm_gengrid_horizontal_set(grid, EINA_FALSE); | ||
543 | elm_gengrid_multi_select_set(grid, EINA_TRUE); | ||
544 | evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
545 | evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, | ||
546 | EVAS_HINT_EXPAND); | ||
547 | |||
548 | gic.item_style = "default"; | ||
549 | gic.func.text_get = grdt_lbl_get; | ||
550 | gic.func.content_get = grdt_content_get; | ||
551 | |||
552 | n = 0; | ||
553 | for (i = 0; i < 9; i++) | ||
554 | { | ||
555 | snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), | ||
556 | img[n]); | ||
557 | n++; | ||
558 | ti[i].mode = i; | ||
559 | ti[i].path = eina_stringshare_add(buf); | ||
560 | ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), NULL, | ||
561 | NULL); | ||
562 | if (n % 2) | ||
563 | elm_gengrid_item_tooltip_text_set(ti[i].item, "Testing X"); | ||
564 | else | ||
565 | elm_gengrid_item_tooltip_text_set(ti[i].item, "Testing Y"); | ||
566 | if (!(i % 5)) | ||
567 | elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE); | ||
568 | } | ||
569 | |||
570 | elm_box_pack_end(bx, grid); | ||
571 | evas_object_show(grid); | ||
572 | |||
573 | gl = elm_genlist_add(win); | ||
574 | evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
575 | evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, | ||
576 | EVAS_HINT_EXPAND); | ||
577 | |||
578 | itct.item_style = "default"; | ||
579 | itct.func.text_get = gltt_text_get; | ||
580 | |||
581 | glit1 = elm_genlist_item_append(gl, &itct, (void *)1, NULL, | ||
582 | ELM_GENLIST_ITEM_TREE, NULL, NULL); | ||
583 | glit2 = elm_genlist_item_append(gl, &itct, (void *)2, NULL, | ||
584 | ELM_GENLIST_ITEM_TREE, NULL, NULL); | ||
585 | glit3 = elm_genlist_item_append(gl, &itct, (void *)3, NULL, | ||
586 | ELM_GENLIST_ITEM_NONE, NULL, NULL); | ||
587 | |||
588 | elm_genlist_item_tooltip_text_set(glit1, "Testing 1"); | ||
589 | elm_genlist_item_tooltip_text_set(glit2, "Testing 2"); | ||
590 | elm_genlist_item_tooltip_text_set(glit3, "Testing 3"); | ||
591 | |||
592 | evas_object_smart_callback_add(gl, "expand,request", gltt_exp_req, gl); | ||
593 | evas_object_smart_callback_add(gl, "contract,request", gltt_con_req, | ||
594 | gl); | ||
595 | evas_object_smart_callback_add(gl, "expanded", gltt_exp, gl); | ||
596 | evas_object_smart_callback_add(gl, "contracted", gltt_con, gl); | ||
597 | |||
598 | elm_box_pack_end(bx, gl); | ||
599 | evas_object_show(gl); | ||
600 | |||
601 | evas_object_resize(win, 320, 480); | ||
602 | evas_object_show(win); | ||
603 | } | ||
604 | |||
605 | #endif | ||