1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 mode_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
10 Evas_Object *win = data;
14 mbs = evas_object_data_get(win, "mbs");
15 EINA_LIST_FOREACH(mbs, l, mb)
17 if (elm_mapbuf_enabled_get(mb))
18 elm_mapbuf_enabled_set(mb, 0);
20 elm_mapbuf_enabled_set(mb, 1);
25 full_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
27 Evas_Object *win = data;
28 elm_win_fullscreen_set(win, !elm_win_fullscreen_get(win));
32 alpha_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
34 Evas_Object *win = data;
38 mbs = evas_object_data_get(win, "mbs");
39 EINA_LIST_FOREACH(mbs, l, mb)
41 elm_mapbuf_alpha_set(mb, elm_check_state_get(obj));
46 smooth_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
48 Evas_Object *win = data;
52 mbs = evas_object_data_get(win, "mbs");
53 EINA_LIST_FOREACH(mbs, l, mb)
55 elm_mapbuf_smooth_set(mb, elm_check_state_get(obj));
60 close_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
62 evas_object_del(data);
68 Evas_Object *tb, *sc, *mb;
71 evas_object_data_del(data, "timer");
72 tb = evas_object_data_get(data, "tb");
73 sc = evas_object_data_get(data, "sc");
74 elm_object_scroll_freeze_push(sc);
75 evas_object_data_set(data, "dragging", (void *)(long)(1));
76 evas_object_color_set(data, 255, 255, 255, 255);
77 list = (Eina_List *)evas_object_data_get
78 (elm_object_top_widget_get(data), "mbs");
79 EINA_LIST_FOREACH(list, l, mb)
80 evas_object_color_set(mb, 128, 128, 128, 128);
81 elm_table_unpack(tb, data);
86 ic_del_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
90 tim = evas_object_data_get(obj, "timer");
93 evas_object_data_del(obj, "timer");
99 ic_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
101 Evas_Event_Mouse_Down *ev = event_info;
103 Evas_Coord x, y, w, h;
105 evas_object_color_set(data, 128, 0, 0, 128);
107 tim = evas_object_data_get(obj, "timer");
108 if (tim) evas_object_data_del(obj, "timer");
109 tim = ecore_timer_add(1.0, tim_cb, obj);
110 evas_object_data_set(obj, "timer", tim);
112 evas_object_geometry_get(data, &x, &y, &w, &h);
113 evas_object_data_set(obj, "x", (void *)(long)(ev->canvas.x));
114 evas_object_data_set(obj, "y", (void *)(long)(ev->canvas.y));
115 evas_object_data_set(obj, "px", (void *)(long)(x));
116 evas_object_data_set(obj, "py", (void *)(long)(y));
118 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
120 printf("double click %p\n", obj);
125 ic_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
127 Evas_Event_Mouse_Up *ev = event_info;
130 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
131 evas_object_color_set(data, 255, 255, 255, 255);
132 tim = evas_object_data_get(obj, "timer");
135 evas_object_data_del(obj, "timer");
136 ecore_timer_del(tim);
138 if (evas_object_data_get(obj, "dragging"))
140 Evas_Object *tb, *sc, *mb;
144 evas_object_data_del(obj, "dragging");
145 tb = evas_object_data_get(obj, "tb");
146 sc = evas_object_data_get(obj, "sc");
147 elm_object_scroll_freeze_pop(sc);
148 tbx = (int)(long)evas_object_data_get(obj, "tbx");
149 tby = (int)(long)evas_object_data_get(obj, "tby");
150 elm_table_pack(tb, obj, tbx, tby, 1, 1);
151 list = (Eina_List *)evas_object_data_get
152 (elm_object_top_widget_get(obj), "mbs");
153 EINA_LIST_FOREACH(list, l, mb)
154 evas_object_color_set(mb, 255, 255, 255, 255);
159 ic_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
161 Evas_Event_Mouse_Move *ev = event_info;
162 if (evas_object_data_get(obj, "dragging"))
164 Evas_Coord x, y, px, py;
166 x = (Evas_Coord)(long)evas_object_data_get(obj, "x");
167 y = (Evas_Coord)(long)evas_object_data_get(obj, "y");
168 px = (Evas_Coord)(long)evas_object_data_get(obj, "px");
169 py = (Evas_Coord)(long)evas_object_data_get(obj, "py");
170 evas_object_move(obj,
171 px + ev->cur.canvas.x - x,
172 py + ev->cur.canvas.y - y);
174 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
178 tim = evas_object_data_get(obj, "timer");
181 evas_object_data_del(obj, "timer");
182 ecore_timer_del(tim);
184 evas_object_color_set(data, 255, 255, 255, 255);
190 test_launcher(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
192 Evas_Object *win, *bg, *sc, *tb, *pad, *bt, *ic, *lb, *tb2, *mb, *ck, *bx, *bx2;
195 const char *names[] =
197 "Hello", "World", "Spam", "Egg",
198 "Ham", "Good", "Bad", "Milk",
199 "Smell", "Of", "Sky", "Gold",
200 "Hole", "Pig", "And", "Calm"
202 Eina_List *mbs = NULL;
204 win = elm_win_add(NULL, "launcher", ELM_WIN_BASIC);
205 elm_win_title_set(win, "Launcher");
206 elm_win_autodel_set(win, 1);
208 bg = elm_bg_add(win);
209 snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", PACKAGE_DATA_DIR);
210 elm_bg_file_set(bg, buf, NULL);
211 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
212 elm_win_resize_object_add(win, bg);
213 evas_object_show(bg);
215 bx = elm_box_add(win);
216 elm_box_homogeneous_set(bx, EINA_TRUE);
217 elm_box_horizontal_set(bx, EINA_TRUE);
219 sc = elm_scroller_add(win);
220 elm_scroller_bounce_set(sc, 1, 0);
221 elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
222 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
223 evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
226 for (k = 0 ; k < 8; k++)
228 tb = elm_table_add(win);
229 evas_object_size_hint_weight_set(tb, 0.0, 0.0);
230 evas_object_size_hint_align_set(tb, 0.5, 0.5);
232 pad = evas_object_rectangle_add(evas_object_evas_get(win));
233 evas_object_size_hint_min_set(pad, 470, 4);
234 evas_object_size_hint_weight_set(pad, 0.0, 0.0);
235 evas_object_size_hint_align_set(pad, EVAS_HINT_FILL, EVAS_HINT_FILL);
236 elm_table_pack(tb, pad, 1, 0, 5, 1);
238 pad = evas_object_rectangle_add(evas_object_evas_get(win));
239 evas_object_size_hint_min_set(pad, 470, 4);
240 evas_object_size_hint_weight_set(pad, 0.0, 0.0);
241 evas_object_size_hint_align_set(pad, EVAS_HINT_FILL, EVAS_HINT_FILL);
242 elm_table_pack(tb, pad, 1, 11, 5, 1);
244 pad = evas_object_rectangle_add(evas_object_evas_get(win));
245 evas_object_size_hint_min_set(pad, 4, 4);
246 evas_object_size_hint_weight_set(pad, 0.0, 0.0);
247 evas_object_size_hint_align_set(pad, EVAS_HINT_FILL, EVAS_HINT_FILL);
248 elm_table_pack(tb, pad, 0, 1, 1, 10);
250 pad = evas_object_rectangle_add(evas_object_evas_get(win));
251 evas_object_size_hint_min_set(pad, 4, 4);
252 evas_object_size_hint_weight_set(pad, 0.0, 0.0);
253 evas_object_size_hint_align_set(pad, EVAS_HINT_FILL, EVAS_HINT_FILL);
254 elm_table_pack(tb, pad, 6, 1, 1, 10);
256 mb = elm_mapbuf_add(win);
257 elm_mapbuf_content_set(mb, tb);
258 evas_object_show(tb);
260 for (j = 0; j < 5; j++)
262 for (i = 0; i < 5; i++)
264 ic = elm_icon_add(win);
265 elm_object_scale_set(ic, 0.5);
266 snprintf(buf, sizeof(buf), "%s/images/icon_%02i.png", PACKAGE_DATA_DIR, n);
267 elm_icon_file_set(ic, buf, NULL);
268 elm_icon_scale_set(ic, 0, 0);
269 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
270 evas_object_size_hint_align_set(ic, 0.5, 0.5);
271 elm_table_pack(tb, ic, 1 + i, 1 + (j * 2), 1, 1);
272 evas_object_show(ic);
274 lb = elm_label_add(win);
275 elm_object_style_set(lb, "marker");
276 elm_object_text_set(lb, names[m]);
277 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
278 evas_object_size_hint_align_set(lb, 0.5, 0.5);
279 elm_table_pack(tb, lb, 1 + i, 1 + (j * 2) + 1, 1, 1);
280 evas_object_show(lb);
282 evas_object_event_callback_add(ic, EVAS_CALLBACK_DEL, ic_del_cb, ic);
284 evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_DOWN, ic_down_cb, ic);
285 evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_UP, ic_up_cb, ic);
286 evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_MOVE, ic_move_cb, ic);
288 evas_object_data_set(ic, "lb", lb);
289 evas_object_data_set(ic, "tb", tb);
290 evas_object_data_set(ic, "sc", sc);
291 evas_object_data_set(ic, "bx", bx);
292 evas_object_data_set(ic, "mb", mb);
293 evas_object_data_set(ic, "tbx", (void *)(long)(1 + i));
294 evas_object_data_set(ic, "tby", (void *)(long)(1 + (j * 2)));
296 n++; if (n > 23) n = 0;
297 m++; if (m > 15) m = 0;
301 elm_box_pack_end(bx, mb);
302 evas_object_show(mb);
304 mbs = eina_list_append(mbs, mb);
308 evas_object_data_set(win, "mbs", mbs);
310 bx2 = elm_box_add(win);
311 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
312 elm_box_horizontal_set(bx2, EINA_FALSE);
313 elm_win_resize_object_add(win, bx2);
314 evas_object_show(bx2);
316 elm_scroller_content_set(sc, bx);
317 evas_object_show(bx);
319 elm_scroller_page_relative_set(sc, 1.0, 1.0);
320 evas_object_show(sc);
322 tb2 = elm_table_add(win);
323 evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, 0.0);
324 evas_object_size_hint_fill_set(tb2, EVAS_HINT_FILL, EVAS_HINT_FILL);
325 elm_box_pack_end(bx2, tb2);
327 elm_box_pack_end(bx2, sc);
329 ck = elm_check_add(win);
330 elm_object_text_set(ck, "Map");
331 elm_check_state_set(ck, 0);
332 evas_object_smart_callback_add(ck, "changed", mode_cb, win);
333 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
334 evas_object_size_hint_align_set(ck, 0.05, 0.99);
335 elm_table_pack(tb2, ck, 0, 0, 1, 1);
336 evas_object_show(ck);
338 ck = elm_check_add(win);
339 elm_object_text_set(ck, "A");
340 elm_check_state_set(ck, 1);
341 evas_object_smart_callback_add(ck, "changed", alpha_cb, win);
342 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
343 evas_object_size_hint_align_set(ck, 0.20, 0.99);
344 elm_table_pack(tb2, ck, 1, 0, 1, 1);
345 evas_object_show(ck);
347 ck = elm_check_add(win);
348 elm_object_text_set(ck, "Smo");
349 elm_check_state_set(ck, 1);
350 evas_object_smart_callback_add(ck, "changed", smooth_cb, win);
351 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
352 evas_object_size_hint_align_set(ck, 0.40, 0.99);
353 elm_table_pack(tb2, ck, 2, 0, 1, 1);
354 evas_object_show(ck);
356 ck = elm_check_add(win);
357 elm_object_text_set(ck, "FS");
358 elm_check_state_set(ck, 0);
359 evas_object_smart_callback_add(ck, "changed", full_cb, win);
360 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
361 evas_object_size_hint_align_set(ck, 0.5, 0.99);
362 elm_table_pack(tb2, ck, 3, 0, 1, 1);
363 evas_object_show(ck);
365 bt = elm_button_add(win);
366 elm_object_text_set(bt, "Close");
367 evas_object_smart_callback_add(bt, "clicked", close_cb, win);
368 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
369 evas_object_size_hint_align_set(bt, 0.95, 0.99);
370 elm_table_pack(tb2, bt, 4, 0, 1, 1);
371 evas_object_show(bt);
373 evas_object_show(tb2);
375 evas_object_resize(win, 480, 800);
376 evas_object_show(win);
380 test_launcher2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
382 Evas_Object *win, *bg, *sc, *bt, *tb2, *mb, *ck, *bx, *ly;
385 Eina_List *mbs = NULL;
387 win = elm_win_add(NULL, "launcher2", ELM_WIN_BASIC);
388 elm_win_title_set(win, "Launcher 2");
389 elm_win_autodel_set(win, 1);
391 bg = elm_bg_add(win);
392 snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", PACKAGE_DATA_DIR);
393 elm_bg_file_set(bg, buf, NULL);
394 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
395 elm_win_resize_object_add(win, bg);
396 evas_object_show(bg);
398 bx = elm_box_add(win);
399 elm_box_homogeneous_set(bx, EINA_TRUE);
400 elm_box_horizontal_set(bx, EINA_TRUE);
402 for (k = 0 ; k < 8; k++)
404 ly = elm_layout_add(win);
405 snprintf(buf, sizeof(buf), "%s/objects/test.edj", PACKAGE_DATA_DIR);
406 elm_layout_file_set(ly, buf, "layout");
407 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
409 bt = elm_button_add(win);
410 elm_object_text_set(bt, "Button 1");
411 elm_layout_content_set(ly, "element1", bt);
412 evas_object_show(bt);
414 bt = elm_button_add(win);
415 elm_object_text_set(bt, "Button 2");
416 elm_layout_content_set(ly, "element2", bt);
417 evas_object_show(bt);
419 bt = elm_button_add(win);
420 elm_object_text_set(bt, "Button 3");
421 elm_layout_content_set(ly, "element3", bt);
422 evas_object_show(bt);
424 mb = elm_mapbuf_add(win);
425 elm_mapbuf_content_set(mb, ly);
426 evas_object_show(ly);
428 elm_box_pack_end(bx, mb);
429 evas_object_show(mb);
431 mbs = eina_list_append(mbs, mb);
435 evas_object_data_set(win, "mbs", mbs);
437 sc = elm_scroller_add(win);
438 elm_scroller_bounce_set(sc, 1, 0);
439 elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
440 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
441 elm_win_resize_object_add(win, sc);
443 elm_scroller_content_set(sc, bx);
444 evas_object_show(bx);
446 elm_scroller_page_relative_set(sc, 1.0, 1.0);
447 evas_object_show(sc);
449 tb2 = elm_table_add(win);
450 evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
451 elm_win_resize_object_add(win, tb2);
453 ck = elm_check_add(win);
454 elm_object_text_set(ck, "Map");
455 elm_check_state_set(ck, 0);
456 evas_object_smart_callback_add(ck, "changed", mode_cb, win);
457 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
458 evas_object_size_hint_align_set(ck, 0.05, 0.99);
459 elm_table_pack(tb2, ck, 0, 0, 1, 1);
460 evas_object_show(ck);
462 ck = elm_check_add(win);
463 elm_object_text_set(ck, "A");
464 elm_check_state_set(ck, 1);
465 evas_object_smart_callback_add(ck, "changed", alpha_cb, win);
466 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
467 evas_object_size_hint_align_set(ck, 0.20, 0.99);
468 elm_table_pack(tb2, ck, 1, 0, 1, 1);
469 evas_object_show(ck);
471 ck = elm_check_add(win);
472 elm_object_text_set(ck, "Smo");
473 elm_check_state_set(ck, 1);
474 evas_object_smart_callback_add(ck, "changed", smooth_cb, win);
475 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
476 evas_object_size_hint_align_set(ck, 0.40, 0.99);
477 elm_table_pack(tb2, ck, 2, 0, 1, 1);
478 evas_object_show(ck);
480 ck = elm_check_add(win);
481 elm_object_text_set(ck, "FS");
482 elm_check_state_set(ck, 0);
483 evas_object_smart_callback_add(ck, "changed", full_cb, win);
484 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
485 evas_object_size_hint_align_set(ck, 0.5, 0.99);
486 elm_table_pack(tb2, ck, 3, 0, 1, 1);
487 evas_object_show(ck);
489 bt = elm_button_add(win);
490 elm_object_text_set(bt, "Close");
491 evas_object_smart_callback_add(bt, "clicked", close_cb, win);
492 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
493 evas_object_size_hint_align_set(bt, 0.95, 0.99);
494 elm_table_pack(tb2, bt, 4, 0, 1, 1);
495 evas_object_show(bt);
497 evas_object_show(tb2);
499 evas_object_resize(win, 480, 800);
500 evas_object_show(win);
504 l3_mode_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
506 Evas_Object *win = data;
510 mbs = evas_object_data_get(win, "mbs");
511 EINA_LIST_FOREACH(mbs, l, mb)
513 if (elm_mapbuf_enabled_get(mb))
514 elm_mapbuf_enabled_set(mb, 0);
516 elm_mapbuf_enabled_set(mb, 1);
521 l3_full_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
523 Evas_Object *win = data;
524 elm_win_fullscreen_set(win, !elm_win_fullscreen_get(win));
528 l3_alpha_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
530 Evas_Object *win = data;
534 mbs = evas_object_data_get(win, "mbs");
535 EINA_LIST_FOREACH(mbs, l, mb)
537 elm_mapbuf_alpha_set(mb, elm_check_state_get(obj));
542 l3_smooth_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
544 Evas_Object *win = data;
548 mbs = evas_object_data_get(win, "mbs");
549 EINA_LIST_FOREACH(mbs, l, mb)
551 elm_mapbuf_smooth_set(mb, elm_check_state_get(obj));
556 l3_hidden_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
558 Evas_Object *win = data;
562 mbs = evas_object_data_get(win, "mbs");
563 EINA_LIST_FOREACH(mbs, l, mb)
565 if (evas_object_visible_get(mb)) evas_object_hide(mb);
566 else evas_object_show(mb);
571 l3_close_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
573 evas_object_del(data);
577 l3_tim_cb(void *data)
579 Evas_Object *ly, *ly2, *sc, *mb;
584 evas_object_data_del(data, "timer");
585 ly = evas_object_data_get(data, "ly");
586 ly2 = evas_object_data_get(data, "ly2");
587 sc = evas_object_data_get(data, "sc");
588 elm_object_scroll_freeze_push(sc);
589 evas_object_data_set(data, "dragging", (void *)(long)1);
590 evas_object_color_set(data, 255, 255, 255, 255);
591 list = (Eina_List *)evas_object_data_get
592 (elm_object_top_widget_get(data), "mbs");
593 EINA_LIST_FOREACH(list, l, mb)
594 evas_object_color_set(mb, 128, 128, 128, 128);
595 slx = (int)(long)evas_object_data_get(data, "slx");
596 sly = (int)(long)evas_object_data_get(data, "sly");
597 snprintf(buf, sizeof(buf), "slot.%i.%i", slx, sly);
598 elm_layout_content_unset(ly, buf);
599 edje_object_signal_emit(elm_layout_edje_get(ly2), "drag", "app");
604 l3_ic_del_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
608 tim = evas_object_data_get(obj, "timer");
611 evas_object_data_del(obj, "timer");
612 ecore_timer_del(tim);
617 l3_ic_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
619 Evas_Event_Mouse_Down *ev = event_info;
621 Evas_Coord x, y, w, h;
624 tim = evas_object_data_get(obj, "timer");
625 if (tim) evas_object_data_del(obj, "timer");
626 tim = ecore_timer_add(1.0, l3_tim_cb, obj);
627 evas_object_data_set(obj, "timer", tim);
629 ly2 = evas_object_data_get(obj, "ly2");
630 evas_object_geometry_get(ly2, &x, &y, &w, &h);
631 evas_object_data_set(obj, "x", (void *)(long)(ev->canvas.x));
632 evas_object_data_set(obj, "y", (void *)(long)(ev->canvas.y));
633 evas_object_data_set(obj, "px", (void *)(long)(x));
634 evas_object_data_set(obj, "py", (void *)(long)(y));
636 edje_object_signal_emit(elm_layout_edje_get(ly2), "click", "app");
638 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
640 printf("double click %p\n", obj);
645 l3_ic_up_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
647 Evas_Event_Mouse_Up *ev = event_info;
651 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
653 ly2 = evas_object_data_get(obj, "ly2");
654 tim = evas_object_data_get(obj, "timer");
657 evas_object_data_del(obj, "timer");
658 ecore_timer_del(tim);
660 if (evas_object_data_get(obj, "dragging"))
662 Evas_Object *ly, *sc, *mb;
667 evas_object_data_del(obj, "dragging");
668 ly = evas_object_data_get(obj, "ly");
669 sc = evas_object_data_get(obj, "sc");
670 elm_object_scroll_freeze_pop(sc);
671 slx = (int)(long)evas_object_data_get(obj, "slx");
672 sly = (int)(long)evas_object_data_get(obj, "sly");
673 snprintf(buf, sizeof(buf), "slot.%i.%i", slx, sly);
674 elm_layout_content_set(ly, buf, ly2);
675 list = (Eina_List *)evas_object_data_get
676 (elm_object_top_widget_get(obj), "mbs");
677 EINA_LIST_FOREACH(list, l, mb)
678 evas_object_color_set(mb, 255, 255, 255, 255);
679 edje_object_signal_emit(elm_layout_edje_get(ly2), "drop", "app");
682 edje_object_signal_emit(elm_layout_edje_get(ly2), "unclick", "app");
686 l3_ic_move_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
688 Evas_Event_Mouse_Move *ev = event_info;
691 ly2 = evas_object_data_get(obj, "ly2");
693 if (evas_object_data_get(obj, "dragging"))
695 Evas_Coord x, y, px, py;
697 x = (Evas_Coord)(long)evas_object_data_get(obj, "x");
698 y = (Evas_Coord)(long)evas_object_data_get(obj, "y");
699 px = (Evas_Coord)(long)evas_object_data_get(obj, "px");
700 py = (Evas_Coord)(long)evas_object_data_get(obj, "py");
701 evas_object_move(ly2,
702 px + ev->cur.canvas.x - x,
703 py + ev->cur.canvas.y - y);
705 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
709 tim = evas_object_data_get(obj, "timer");
712 evas_object_data_del(obj, "timer");
713 ecore_timer_del(tim);
715 edje_object_signal_emit(elm_layout_edje_get(ly2), "cancel", "app");
721 test_launcher3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
723 Evas_Object *win, *bg, *sc, *tb, *pad, *bt, *ic, *tb2, *mb, *ck, *bx, *bx2, *ly, *ly2;
726 const char *names[] =
728 "Hello", "World", "Spam", "Egg",
729 "Ham", "Good", "Bad", "Milk",
730 "Smell", "Of", "Sky", "Gold",
731 "Hole", "Pig", "And", "Calm"
733 Eina_List *mbs = NULL;
735 win = elm_win_add(NULL, "launcher", ELM_WIN_BASIC);
736 elm_win_title_set(win, "Launcher");
737 elm_win_autodel_set(win, 1);
739 bg = elm_bg_add(win);
740 snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", PACKAGE_DATA_DIR);
741 elm_bg_file_set(bg, buf, NULL);
742 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
743 elm_win_resize_object_add(win, bg);
744 evas_object_show(bg);
746 bx = elm_box_add(win);
747 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
748 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
749 elm_box_homogeneous_set(bx, EINA_TRUE);
750 elm_box_horizontal_set(bx, EINA_TRUE);
752 sc = elm_scroller_add(win);
753 elm_scroller_bounce_set(sc, 1, 0);
754 elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
755 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
756 evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
759 for (k = 0 ; k < 8; k++)
761 tb = elm_table_add(win);
762 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
763 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
765 pad = evas_object_rectangle_add(evas_object_evas_get(win));
766 evas_object_size_hint_min_set(pad, 450, 10);
767 elm_table_pack(tb, pad, 1, 0, 1, 1);
769 pad = evas_object_rectangle_add(evas_object_evas_get(win));
770 evas_object_size_hint_min_set(pad, 450, 10);
771 elm_table_pack(tb, pad, 1, 2, 1, 1);
773 pad = evas_object_rectangle_add(evas_object_evas_get(win));
774 evas_object_size_hint_min_set(pad, 10, 450);
775 elm_table_pack(tb, pad, 0, 1, 1, 1);
777 pad = evas_object_rectangle_add(evas_object_evas_get(win));
778 evas_object_size_hint_min_set(pad, 10, 450);
779 elm_table_pack(tb, pad, 2, 1, 1, 1);
781 mb = elm_mapbuf_add(win);
782 mbs = eina_list_append(mbs, mb);
784 elm_mapbuf_content_set(mb, tb);
785 evas_object_show(tb);
786 elm_box_pack_end(bx, mb);
787 evas_object_show(mb);
789 ly = elm_layout_add(win);
790 snprintf(buf, sizeof(buf), "%s/objects/test.edj", PACKAGE_DATA_DIR);
791 elm_layout_file_set(ly, buf, "launcher_page");
792 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
793 evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
794 elm_table_pack(tb, ly, 1, 1, 1, 1);
795 evas_object_show(ly);
797 for (j = 0; j < 4; j++)
799 for (i = 0; i < 4; i++)
801 ly2 = elm_layout_add(win);
802 snprintf(buf, sizeof(buf), "%s/objects/test.edj", PACKAGE_DATA_DIR);
803 elm_layout_file_set(ly2, buf, "launcher_icon");
804 evas_object_size_hint_weight_set(ly2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
805 evas_object_size_hint_align_set(ly2, EVAS_HINT_FILL, EVAS_HINT_FILL);
806 edje_object_part_text_set(elm_layout_edje_get(ly2), "label", names[m]);
808 ic = elm_icon_add(win);
809 elm_object_scale_set(ic, 0.5);
810 snprintf(buf, sizeof(buf), "%s/images/icon_%02i.png", PACKAGE_DATA_DIR, n);
811 elm_icon_file_set(ic, buf, NULL);
812 elm_icon_scale_set(ic, 0, 0);
813 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
814 evas_object_size_hint_align_set(ic, 0.5, 0.5);
815 elm_layout_content_set(ly2, "slot", ic);
816 evas_object_show(ic);
818 evas_object_event_callback_add(ic, EVAS_CALLBACK_DEL, l3_ic_del_cb, ic);
820 evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_DOWN, l3_ic_down_cb, ic);
821 evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_UP, l3_ic_up_cb, ic);
822 evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_MOVE, l3_ic_move_cb, ic);
824 evas_object_data_set(ic, "ly", ly);
825 evas_object_data_set(ic, "ly2", ly2);
826 evas_object_data_set(ic, "sc", sc);
827 evas_object_data_set(ic, "bx", bx);
828 evas_object_data_set(ic, "mb", mb);
829 evas_object_data_set(ic, "slx", (void *)(long)(i));
830 evas_object_data_set(ic, "sly", (void *)(long)(j));
832 snprintf(buf, sizeof(buf), "slot.%i.%i", i, j);
833 elm_layout_content_set(ly, buf, ly2);
834 evas_object_show(ly2);
836 n++; if (n > 23) n = 0;
837 m++; if (m > 15) m = 0;
843 evas_object_data_set(win, "mbs", mbs);
845 bx2 = elm_box_add(win);
846 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
847 elm_box_horizontal_set(bx2, EINA_FALSE);
848 elm_win_resize_object_add(win, bx2);
849 evas_object_show(bx2);
851 elm_scroller_content_set(sc, bx);
852 evas_object_show(bx);
854 elm_scroller_page_relative_set(sc, 1.0, 1.0);
855 evas_object_show(sc);
857 tb2 = elm_table_add(win);
858 evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, 0.0);
859 evas_object_size_hint_fill_set(tb2, EVAS_HINT_FILL, EVAS_HINT_FILL);
860 elm_box_pack_end(bx2, tb2);
862 elm_box_pack_end(bx2, sc);
864 ck = elm_check_add(win);
865 elm_object_text_set(ck, "Map");
866 elm_check_state_set(ck, 0);
867 evas_object_smart_callback_add(ck, "changed", l3_mode_cb, win);
868 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
869 evas_object_size_hint_align_set(ck, 0.05, 0.99);
870 elm_table_pack(tb2, ck, 0, 0, 1, 1);
871 evas_object_show(ck);
873 ck = elm_check_add(win);
874 elm_object_text_set(ck, "A");
875 elm_check_state_set(ck, 1);
876 evas_object_smart_callback_add(ck, "changed", l3_alpha_cb, win);
877 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
878 evas_object_size_hint_align_set(ck, 0.20, 0.99);
879 elm_table_pack(tb2, ck, 1, 0, 1, 1);
880 evas_object_show(ck);
882 ck = elm_check_add(win);
883 elm_object_text_set(ck, "Smo");
884 elm_check_state_set(ck, 1);
885 evas_object_smart_callback_add(ck, "changed", l3_smooth_cb, win);
886 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
887 evas_object_size_hint_align_set(ck, 0.40, 0.99);
888 elm_table_pack(tb2, ck, 2, 0, 1, 1);
889 evas_object_show(ck);
891 ck = elm_check_add(win);
892 elm_object_text_set(ck, "FS");
893 elm_check_state_set(ck, 0);
894 evas_object_smart_callback_add(ck, "changed", l3_full_cb, win);
895 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
896 evas_object_size_hint_align_set(ck, 0.5, 0.99);
897 elm_table_pack(tb2, ck, 3, 0, 1, 1);
898 evas_object_show(ck);
900 ck = elm_check_add(win);
901 elm_object_text_set(ck, "Hid");
902 elm_check_state_set(ck, 0);
903 evas_object_smart_callback_add(ck, "changed", l3_hidden_cb, win);
904 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
905 evas_object_size_hint_align_set(ck, 0.5, 0.99);
906 elm_table_pack(tb2, ck, 4, 0, 1, 1);
907 evas_object_show(ck);
909 bt = elm_button_add(win);
910 elm_object_text_set(bt, "Close");
911 evas_object_smart_callback_add(bt, "clicked", l3_close_cb, win);
912 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
913 evas_object_size_hint_align_set(bt, 0.95, 0.99);
914 elm_table_pack(tb2, bt, 5, 0, 1, 1);
915 evas_object_show(bt);
917 evas_object_show(tb2);
919 evas_object_resize(win, 480, 800);
920 evas_object_show(win);