1 #include <Elementary.h>
8 #define MY_CLASS EVAS_OBJ_CLASS
10 EAPI Eobj_Op EVAS_OBJ_BASE_ID = 0;
18 _position_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
20 Evas_Object *evas_obj = eobj_evas_object_get(obj);
22 x = va_arg(*list, Evas_Coord);
23 y = va_arg(*list, Evas_Coord);
24 evas_object_move(evas_obj, x, y);
28 _size_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
30 Evas_Object *evas_obj = eobj_evas_object_get(obj);
32 w = va_arg(*list, Evas_Coord);
33 h = va_arg(*list, Evas_Coord);
34 evas_object_resize(evas_obj, w, h);
38 _color_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
40 Evas_Object *evas_obj = eobj_evas_object_get(obj);
42 r = va_arg(*list, int);
43 g = va_arg(*list, int);
44 b = va_arg(*list, int);
45 a = va_arg(*list, int);
46 evas_object_color_set(evas_obj, r, g, b, a);
50 _color_get(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list)
52 Evas_Object *evas_obj = eobj_evas_object_get(obj);
54 r = va_arg(*list, int *);
55 g = va_arg(*list, int *);
56 b = va_arg(*list, int *);
57 a = va_arg(*list, int *);
58 evas_object_color_get(evas_obj, r, g, b, a);
62 _visibility_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
64 Evas_Object *evas_obj = eobj_evas_object_get(obj);
66 v = va_arg(*list, int);
67 if (v) evas_object_show(evas_obj);
68 else evas_object_hide(evas_obj);
72 _child_add(Eobj *obj, void *class_data, va_list *list)
74 Widget_Data *wd = class_data;
76 child = va_arg(*list, Eobj *);
77 wd->children = eina_list_append(wd->children, eobj_xref(child, obj));
81 _constructor(Eobj *obj, void *class_data EINA_UNUSED)
83 eobj_constructor_super(obj);
86 Eobj *parent = eobj_parent_get(obj);
88 eobj_do(parent, EVAS_OBJ_CHILD_ADD(obj));
92 _destructor(Eobj *obj, void *class_data)
94 eobj_destructor_super(obj);
96 Widget_Data *wd = class_data;
99 EINA_LIST_FREE(wd->children, child)
101 eobj_xunref(child, obj);
106 _class_constructor(Eobj_Class *klass)
108 const Eobj_Op_Func_Description func_desc[] = {
109 EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), _position_set),
110 EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_SET), _size_set),
111 EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_SET), _color_set),
112 EOBJ_OP_FUNC_CONST(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_GET), _color_get),
113 EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_SET), _visibility_set),
114 EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CHILD_ADD), _child_add),
115 EOBJ_OP_FUNC_SENTINEL
118 eobj_class_funcs_set(klass, func_desc);
121 static const Eobj_Op_Description op_desc[] = {
122 EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_POSITION_SET, "ii", "Position of an evas object."),
123 EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_SIZE_SET, "ii", "Size of an evas object."),
124 EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_COLOR_SET, "iiii", "Color of an evas object."),
125 EOBJ_OP_DESCRIPTION_CONST(EVAS_OBJ_SUB_ID_COLOR_GET, "iiii", "Color of an evas object."),
126 EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_VISIBILITY_SET, "b", "Visibility of an evas object."),
127 EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_CHILD_ADD, "o", "Add a child eobj."),
128 EOBJ_OP_DESCRIPTION_SENTINEL
131 static const Eobj_Class_Description class_desc = {
133 EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT,
134 EOBJ_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_BASE_ID, op_desc, EVAS_OBJ_SUB_ID_LAST),
143 EOBJ_DEFINE_CLASS(evas_object_class_get, &class_desc, EOBJ_BASE_CLASS, NULL)