summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <juyung.seo@samsung.com>2013-12-07 22:14:11 +0900
committerDaniel Juyung Seo <juyung.seo@samsung.com>2013-12-07 22:14:11 +0900
commit610797343f3448664b738449ba66bbf33de354b9 (patch)
tree64ccaa2c0197c7c5ca2f71ff4f596fc47c7ce3e0
parent0ce95f30aa07180a9539df147e41e408552f44c5 (diff)
evas: added event_touch sample.
-rw-r--r--.gitignore1
-rw-r--r--evas/Makefile5
-rw-r--r--evas/event_touch.c62
3 files changed, 67 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index d9009a2..1e895df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@ evas/longpress
43evas/color 43evas/color
44evas/freeze 44evas/freeze
45evas/recalc_err 45evas/recalc_err
46evas/event_touch
46focus/focus 47focus/focus
47images/*.jpg 48images/*.jpg
48tutorial_01 49tutorial_01
diff --git a/evas/Makefile b/evas/Makefile
index f77066e..1d17ba4 100644
--- a/evas/Makefile
+++ b/evas/Makefile
@@ -1,4 +1,4 @@
1all: premultiplied-color smart-member preload mouse-out mouse-out.edj image-data image-color event evas_leak del geo key_down longpress color freeze freeze.edj recalc_err 1all: premultiplied-color smart-member preload mouse-out mouse-out.edj image-data image-color event evas_leak del geo key_down longpress color freeze freeze.edj recalc_err event_touch
2 2
3premultiplied-color: premultiplied-color.c 3premultiplied-color: premultiplied-color.c
4 gcc premultiplied-color.c -o premultiplied-color `pkg-config --cflags --libs elementary` 4 gcc premultiplied-color.c -o premultiplied-color `pkg-config --cflags --libs elementary`
@@ -53,3 +53,6 @@ freeze.edj: freeze.edc
53 53
54recalc_err: recalc_err.c 54recalc_err: recalc_err.c
55 gcc recalc_err.c -o recalc_err `pkg-config --cflags --libs elementary` -g 55 gcc recalc_err.c -o recalc_err `pkg-config --cflags --libs elementary` -g
56
57event_touch: event_touch.c
58 gcc event_touch.c -o event_touch `pkg-config --cflags --libs elementary` -g
diff --git a/evas/event_touch.c b/evas/event_touch.c
new file mode 100644
index 0000000..210a316
--- /dev/null
+++ b/evas/event_touch.c
@@ -0,0 +1,62 @@
1/*
2 * gcc event-touch.c -o event-touch `pkg-config --cflags --libs elementary` -g
3 */
4#include <Elementary.h>
5
6static void
7_mouse_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
8{
9 printf("%s \n", (char *)data);
10}
11
12static void
13_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
14{
15 Evas_Event_Mouse_Move *ev = event_info;
16
17 printf("%s btn: %d, x: %d, y: %d\n", (char *)data, ev->buttons, ev->cur.canvas.x, ev->cur.canvas.y);
18}
19
20static void
21_multi_mouse_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
22{
23 printf("%s \n", (char *)data);
24}
25
26static void
27_multi_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
28{
29 Evas_Event_Multi_Move *ev = event_info;
30
31 printf("%s btn: %d, x: %d, y: %d\n", (char *)data, ev->device, ev->cur.canvas.x, ev->cur.canvas.y);
32}
33
34EAPI_MAIN int
35elm_main(int argc, char **argv)
36{
37 Evas_Object *win = NULL, *bg = NULL, *box = NULL, *box2 = NULL, *btn = NULL;
38
39 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
40
41 win = elm_win_util_standard_add("main", "Main");
42 elm_win_autodel_set(win, EINA_TRUE);
43 evas_object_resize(win, 300, 400);
44 evas_object_show(win);
45
46 bg = elm_bg_add(win);
47 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48 elm_win_resize_object_add(win, bg);
49 evas_object_event_callback_add(bg, EVAS_CALLBACK_MOUSE_DOWN, _mouse_cb, "down");
50 evas_object_event_callback_add(bg, EVAS_CALLBACK_MOUSE_UP, _mouse_cb, "up");
51 evas_object_event_callback_add(bg, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, "move");
52 evas_object_event_callback_add(bg, EVAS_CALLBACK_MULTI_DOWN, _multi_mouse_cb, "down");
53 evas_object_event_callback_add(bg, EVAS_CALLBACK_MULTI_UP, _multi_mouse_cb, "up");
54 evas_object_event_callback_add(bg, EVAS_CALLBACK_MULTI_MOVE, _multi_mouse_move_cb, "move");
55 evas_object_show(bg);
56
57 elm_run();
58 elm_shutdown();
59
60 return 0;
61}
62ELM_MAIN()