aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/evas/src/lib/canvas/evas_callbacks.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2002-11-08 08:02:15 +0000
committerCarsten Haitzler <raster@rasterman.com>2002-11-08 08:02:15 +0000
commit56b5e15f26e16ec835fdcdc7649347f23fb6abf6 (patch)
tree3f86155cee8ee5cec8ae19fcfba6d2625889bff8 /legacy/evas/src/lib/canvas/evas_callbacks.c
parentin goes new code (diff)
downloadefl-56b5e15f26e16ec835fdcdc7649347f23fb6abf6.tar.gz
code move
SVN revision: 6445
Diffstat (limited to 'legacy/evas/src/lib/canvas/evas_callbacks.c')
-rw-r--r--legacy/evas/src/lib/canvas/evas_callbacks.c139
1 files changed, 139 insertions, 0 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_callbacks.c b/legacy/evas/src/lib/canvas/evas_callbacks.c
new file mode 100644
index 0000000000..f0d1ced057
--- /dev/null
+++ b/legacy/evas/src/lib/canvas/evas_callbacks.c
@@ -0,0 +1,139 @@
+#include "evas_common.h"
+#include "evas_private.h"
+#include "Evas.h"
+
+void
+evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void *event_info)
+{
+ Evas_Object_List **l_mod, *l;
+
+ switch (type)
+ {
+ case EVAS_CALLBACK_MOUSE_IN:
+ l_mod = &(obj->callbacks.in);
+ break;
+ case EVAS_CALLBACK_MOUSE_OUT:
+ l_mod = &(obj->callbacks.out);
+ break;
+ case EVAS_CALLBACK_MOUSE_DOWN:
+ l_mod = &(obj->callbacks.down);
+ break;
+ case EVAS_CALLBACK_MOUSE_UP:
+ l_mod = &(obj->callbacks.up);
+ break;
+ case EVAS_CALLBACK_MOUSE_MOVE:
+ l_mod = &(obj->callbacks.move);
+ break;
+ case EVAS_CALLBACK_FREE:
+ l_mod = &(obj->callbacks.free);
+ break;
+ default:
+ return;
+ break;
+ }
+ for (l = *l_mod; l; l = l->next)
+ {
+ Evas_Func_Node *fn;
+
+ fn = (Evas_Func_Node *)l;
+ fn->func(fn->data, obj->layer->evas, obj, event_info);
+ }
+}
+
+/* public functions */
+
+void
+evas_object_event_callback_add(Evas_Object *obj, Evas_Callback_Type type, void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info), void *data)
+{
+ Evas_Func_Node *fn;
+
+ MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
+ return;
+ MAGIC_CHECK_END();
+
+ if (!func) return;
+ if (obj->smart.smart) return;
+
+ fn = calloc(1, sizeof(Evas_Func_Node));
+ if (!fn) return;
+ fn->func = func;
+ fn->data = data;
+ switch (type)
+ {
+ case EVAS_CALLBACK_MOUSE_IN:
+ obj->callbacks.in = evas_object_list_prepend(obj->callbacks.in, fn);
+ break;
+ case EVAS_CALLBACK_MOUSE_OUT:
+ obj->callbacks.out = evas_object_list_prepend(obj->callbacks.out, fn);
+ break;
+ case EVAS_CALLBACK_MOUSE_DOWN:
+ obj->callbacks.down = evas_object_list_prepend(obj->callbacks.down, fn);
+ break;
+ case EVAS_CALLBACK_MOUSE_UP:
+ obj->callbacks.up = evas_object_list_prepend(obj->callbacks.up, fn);
+ break;
+ case EVAS_CALLBACK_MOUSE_MOVE:
+ obj->callbacks.move = evas_object_list_prepend(obj->callbacks.move, fn);
+ break;
+ case EVAS_CALLBACK_FREE:
+ obj->callbacks.free = evas_object_list_prepend(obj->callbacks.free, fn);
+ break;
+ default:
+ return;
+ break;
+ }
+}
+
+void *
+evas_object_event_callback_del(Evas_Object *obj, Evas_Callback_Type type, void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info))
+{
+ Evas_Object_List **l_mod, *l;
+
+ MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
+ return NULL;
+ MAGIC_CHECK_END();
+
+ if (!func) return NULL;
+ if (obj->smart.smart) return NULL;
+
+ switch (type)
+ {
+ case EVAS_CALLBACK_MOUSE_IN:
+ l_mod = &(obj->callbacks.in);
+ break;
+ case EVAS_CALLBACK_MOUSE_OUT:
+ l_mod = &(obj->callbacks.out);
+ break;
+ case EVAS_CALLBACK_MOUSE_DOWN:
+ l_mod = &(obj->callbacks.down);
+ break;
+ case EVAS_CALLBACK_MOUSE_UP:
+ l_mod = &(obj->callbacks.up);
+ break;
+ case EVAS_CALLBACK_MOUSE_MOVE:
+ l_mod = &(obj->callbacks.move);
+ break;
+ case EVAS_CALLBACK_FREE:
+ l_mod = &(obj->callbacks.free);
+ break;
+ default:
+ return NULL;
+ break;
+ }
+ for (l = *l_mod; l; l = l->next)
+ {
+ Evas_Func_Node *fn;
+
+ fn = (Evas_Func_Node *)l;
+ if (fn->func == func)
+ {
+ void *data;
+
+ data = fn->data;
+ *l_mod = evas_object_list_remove(*l_mod, fn);
+ free(fn);
+ return data;
+ }
+ }
+ return NULL;
+}