aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/evas/src/lib/canvas/evas_callbacks.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2008-06-03 20:33:40 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2008-06-03 20:33:40 +0000
commitb802f4c94ad6b73adb86d0c4036e315d21a0a91d (patch)
tree0a46b4edb0386c92b54939b69fb322756cc7581a /legacy/evas/src/lib/canvas/evas_callbacks.c
parentadd stylus support (diff)
downloadefl-b802f4c94ad6b73adb86d0c4036e315d21a0a91d.tar.gz
Add evas_object_event_callback_del_full()
This will check both function and data before removing the callback, this is useful when you have lots of children monitoring parent, when one child want to remove its monitoring function, others will remain. Name is quite difficult to choose, I opted for "_full", but could be "_with_data" or similar. SVN revision: 34731
Diffstat (limited to 'legacy/evas/src/lib/canvas/evas_callbacks.c')
-rw-r--r--legacy/evas/src/lib/canvas/evas_callbacks.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_callbacks.c b/legacy/evas/src/lib/canvas/evas_callbacks.c
index 7d8f1cd6f0..1fde3755ea 100644
--- a/legacy/evas/src/lib/canvas/evas_callbacks.c
+++ b/legacy/evas/src/lib/canvas/evas_callbacks.c
@@ -406,3 +406,63 @@ evas_object_event_callback_del(Evas_Object *obj, Evas_Callback_Type type, void (
}
return NULL;
}
+
+/**
+ * Delete a callback function from an object
+ * @param obj Object to remove a callback from
+ * @param type The type of event that was triggering the callback
+ * @param func The function that was to be called when the event was triggered
+ * @param data The data pointer that was to be passed to the callback
+ * @return The data pointer that was to be passed to the callback
+ *
+ * This function removes the most recently added callback from the object
+ * @p obj which was triggered by the event type @p type and was calling the
+ * function @p func with data @p data when triggered. If the removal is
+ * successful it will also return the data pointer that was passed to
+ * evas_object_event_callback_add() (that will be the same as the parameter)
+ * when the callback was added to the object. If not successful NULL will be
+ * returned.
+ *
+ * Example:
+ * @code
+ * extern Evas_Object *object;
+ * void *my_data;
+ * void up_callback(void *data, Evas *e, Evas_Object *obj, void *event_info);
+ *
+ * my_data = evas_object_event_callback_del_full(object, EVAS_CALLBACK_MOUSE_UP, up_callback, data);
+ * @endcode
+ * @ingroup Evas_Object_Callback_Group
+ */
+EAPI void *
+evas_object_event_callback_del_full(Evas_Object *obj, Evas_Callback_Type type, void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info), const void *data)
+{
+ /* MEM OK */
+ Evas_Object_List *l;
+
+ MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
+ return NULL;
+ MAGIC_CHECK_END();
+
+ if (!func) return NULL;
+
+ if (!obj->callbacks) return NULL;
+
+ for (l = obj->callbacks->callbacks; l; l = l->next)
+ {
+ Evas_Func_Node *fn;
+
+ fn = (Evas_Func_Node *)l;
+ if ((fn->func == func) && (fn->type == type) && (fn->data == data) && (!fn->delete_me))
+ {
+ void *data;
+
+ data = fn->data;
+ fn->delete_me = 1;
+ obj->callbacks->deletions_waiting = 1;
+ if (!obj->callbacks->walking_list)
+ evas_object_event_callback_clear(obj);
+ return data;
+ }
+ }
+ return NULL;
+}