Eobj: Changed all the eobj_do macros to lowercase.
[profile/ivi/eobj.git] / examples / evas / evas_obj.h
1 #ifndef EVAS_OBJ_H
2 #define EVAS_OBJ_H
3
4 #include "Eobj.h"
5
6 extern EAPI Eobj_Op EVAS_OBJ_BASE_ID;
7
8 enum {
9      EVAS_OBJ_SUB_ID_POSITION_SET,
10      EVAS_OBJ_SUB_ID_SIZE_SET,
11      EVAS_OBJ_SUB_ID_COLOR_SET,
12      EVAS_OBJ_SUB_ID_COLOR_GET,
13      EVAS_OBJ_SUB_ID_VISIBILITY_SET,
14      EVAS_OBJ_SUB_ID_CHILD_ADD,
15      EVAS_OBJ_SUB_ID_LAST
16 };
17
18 #define EVAS_OBJ_ID(sub_id) (EVAS_OBJ_BASE_ID + sub_id)
19
20 /**
21  * @def evas_obj_position_set(x, y)
22  * @brief Set object's position
23  * @param[in] x object's X position
24  * @param[in] y object's Y position
25  */
26 #define evas_obj_position_set(x, y) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), EOBJ_TYPECHECK(Evas_Coord, x), EOBJ_TYPECHECK(Evas_Coord, y)
27
28 /**
29  * @def evas_obj_size_set(w, h)
30  * @brief Set object's size
31  * @param[in] w object's width
32  * @param[in] h object's height
33  */
34 #define evas_obj_size_set(w, h) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_SET), EOBJ_TYPECHECK(Evas_Coord, w), EOBJ_TYPECHECK(Evas_Coord, h)
35
36 /**
37  * @def evas_obj_color_set(r, g, b, a)
38  * @brief Set object's color
39  * @param[in] r r-value of color
40  * @param[in] g g-value of color
41  * @param[in] b b-value of color
42  * @param[in] a a-value of color
43  */
44 #define evas_obj_color_set(r, g, b, a) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_SET), EOBJ_TYPECHECK(int, r), EOBJ_TYPECHECK(int, g), EOBJ_TYPECHECK(int, b), EOBJ_TYPECHECK(int, a)
45
46 /**
47  * @def evas_obj_color_get(r, g, b, a)
48  * @brief Set object's position
49  * @param[out] r integer pointer for r-value of color
50  * @param[out] g integer pointer for g-value of color
51  * @param[out] b integer pointer for b-value of color
52  * @param[out] a integer pointer for a-value of color
53  */
54 #define evas_obj_color_get(r, g, b, a) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_GET), EOBJ_TYPECHECK(int *, r), EOBJ_TYPECHECK(int *, g), EOBJ_TYPECHECK(int *, b), EOBJ_TYPECHECK(int *, a)
55
56 /**
57  * @def evas_obj_visibility_set(v)
58  * @brief Set object's visible property
59  * @param[in] v True/False value
60  */
61 #define evas_obj_visibility_set(v) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_SET), EOBJ_TYPECHECK(Eina_Bool, v)
62
63 /**
64  * @def evas_obj_child_add(child)
65  * @brief Add child to current object
66  * @param[in] pointer to child object
67  */
68 #define evas_obj_child_add(child) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CHILD_ADD), EOBJ_TYPECHECK(Eobj *, child)
69
70 #define EVAS_OBJ_CLASS evas_object_class_get()
71 const Eobj_Class *evas_object_class_get(void) EINA_CONST;
72
73 #define EVAS_OBJ_STR "Evas_Obj"
74 /* FIXME: Hack in the meanwhile. */
75 static inline Evas_Object *
76 eobj_evas_object_get(const Eobj *obj)
77 {
78    void *data;
79    eobj_query(obj, eobj_base_data_get(EVAS_OBJ_STR, &data));
80    return data;
81 }
82
83 /* FIXME: Hack in the meanwhile. */
84 static inline void
85 eobj_evas_object_set(Eobj *obj, Evas_Object *evas_obj)
86 {
87    eobj_do(obj, eobj_base_data_set(EVAS_OBJ_STR, evas_obj, NULL));
88 }
89
90 #endif