diff options
author | ChunEon Park <hermet@hermet.pe.kr> | 2012-10-30 04:15:34 +0000 |
---|---|---|
committer | ChunEon Park <hermet@hermet.pe.kr> | 2012-10-30 04:15:34 +0000 |
commit | 6efc9a7ab723fb92189e82fa54dcb1d8dd70dc38 (patch) | |
tree | 8aa823441cebdbd8fad308aa0f8462a22aadd4ba /legacy/evas/src | |
parent | d33cf9b871ced2e973187304895449f4e0d06cb6 (diff) |
evas/examples - added test cases for proxy visibility/events
SVN revision: 78633
Diffstat (limited to 'legacy/evas/src')
-rw-r--r-- | legacy/evas/src/examples/evas-images2.c | 107 |
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 | ||
39 | const char *file_path = "/tmp/evas-images2-example.png"; | 41 | const char *file_path = "/tmp/evas-images2-example.png"; |
@@ -49,6 +51,86 @@ struct test_data | |||
49 | static struct test_data d = {0}; | 51 | static struct test_data d = {0}; |
50 | 52 | ||
51 | static void | 53 | static 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 | |||
62 | static 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 | |||
71 | static 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 | |||
80 | static 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 | |||
89 | static 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 | |||
98 | static 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 | |||
107 | static 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 | |||
116 | static 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 | |||
125 | static 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 | |||
133 | static 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 | ||
128 | int | 225 | int |
@@ -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 */ |