1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 #define DOUBLE_TAP_NAME "double_tap"
9 #define TRIPLE_TAP_NAME "triple_tap"
10 #define LONG_TAP_NAME "long_tap"
11 #define FLICK_NAME "flick"
12 #define LINE_NAME "line"
13 #define MOMENTUM_NAME "momentum"
14 #define ROTATE_NAME "rotate"
15 #define ZOOM_NAME "zoom"
17 #define N_GESTURE_TYPE 9
18 #define MAX_DOUBLE_TAP 5
21 #define MAX_LONG_TAP 5
22 #define MAX_MOMENTUM 5
25 #define MAX_TRIPLE_TAP 5
28 #define TB_PADDING_X 4
29 #define TB_PADDING_Y 12
31 #define BX_PADDING_X 0
32 #define BX_PADDING_Y 2
34 /* Define initial RGBA values for icons */
41 #define START_COLOR 220, 220, 200, 255
42 #define MOVE_COLOR 255, 255, 0, 255
43 #define ABORT_COLOR 255, 0, 0, 255
44 #define END_COLOR 0, 255, 0, 255
46 struct _icon_properties
49 int r; /* current r */
56 typedef struct _icon_properties icon_properties;
59 { /* Some data that is passed aroung between callbacks (replacing globals) */
60 icon_properties *icons;
61 Ecore_Timer *colortimer;
64 typedef struct _infra_data infra_data;
67 _infra_data_free(infra_data *infra)
71 if (infra->colortimer)
72 ecore_timer_del(infra->colortimer);
82 _infra_data_alloc(void)
84 infra_data *infra = malloc(sizeof(infra_data));
85 infra->icons = calloc(N_GESTURE_TYPE, sizeof(icon_properties ));
86 infra->colortimer = NULL;
92 my_win_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
93 { /* called when my_win_main is requested to be deleted */
94 _infra_data_free(data);
98 _icon_properties_find(icon_properties *icons, char *name)
102 for (n = 0; n < N_GESTURE_TYPE; n++)
103 if (!strcmp(icons[n].name, name))
110 _icon_color_set(icon_properties *i, int r, int g, int b, int a)
116 evas_object_color_set(i->icon, i->r, i->g, i->b, i->a);
121 _icon_color_set_cb(void *data)
123 #define INC_COLOR(C, NC) \
125 if (abs(i->C - NC) < COLOR_STEP) \
128 i->C += ((i->C < NC) ? COLOR_STEP : (-COLOR_STEP)); \
132 icon_properties *icons = data;
135 for (n = 0; n < N_GESTURE_TYPE; n++)
144 /* Change Icon color */
145 evas_object_color_set(i->icon, i->r, i->g, i->b, i->a);
148 return ECORE_CALLBACK_RENEW;
153 _color_and_icon_set(infra_data *infra, char *name, int n, int max,
154 int r, int g, int b, int a)
158 i = _icon_properties_find(infra->icons, name);
167 snprintf(infra->buf, sizeof(infra->buf),
168 "%s/images/g_layer/%s_%d.png", elm_app_data_dir_get(), i->name, nn);
169 elm_icon_file_set(i->icon, infra->buf, NULL);
170 _icon_color_set(i, r, g, b, a);
174 /* START - Callbacks for gestures */
175 static Evas_Event_Flags
176 n_finger_tap_start(void *data , void *event_info)
178 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
179 _color_and_icon_set(data, TAP_NAME, p->n, MAX_TAP, START_COLOR);
180 printf("N tap started <%p> x,y=<%d,%d> count=<%d>\n",
181 event_info, p->x, p->y, p->n);
182 return EVAS_EVENT_FLAG_ON_HOLD;
185 static Evas_Event_Flags
186 n_finger_tap_end(void *data , void *event_info)
188 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
190 printf("N tap ended <%p> x,y=<%d,%d> count=<%d>\n",
191 event_info, p->x, p->y, p->n);
192 _color_and_icon_set(data, TAP_NAME, p->n, MAX_TAP, END_COLOR);
193 return EVAS_EVENT_FLAG_ON_HOLD;
196 static Evas_Event_Flags
197 n_finger_tap_abort(void *data , void *event_info)
199 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
200 printf("N tap abort\n");
201 _color_and_icon_set(data, TAP_NAME, p->n, MAX_TAP, ABORT_COLOR);
202 return EVAS_EVENT_FLAG_ON_HOLD;
205 static Evas_Event_Flags
206 n_long_tap_start(void *data , void *event_info)
208 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
210 printf("N long tap started <%p> x,y=<%d,%d> count=<%d>\n",
211 event_info, p->x, p->y, p->n);
212 _color_and_icon_set(data, LONG_TAP_NAME, p->n, MAX_LONG_TAP, START_COLOR);
213 return EVAS_EVENT_FLAG_ON_HOLD;
216 static Evas_Event_Flags
217 n_long_tap_move(void *data , void *event_info)
219 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
220 _color_and_icon_set(data, LONG_TAP_NAME, p->n, MAX_LONG_TAP, MOVE_COLOR);
222 printf("N long tap moved <%p> x,y=<%d,%d> count=<%d>\n",
223 event_info, p->x, p->y, p->n);
224 return EVAS_EVENT_FLAG_ON_HOLD;
227 static Evas_Event_Flags
228 n_long_tap_end(void *data , void *event_info)
230 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
232 printf("N long tap ended <%p> x,y=<%d,%d> count=<%d>\n",
233 event_info, p->x, p->y, p->n);
234 _color_and_icon_set(data, LONG_TAP_NAME, p->n, MAX_LONG_TAP, END_COLOR);
235 return EVAS_EVENT_FLAG_ON_HOLD;
238 static Evas_Event_Flags
239 n_long_tap_abort(void *data , void *event_info)
241 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
242 _color_and_icon_set(data, LONG_TAP_NAME, p->n, MAX_LONG_TAP, ABORT_COLOR);
243 printf("N long tap abort\n");
244 return EVAS_EVENT_FLAG_ON_HOLD;
247 static Evas_Event_Flags
248 dbl_click_start(void *data , void *event_info)
250 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
252 _color_and_icon_set(data,DOUBLE_TAP_NAME, p->n, MAX_DOUBLE_TAP, START_COLOR);
253 printf("Double click started <%p> x,y=<%d,%d> count=<%d>\n",
254 event_info, p->x, p->y, p->n);
255 return EVAS_EVENT_FLAG_ON_HOLD;
258 static Evas_Event_Flags
259 dbl_click_end(void *data , void *event_info)
261 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
262 _color_and_icon_set(data, DOUBLE_TAP_NAME, p->n, MAX_DOUBLE_TAP, END_COLOR);
264 printf("Double click ended <%p> x,y=<%d,%d> count=<%d>\n",
265 event_info, p->x, p->y, p->n);
266 return EVAS_EVENT_FLAG_ON_HOLD;
269 static Evas_Event_Flags
270 dbl_click_abort(void *data , void *event_info)
272 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
273 _color_and_icon_set(data,DOUBLE_TAP_NAME, p->n, MAX_DOUBLE_TAP, ABORT_COLOR);
275 printf("Double click abort\n");
276 return EVAS_EVENT_FLAG_ON_HOLD;
279 static Evas_Event_Flags
280 triple_click_start(void *data , void *event_info)
282 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
283 _color_and_icon_set(data,TRIPLE_TAP_NAME, p->n, MAX_TRIPLE_TAP, START_COLOR);
285 printf("Triple click started <%p> x,y=<%d,%d> count=<%d>\n",
286 event_info, p->x, p->y, p->n);
287 return EVAS_EVENT_FLAG_ON_HOLD;
290 static Evas_Event_Flags
291 triple_click_end(void *data , void *event_info)
293 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
295 _color_and_icon_set(data, TRIPLE_TAP_NAME, p->n, MAX_TRIPLE_TAP, END_COLOR);
296 printf("Triple click ended <%p> x,y=<%d,%d> count=<%d>\n",
297 event_info, p->x, p->y, p->n);
298 return EVAS_EVENT_FLAG_ON_HOLD;
301 static Evas_Event_Flags
302 triple_click_abort(void *data , void *event_info)
304 Elm_Gesture_Taps_Info *p = (Elm_Gesture_Taps_Info *) event_info;
305 _color_and_icon_set(data,TRIPLE_TAP_NAME, p->n, MAX_TRIPLE_TAP, ABORT_COLOR);
307 printf("Triple click abort\n");
308 return EVAS_EVENT_FLAG_ON_HOLD;
312 static Evas_Event_Flags
313 momentum_start(void *data , void *event_info)
315 Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info;
316 _color_and_icon_set(data, MOMENTUM_NAME, p->n, MAX_MOMENTUM, START_COLOR);
318 printf("momentum started x1,y1=<%d,%d> tx,ty=<%u,%u> n=<%u>\n",
319 p->x1, p->y1, p->tx, p->ty, p->n);
320 return EVAS_EVENT_FLAG_ON_HOLD;
323 static Evas_Event_Flags
324 momentum_end(void *data , void *event_info)
326 Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info;
327 _color_and_icon_set(data, MOMENTUM_NAME, p->n, MAX_MOMENTUM, END_COLOR);
328 printf("momentum ended x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> mx=<%d> my=<%d> n=<%u>\n",p->x1, p->y1, p->x2, p->y2, p->tx, p->ty, p->mx, p->my, p->n);
329 return EVAS_EVENT_FLAG_ON_HOLD;
332 static Evas_Event_Flags
333 momentum_abort(void *data , void *event_info)
335 Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info;
336 printf("momentum abort\n");
337 _color_and_icon_set(data, MOMENTUM_NAME, p->n, MAX_MOMENTUM, ABORT_COLOR);
338 return EVAS_EVENT_FLAG_ON_HOLD;
341 static Evas_Event_Flags
342 momentum_move(void *data , void *event_info)
344 Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info;
345 _color_and_icon_set(data, MOMENTUM_NAME, p->n, MAX_MOMENTUM, MOVE_COLOR);
346 printf("momentum move x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> mx=<%d> my=<%d> n=<%u>\n", p->x1, p->y1, p->x2, p->y2, p->tx, p->ty, p->mx, p->my, p->n);
347 return EVAS_EVENT_FLAG_ON_HOLD;
350 static Evas_Event_Flags
351 line_start(void *data , void *event_info)
353 Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info;
354 _color_and_icon_set(data, LINE_NAME, p->momentum.n, MAX_LINE, START_COLOR);
356 printf("line started x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> n=<%u>\n", p->momentum.x1, p->momentum.y1, p->momentum.x2, p->momentum.y2, p->momentum.tx, p->momentum.ty, p->momentum.n);
357 return EVAS_EVENT_FLAG_ON_HOLD;
360 static Evas_Event_Flags
361 line_move(void *data , void *event_info)
363 Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info;
364 _color_and_icon_set(data, LINE_NAME, p->momentum.n, MAX_LINE, MOVE_COLOR);
365 printf("line move x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> n=<%u>\n", p->momentum.x1, p->momentum.y1, p->momentum.x2, p->momentum.y2, p->momentum.tx, p->momentum.ty, p->momentum.n);
367 return EVAS_EVENT_FLAG_ON_HOLD;
370 static Evas_Event_Flags
371 line_end(void *data , void *event_info)
373 Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info;
374 _color_and_icon_set(data, LINE_NAME, p->momentum.n, MAX_LINE, END_COLOR);
375 printf("line end x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> n=<%u>\n", p->momentum.x1, p->momentum.y1, p->momentum.x2, p->momentum.y2, p->momentum.tx, p->momentum.ty, p->momentum.n);
376 return EVAS_EVENT_FLAG_ON_HOLD;
379 static Evas_Event_Flags
380 line_abort(void *data , void *event_info)
382 Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info;
383 _color_and_icon_set(data, LINE_NAME, p->momentum.n, MAX_LINE, ABORT_COLOR);
384 printf("line abort\n");
385 return EVAS_EVENT_FLAG_ON_HOLD;
388 static Evas_Event_Flags
389 flick_start(void *data , void *event_info)
391 Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info;
392 _color_and_icon_set(data, FLICK_NAME, p->momentum.n, MAX_FLICK, START_COLOR);
394 printf("flick started x1,y1=<%d,%d> tx,ty=<%u,%u> n=<%u>\n",
395 p->momentum.x1, p->momentum.y1, p->momentum.tx,
396 p->momentum.ty, p->momentum.n);
397 return EVAS_EVENT_FLAG_ON_HOLD;
400 static Evas_Event_Flags
401 flick_end(void *data , void *event_info)
403 Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info;
404 _color_and_icon_set(data, FLICK_NAME, p->momentum.n, MAX_FLICK, END_COLOR);
406 printf("flick ended x1,y1=<%d,%d> x2,y2=<%d,%d> tx,ty=<%u,%u> mx=<%d> my=<%d> n=<%u>\n",p->momentum.x1, p->momentum.y1, p->momentum.x2, p->momentum.y2, p->momentum.tx, p->momentum.ty, p->momentum.mx, p->momentum.my, p->momentum.n);
407 return EVAS_EVENT_FLAG_ON_HOLD;
410 static Evas_Event_Flags
411 flick_abort(void *data , void *event_info)
413 Elm_Gesture_Line_Info *p = (Elm_Gesture_Line_Info *) event_info;
414 _color_and_icon_set(data, FLICK_NAME, p->momentum.n, MAX_FLICK, ABORT_COLOR);
415 printf("flick abort\n");
416 return EVAS_EVENT_FLAG_ON_HOLD;
419 static Evas_Event_Flags
420 zoom_start(void *data , void *event_info)
422 Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info;
423 _color_and_icon_set(data, ZOOM_NAME, MAX_ZOOM, MAX_ZOOM, START_COLOR);
424 printf("zoom started <%d,%d> zoom=<%f> radius=<%d> momentum=<%f>\n",
425 p->x, p->y, p->zoom, p->radius, p->momentum);
426 return EVAS_EVENT_FLAG_ON_HOLD;
429 static Evas_Event_Flags
430 zoom_move(void *data , void *event_info)
432 Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info;
433 _color_and_icon_set(data, ZOOM_NAME, MAX_ZOOM, MAX_ZOOM, MOVE_COLOR);
434 printf("zoom move <%d,%d> zoom=<%f> radius=<%d> momentum=<%f>\n",
435 p->x, p->y, p->zoom, p->radius, p->momentum);
436 return EVAS_EVENT_FLAG_ON_HOLD;
439 static Evas_Event_Flags
440 zoom_end(void *data , void *event_info)
442 Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info;
443 _color_and_icon_set(data, ZOOM_NAME, MAX_ZOOM, MAX_ZOOM, END_COLOR);
444 printf("zoom end <%d,%d> zoom=<%f> radius=<%d> momentum=<%f>\n",
445 p->x, p->y, p->zoom, p->radius, p->momentum);
446 return EVAS_EVENT_FLAG_ON_HOLD;
449 static Evas_Event_Flags
450 zoom_abort(void *data , void *event_info __UNUSED__)
452 printf("zoom abort\n");
453 _color_and_icon_set(data, ZOOM_NAME, MAX_ZOOM, MAX_ZOOM, ABORT_COLOR);
454 return EVAS_EVENT_FLAG_ON_HOLD;
457 static Evas_Event_Flags
458 rotate_start(void *data , void *event_info)
460 Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info;
461 _color_and_icon_set(data, ROTATE_NAME, MAX_ROTATE, MAX_ROTATE, START_COLOR);
462 printf("rotate started <%d,%d> base=<%f> angle=<%f> radius=<%d> momentum=<%f>\n", p->x, p->y, p->base_angle, p->angle, p->radius, p->momentum);
463 return EVAS_EVENT_FLAG_ON_HOLD;
466 static Evas_Event_Flags
467 rotate_move(void *data , void *event_info)
469 Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info;
470 _color_and_icon_set(data, ROTATE_NAME, MAX_ROTATE, MAX_ROTATE, MOVE_COLOR);
471 printf("rotate move <%d,%d> base=<%f> angle=<%f> radius=<%d> momentum=<%f>\n", p->x, p->y, p->base_angle, p->angle, p->radius, p->momentum);
472 return EVAS_EVENT_FLAG_ON_HOLD;
475 static Evas_Event_Flags
476 rotate_end(void *data , void *event_info)
478 Elm_Gesture_Rotate_Info *p = (Elm_Gesture_Rotate_Info *) event_info;
479 _color_and_icon_set(data, ROTATE_NAME, MAX_ROTATE, MAX_ROTATE, END_COLOR);
480 printf("rotate end <%d,%d> base=<%f> angle=<%f> radius=<%d> momentum=<%f>\n", p->x, p->y, p->base_angle, p->angle, p->radius, p->momentum);
481 return EVAS_EVENT_FLAG_ON_HOLD;
484 static Evas_Event_Flags
485 rotate_abort(void *data , void *event_info __UNUSED__)
487 _color_and_icon_set(data, ROTATE_NAME, MAX_ROTATE, MAX_ROTATE, ABORT_COLOR);
488 printf("rotate abort\n");
489 return EVAS_EVENT_FLAG_ON_HOLD;
491 /* END - Callbacks for gestures */
493 Evas_Object *create_gesture_box(Evas_Object *win, icon_properties *icons,
494 int idx, const char *name, const char *lb_txt)
495 { /* Creates a box with icon and label, later placed in a table */
496 Evas_Object *lb, *bx = elm_box_add(win);
499 elm_box_padding_set(bx, BX_PADDING_X, BX_PADDING_Y);
500 icons[idx].icon = elm_icon_add(win);
501 icons[idx].name = name;
502 snprintf(buf, sizeof(buf), "%s/images/g_layer/%s_1.png",
503 elm_app_data_dir_get(), icons[idx].name);
504 elm_icon_file_set(icons[idx].icon, buf, NULL);
505 elm_icon_resizable_set(icons[idx].icon, 0, 0);
506 evas_object_size_hint_align_set(icons[idx].icon, 0.5, 0.5);
507 _icon_color_set(&icons[idx], INI_R, INI_G, INI_B, INI_A);
508 elm_box_pack_end(bx, icons[idx].icon);
509 evas_object_show(icons[idx].icon);
511 lb = elm_label_add(win);
512 elm_object_text_set(lb, lb_txt);
513 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
514 evas_object_size_hint_align_set(lb, 0.5, 0.5);
515 elm_box_pack_end(bx, lb);
516 evas_object_show(lb);
517 evas_object_show(bx);
523 test_gesture_layer2(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
524 void *event_info __UNUSED__)
526 Evas_Object *win, *bg, *tb, *lb, *bx;
527 Evas_Object *r; /* Gesture layer transparent object */
528 Evas_Object *g; /* The Gesture Layer object */
530 infra_data *infra = _infra_data_alloc();
532 win = elm_win_add(NULL, "table", ELM_WIN_BASIC);
533 elm_win_title_set(win, "Table");
534 elm_win_autodel_set(win, EINA_TRUE);
535 evas_object_smart_callback_add(win, "delete,request", my_win_del, infra);
537 bg = elm_bg_add(win);
538 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
539 elm_win_resize_object_add(win, bg);
540 evas_object_show(bg);
542 /* START - Building icons table */
543 bx = elm_box_add(win);
544 tb = elm_table_add(win);
545 elm_box_pack_end(bx, tb);
546 elm_win_resize_object_add(win, bx);
547 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
548 evas_object_size_hint_align_set(tb, 0.5, 0.5);
549 evas_object_show(tb);
550 evas_object_show(bx);
552 /* Box of Tap icon and label */
553 bx = create_gesture_box(win, infra->icons, 0, TAP_NAME, "Tap");
554 elm_table_pack(tb, bx, 0, 0, 1, 1);
556 /* Box of Double Tap icon and label */
557 bx = create_gesture_box(win, infra->icons, 1, DOUBLE_TAP_NAME, "Double Tap");
558 elm_table_pack(tb, bx, 1, 0, 1, 1);
560 /* Box of Triple Tap icon and label */
561 bx = create_gesture_box(win, infra->icons, 2, TRIPLE_TAP_NAME, "Triple Tap");
562 elm_table_pack(tb, bx, 2, 0, 1, 1);
564 /* Box of Long Tap icon and label */
565 bx = create_gesture_box(win, infra->icons, 3, LONG_TAP_NAME, "Long Tap");
566 elm_table_pack(tb, bx, 3, 0, 1, 1);
568 /* Box of Momentum icon and label */
569 bx = create_gesture_box(win, infra->icons, 4, MOMENTUM_NAME, "Momentum");
570 elm_table_pack(tb, bx, 0, 2, 1, 1);
572 /* Box of Line icon and label */
573 bx = create_gesture_box(win, infra->icons, 5, LINE_NAME, "Line");
574 elm_table_pack(tb, bx, 1, 2, 1, 1);
576 /* Box of Flick icon and label */
577 bx = create_gesture_box(win, infra->icons, 6, FLICK_NAME, "Flick");
578 elm_table_pack(tb, bx, 2, 2, 1, 1);
580 /* Box of Zoom icon and label */
581 bx = create_gesture_box(win, infra->icons, 7, ZOOM_NAME, "Zoom");
582 elm_table_pack(tb, bx, 0, 3, 1, 1);
584 /* Box of Rotate icon and label */
585 bx = create_gesture_box(win, infra->icons, 8, ROTATE_NAME, "Rotate");
586 elm_table_pack(tb, bx, 1, 3, 1, 1);
589 /* Legend of gestures - states */
590 lb = elm_label_add(win);
591 elm_object_text_set(lb, "<b>Gesture States</b>");
592 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
593 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
594 elm_table_pack(tb, lb, 0, 6, 4, 2);
595 evas_object_show(lb);
597 r = evas_object_rectangle_add(evas_object_evas_get(win));
598 evas_object_resize(r, 64, 64);
599 evas_object_color_set(r, INI_R, INI_G, INI_B, INI_A);
600 evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0);
601 evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL);
602 elm_table_pack(tb, r, 0, 7, 1, 1);
605 lb = elm_label_add(win);
606 elm_object_text_set(lb, "Not Started");
607 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
608 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
609 elm_table_pack(tb, lb, 1, 7, 3, 1);
610 evas_object_show(lb);
612 r = evas_object_rectangle_add(evas_object_evas_get(win));
613 evas_object_resize(r, 64, 64);
614 evas_object_color_set(r, START_COLOR);
615 evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0);
616 evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL);
617 elm_table_pack(tb, r, 0, 8, 1, 1);
620 lb = elm_label_add(win);
621 elm_object_text_set(lb, "Gesture START");
622 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
623 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
624 elm_table_pack(tb, lb, 1, 8, 3, 1);
625 evas_object_show(lb);
627 r = evas_object_rectangle_add(evas_object_evas_get(win));
628 evas_object_resize(r, 64, 64);
629 evas_object_color_set(r, MOVE_COLOR);
630 evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0);
631 evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL);
632 elm_table_pack(tb, r, 0, 9, 1, 1);
635 lb = elm_label_add(win);
636 elm_object_text_set(lb, "Gesture MOVE");
637 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
638 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
639 elm_table_pack(tb, lb, 1, 9, 3, 1);
640 evas_object_show(lb);
642 r = evas_object_rectangle_add(evas_object_evas_get(win));
643 evas_object_resize(r, 64, 64);
644 evas_object_color_set(r, END_COLOR);
645 evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0);
646 evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL);
647 elm_table_pack(tb, r, 0, 10, 1, 1);
650 lb = elm_label_add(win);
651 elm_object_text_set(lb, "Gesture END");
652 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
653 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
654 elm_table_pack(tb, lb, 1, 10, 3, 1);
655 evas_object_show(lb);
657 r = evas_object_rectangle_add(evas_object_evas_get(win));
658 evas_object_resize(r, 64, 64);
659 evas_object_color_set(r, ABORT_COLOR);
660 evas_object_size_hint_weight_set(r, EVAS_HINT_EXPAND, 0.0);
661 evas_object_size_hint_align_set(r, EVAS_HINT_FILL, EVAS_HINT_FILL);
662 elm_table_pack(tb, r, 0, 11, 1, 1);
665 lb = elm_label_add(win);
666 elm_object_text_set(lb, "Gesture ABORT");
667 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
668 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
669 elm_table_pack(tb, lb, 1, 11, 3, 1);
672 elm_table_padding_set(tb, TB_PADDING_X, TB_PADDING_Y);
673 evas_object_show(lb);
674 /* END - Building icons table */
676 /* Gesture layer transparent object */
677 r = evas_object_rectangle_add(evas_object_evas_get(win));
678 evas_object_color_set(r, 0, 0, 0, 0);
679 elm_win_resize_object_add(win, r);
680 g = elm_gesture_layer_add(r);
681 elm_gesture_layer_attach(g, r);
684 /* START - Setting gestures callbacks */
686 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TRIPLE_TAPS,
687 ELM_GESTURE_STATE_START, triple_click_start, infra);
688 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TRIPLE_TAPS,
689 ELM_GESTURE_STATE_END, triple_click_end, infra);
690 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TRIPLE_TAPS,
691 ELM_GESTURE_STATE_ABORT, triple_click_abort, infra);
695 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_DOUBLE_TAPS,
696 ELM_GESTURE_STATE_START, dbl_click_start, infra);
697 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_DOUBLE_TAPS,
698 ELM_GESTURE_STATE_END, dbl_click_end, infra);
699 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_DOUBLE_TAPS,
700 ELM_GESTURE_STATE_ABORT, dbl_click_abort, infra);
704 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TAPS,
705 ELM_GESTURE_STATE_START, n_finger_tap_start, infra);
706 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TAPS,
707 ELM_GESTURE_STATE_END, n_finger_tap_end, infra);
708 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_TAPS,
709 ELM_GESTURE_STATE_ABORT, n_finger_tap_abort, infra);
713 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS,
714 ELM_GESTURE_STATE_START, n_long_tap_start, infra);
715 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS,
716 ELM_GESTURE_STATE_MOVE, n_long_tap_move, infra);
717 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS,
718 ELM_GESTURE_STATE_END, n_long_tap_end, infra);
719 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS,
720 ELM_GESTURE_STATE_ABORT, n_long_tap_abort, infra);
724 elm_gesture_layer_cb_set(g, ELM_GESTURE_MOMENTUM,
725 ELM_GESTURE_STATE_START, momentum_start, infra);
726 elm_gesture_layer_cb_set(g, ELM_GESTURE_MOMENTUM,
727 ELM_GESTURE_STATE_END, momentum_end, infra);
728 elm_gesture_layer_cb_set(g, ELM_GESTURE_MOMENTUM,
729 ELM_GESTURE_STATE_ABORT, momentum_abort, infra);
730 elm_gesture_layer_cb_set(g, ELM_GESTURE_MOMENTUM,
731 ELM_GESTURE_STATE_MOVE, momentum_move, infra);
735 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LINES,
736 ELM_GESTURE_STATE_START, line_start, infra);
737 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LINES,
738 ELM_GESTURE_STATE_MOVE, line_move, infra);
739 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LINES,
740 ELM_GESTURE_STATE_END, line_end, infra);
741 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LINES,
742 ELM_GESTURE_STATE_ABORT, line_abort, infra);
746 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_FLICKS,
747 ELM_GESTURE_STATE_START, flick_start, infra);
748 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_FLICKS,
749 ELM_GESTURE_STATE_END, flick_end, infra);
750 elm_gesture_layer_cb_set(g, ELM_GESTURE_N_FLICKS,
751 ELM_GESTURE_STATE_ABORT, flick_abort, infra);
755 elm_gesture_layer_cb_set(g, ELM_GESTURE_ZOOM,
756 ELM_GESTURE_STATE_START, zoom_start, infra);
757 elm_gesture_layer_cb_set(g, ELM_GESTURE_ZOOM,
758 ELM_GESTURE_STATE_END, zoom_end, infra);
759 elm_gesture_layer_cb_set(g, ELM_GESTURE_ZOOM,
760 ELM_GESTURE_STATE_ABORT, zoom_abort, infra);
761 elm_gesture_layer_cb_set(g, ELM_GESTURE_ZOOM,
762 ELM_GESTURE_STATE_MOVE, zoom_move, infra);
763 /* elm_gesture_layer_zoom_step_set(g, 0.2); */
767 elm_gesture_layer_cb_set(g, ELM_GESTURE_ROTATE,
768 ELM_GESTURE_STATE_START, rotate_start, infra);
769 elm_gesture_layer_cb_set(g, ELM_GESTURE_ROTATE,
770 ELM_GESTURE_STATE_END, rotate_end, infra);
771 elm_gesture_layer_cb_set(g, ELM_GESTURE_ROTATE,
772 ELM_GESTURE_STATE_ABORT, rotate_abort, infra);
773 elm_gesture_layer_cb_set(g, ELM_GESTURE_ROTATE,
774 ELM_GESTURE_STATE_MOVE, rotate_move, infra);
775 /* elm_gesture_layer_rotate_step_set(g, 5.2); */
777 /* END - Setting gestures callbacks */
779 /* Update color state 20 times a second */
780 infra->colortimer = ecore_timer_add(0.05, _icon_color_set_cb, infra->icons);
782 evas_object_show(win);