summaryrefslogtreecommitdiff
path: root/legacy/evas/src/examples/evas-images2.c
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2012-10-30 04:15:34 +0000
committerChunEon Park <hermet@hermet.pe.kr>2012-10-30 04:15:34 +0000
commit6efc9a7ab723fb92189e82fa54dcb1d8dd70dc38 (patch)
tree8aa823441cebdbd8fad308aa0f8462a22aadd4ba /legacy/evas/src/examples/evas-images2.c
parentd33cf9b871ced2e973187304895449f4e0d06cb6 (diff)
evas/examples - added test cases for proxy visibility/events
SVN revision: 78633
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/examples/evas-images2.c107
1 files changed, 107 insertions, 0 deletions
diff --git a/legacy/evas/src/examples/evas-images2.c b/legacy/evas/src/examples/evas-images2.c
index ba7766c3ef..64f4c9fc43 100644
--- a/legacy/evas/src/examples/evas-images2.c
+++ b/legacy/evas/src/examples/evas-images2.c
@@ -34,6 +34,8 @@ static const char *commands = \
34 "\tp - change proxy image's source\n" 34 "\tp - change proxy image's source\n"
35 "\ts - print noise image's stride value\n" 35 "\ts - print noise image's stride value\n"
36 "\ta - save noise image to disk (/tmp dir)\n" 36 "\ta - save noise image to disk (/tmp dir)\n"
37 "\tv - change source visibility\n"
38 "\te - enable/disable source events\n"
37 "\th - print help\n"; 39 "\th - print help\n";
38 40
39const char *file_path = "/tmp/evas-images2-example.png"; 41const char *file_path = "/tmp/evas-images2-example.png";
@@ -49,6 +51,86 @@ struct test_data
49static struct test_data d = {0}; 51static struct test_data d = {0};
50 52
51static void 53static void
54_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
55 void *event_info)
56{
57 Evas_Event_Mouse_Down *ev = event_info;
58 printf("Mouse Down - obj(%p), coords(%d %d)\n", obj, ev->canvas.x,
59 ev->canvas.y);
60}
61
62static void
63_mouse_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
64 void *event_info)
65{
66 Evas_Event_Mouse_Move *ev = event_info;
67 printf("Mouse Move - obj(%p), coords(%d %d)\n", obj, ev->cur.canvas.x,
68 ev->cur.canvas.y);
69}
70
71static void
72_mouse_up(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
73 void *event_info)
74{
75 Evas_Event_Mouse_Up *ev = event_info;
76 printf("Mouse Up - obj(%p), coords(%d %d)\n", obj, ev->canvas.x,
77 ev->canvas.y);
78}
79
80static void
81_multi_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
82 void *event_info)
83{
84 Evas_Event_Multi_Down *ev = event_info;
85 printf("Multi Down - obj(%p), coords(%d %d)\n", obj, ev->canvas.x,
86 ev->canvas.y);
87}
88
89static void
90_multi_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
91 void *event_info)
92{
93 Evas_Event_Multi_Move *ev = event_info;
94 printf("Multi Move - obj(%p), coords(%d %d)\n", obj, ev->cur.canvas.x,
95 ev->cur.canvas.y);
96}
97
98static void
99_multi_up(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
100 void *event_info)
101{
102 Evas_Event_Multi_Up *ev = event_info;
103 printf("Multi Up - obj(%p), coords(%d %d)\n", obj, ev->canvas.x,
104 ev->canvas.y);
105}
106
107static void
108_mouse_in(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
109 void *event_info)
110{
111 Evas_Event_Mouse_In *ev = event_info;
112 printf("Mouse In - obj(%p), coords(%d %d)\n", obj, ev->canvas.x,
113 ev->canvas.y);
114}
115
116static void
117_mouse_out(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
118 void *event_info)
119{
120 Evas_Event_Mouse_Out *ev = event_info;
121 printf("Mouse Out - obj(%p), coords(%d %d)\n", obj, ev->canvas.x,
122 ev->canvas.y);
123}
124
125static void
126_hold(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
127 void *event_info)
128{
129 Evas_Event_Hold *ev = event_info;
130 printf("Hold - obj(%p), hold(%d)\n", obj, ev->hold);
131}
132
133static void
52_on_preloaded(void *data __UNUSED__, 134_on_preloaded(void *data __UNUSED__,
53 Evas *e __UNUSED__, 135 Evas *e __UNUSED__,
54 Evas_Object *obj __UNUSED__, 136 Evas_Object *obj __UNUSED__,
@@ -123,6 +205,21 @@ _on_keydown(void *data __UNUSED__,
123 205
124 return; 206 return;
125 } 207 }
208
209 if (strcmp(ev->keyname, "v") == 0) /* change source visibility */
210 {
211 Eina_Bool src_visible =
212 evas_object_image_source_visible_get(d.proxy_img);
213 evas_object_image_source_visible_set(d.proxy_img, !src_visible);
214 return;
215 }
216
217 if (strcmp(ev->keyname, "e") == 0) /* change source events */
218 {
219 Eina_Bool src_events = evas_object_image_source_events_get(d.proxy_img);
220 evas_object_image_source_events_set(d.proxy_img, !src_events);
221 return;
222 }
126} 223}
127 224
128int 225int
@@ -167,6 +264,16 @@ main(void)
167 264
168 evas_object_image_file_set(d.logo, img_path, NULL); 265 evas_object_image_file_set(d.logo, img_path, NULL);
169 evas_object_resize(d.logo, WIDTH / 2, HEIGHT / 2); 266 evas_object_resize(d.logo, WIDTH / 2, HEIGHT / 2);
267 evas_object_event_callback_add(d.logo, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, 0);
268 evas_object_event_callback_add(d.logo, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, 0);
269 evas_object_event_callback_add(d.logo, EVAS_CALLBACK_MOUSE_UP, _mouse_up, 0);
270 evas_object_event_callback_add(d.logo, EVAS_CALLBACK_MOUSE_IN, _mouse_in, 0);
271 evas_object_event_callback_add(d.logo, EVAS_CALLBACK_MOUSE_OUT, _mouse_out, 0);
272 evas_object_event_callback_add(d.logo, EVAS_CALLBACK_MULTI_DOWN, _multi_down, 0);
273 evas_object_event_callback_add(d.logo, EVAS_CALLBACK_MULTI_UP, _multi_up, 0);
274 evas_object_event_callback_add(d.logo, EVAS_CALLBACK_MULTI_MOVE, _multi_move, 0);
275 evas_object_event_callback_add(d.logo, EVAS_CALLBACK_HOLD, _hold, 0);
276
170 evas_object_show(d.logo); 277 evas_object_show(d.logo);
171 278
172 /* creating noise image */ 279 /* creating noise image */