summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <juyung.seo@samsung.com>2014-12-18 13:41:43 +0900
committerDaniel Juyung Seo <juyung.seo@samsung.com>2014-12-18 13:41:43 +0900
commite78e36e06e22334d402c2af6daf3a0517a13f0d9 (patch)
tree2d8182a78a6132d5a270b65a49c69de36a6012a4
parent1bfe9aa99aa26acc5fbb8368b83ea3e2541ae7a0 (diff)
evas/mouse_out: Add mouse in/out sample.
-rw-r--r--.gitignore1
-rw-r--r--evas/Makefile5
-rw-r--r--evas/mouse_out.c73
3 files changed, 78 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index fcc8dca..1db6aa1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,6 +59,7 @@ evas/event_touch
59evas/render_op 59evas/render_op
60evas/render_op.edj 60evas/render_op.edj
61evas/layer 61evas/layer
62evas/mouse_out
62focus/focus 63focus/focus
63focus/focus_obj_del 64focus/focus_obj_del
64images/*.jpg 65images/*.jpg
diff --git a/evas/Makefile b/evas/Makefile
index 7e5ae54..98ddec5 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 event2 evas_leak del geo key_down longpress color freeze freeze.edj recalc_err event_touch render_op render_op.edj layer 1all: premultiplied-color smart-member preload mouse-out mouse-out.edj image-data image-color event event2 evas_leak del geo key_down longpress color freeze freeze.edj recalc_err event_touch render_op render_op.edj layer mouse_out
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`
@@ -68,3 +68,6 @@ render_op.edj: render_op.edc
68 68
69layer: layer.c 69layer: layer.c
70 gcc layer.c -o layer `pkg-config --cflags --libs elementary` -g 70 gcc layer.c -o layer `pkg-config --cflags --libs elementary` -g
71
72mouse_out: mouse_out.c
73 gcc mouse_out.c -o mouse_out `pkg-config --cflags --libs elementary` -g
diff --git a/evas/mouse_out.c b/evas/mouse_out.c
new file mode 100644
index 0000000..92fbdb1
--- /dev/null
+++ b/evas/mouse_out.c
@@ -0,0 +1,73 @@
1/*
2 * gcc mouse_out.c -o mouse_out `pkg-config --cflags --libs elementary` -g
3 */
4#include <Elementary.h>
5
6static void
7_evas_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
8{
9 printf("%s\n", (char *)data);
10}
11
12static void
13_evas_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
14{
15 Evas_Event_Mouse_Move *ev = event_info;
16 Evas_Coord x = 0, y = 0, w = 0, h = 0;
17 static Eina_Bool out = EINA_FALSE;
18
19 printf("%s (%d %d), button: %d\n", (char *)data, ev->cur.canvas.x, ev->cur.canvas.y, ev->buttons);
20
21 evas_object_geometry_get(obj, &x, &y, &w, &h);
22 if (ELM_RECTS_POINT_OUT(x, y, w, h, ev->cur.canvas.x, ev->cur.canvas.y))
23 {
24 if (!out)
25 {
26 printf("OUT!!! \n");
27 out = EINA_TRUE;
28 }
29 }
30 else
31 {
32 if (out)
33 {
34 printf("IN!!! \n");
35 out = EINA_FALSE;
36 }
37 }
38}
39
40EAPI_MAIN int
41elm_main(int argc, char **argv)
42{
43 Evas_Object *win = NULL, *btn = NULL;
44
45 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
46
47 win = elm_win_util_standard_add("mouse-out", "Mouse Out");
48 elm_win_autodel_set(win, EINA_TRUE);
49
50 btn = elm_button_add(win);
51 elm_object_text_set(btn, "Button");
52 evas_object_resize(btn, 200, 200);
53 evas_object_move(btn, 50, 50);
54 evas_object_show(btn);
55
56 //evas_object_pointer_mode_set(btn, EVAS_OBJECT_POINTER_MODE_AUTOGRAB);
57 //evas_object_pointer_mode_set(btn, EVAS_OBJECT_POINTER_MODE_NOGRAB);
58 //evas_object_pointer_mode_set(btn, EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN);
59
60 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_IN, _evas_cb, "MOUSE IN");
61 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_OUT, _evas_cb, "MOUSE OUT");
62 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_DOWN, _evas_cb, "MOUSE DOWN");
63 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, _evas_cb, "MOUSE UP");
64 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE, _evas_move_cb, "MOUSE MOVE");
65
66 evas_object_resize(win, 300, 400);
67 evas_object_show(win);
68
69 elm_run();
70
71 return 0;
72}
73ELM_MAIN()