Mercurial > MadButterfly
comparison src/mb_types.h @ 73:9ab15ebc9061
Observer for mouse events
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 18 Aug 2008 01:59:26 +0800 |
parents | 1ca417f741f1 |
children | a6763f080da5 |
comparison
equal
deleted
inserted
replaced
72:171a8cb7e4b5 | 73:9ab15ebc9061 |
---|---|
1 #ifndef __MB_TYPES_H_ | 1 #ifndef __MB_TYPES_H_ |
2 #define __MB_TYPES_H_ | 2 #define __MB_TYPES_H_ |
3 | 3 |
4 #include <cairo.h> | 4 #include <cairo.h> |
5 #include "tools.h" | 5 #include "tools.h" |
6 #include "observer.h" | |
6 | 7 |
7 typedef float co_aix; | 8 typedef float co_aix; |
8 typedef struct _shape shape_t; | 9 typedef struct _shape shape_t; |
9 typedef struct _geo geo_t; | 10 typedef struct _geo geo_t; |
10 typedef struct _area area_t; | 11 typedef struct _area area_t; |
45 shape_t *shape; | 46 shape_t *shape; |
46 geo_t *next; /*!< \brief Link all geo objects. */ | 47 geo_t *next; /*!< \brief Link all geo objects. */ |
47 | 48 |
48 area_t *cur_area, *last_area; | 49 area_t *cur_area, *last_area; |
49 area_t areas[2]; | 50 area_t areas[2]; |
51 | |
52 subject_t *mouse_event; | |
50 }; | 53 }; |
51 #define GEF_DIRTY 0x1 | 54 #define GEF_DIRTY 0x1 |
52 #define GEF_HIDDEN 0x2 | 55 #define GEF_HIDDEN 0x2 |
53 | 56 |
54 extern int is_overlay(area_t *r1, area_t *r2); | 57 extern int is_overlay(area_t *r1, area_t *r2); |
94 struct _coord *parent; | 97 struct _coord *parent; |
95 STAILQ(struct _coord) children; | 98 STAILQ(struct _coord) children; |
96 struct _coord *sibling; | 99 struct _coord *sibling; |
97 | 100 |
98 STAILQ(shape_t) members; /*!< All shape_t objects in this coord. */ | 101 STAILQ(shape_t) members; /*!< All shape_t objects in this coord. */ |
102 subject_t *mouse_event; | |
99 } coord_t; | 103 } coord_t; |
100 #define COF_DIRTY 0x1 | 104 #define COF_DIRTY 0x1 |
101 #define COF_HIDDEN 0x2 | 105 #define COF_HIDDEN 0x2 |
102 | 106 |
103 extern void coord_init(coord_t *co, coord_t *parent); | 107 extern void coord_init(coord_t *co, coord_t *parent); |
127 geo_t *geo; | 131 geo_t *geo; |
128 coord_t *coord; | 132 coord_t *coord; |
129 shape_t *coord_mem_next; | 133 shape_t *coord_mem_next; |
130 paint_t *fill, *stroke; | 134 paint_t *fill, *stroke; |
131 co_aix stroke_width; | 135 co_aix stroke_width; |
132 int stroke_linecap; | 136 int stroke_linecap:2; |
133 int stroke_linejoin; | 137 int stroke_linejoin:2; |
138 void (*free)(shape_t *shape); | |
134 }; | 139 }; |
135 enum { SHT_UNKNOW, SHT_PATH, SHT_TEXT, SHT_RECT }; | 140 enum { SHT_UNKNOW, SHT_PATH, SHT_TEXT, SHT_RECT }; |
136 | 141 |
137 #define sh_attach_geo(sh, g) \ | 142 #define sh_attach_geo(sh, g) \ |
138 do { \ | 143 do { \ |