eo_do_super(obj, MY_CLASS, eo_constructor());
Eo *bt = eo_add(ELW_BUTTON_CLASS, obj);
- eo_composite_attach(bt, obj);
+ eo_do(obj, eo_composite_attach(bt));
eo_do(bt, eo_event_callback_forwarder_add(EV_CLICKED, obj));
eo_do(bt, exevas_obj_visibility_set(EINA_TRUE));
*/
EAPI Eina_Bool eo_destructed_is(const Eo *obj);
-/**
- * @addtogroup Eo_Composite_Objects Composite Objects.
- * @{
- */
-
-/**
- * @brief Make an object a composite object of another.
- * @param comp_obj the object that will be used to composite parent.
- * @param parent the "parent" object.
- * @return EINA_TRUE if successfull. EINA_FALSE otherwise.
- *
- * The class of comp_obj must be part of the extensions of the class of the parent.
- * It is not possible to attach more then 1 composite of the same class.
- * This functions also sets the parent of comp_obj to parent.
- *
- * @see eo_composite_detach()
- * @see eo_composite_is()
- */
-EAPI Eina_Bool eo_composite_attach(Eo *comp_obj, Eo *parent);
-
-/**
- * @brief Detach a composite object from another object.
- * @param comp_obj the object attached to parent.
- * @param parent the "parent" object.
- * @return EINA_TRUE if successfull. EINA_FALSE otherwise.
- *
- * This functions also sets the parent of comp_obj to @c NULL.
- *
- * @see eo_composite_attach()
- * @see eo_composite_is()
- */
-EAPI Eina_Bool eo_composite_detach(Eo *comp_obj, Eo *parent);
-
-/**
- * @brief Check if an object is a composite object.
- * @param comp_obj the object to be checked.
- * @return @c EINA_TRUE if it is, @c EINA_FALSE otherwise.
- *
- * @see eo_composite_attach()
- * @see eo_composite_detach()
- */
-EAPI Eina_Bool eo_composite_is(const Eo *comp_obj);
-
-/**
- * @}
- */
-
/**
* @addtogroup Eo_Class_Class Eo's Class class.
* @{
return EINA_TRUE;
}
-EAPI Eina_Bool
-eo_composite_attach(Eo *comp_obj_id, Eo *parent_id)
-{
- EO_OBJ_POINTER_RETURN_VAL(comp_obj_id, comp_obj, EINA_FALSE);
- EO_OBJ_POINTER_RETURN_VAL(parent_id, parent, EINA_FALSE);
-
- if (!eo_isa(parent_id, _eo_class_id_get(comp_obj->klass))) return EINA_FALSE;
-
- {
- Eina_List *itr;
- Eo *emb_obj_id;
- EINA_LIST_FOREACH(parent->composite_objects, itr, emb_obj_id)
- {
- EO_OBJ_POINTER_RETURN_VAL(emb_obj_id, emb_obj, EINA_FALSE);
- if(emb_obj->klass == comp_obj->klass)
- return EINA_FALSE;
- }
- }
-
- comp_obj->composite = EINA_TRUE;
- parent->composite_objects = eina_list_prepend(parent->composite_objects, comp_obj_id);
-
- eo_do(comp_obj_id, eo_parent_set(parent_id));
-
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
-eo_composite_detach(Eo *comp_obj_id, Eo *parent_id)
-{
- EO_OBJ_POINTER_RETURN_VAL(comp_obj_id, comp_obj, EINA_FALSE);
- EO_OBJ_POINTER_RETURN_VAL(parent_id, parent, EINA_FALSE);
-
- if (!comp_obj->composite)
- return EINA_FALSE;
-
- comp_obj->composite = EINA_FALSE;
- parent->composite_objects = eina_list_remove(parent->composite_objects, comp_obj_id);
- eo_do(comp_obj_id, eo_parent_set(NULL));
-
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
-eo_composite_is(const Eo *comp_obj_id)
-{
- EO_OBJ_POINTER_RETURN_VAL(comp_obj_id, comp_obj, EINA_FALSE);
-
- return comp_obj->composite;
-}
-
EAPI Eina_Bool
eo_destructed_is(const Eo *obj_id)
{
/*@ Get an iterator on all childrens */
return: free(own(iterator<Eo *> *), eina_iterator_free) @warn_unused;
}
+ composite_attach {
+ /**
+ * @brief Make an object a composite object of another.
+ *
+ * The class of comp_obj must be part of the extensions of the class of the parent.
+ * It is not possible to attach more then 1 composite of the same class.
+ * This functions also sets the parent of comp_obj to parent.
+ *
+ * @see eo_composite_detach()
+ * @see eo_composite_part_is()
+ * @ingroup Eo_Composite_Objects
+ */
+ params {
+ @in Eo *comp_obj; /*@ the object that will be used to composite the parent. */
+ }
+ return: bool; /*@ EINA_TRUE if successfull. EINA_FALSE otherwise. */
+ }
+ composite_detach {
+ /**
+ * @brief Detach a composite object from another object.
+ *
+ * This functions also sets the parent of comp_obj to @c NULL.
+ *
+ * @see eo_composite_attach()
+ * @see eo_composite_part_is()
+ * @ingroup Eo_Composite_Objects
+ */
+ params {
+ @in Eo *comp_obj; /*@ the object that will be removed from the parent. */
+ }
+ return: bool; /*@ EINA_TRUE if successfull. EINA_FALSE otherwise. */
+ }
+ composite_part_is {
+ /**
+ * @brief Check if an object is part of a composite object.
+ *
+ * @see eo_composite_attach()
+ * @see eo_composite_part_is()
+ * @ingroup Eo_Composite_Objects
+ */
+ return: bool; /*@ EINA_TRUE if it is. EINA_FALSE otherwise. */
+ }
}
implements {
class.constructor;
if (pd->parent == parent_id)
return;
- if (eo_composite_is(obj) && pd->parent)
+ if (eo_do(obj, eo_composite_part_is()) && pd->parent)
{
- eo_composite_detach(obj, pd->parent);
+ eo_do(pd->parent, eo_composite_detach(obj));
}
if (pd->parent)
return event_freeze_count;
}
+EOLIAN static Eina_Bool
+_eo_base_composite_attach(Eo *parent_id, Eo_Base_Data *pd EINA_UNUSED, Eo *comp_obj_id)
+{
+ EO_OBJ_POINTER_RETURN_VAL(comp_obj_id, comp_obj, EINA_FALSE);
+ EO_OBJ_POINTER_RETURN_VAL(parent_id, parent, EINA_FALSE);
+
+ if (!eo_isa(parent_id, _eo_class_id_get(comp_obj->klass))) return EINA_FALSE;
+
+ {
+ Eina_List *itr;
+ Eo *emb_obj_id;
+ EINA_LIST_FOREACH(parent->composite_objects, itr, emb_obj_id)
+ {
+ EO_OBJ_POINTER_RETURN_VAL(emb_obj_id, emb_obj, EINA_FALSE);
+ if(emb_obj->klass == comp_obj->klass)
+ return EINA_FALSE;
+ }
+ }
+
+ comp_obj->composite = EINA_TRUE;
+ parent->composite_objects = eina_list_prepend(parent->composite_objects, comp_obj_id);
+
+ eo_do(comp_obj_id, eo_parent_set(parent_id));
+
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_eo_base_composite_detach(Eo *parent_id, Eo_Base_Data *pd EINA_UNUSED, Eo *comp_obj_id)
+{
+ EO_OBJ_POINTER_RETURN_VAL(comp_obj_id, comp_obj, EINA_FALSE);
+ EO_OBJ_POINTER_RETURN_VAL(parent_id, parent, EINA_FALSE);
+
+ if (!comp_obj->composite)
+ return EINA_FALSE;
+
+ comp_obj->composite = EINA_FALSE;
+ parent->composite_objects = eina_list_remove(parent->composite_objects, comp_obj_id);
+ eo_do(comp_obj_id, eo_parent_set(NULL));
+
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_eo_base_composite_part_is(Eo *comp_obj_id, Eo_Base_Data *pd EINA_UNUSED)
+{
+ EO_OBJ_POINTER_RETURN_VAL(comp_obj_id, comp_obj, EINA_FALSE);
+
+ return comp_obj->composite;
+}
+
/* Eo_Dbg */
EAPI void
eo_dbg_info_free(Eo_Dbg_Info *info)
Eo *emb_obj;
EINA_LIST_FOREACH_SAFE(obj->composite_objects, itr, itr_n, emb_obj)
{
- eo_composite_detach(emb_obj, _eo_id_get(obj));
+ eo_do(_eo_id_get(obj), eo_composite_detach(emb_obj));
}
}
eo_do_super(obj, MY_CLASS, eo_constructor());
Eo *simple = eo_add(SIMPLE_CLASS, obj);
- eo_composite_attach(simple, obj);
+ eo_do(obj, eo_composite_attach(simple));
eo_do(simple, eo_event_callback_forwarder_add(EV_A_CHANGED, obj));
- fail_if(eo_composite_is(obj));
- fail_if(!eo_composite_is(simple));
+ fail_if(eo_do(obj, eo_composite_part_is()));
+ fail_if(!eo_do(simple, eo_composite_part_is()));
eo_do(obj, eo_key_data_set("simple-obj", simple, NULL));
}
eo_do(obj, simple_a_set(2));
fail_if(cb_called);
- fail_if(!eo_composite_is(simple));
- fail_if(!eo_composite_detach(simple, obj));
- fail_if(eo_composite_detach(simple, obj));
- fail_if(eo_composite_is(simple));
- fail_if(!eo_composite_attach(simple, obj));
- fail_if(!eo_composite_is(simple));
- fail_if(eo_composite_attach(simple, obj));
-
- fail_if(eo_composite_attach(obj, simple));
+ fail_if(!eo_do(simple, eo_composite_part_is()));
+ fail_if(!eo_do(obj, eo_composite_detach(simple)));
+ fail_if(eo_do(obj, eo_composite_detach(simple)));
+ fail_if(eo_do(simple, eo_composite_part_is()));
+ fail_if(!eo_do(obj, eo_composite_attach(simple)));
+ fail_if(!eo_do(simple, eo_composite_part_is()));
+ fail_if(eo_do(obj, eo_composite_attach(simple)));
+
+ fail_if(eo_do(simple, eo_composite_attach(obj)));
eo_unref(simple);
eo_unref(obj);
Eo *obj2 = eo_add(SIMPLE_CLASS, NULL);
fail_if(!obj2);
- eo_composite_attach(obj2, obj);
+ eo_do(obj, eo_composite_attach(obj2));
eo_do(obj2, eo_parent_set(NULL));
- fail_if(eo_composite_is(obj2));
+ fail_if(eo_do(obj2, eo_composite_part_is()));
eo_unref(obj2);
eo_unref(obj);
fail_if(eo_data_scope_get((Eo *) buf, SIMPLE_CLASS));
- eo_composite_attach((Eo *) buf, obj);
- eo_composite_attach(obj, (Eo *) buf);
- eo_composite_detach((Eo *) buf, obj);
- eo_composite_detach(obj, (Eo *) buf);
- eo_composite_is((Eo *) buf);
+ eo_do(obj, eo_composite_attach((Eo *) buf));
+ eo_do(obj, eo_composite_detach((Eo *) buf));
+ eo_do((Eo *) buf, eo_composite_part_is());
eo_do(obj, eo_event_callback_forwarder_add(NULL, (Eo *) buf));
eo_do(obj, eo_event_callback_forwarder_del(NULL, (Eo *) buf));