Mercurial > MadButterfly
comparison include/mb_types.h @ 196:c234ee745ceb
Start moving to mb_obj_t
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 09 Dec 2008 17:34:10 +0800 |
parents | 257af0ed5852 |
children | eb6ff421da7e |
comparison
equal
deleted
inserted
replaced
195:5235aded379c | 196:c234ee745ceb |
---|---|
9 typedef struct _shape shape_t; | 9 typedef struct _shape shape_t; |
10 typedef struct _geo geo_t; | 10 typedef struct _geo geo_t; |
11 typedef struct _area area_t; | 11 typedef struct _area area_t; |
12 typedef struct _shnode shnode_t; | 12 typedef struct _shnode shnode_t; |
13 typedef struct _paint paint_t; | 13 typedef struct _paint paint_t; |
14 typedef struct _mb_obj mb_obj_t; | |
14 | 15 |
15 struct _redraw_man; | 16 struct _redraw_man; |
17 | |
18 struct _mb_obj { | |
19 int obj_type; | |
20 }; | |
21 | |
22 enum { MBO_DUMMY, | |
23 MBO_COORD, | |
24 MBO_SHAPES=0x1000, | |
25 MBO_PATH, | |
26 MBO_TEXT, | |
27 MBO_RECT | |
28 }; | |
29 #define MBO_CLASS_MASK 0xf000 | |
30 #define MBO_CLASS(x) (((mb_obj_t *)(x))->obj_type & MBO_CLASS_MASK) | |
31 #define MBO_TYPE(x) (((mb_obj_t *)(x))->obj_type) | |
32 #define IS_MBO_SHAPES(obj) (MBO_CLASS(obj) == MBO_SHAPES) | |
33 #define IS_MBO_COORD(obj) (MBO_TYPE(obj) == MB_COORD) | |
16 | 34 |
17 /*! \brief Base of paint types. | 35 /*! \brief Base of paint types. |
18 * | 36 * |
19 * Paints should be freed by users by calling rdman_paint_free() of | 37 * Paints should be freed by users by calling rdman_paint_free() of |
20 * the paint. | 38 * the paint. |
91 * child10 -> child11 [label="sibling"]; | 109 * child10 -> child11 [label="sibling"]; |
92 * } | 110 * } |
93 * \enddot | 111 * \enddot |
94 */ | 112 */ |
95 typedef struct _coord { | 113 typedef struct _coord { |
114 mb_obj_t obj; | |
96 unsigned int order; | 115 unsigned int order; |
97 unsigned int flags; | 116 unsigned int flags; |
98 co_aix opacity; | 117 co_aix opacity; |
99 /*! Own one or inherit from an ancestor. | 118 /*! Own one or inherit from an ancestor. |
100 * Setup it when clean coords. | 119 * Setup it when clean coords. |
159 * "shape" -> "shape" [label="sibling"]; | 178 * "shape" -> "shape" [label="sibling"]; |
160 * } | 179 * } |
161 * \enddot | 180 * \enddot |
162 */ | 181 */ |
163 struct _shape { | 182 struct _shape { |
164 int sh_type; | 183 mb_obj_t obj; |
165 geo_t *geo; | 184 geo_t *geo; |
166 coord_t *coord; | 185 coord_t *coord; |
167 paint_t *fill, *stroke; | 186 paint_t *fill, *stroke; |
168 co_aix stroke_width; | 187 co_aix stroke_width; |
169 int stroke_linecap:2; | 188 int stroke_linecap:2; |
170 int stroke_linejoin:2; | 189 int stroke_linejoin:2; |
171 struct _shape *sh_next; /*!< Link all shapes of a rdman together. */ | 190 struct _shape *sh_next; /*!< Link all shapes of a rdman together. */ |
172 void (*free)(shape_t *shape); | 191 void (*free)(shape_t *shape); |
173 }; | 192 }; |
174 enum { SHT_UNKNOW, SHT_PATH, SHT_TEXT, SHT_RECT }; | 193 /* enum { SHT_UNKNOW, SHT_PATH, SHT_TEXT, SHT_RECT }; */ |
175 | 194 |
176 #define sh_get_mouse_event_subject(sh) ((sh)->geo->mouse_event) | 195 #define sh_get_mouse_event_subject(sh) ((sh)->geo->mouse_event) |
177 #define sh_hide(sh) \ | 196 #define sh_hide(sh) \ |
178 do { \ | 197 do { \ |
179 (sh)->geo->flags |= GEF_HIDDEN; \ | 198 (sh)->geo->flags |= GEF_HIDDEN; \ |