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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
234 if (obj->interceptors->clip_unset.func)
235 obj->interceptors->clip_unset.func(obj->interceptors->clip_unset.data, obj);
236 obj->intercepted = 0;
243 * @addtogroup Evas_Object_Group_Interceptors
248 * Set the callback function that intercepts a show event of a object.
250 * @param obj The given canvas object pointer.
251 * @param func The given function to be the callback function.
252 * @param data The data passed to the callback function.
254 * This function sets a callback function to intercepts a show event
255 * of a canvas object.
257 * @see evas_object_intercept_show_callback_del().
261 evas_object_intercept_show_callback_add(Evas_Object *obj, Evas_Object_Intercept_Show_Cb func, const void *data)
265 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
269 evas_object_intercept_init(obj);
270 if (!obj->interceptors) return;
271 obj->interceptors->show.func = func;
272 obj->interceptors->show.data = (void *)data;
276 * Unset the callback function that intercepts a show event of a
279 * @param obj The given canvas object pointer.
280 * @param func The given callback function.
282 * This function sets a callback function to intercepts a show event
283 * of a canvas object.
285 * @see evas_object_intercept_show_callback_add().
289 evas_object_intercept_show_callback_del(Evas_Object *obj, Evas_Object_Intercept_Show_Cb func)
294 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
297 if (!func) return NULL;
298 if (!obj->interceptors) return NULL;
299 obj->interceptors->show.func = NULL;
300 data = obj->interceptors->show.data;
301 obj->interceptors->show.data = NULL;
302 evas_object_intercept_deinit(obj);
307 * Set the callback function that intercepts a hide event of a object.
309 * @param obj The given canvas object pointer.
310 * @param func The given function to be the callback function.
311 * @param data The data passed to the callback function.
313 * This function sets a callback function to intercepts a hide event
314 * of a canvas object.
316 * @see evas_object_intercept_hide_callback_del().
320 evas_object_intercept_hide_callback_add(Evas_Object *obj, Evas_Object_Intercept_Hide_Cb func, const void *data)
323 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
327 evas_object_intercept_init(obj);
328 if (!obj->interceptors) return;
329 obj->interceptors->hide.func = func;
330 obj->interceptors->hide.data = (void *)data;
334 * Unset the callback function that intercepts a hide event of a
337 * @param obj The given canvas object pointer.
338 * @param func The given callback function.
340 * This function sets a callback function to intercepts a hide event
341 * of a canvas object.
343 * @see evas_object_intercept_hide_callback_add().
347 evas_object_intercept_hide_callback_del(Evas_Object *obj, Evas_Object_Intercept_Hide_Cb func)
352 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
355 if (!func) return NULL;
356 if (!obj->interceptors) return NULL;
357 obj->interceptors->hide.func = NULL;
358 data = obj->interceptors->hide.data;
359 obj->interceptors->hide.data = NULL;
360 evas_object_intercept_deinit(obj);
365 * Set the callback function that intercepts a move event of a object.
367 * @param obj The given canvas object pointer.
368 * @param func The given function to be the callback function.
369 * @param data The data passed to the callback function.
371 * This function sets a callback function to intercepts a move event
372 * of a canvas object.
374 * @see evas_object_intercept_move_callback_del().
378 evas_object_intercept_move_callback_add(Evas_Object *obj, Evas_Object_Intercept_Move_Cb func, const void *data)
381 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
385 evas_object_intercept_init(obj);
386 if (!obj->interceptors) return;
387 obj->interceptors->move.func = func;
388 obj->interceptors->move.data = (void *)data;
392 * Unset the callback function that intercepts a move event of a
395 * @param obj The given canvas object pointer.
396 * @param func The given callback function.
398 * This function sets a callback function to intercepts a move event
399 * of a canvas object.
401 * @see evas_object_intercept_move_callback_add().
405 evas_object_intercept_move_callback_del(Evas_Object *obj, Evas_Object_Intercept_Move_Cb func)
410 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
413 if (!func) return NULL;
414 if (!obj->interceptors) return NULL;
415 obj->interceptors->move.func = NULL;
416 data = obj->interceptors->move.data;
417 obj->interceptors->move.data = NULL;
418 evas_object_intercept_deinit(obj);
425 * FIXME: To be fixed.
429 evas_object_intercept_resize_callback_add(Evas_Object *obj, Evas_Object_Intercept_Resize_Cb func, const void *data)
432 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
436 evas_object_intercept_init(obj);
437 if (!obj->interceptors) return;
438 obj->interceptors->resize.func = func;
439 obj->interceptors->resize.data = (void *)data;
445 * FIXME: To be fixed.
449 evas_object_intercept_resize_callback_del(Evas_Object *obj, Evas_Object_Intercept_Resize_Cb func)
454 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
457 if (!func) return NULL;
458 if (!obj->interceptors) return NULL;
459 obj->interceptors->resize.func = NULL;
460 data = obj->interceptors->resize.data;
461 obj->interceptors->resize.data = NULL;
462 evas_object_intercept_deinit(obj);
469 * FIXME: To be fixed.
473 evas_object_intercept_raise_callback_add(Evas_Object *obj, Evas_Object_Intercept_Raise_Cb func, const void *data)
476 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
480 evas_object_intercept_init(obj);
481 if (!obj->interceptors) return;
482 obj->interceptors->raise.func = func;
483 obj->interceptors->raise.data = (void *)data;
489 * FIXME: To be fixed.
493 evas_object_intercept_raise_callback_del(Evas_Object *obj, Evas_Object_Intercept_Raise_Cb func)
498 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
501 if (!func) return NULL;
502 if (!obj->interceptors) return NULL;
503 obj->interceptors->raise.func = NULL;
504 data = obj->interceptors->raise.data;
505 obj->interceptors->raise.data = NULL;
506 evas_object_intercept_deinit(obj);
513 * FIXME: To be fixed.
517 evas_object_intercept_lower_callback_add(Evas_Object *obj, Evas_Object_Intercept_Lower_Cb func, const void *data)
520 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
524 evas_object_intercept_init(obj);
525 if (!obj->interceptors) return;
526 obj->interceptors->lower.func = func;
527 obj->interceptors->lower.data = (void *)data;
533 * FIXME: To be fixed.
537 evas_object_intercept_lower_callback_del(Evas_Object *obj, Evas_Object_Intercept_Lower_Cb func)
542 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
545 if (!func) return NULL;
546 if (!obj->interceptors) return NULL;
547 obj->interceptors->lower.func = NULL;
548 data = obj->interceptors->lower.data;
549 obj->interceptors->lower.data = NULL;
550 evas_object_intercept_deinit(obj);
557 * FIXME: To be fixed.
561 evas_object_intercept_stack_above_callback_add(Evas_Object *obj, Evas_Object_Intercept_Stack_Above_Cb func, const void *data)
564 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
568 evas_object_intercept_init(obj);
569 if (!obj->interceptors) return;
570 obj->interceptors->stack_above.func = func;
571 obj->interceptors->stack_above.data = (void *)data;
577 * FIXME: To be fixed.
581 evas_object_intercept_stack_above_callback_del(Evas_Object *obj, Evas_Object_Intercept_Stack_Above_Cb func)
586 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
589 if (!func) return NULL;
590 if (!obj->interceptors) return NULL;
591 obj->interceptors->stack_above.func = NULL;
592 data = obj->interceptors->stack_above.data;
593 obj->interceptors->stack_above.data = NULL;
594 evas_object_intercept_deinit(obj);
601 * FIXME: To be fixed.
605 evas_object_intercept_stack_below_callback_add(Evas_Object *obj, Evas_Object_Intercept_Stack_Below_Cb func, const void *data)
608 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
612 evas_object_intercept_init(obj);
613 if (!obj->interceptors) return;
614 obj->interceptors->stack_below.func = func;
615 obj->interceptors->stack_below.data = (void *)data;
621 * FIXME: To be fixed.
625 evas_object_intercept_stack_below_callback_del(Evas_Object *obj, Evas_Object_Intercept_Stack_Below_Cb func)
630 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
633 if (!func) return NULL;
634 if (!obj->interceptors) return NULL;
635 obj->interceptors->stack_below.func = NULL;
636 data = obj->interceptors->stack_below.data;
637 obj->interceptors->stack_below.data = NULL;
638 evas_object_intercept_deinit(obj);
645 * FIXME: To be fixed.
649 evas_object_intercept_layer_set_callback_add(Evas_Object *obj, Evas_Object_Intercept_Layer_Set_Cb func, const void *data)
652 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
656 evas_object_intercept_init(obj);
657 if (!obj->interceptors) return;
658 obj->interceptors->layer_set.func = func;
659 obj->interceptors->layer_set.data = (void *)data;
665 * FIXME: To be fixed.
669 evas_object_intercept_layer_set_callback_del(Evas_Object *obj, Evas_Object_Intercept_Layer_Set_Cb func)
674 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
677 if (!func) return NULL;
678 if (!obj->interceptors) return NULL;
679 obj->interceptors->layer_set.func = NULL;
680 data = obj->interceptors->layer_set.data;
681 obj->interceptors->layer_set.data = NULL;
682 evas_object_intercept_deinit(obj);
689 * FIXME: To be fixed.
693 evas_object_intercept_color_set_callback_add(Evas_Object *obj, Evas_Object_Intercept_Color_Set_Cb func, const void *data)
696 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
700 evas_object_intercept_init(obj);
701 if (!obj->interceptors) return;
702 obj->interceptors->color_set.func = func;
703 obj->interceptors->color_set.data = (void *)data;
709 * FIXME: To be fixed.
713 evas_object_intercept_color_set_callback_del(Evas_Object *obj, Evas_Object_Intercept_Color_Set_Cb func)
718 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
721 if (!func) return NULL;
722 if (!obj->interceptors) return NULL;
723 obj->interceptors->color_set.func = NULL;
724 data = obj->interceptors->color_set.data;
725 obj->interceptors->color_set.data = NULL;
726 evas_object_intercept_deinit(obj);
733 * FIXME: To be fixed.
737 evas_object_intercept_clip_set_callback_add(Evas_Object *obj, Evas_Object_Intercept_Clip_Set_Cb func, const void *data)
740 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
744 evas_object_intercept_init(obj);
745 if (!obj->interceptors) return;
746 obj->interceptors->clip_set.func = func;
747 obj->interceptors->clip_set.data = (void *)data;
753 * FIXME: To be fixed.
757 evas_object_intercept_clip_set_callback_del(Evas_Object *obj, Evas_Object_Intercept_Clip_Set_Cb func)
762 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
765 if (!func) return NULL;
766 if (!obj->interceptors) return NULL;
767 obj->interceptors->clip_set.func = NULL;
768 data = obj->interceptors->clip_set.data;
769 obj->interceptors->clip_set.data = NULL;
770 evas_object_intercept_deinit(obj);
777 * FIXME: To be fixed.
781 evas_object_intercept_clip_unset_callback_add(Evas_Object *obj, Evas_Object_Intercept_Clip_Unset_Cb func, const void *data)
784 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
788 evas_object_intercept_init(obj);
789 if (!obj->interceptors) return;
790 obj->interceptors->clip_unset.func = func;
791 obj->interceptors->clip_unset.data = (void *)data;
797 * FIXME: To be fixed.
801 evas_object_intercept_clip_unset_callback_del(Evas_Object *obj, Evas_Object_Intercept_Clip_Unset_Cb func)
806 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
809 if (!func) return NULL;
810 if (!obj->interceptors) return NULL;
811 obj->interceptors->clip_unset.func = NULL;
812 data = obj->interceptors->clip_unset.data;
813 obj->interceptors->clip_unset.data = NULL;
814 evas_object_intercept_deinit(obj);