1 #include "evas_common.h"
2 #include "evas_private.h"
6 static void evas_object_intercept_init(Evas_Object *obj);
7 static void evas_object_intercept_deinit(Evas_Object *obj);
10 evas_object_intercept_init(Evas_Object *obj)
13 if (!obj->interceptors)
14 obj->interceptors = evas_mem_calloc(sizeof(Evas_Intercept_Func));
18 evas_object_intercept_deinit(Evas_Object *obj)
21 if (!obj->interceptors) return;
22 if ((obj->interceptors->show.func) ||
23 (obj->interceptors->hide.func) ||
24 (obj->interceptors->move.func) ||
25 (obj->interceptors->resize.func) ||
26 (obj->interceptors->raise.func) ||
27 (obj->interceptors->lower.func) ||
28 (obj->interceptors->stack_above.func) ||
29 (obj->interceptors->stack_below.func) ||
30 (obj->interceptors->layer_set.func) ||
31 (obj->interceptors->color_set.func) ||
32 (obj->interceptors->clip_set.func) ||
33 (obj->interceptors->clip_unset.func))
35 free(obj->interceptors);
36 obj->interceptors = NULL;
42 evas_object_intercept_cleanup(Evas_Object *obj)
45 if (obj->interceptors) free(obj->interceptors);
49 evas_object_intercept_call_show(Evas_Object *obj)
54 if (!obj->interceptors) return 0;
55 if (obj->intercepted) return 0;
57 ret = ((obj->interceptors->show.func) != NULL);
58 if (obj->interceptors->show.func)
59 obj->interceptors->show.func(obj->interceptors->show.data, obj);
65 evas_object_intercept_call_hide(Evas_Object *obj)
70 if (!obj->interceptors) return 0;
71 if (obj->intercepted) return 0;
73 ret = ((obj->interceptors->hide.func) != NULL);
74 if (obj->interceptors->hide.func)
75 obj->interceptors->hide.func(obj->interceptors->hide.data, obj);
81 evas_object_intercept_call_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
86 if (!obj->interceptors) return 0;
87 if (obj->intercepted) return 0;
89 ret = ((obj->interceptors->move.func) != NULL);
90 if (obj->interceptors->move.func)
91 obj->interceptors->move.func(obj->interceptors->move.data, obj, x, y);
97 evas_object_intercept_call_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
102 if (!obj->interceptors) return 0;
103 if (obj->intercepted) return 0;
104 obj->intercepted = 1;
105 ret = ((obj->interceptors->resize.func) != NULL);
106 if (obj->interceptors->resize.func)
107 obj->interceptors->resize.func(obj->interceptors->resize.data, obj, w, h);
108 obj->intercepted = 0;
113 evas_object_intercept_call_raise(Evas_Object *obj)
118 if (!obj->interceptors) return 0;
119 if (obj->intercepted) return 0;
120 obj->intercepted = 1;
121 ret = ((obj->interceptors->raise.func) != NULL);
122 if (obj->interceptors->raise.func)
123 obj->interceptors->raise.func(obj->interceptors->raise.data, obj);
124 obj->intercepted = 0;
129 evas_object_intercept_call_lower(Evas_Object *obj)
134 if (!obj->interceptors) return 0;
135 if (obj->intercepted) return 0;
136 obj->intercepted = 1;
137 ret = ((obj->interceptors->lower.func) != NULL);
138 if (obj->interceptors->lower.func)
139 obj->interceptors->lower.func(obj->interceptors->lower.data, obj);
140 obj->intercepted = 0;
145 evas_object_intercept_call_stack_above(Evas_Object *obj, Evas_Object *above)
150 if (!obj->interceptors) return 0;
151 if (obj->intercepted) return 0;
152 obj->intercepted = 1;
153 ret = ((obj->interceptors->stack_above.func) != NULL);
154 if (obj->interceptors->stack_above.func)
155 obj->interceptors->stack_above.func(obj->interceptors->stack_above.data, obj, above);
156 obj->intercepted = 0;
161 evas_object_intercept_call_stack_below(Evas_Object *obj, Evas_Object *below)
166 if (!obj->interceptors) return 0;
167 if (obj->intercepted) return 0;
168 obj->intercepted = 1;
169 ret = ((obj->interceptors->stack_below.func) != NULL);
170 if (obj->interceptors->stack_below.func)
171 obj->interceptors->stack_below.func(obj->interceptors->stack_below.data, obj, below);
172 obj->intercepted = 0;
177 evas_object_intercept_call_layer_set(Evas_Object *obj, int l)
182 if (!obj->interceptors) return 0;
183 if (obj->intercepted) return 0;
184 obj->intercepted = 1;
185 ret = ((obj->interceptors->layer_set.func) != NULL);
186 if (obj->interceptors->layer_set.func)
187 obj->interceptors->layer_set.func(obj->interceptors->layer_set.data, obj, l);
188 obj->intercepted = 0;
193 evas_object_intercept_call_color_set(Evas_Object *obj, int r, int g, int b, int a)
198 if (!obj->interceptors) return 0;
199 if (obj->intercepted) return 0;
200 obj->intercepted = 1;
201 ret = ((obj->interceptors->color_set.func) != NULL);
202 if (obj->interceptors->color_set.func)
203 obj->interceptors->color_set.func(obj->interceptors->color_set.data, obj, r, g, b, a);
204 obj->intercepted = 0;
209 evas_object_intercept_call_clip_set(Evas_Object *obj, Evas_Object *clip)
214 if (!obj->interceptors) return 0;
215 if (obj->intercepted) return 0;
216 obj->intercepted = 1;
217 ret = ((obj->interceptors->clip_set.func) != NULL);
218 if (obj->interceptors->clip_set.func)
219 obj->interceptors->clip_set.func(obj->interceptors->clip_set.data, obj, clip);
220 obj->intercepted = 0;
225 evas_object_intercept_call_clip_unset(Evas_Object *obj)
230 if (!obj->interceptors) return 0;
231 if (obj->intercepted) return 0;
232 obj->intercepted = 1;
233 ret = ((obj->interceptors->clip_unset.func) != NULL);
234 if (obj->interceptors->clip_unset.func)
235 obj->interceptors->clip_unset.func(obj->interceptors->clip_unset.data, obj);
236 obj->intercepted = 0;
245 * FIXME: To be fixed.
249 evas_object_intercept_show_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), const void *data)
253 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
257 evas_object_intercept_init(obj);
258 if (!obj->interceptors) return;
259 obj->interceptors->show.func = func;
260 obj->interceptors->show.data = (void *)data;
266 * FIXME: To be fixed.
270 evas_object_intercept_show_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj))
275 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
278 if (!func) return NULL;
279 if (!obj->interceptors) return NULL;
280 obj->interceptors->show.func = NULL;
281 data = obj->interceptors->show.data;
282 obj->interceptors->show.data = NULL;
283 evas_object_intercept_deinit(obj);
290 * FIXME: To be fixed.
294 evas_object_intercept_hide_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), const void *data)
297 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
301 evas_object_intercept_init(obj);
302 if (!obj->interceptors) return;
303 obj->interceptors->hide.func = func;
304 obj->interceptors->hide.data = (void *)data;
310 * FIXME: To be fixed.
314 evas_object_intercept_hide_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj))
319 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
322 if (!func) return NULL;
323 if (!obj->interceptors) return NULL;
324 obj->interceptors->hide.func = NULL;
325 data = obj->interceptors->hide.data;
326 obj->interceptors->hide.data = NULL;
327 evas_object_intercept_deinit(obj);
334 * FIXME: To be fixed.
338 evas_object_intercept_move_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y), const void *data)
341 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
345 evas_object_intercept_init(obj);
346 if (!obj->interceptors) return;
347 obj->interceptors->move.func = func;
348 obj->interceptors->move.data = (void *)data;
354 * FIXME: To be fixed.
358 evas_object_intercept_move_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y))
363 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
366 if (!func) return NULL;
367 if (!obj->interceptors) return NULL;
368 obj->interceptors->move.func = NULL;
369 data = obj->interceptors->move.data;
370 obj->interceptors->move.data = NULL;
371 evas_object_intercept_deinit(obj);
378 * FIXME: To be fixed.
382 evas_object_intercept_resize_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Coord w, Evas_Coord h), const void *data)
385 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
389 evas_object_intercept_init(obj);
390 if (!obj->interceptors) return;
391 obj->interceptors->resize.func = func;
392 obj->interceptors->resize.data = (void *)data;
398 * FIXME: To be fixed.
402 evas_object_intercept_resize_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Coord w, Evas_Coord h))
407 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
410 if (!func) return NULL;
411 if (!obj->interceptors) return NULL;
412 obj->interceptors->resize.func = NULL;
413 data = obj->interceptors->resize.data;
414 obj->interceptors->resize.data = NULL;
415 evas_object_intercept_deinit(obj);
422 * FIXME: To be fixed.
426 evas_object_intercept_raise_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), const void *data)
429 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
433 evas_object_intercept_init(obj);
434 if (!obj->interceptors) return;
435 obj->interceptors->raise.func = func;
436 obj->interceptors->raise.data = (void *)data;
442 * FIXME: To be fixed.
446 evas_object_intercept_raise_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj))
451 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
454 if (!func) return NULL;
455 if (!obj->interceptors) return NULL;
456 obj->interceptors->raise.func = NULL;
457 data = obj->interceptors->raise.data;
458 obj->interceptors->raise.data = NULL;
459 evas_object_intercept_deinit(obj);
466 * FIXME: To be fixed.
470 evas_object_intercept_lower_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), const void *data)
473 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
477 evas_object_intercept_init(obj);
478 if (!obj->interceptors) return;
479 obj->interceptors->lower.func = func;
480 obj->interceptors->lower.data = (void *)data;
486 * FIXME: To be fixed.
490 evas_object_intercept_lower_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj))
495 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
498 if (!func) return NULL;
499 if (!obj->interceptors) return NULL;
500 obj->interceptors->lower.func = NULL;
501 data = obj->interceptors->lower.data;
502 obj->interceptors->lower.data = NULL;
503 evas_object_intercept_deinit(obj);
510 * FIXME: To be fixed.
514 evas_object_intercept_stack_above_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Object *above), const void *data)
517 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
521 evas_object_intercept_init(obj);
522 if (!obj->interceptors) return;
523 obj->interceptors->stack_above.func = func;
524 obj->interceptors->stack_above.data = (void *)data;
530 * FIXME: To be fixed.
534 evas_object_intercept_stack_above_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Object *above))
539 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
542 if (!func) return NULL;
543 if (!obj->interceptors) return NULL;
544 obj->interceptors->stack_above.func = NULL;
545 data = obj->interceptors->stack_above.data;
546 obj->interceptors->stack_above.data = NULL;
547 evas_object_intercept_deinit(obj);
554 * FIXME: To be fixed.
558 evas_object_intercept_stack_below_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Object *below), const void *data)
561 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
565 evas_object_intercept_init(obj);
566 if (!obj->interceptors) return;
567 obj->interceptors->stack_below.func = func;
568 obj->interceptors->stack_below.data = (void *)data;
574 * FIXME: To be fixed.
578 evas_object_intercept_stack_below_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Object *below))
583 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
586 if (!func) return NULL;
587 if (!obj->interceptors) return NULL;
588 obj->interceptors->stack_below.func = NULL;
589 data = obj->interceptors->stack_below.data;
590 obj->interceptors->stack_below.data = NULL;
591 evas_object_intercept_deinit(obj);
598 * FIXME: To be fixed.
602 evas_object_intercept_layer_set_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, int l), const void *data)
605 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
609 evas_object_intercept_init(obj);
610 if (!obj->interceptors) return;
611 obj->interceptors->layer_set.func = func;
612 obj->interceptors->layer_set.data = (void *)data;
618 * FIXME: To be fixed.
622 evas_object_intercept_layer_set_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, int l))
627 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
630 if (!func) return NULL;
631 if (!obj->interceptors) return NULL;
632 obj->interceptors->layer_set.func = NULL;
633 data = obj->interceptors->layer_set.data;
634 obj->interceptors->layer_set.data = NULL;
635 evas_object_intercept_deinit(obj);
642 * FIXME: To be fixed.
646 evas_object_intercept_color_set_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, int r, int g, int b, int a), const void *data)
649 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
653 evas_object_intercept_init(obj);
654 if (!obj->interceptors) return;
655 obj->interceptors->color_set.func = func;
656 obj->interceptors->color_set.data = (void *)data;
662 * FIXME: To be fixed.
666 evas_object_intercept_color_set_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, int r, int g, int b, int a))
671 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
674 if (!func) return NULL;
675 if (!obj->interceptors) return NULL;
676 obj->interceptors->color_set.func = NULL;
677 data = obj->interceptors->color_set.data;
678 obj->interceptors->color_set.data = NULL;
679 evas_object_intercept_deinit(obj);
686 * FIXME: To be fixed.
690 evas_object_intercept_clip_set_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Object *clip), const void *data)
693 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
697 evas_object_intercept_init(obj);
698 if (!obj->interceptors) return;
699 obj->interceptors->clip_set.func = func;
700 obj->interceptors->clip_set.data = (void *)data;
706 * FIXME: To be fixed.
710 evas_object_intercept_clip_set_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, Evas_Object *clip))
715 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
718 if (!func) return NULL;
719 if (!obj->interceptors) return NULL;
720 obj->interceptors->clip_set.func = NULL;
721 data = obj->interceptors->clip_set.data;
722 obj->interceptors->clip_set.data = NULL;
723 evas_object_intercept_deinit(obj);
730 * FIXME: To be fixed.
734 evas_object_intercept_clip_unset_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), const void *data)
737 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
741 evas_object_intercept_init(obj);
742 if (!obj->interceptors) return;
743 obj->interceptors->clip_unset.func = func;
744 obj->interceptors->clip_unset.data = (void *)data;
750 * FIXME: To be fixed.
754 evas_object_intercept_clip_unset_callback_del(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj))
759 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
762 if (!func) return NULL;
763 if (!obj->interceptors) return NULL;
764 obj->interceptors->clip_unset.func = NULL;
765 data = obj->interceptors->clip_unset.data;
766 obj->interceptors->clip_unset.data = NULL;
767 evas_object_intercept_deinit(obj);