summaryrefslogtreecommitdiff
path: root/src/examples/eo/evas/evas_evas_obj.h
blob: 5490c6989e90466b52e364435b5eb6684838c675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef EXEVAS_OBJ_H
#define EXEVAS_OBJ_H

#include "Eo.h"

extern EAPI Eo_Op EXEVAS_OBJ_BASE_ID;

enum {
     EXEVAS_OBJ_SUB_ID_POSITION_SET,
     EXEVAS_OBJ_SUB_ID_SIZE_SET,
     EXEVAS_OBJ_SUB_ID_COLOR_SET,
     EXEVAS_OBJ_SUB_ID_COLOR_GET,
     EXEVAS_OBJ_SUB_ID_VISIBILITY_SET,
     EXEVAS_OBJ_SUB_ID_CHILD_ADD,
     EXEVAS_OBJ_SUB_ID_LAST
};

#define EXEVAS_OBJ_ID(sub_id) (EXEVAS_OBJ_BASE_ID + sub_id)

/**
 * @def exevas_obj_position_set(x, y)
 * @brief Set object's position
 * @param[in] x object's X position
 * @param[in] y object's Y position
 */
#define exevas_obj_position_set(x, y) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_POSITION_SET), EO_TYPECHECK(Evas_Coord, x), EO_TYPECHECK(Evas_Coord, y)

/**
 * @def exevas_obj_size_set(w, h)
 * @brief Set object's size
 * @param[in] w object's width
 * @param[in] h object's height
 */
#define exevas_obj_size_set(w, h) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_SIZE_SET), EO_TYPECHECK(Evas_Coord, w), EO_TYPECHECK(Evas_Coord, h)

/**
 * @def exevas_obj_color_set(r, g, b, a)
 * @brief Set object's color
 * @param[in] r r-value of color
 * @param[in] g g-value of color
 * @param[in] b b-value of color
 * @param[in] a a-value of color
 */
#define exevas_obj_color_set(r, g, b, a) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_COLOR_SET), EO_TYPECHECK(int, r), EO_TYPECHECK(int, g), EO_TYPECHECK(int, b), EO_TYPECHECK(int, a)

/**
 * @def exevas_obj_color_get(r, g, b, a)
 * @brief Set object's position
 * @param[out] r integer pointer for r-value of color
 * @param[out] g integer pointer for g-value of color
 * @param[out] b integer pointer for b-value of color
 * @param[out] a integer pointer for a-value of color
 */
#define exevas_obj_color_get(r, g, b, a) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_COLOR_GET), EO_TYPECHECK(int *, r), EO_TYPECHECK(int *, g), EO_TYPECHECK(int *, b), EO_TYPECHECK(int *, a)

/**
 * @def exevas_obj_visibility_set(v)
 * @brief Set object's visible property
 * @param[in] v True/False value
 */
#define exevas_obj_visibility_set(v) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_VISIBILITY_SET), EO_TYPECHECK(Eina_Bool, v)

/**
 * @def exevas_obj_child_add(child)
 * @brief Add child to current object
 * @param[in] pointer to child object
 */
#define exevas_obj_child_add(child) EXEVAS_OBJ_ID(EXEVAS_OBJ_SUB_ID_CHILD_ADD), EO_TYPECHECK(Eo *, child)

#define EXEVAS_OBJ_CLASS evas_object_class_get()
const Eo_Class *evas_object_class_get(void);

#define EXEVAS_OBJ_STR "Evas_Obj"
/* FIXME: Hack in the meanwhile. */
static inline Evas_Object *
eo_evas_object_get(const Eo *obj)
{
   void *data;
   eo_key_data_get((Eo *) obj, EXEVAS_OBJ_STR, &data);
   return data;
}

/* FIXME: Hack in the meanwhile. */
static inline void
eo_evas_object_set(Eo *obj, Evas_Object *evas_obj)
{
   eo_key_data_set(obj, EXEVAS_OBJ_STR, evas_obj);
}

#endif