14 # define EAPI __declspec(dllexport)
17 # endif /* ! DLL_EXPORT */
19 # define EAPI __declspec(dllimport)
20 # endif /* ! EFL_EO_BUILD */
24 # define EAPI __attribute__ ((visibility("default")))
38 * @var _eo_class_creation_lock
39 * This variable is used for locking purposes in the class_get function
40 * defined in #EO_DEFINE_CLASS.
41 * This is just to work around the fact that we need to init locks before
43 * Don't touch it if you don't know what you are doing.
46 EAPI extern Eina_Lock _eo_class_creation_lock;
50 * An enum representing the possible types of an Op.
54 EO_OP_TYPE_INVALID = -1, /**< Invalid op. */
55 EO_OP_TYPE_REGULAR = 0, /**< Regular op. */
56 EO_OP_TYPE_CLASS, /**< Class op - a class op. Like static in Java/C++. */
62 * A convenience typedef for #_Eo_Op_Type.
64 typedef enum _Eo_Op_Type Eo_Op_Type;
67 * @defgroup Eo Eo Generic Object System
69 * The Eo generic object system. It was designed to be the base object
76 * @def EO_TYPECHECK(type, x)
78 * Checks x is castable to type "type" and casts it to it.
79 * @param type The C type to check against.
80 * @param x the variable to test and cast.
82 #define EO_TYPECHECK(type, x) \
91 * The basic Object type.
93 typedef struct _Eo Eo;
96 * The Eo operation type id.
98 typedef unsigned int Eo_Op;
102 * The basic Object class type.
105 typedef struct _Eo_Class Eo_Class;
108 * @typedef Eo_Class_Id
112 typedef size_t Eo_Class_Id;
116 * A special #Eo_Op meaning "No operation".
118 #define EO_NOOP ((Eo_Op) 0)
121 * @typedef eo_op_func_type
122 * The type of the Op functions. This is the type of the functions used by
125 * @see eo_op_func_type_class
127 typedef void (*eo_op_func_type)(Eo *, void *class_data, va_list *list);
130 * @typedef eo_op_func_type_class
131 * The type of the class Op functions. This is the same as #eo_op_func_type,\
132 * exepct that it's for usage with class functions, and not with object
135 * @see eo_op_func_type
137 typedef void (*eo_op_func_type_class)(const Eo_Class *, va_list *list);
140 * @addtogroup Eo_Events Eo's Event Handling
145 * @struct _Eo_Event_Description
146 * This struct holds the description of a specific event.
148 struct _Eo_Event_Description
150 const char *name; /**< name of the event. */
151 const char *doc; /**< Explanation about the event. */
155 * @typedef Eo_Event_Description
156 * A convenience typedef for #_Eo_Event_Description
158 typedef struct _Eo_Event_Description Eo_Event_Description;
161 * @def EO_EVENT_DESCRIPTION(name, doc)
162 * An helper macro to help populating #Eo_Event_Description
163 * @param name The name of the event.
164 * @param doc Additional doc for the event.
165 * @see Eo_Event_Description
167 #define EO_EVENT_DESCRIPTION(name, doc) { name, doc }
174 * @addtogroup Eo_Class Eo Class
179 * @def EO_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...)
180 * A convenience macro to be used for creating the class_get function. This
181 * macro is fairly simple but should still be used as it'll let us improve
183 * @param class_get_func_name the name of the wanted class_get function name.
184 * @param class_desc the class description.
185 * @param parent_class The parent class for the function. Look at eo_class_new() for more information.
186 * @param ... List of etxensions. Look at eo_class_new() for more information.
188 * You must use this macro if you want thread safety in class creation.
190 #define EO_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) \
191 EAPI const Eo_Class * \
192 class_get_func_name(void) \
194 static volatile char lk_init = 0; \
195 static Eina_Lock _my_lock; \
196 static const Eo_Class * volatile _my_class = NULL; \
197 if (EINA_LIKELY(!!_my_class)) return _my_class; \
199 eina_lock_take(&_eo_class_creation_lock); \
201 eina_lock_new(&_my_lock); \
202 if (lk_init < 2) eina_lock_take(&_my_lock); \
207 if (lk_init < 2) eina_lock_release(&_my_lock); \
208 eina_lock_release(&_eo_class_creation_lock); \
211 eina_lock_release(&_eo_class_creation_lock); \
212 (void) parent_class; \
213 _my_class = eo_class_new(class_desc, parent_class, __VA_ARGS__); \
214 eina_lock_release(&_my_lock); \
216 eina_lock_take(&_eo_class_creation_lock); \
217 eina_lock_free(&_my_lock); \
219 eina_lock_release(&_eo_class_creation_lock); \
225 * An enum representing the possible types of an Eo class.
229 EO_CLASS_TYPE_REGULAR = 0, /**< Regular class. */
230 EO_CLASS_TYPE_REGULAR_NO_INSTANT, /**< Regular non instant-able class. */
231 EO_CLASS_TYPE_INTERFACE, /**< Interface */
232 EO_CLASS_TYPE_MIXIN /**< Mixin */
236 * @typedef Eo_Class_Type
237 * A convenience typedef for #_Eo_Class_Type.
239 typedef enum _Eo_Class_Type Eo_Class_Type;
242 * @struct _Eo_Op_Func_Description
243 * Used to associate an Op with a func.
244 * @see eo_class_funcs_set
246 struct _Eo_Op_Func_Description
248 Eo_Op op; /**< The op */
249 eo_op_func_type func; /**< The function to call for the op. */
250 Eo_Op_Type op_type; /**< The type of the op */
254 * @typedef Eo_Op_Func_Description
255 * A convenience typedef for #_Eo_Op_Func_Description
257 typedef struct _Eo_Op_Func_Description Eo_Op_Func_Description;
260 * @def EO_OP_FUNC(op, func)
261 * A convenience macro to be used when populating the #Eo_Op_Func_Description
264 #define EO_OP_FUNC(op, func) { op, EO_TYPECHECK(eo_op_func_type, func), EO_OP_TYPE_REGULAR }
267 * @def EO_OP_FUNC_CLASS(op, func)
268 * A convenience macro to be used when populating the #Eo_Op_Func_Description
270 * The same as #EO_OP_FUNC but for class functions.
274 #define EO_OP_FUNC_CLASS(op, func) { op, (eo_op_func_type) EO_TYPECHECK(eo_op_func_type_class, func), EO_OP_TYPE_CLASS }
277 * @def EO_OP_FUNC_SENTINEL
278 * A convenience macro to be used when populating the #Eo_Op_Func_Description
279 * array. It must appear at the end of the ARRAY.
281 #define EO_OP_FUNC_SENTINEL { 0, NULL, EO_OP_TYPE_INVALID }
284 * @struct _Eo_Op_Description
285 * This struct holds the description of a specific op.
287 struct _Eo_Op_Description
289 Eo_Op sub_op; /**< The sub_id of the op in it's class. */
290 const char *name; /**< The name of the op. */
291 const char *doc; /**< Explanation about the Op. */
292 Eo_Op_Type op_type; /**< The type of the Op. */
296 * @typedef Eo_Op_Description
297 * A convenience typedef for #_Eo_Op_Description
299 typedef struct _Eo_Op_Description Eo_Op_Description;
303 * The current version of EO.
308 * @struct _Eo_Class_Description
309 * This struct holds the description of a class.
310 * This description should be passed to eo_class_new.
311 * Please use the #EO_CLASS_DESCRIPTION_OPS macro when populating it.
313 struct _Eo_Class_Description
315 unsigned int version; /**< The current version of eo, use #EO_VERSION */
316 const char *name; /**< The name of the class. */
317 Eo_Class_Type type; /**< The type of the class. */
320 const Eo_Op_Description *descs;
322 } ops; /**< The ops description, should be filled using #EO_CLASS_DESCRIPTION_OPS */
323 const Eo_Event_Description **events; /**< The event descriptions for this class. */
324 size_t data_size; /**< The size of data (private + protected + public) this class needs per object. */
325 void (*class_constructor)(Eo_Class *klass); /**< The constructor of the class. */
326 void (*class_destructor)(Eo_Class *klass); /**< The destructor of the class. */
330 * @typedef Eo_Class_Description
331 * A convenience typedef for #_Eo_Class_Description
333 typedef struct _Eo_Class_Description Eo_Class_Description;
336 * @def EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count)
337 * An helper macro to help populating #Eo_Class_Description.
338 * @param base_op_id A pointer to the base op id of the class.
339 * @param op_descs the op descriptions array.
340 * @param count the number of ops in the op descriptions array.
342 #define EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) { base_op_id, op_descs, count }
345 * @def EO_OP_DESCRIPTION(op, doc)
346 * An helper macro to help populating #Eo_Op_Description
347 * @param sub_id The sub id of the op being described.
348 * @param doc Additional doc for the op.
349 * @see Eo_Op_Description
350 * @see EO_OP_DESCRIPTION_CLASS
351 * @see EO_OP_DESCRIPTION_SENTINEL
353 #define EO_OP_DESCRIPTION(sub_id, doc) { sub_id, #sub_id, doc, EO_OP_TYPE_REGULAR }
356 * @def EO_OP_DESCRIPTION_CLASS(op, doc)
357 * An helper macro to help populating #Eo_Op_Description
358 * This macro is the same as EO_OP_DESCRIPTION but indicates that the op's
359 * implementation is of type CLASS.
360 * @param sub_id The sub id of the op being described.
361 * @param doc Additional doc for the op.
362 * @see Eo_Op_Description
363 * @see EO_OP_DESCRIPTION
364 * @see EO_OP_DESCRIPTION_SENTINEL
366 #define EO_OP_DESCRIPTION_CLASS(sub_id, doc) { sub_id, #sub_id, doc, EO_OP_TYPE_CLASS }
369 * @def EO_OP_DESCRIPTION_SENTINEL
370 * An helper macro to help populating #Eo_Op_Description
371 * Should be placed at the end of the array.
372 * @see Eo_Op_Description
373 * @see EO_OP_DESCRIPTION
375 #define EO_OP_DESCRIPTION_SENTINEL { 0, NULL, NULL, EO_OP_TYPE_INVALID }
378 * @brief Create a new class.
379 * @param desc the class description to create the class with.
380 * @param parent the class to inherit from.
381 * @param ... A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects).
382 * @return The new class's handle on success, or NULL otherwise.
384 * You should use #EO_DEFINE_CLASS. It'll provide thread safety and other
387 * @see #EO_DEFINE_CLASS
389 EAPI const Eo_Class *eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent, ...);
392 * @brief Check if an object "is a" klass.
393 * @param obj The object to check
394 * @param klass The klass to check against.
395 * @return @c EINA_TRUE if obj implements klass, @c EINA_FALSE otherwise.
397 * Notice: This function does not support composite objects.
399 EAPI Eina_Bool eo_isa(const Eo *obj, const Eo_Class *klass);
402 * @brief Sets the OP functions for a class.
403 * @param klass the class to set the functions to.
404 * @param func_descs a NULL terminated array of #Eo_Op_Func_Description
406 * Should be called from within the class constructor.
408 EAPI void eo_class_funcs_set(Eo_Class *klass, const Eo_Op_Func_Description *func_descs);
411 * @brief Gets the name of the passed class.
412 * @param klass the class to work on.
413 * @return The class's name.
415 * @see eo_class_get()
417 EAPI const char *eo_class_name_get(const Eo_Class *klass);
424 * @brief Init the eo subsystem
425 * @return @c EINA_TRUE on success.
429 EAPI Eina_Bool eo_init(void);
432 * @brief Shutdown the eo subsystem
433 * @return @c EINA_TRUE on success.
437 EAPI Eina_Bool eo_shutdown(void);
441 * A convenience wrapper around eo_do_internal()
442 * @see eo_do_internal
444 #define eo_do(obj, ...) eo_do_internal(obj, EO_OP_TYPE_REGULAR, __VA_ARGS__, EO_NOOP)
448 * A convenience wrapper around eo_class_do_internal()
449 * @see eo_class_do_internal
451 #define eo_class_do(klass, ...) eo_class_do_internal(klass, __VA_ARGS__, EO_NOOP)
454 * @brief Calls op functions of an object
455 * @param obj The object to work on
456 * @param op_type The type of the ops that are passed.
457 * @param ... NULL terminated list of OPs and parameters.
458 * @return @c EINA_TRUE on success.
460 * Use the helper macros, don't pass the parameters manually.
461 * Use #eo_do instead of this function.
465 EAPI Eina_Bool eo_do_internal(Eo *obj, Eo_Op_Type op_type, ...);
468 * @brief Calls op functions of a class.
469 * @param klass The class to work on
470 * @param ... NULL terminated list of OPs and parameters.
471 * @return @c EINA_TRUE on success.
473 * Use the helper macros, don't pass the parameters manually.
474 * Use #eo_do instead of this function.
478 EAPI Eina_Bool eo_class_do_internal(const Eo_Class *klass, ...);
481 * @brief Calls the super function for the specific op.
482 * @param obj The object to work on
483 * @param ... list of parameters.
484 * @return @c EINA_TRUE on success.
486 * Unlike eo_do(), this function only accepts one op.
490 #define eo_do_super(obj, ...) eo_do_super_internal(obj, EO_OP_TYPE_REGULAR, __VA_ARGS__)
493 * @brief Calls the super function for the specific op.
494 * @param klass The klass to work on
495 * @param ... list of parameters.
496 * @return @c EINA_TRUE on success.
498 * Unlike eo_class_do(), this function only accepts one op.
502 #define eo_class_do_super(klass, ...) eo_class_do_super_internal(klass, __VA_ARGS__)
505 * @brief Calls the super function for the specific op.
506 * @param obj The object to work on
507 * @param op_type The type of the ops that are passed.
508 * @param op The wanted op.
509 * @param ... list of parameters.
510 * @return @c EINA_TRUE on success.
512 * Don't use this function, use the wrapping macros instead.
517 EAPI Eina_Bool eo_do_super_internal(Eo *obj, Eo_Op_Type op_type, Eo_Op op, ...);
520 * @brief Calls the super function for the specific op.
521 * @param klass The klass to work on
522 * @param op The wanted op.
523 * @param ... list of parameters.
524 * @return @c EINA_TRUE on success.
526 * Don't use this function, use the wrapping macros instead.
529 * @see #eo_class_do_super
531 EAPI Eina_Bool eo_class_do_super_internal(const Eo_Class *klass, Eo_Op op, ...);
534 * @brief Gets the class of the object.
535 * @param obj The object to work on
536 * @return The object's class.
538 * @see eo_class_name_get()
540 EAPI const Eo_Class *eo_class_get(const Eo *obj);
544 * @brief Notify eo that there was an error when constructing, destructing or calling a function of the object.
545 * @param obj the object to work on.
547 * @see eo_error_get()
549 #define eo_error_set(obj) eo_error_set_internal(obj, __FILE__, __LINE__)
552 EAPI void eo_error_set_internal(const Eo *obj, const char *file, int line);
557 * @brief Create a new object with the default constructor.
558 * @param klass the class of the object to create.
559 * @param parent the parent to set to the object.
560 * @param ... The ops to run.
561 * @return An handle to the new object on success, NULL otherwise.
563 #define eo_add(klass, parent, ...) \
565 volatile const Eo_Class *_tmp_klass = klass; \
566 eo_add_internal((const Eo_Class *) _tmp_klass, parent, eo_constructor(), ## __VA_ARGS__, EO_NOOP); \
571 * @brief Create a new object with a custom constructor.
572 * @param klass the class of the object to create.
573 * @param parent the parent to set to the object.
574 * @param ... The ops to run. With the constructor being first.
575 * @return An handle to the new object on success, NULL otherwise.
577 #define eo_add_custom(klass, parent, ...) \
579 volatile const Eo_Class *_tmp_klass = klass; \
580 eo_add_internal((const Eo_Class *) _tmp_klass, parent, ## __VA_ARGS__, EO_NOOP); \
584 * @brief Create a new object.
585 * @param klass the class of the object to create.
586 * @param parent the parent to set to the object.
587 * @param ... The ops to run. With the constructor being first.
588 * @return An handle to the new object on success, NULL otherwise.
590 * Use the helper macros, don't pass the parameters manually.
591 * Use #eo_add or #eo_add_custom instead of this function.
595 EAPI Eo *eo_add_internal(const Eo_Class *klass, Eo *parent, ...);
598 * @brief Get the parent of an object
599 * @param obj the object to get the parent of.
600 * @return a pointer to the parent object.
602 * @see eo_parent_set()
604 EAPI Eo *eo_parent_get(const Eo *obj);
607 * @brief Set the parent of an object
608 * @param obj the object to get the parent of.
609 * @param parent the new parent.
610 * @return @c EINA_TRUE on success, @c EINA_FALSE on failure.
612 * Parents keep references to their children so in order to delete objects
613 * that have parents you need to set parent to NULL or use eo_del() that
614 * does that for you (and also unrefs the object).
617 * @see eo_parent_get()
619 EAPI Eina_Bool eo_parent_set(Eo *obj, const Eo *parent);
622 * @brief Get a pointer to the data of an object for a specific class.
623 * @param obj the object to work on.
624 * @param klass the klass associated with the data.
625 * @return a pointer to the data.
627 EAPI void *eo_data_get(const Eo *obj, const Eo_Class *klass);
630 * @brief Increment the object's reference count by 1.
631 * @param obj the object to work on.
632 * @return The object passed.
634 * It's very easy to get a refcount leak and start leaking memory because
635 * of a forgotten unref or an extra ref. That is why there are eo_xref
636 * and eo_xunref that will make debugging easier in such a case.
637 * Therefor, these functions should only be used in small scopes, i.e at the
638 * start of some section in which the object may get freed, or if you know
639 * what you are doing.
644 EAPI Eo *eo_ref(const Eo *obj);
647 * @brief Decrement the object's reference count by 1 and free it if needed.
648 * @param obj the object to work on.
653 EAPI void eo_unref(const Eo *obj);
656 * @brief Return the ref count of the object passed.
657 * @param obj the object to work on.
658 * @return the ref count of the object.
663 EAPI int eo_ref_get(const Eo *obj);
666 * @brief Unrefs the object and reparents it to NULL.
667 * @param obj the object to work on.
669 * Because eo_del() unrefs and reparents to NULL, it doesn't really delete the
673 * @see eo_parent_set()
675 EAPI void eo_del(const Eo *obj);
678 * @def eo_xref(obj, ref_obj)
679 * Convenience macro around eo_xref_internal()
682 #define eo_xref(obj, ref_obj) eo_xref_internal(obj, ref_obj, __FILE__, __LINE__)
685 * @brief Increment the object's reference count by 1 (and associate the ref with ref_obj)
686 * @param obj the object to work on.
687 * @param ref_obj the object that references obj.
688 * @param file the call's filename.
689 * @param line the call's line number.
690 * @return The object passed (obj)
692 * People should not use this function, use #eo_xref instead.
693 * A compile flag my make it and eobj_xunref() behave the same as eobj_ref()
694 * and eobj_unref() respectively. So this should be used wherever possible.
698 EAPI Eo *eo_xref_internal(Eo *obj, const Eo *ref_obj, const char *file, int line);
701 * @brief Decrement the object's reference count by 1 and free it if needed. Will free the ref associated with ref_obj).
702 * @param obj the object to work on.
703 * @param ref_obj the object that references obj.
705 * This function only enforces the checks for object association. I.e don't rely
706 * on it. If such enforces are compiled out, this function behaves the same as
709 * @see eo_xref_internal()
711 EAPI void eo_xunref(Eo *obj, const Eo *ref_obj);
714 * @brief Enable or disable the manual free feature.
715 * @param obj the object to work on.
716 * @param manual_free indicates if the free is manual (EINA_TRUE) or automatic (EINA_FALSE).
718 * The developer is in charge to call the function eo_manual_free to free the memory allocated for this object.
720 * Do not use, unless you really know what you are doing. It's used by Evas
721 * because evas wants to keep its private data available even after the object
722 * is deleted. Setting this to true makes Eo destruct the object but not free
723 * the private data or the object itself.
725 * @see eo_manual_free()
727 EAPI void eo_manual_free_set(Eo *obj, Eina_Bool manual_free);
730 * @brief Frees the object.
731 * @param obj the object to work on.
732 * This function must be called by the developer if the function
733 * eo_manual_free_set has been called before with the parameter EINA_TRUE.
734 * An error will be printed if this function is called when the manual
735 * free option is not set to EINA_TRUE or the number of refs is not 0.
737 * @see eo_manual_free_set()
739 EAPI void eo_manual_free(Eo *obj);
742 * @addtogroup Eo_Composite_Objects Composite Objects.
747 * @brief Make an object a composite object of another.
748 * @param comp_obj the object that will be used to composite parent.
749 * @param parent the "parent" object.
751 * This functions also sets the parent of comp_obj to parent.
753 * @see eo_composite_detach()
754 * @see eo_composite_is()
756 EAPI void eo_composite_attach(Eo *comp_obj, Eo *parent);
759 * @brief Detach a composite object from another object.
760 * @param comp_obj the object attached to parent.
761 * @param parent the "parent" object.
763 * This functions also sets the parent of comp_obj to @c NULL.
765 * @see eo_composite_attach()
766 * @see eo_composite_is()
768 EAPI void eo_composite_detach(Eo *comp_obj, Eo *parent);
771 * @brief Check if an object is a composite object.
772 * @param comp_obj the object to be checked.
773 * @return @c EINA_TRUE if it is, @c EINA_FALSE otherwise.
775 * @see eo_composite_attach()
776 * @see eo_composite_detach()
778 EAPI Eina_Bool eo_composite_is(const Eo *comp_obj);
785 * @addtogroup Eo_Class_Base Eo's Base class.
791 * The class type for the Eo base class.
793 #define EO_BASE_CLASS eo_base_class_get()
795 * @brief Use #EO_BASE_CLASS
798 EAPI const Eo_Class *eo_base_class_get(void);
801 * @typedef eo_base_data_free_func
802 * Data free func prototype.
804 typedef void (*eo_base_data_free_func)(void *);
807 * @var EO_BASE_BASE_ID
808 * #EO_BASE_CLASS 's base id.
810 extern EAPI Eo_Op EO_BASE_BASE_ID;
813 EO_BASE_SUB_ID_CONSTRUCTOR,
814 EO_BASE_SUB_ID_DESTRUCTOR,
815 EO_BASE_SUB_ID_DATA_SET,
816 EO_BASE_SUB_ID_DATA_GET,
817 EO_BASE_SUB_ID_DATA_DEL,
818 EO_BASE_SUB_ID_WREF_ADD,
819 EO_BASE_SUB_ID_WREF_DEL,
820 EO_BASE_SUB_ID_EVENT_CALLBACK_PRIORITY_ADD,
821 EO_BASE_SUB_ID_EVENT_CALLBACK_DEL,
822 EO_BASE_SUB_ID_EVENT_CALLBACK_CALL,
823 EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_ADD,
824 EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_DEL,
825 EO_BASE_SUB_ID_EVENT_FREEZE,
826 EO_BASE_SUB_ID_EVENT_THAW,
827 EO_BASE_SUB_ID_EVENT_FREEZE_GET,
828 EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE,
829 EO_BASE_SUB_ID_EVENT_GLOBAL_THAW,
830 EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE_GET,
835 * @def EO_BASE_ID(sub_id)
836 * Helper macro to get the full Op ID out of the sub_id for EO_BASE.
837 * @param sub_id the sub id inside EO_BASE.
839 #define EO_BASE_ID(sub_id) (EO_BASE_BASE_ID + (sub_id))
842 * @def eo_base_data_set(key, data, free_func)
843 * Set generic data to object.
844 * @param[in] key the key associated with the data
845 * @param[in] data the data to set.
846 * @param[in] free_func the func to free data with (NULL means "do nothing").
848 * @see #eo_base_data_get
849 * @see #eo_base_data_del
851 #define eo_base_data_set(key, data, free_func) EO_BASE_ID(EO_BASE_SUB_ID_DATA_SET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(const void *, data), EO_TYPECHECK(eo_base_data_free_func, free_func)
854 * @def eo_base_data_get(key, data)
855 * Get generic data from object.
856 * @param[in] key the key associated with the data
857 * @param[out] data the data for the key
859 * @see #eo_base_data_set
860 * @see #eo_base_data_del
862 #define eo_base_data_get(key, data) EO_BASE_ID(EO_BASE_SUB_ID_DATA_GET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(void **, data)
865 * @def eo_base_data_del(key)
866 * Del generic data from object.
867 * @param[in] key the key associated with the data
869 * @see #eo_base_data_set
870 * @see #eo_base_data_get
872 #define eo_base_data_del(key) EO_BASE_ID(EO_BASE_SUB_ID_DATA_DEL), EO_TYPECHECK(const char *, key)
876 * @brief Add a new weak reference to obj.
877 * @param wref The pointer to use for the weak ref.
879 * This function registers the object handle pointed by wref to obj so when
880 * obj is deleted it'll be updated to NULL. This functions should be used
881 * when you want to keep track of an object in a safe way, but you don't want
882 * to prevent it from being freed.
886 #define eo_wref_add(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_ADD), EO_TYPECHECK(Eo **, wref)
890 * @brief Delete the weak reference passed.
891 * @param wref the weak reference to free.
895 #define eo_wref_del(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_DEL), EO_TYPECHECK(Eo **, wref)
898 * @def eo_wref_del_safe
899 * @brief Delete the weak reference passed.
900 * @param wref the weak reference to free.
902 * Same as eo_wref_del(), with the different that it's not called from eobj_do()
903 * so you don't need to check if *wref is not NULL.
907 #define eo_wref_del_safe(wref) \
909 if (*wref) eo_do(*wref, eo_wref_del(wref)); \
913 * @def eo_constructor
914 * @brief Call the object's constructor.
916 * Should not be used with #eo_do. Only use it with #eo_do_super.
918 * @see #eo_destructor
920 #define eo_constructor() EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR)
924 * @brief Call the object's destructor.
926 * Should not be used with #eo_do. Only use it with #eo_do_super.
928 * @see #eo_constructor
930 #define eo_destructor() EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR)
933 * @addtogroup Eo_Events Eo's Event Handling
938 * @def EO_CALLBACK_PRIORITY_BEFORE
939 * Slightly more prioritized than default.
941 #define EO_CALLBACK_PRIORITY_BEFORE -100
943 * @def EO_CALLBACK_PRIORITY_DEFAULT
944 * Default callback priority level
946 #define EO_CALLBACK_PRIORITY_DEFAULT 0
948 * @def EO_CALLBACK_PRIORITY_AFTER
949 * Slightly less prioritized than default.
951 #define EO_CALLBACK_PRIORITY_AFTER 100
954 * @typedef Eo_Callback_Priority
956 * Callback priority value. Range is -32k - 32k. The lower the number, the
957 * higher the priority.
959 * @see EO_CALLBACK_PRIORITY_AFTER
960 * @see EO_CALLBACK_PRIORITY_BEFORE
961 * @see EO_CALLBACK_PRIORITY_DEFAULT
963 typedef short Eo_Callback_Priority;
966 * @def EO_CALLBACK_STOP
967 * Stop calling callbacks for the even of which the callback was called for.
968 * @see EO_CALLBACK_CONTINUE
970 #define EO_CALLBACK_STOP EINA_FALSE
973 * @def EO_CALLBACK_CONTINUE
974 * Continue calling callbacks for the even of which the callback was called for.
975 * @see EO_CALLBACK_STOP
977 #define EO_CALLBACK_CONTINUE EINA_TRUE
980 * @typedef Eo_Event_Cb
982 * An event callback prototype.
984 * @param data The user data registered with the callback.
985 * @param obj The object which initiated the event.
986 * @param desc The event's description.
987 * @param event_info additional data passed with the event.
988 * @return #EO_CALLBACK_STOP to stop calling additional callbacks for the event, #EO_CALLBACK_CONTINUE to continue.
990 typedef Eina_Bool (*Eo_Event_Cb)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
993 * @def eo_event_callback_forwarder_add
994 * @brief Add an event callback forwarder for an event and an object.
995 * @param[in] desc The description of the event to listen to.
996 * @param[in] new_obj The object to emit events from.
998 * @see eo_event_callback_forwarder_del()
1000 #define eo_event_callback_forwarder_add(desc, new_obj) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_ADD), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(Eo *, new_obj)
1003 * @def eo_event_callback_forwarder_del
1004 * @brief Remove an event callback forwarder for an event and an object.
1005 * @param[in] desc The description of the event to listen to.
1006 * @param[in] new_obj The object to emit events from.
1008 * @see eo_event_callback_forwarder_add()
1010 #define eo_event_callback_forwarder_del(desc, new_obj) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_DEL), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(Eo *, new_obj)
1013 * @def eo_event_freeze
1014 * @brief freeze events of object.
1016 * Prevents event callbacks from being called for the object.
1018 * @see #eo_event_thaw
1020 #define eo_event_freeze() EO_BASE_ID(EO_BASE_SUB_ID_EVENT_FREEZE)
1023 * @def eo_event_thaw
1024 * @brief thaw events of object.
1026 * Lets event callbacks be called for the object.
1028 * @see #eo_event_freeze
1030 #define eo_event_thaw() EO_BASE_ID(EO_BASE_SUB_ID_EVENT_THAW)
1033 * @def eo_event_freeze_get
1034 * @brief return freeze events of object.
1036 * @param[out] fcount The event freeze count of the object.
1038 * Return event freeze count.
1040 * @see #eo_event_freeze
1041 * @see #eo_event_thaw
1043 #define eo_event_freeze_get(fcount) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_FREEZE_GET), EO_TYPECHECK(int *, fcount)
1046 * @def eo_event_global_freeze
1047 * @brief freeze events of object.
1049 * Prevents event callbacks from being called for the object.
1051 * @see #eo_event_freeze
1052 * @see #eo_event_global_thaw
1054 #define eo_event_global_freeze() EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE)
1057 * @def eo_event_global_thaw
1058 * @brief thaw events of object.
1060 * Lets event callbacks be called for the object.
1062 * @see #eo_event_thaw
1063 * @see #eo_event_global_freeze
1065 #define eo_event_global_thaw() EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_THAW)
1068 * @def eo_event_global_freeze_get
1069 * @brief return freeze events of object.
1071 * @param[out] fcount The event freeze count of the object.
1073 * Return event freeze count.
1075 * @see #eo_event_freeze_get
1076 * @see #eo_event_global_freeze
1077 * @see #eo_event_global_thaw
1079 #define eo_event_global_freeze_get(fcount) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE_GET), EO_TYPECHECK(int *, fcount)
1082 * @def eo_event_callback_add(obj, desc, cb, data)
1083 * Add a callback for an event.
1084 * @param[in] desc The description of the event to listen to.
1085 * @param[in] cb the callback to call.
1086 * @param[in] data additional data to pass to the callback.
1088 * callbacks of the same priority are called in reverse order of creation.
1090 * @see eo_event_callback_priority_add()
1092 #define eo_event_callback_add(desc, cb, data) \
1093 eo_event_callback_priority_add(desc, \
1094 EO_CALLBACK_PRIORITY_DEFAULT, cb, data)
1097 * @def eo_event_callback_priority_add
1098 * @brief Add a callback for an event with a specific priority.
1099 * @param[in] desc The description of the event to listen to.
1100 * @param[in] priority The priority of the callback.
1101 * @param[in] cb the callback to call.
1102 * @param[in] data additional data to pass to the callback.
1104 * callbacks of the same priority are called in reverse order of creation.
1106 * @see #eo_event_callback_add
1108 #define eo_event_callback_priority_add(desc, priority, cb, data) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_PRIORITY_ADD), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(Eo_Callback_Priority, priority), EO_TYPECHECK(Eo_Event_Cb, cb), EO_TYPECHECK(const void *, data)
1112 * @def eo_event_callback_del
1113 * @brief Del a callback with a specific data associated to it for an event.
1114 * @param[in] desc The description of the event to listen to.
1115 * @param[in] func the callback to delete.
1116 * @param[in] user_data The data to compare.
1119 #define eo_event_callback_del(desc, func, user_data) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_DEL), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(Eo_Event_Cb, func), EO_TYPECHECK(const void *, user_data)
1122 * @def eo_event_callback_call
1123 * @brief Call the callbacks for an event of an object.
1124 * @param[in] desc The description of the event to call.
1125 * @param[in] event_info Extra event info to pass to the callbacks.
1126 * @param[out] aborted @c EINA_TRUE if one of the callbacks aborted the call, @c EINA_FALSE otherwise.
1128 #define eo_event_callback_call(desc, event_info, aborted) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_CALL), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(const void *, event_info), EO_TYPECHECK(Eina_Bool *, aborted)
1135 * @var _EO_EV_CALLBACK_ADD
1136 * see EO_EV_CALLBACK_ADD
1138 EAPI extern const Eo_Event_Description _EO_EV_CALLBACK_ADD;
1141 * @def EO_EV_CALLBACK_ADD
1142 * The event description (of type #Eo_Event_Description) for
1143 * The "Callback listener added" event.
1145 #define EO_EV_CALLBACK_ADD (&(_EO_EV_CALLBACK_ADD))
1148 * @var _EO_EV_CALLBACK_DEL
1149 * see EO_EV_CALLBACK_DEL
1151 EAPI extern const Eo_Event_Description _EO_EV_CALLBACK_DEL;
1154 * @def EO_EV_CALLBACK_DEL
1155 * The event description (of type #Eo_Event_Description) for
1156 * The "Callback listener deleted" event.
1158 #define EO_EV_CALLBACK_DEL (&(_EO_EV_CALLBACK_DEL))
1164 EAPI extern const Eo_Event_Description _EO_EV_DEL;
1168 * Object is being deleted.
1170 #define EO_EV_DEL (&(_EO_EV_DEL))