comparison include/mb_prop.h @ 224:29e1b2bffe4c

X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly. - backend does not interpret mouse events (over/out/move), now. - redraw manager, now, interpret mouse events to make it backend independent. - The task (interpret mouse events) should be moved to somewhere in futhure. - backend only sent MotionNotify as EVT_MOUSE_MOVE_RAW. - EVT_MOUSE_MOVE_RAW is interpreted by backend independent code.
author Thinker K.F. Li <thinker@branda.to>
date Mon, 15 Dec 2008 10:13:03 +0800
parents
children 50d253d0fcba
comparison
equal deleted inserted replaced
223:8be36a0d4239 224:29e1b2bffe4c
1 #ifndef __MB_PROP_H_
2 #define __MB_PROP_H_
3
4 #include "mb_tools.h"
5
6 /*! \defgroup mb_prop_grp Property
7 * \brief A way the modules can set up their own properties on objects.
8 *
9 * Properties are key-value pairs that are associated with objects.
10 * MadButterfly associate a property store for each object (coord or shape)
11 * to keep property values. Every property is identified by a ID; an
12 * integer. Programmer can use a ID to set/get value to/from a property
13 * store. The ID should be unique in a property store.
14 * @{
15 */
16
17 typedef struct _mb_prop_entry mb_prop_entry_t;
18 typedef struct _mb_prop_store mb_prop_store_t;
19
20 struct _mb_prop_entry {
21 int id;
22 void *value;
23 mb_prop_entry_t *next;
24 };
25
26 /*! \brief Property IDs. */
27 enum {
28 PROP_DUMMY,
29 PROP_MEVT_OB_CNT,
30 PROP_MEVT_OBSERVER,
31 PROP_LAST
32 };
33
34 struct _mb_prop_store {
35 elmpool_t *entry_pool;
36 STAILQ(mb_prop_entry_t) entries;
37 };
38
39 #define mb_prop_store_init(prop_store, pent_pool) \
40 do { \
41 (prop_store)->entry_pool = pent_pool; \
42 STAILQ_INIT((prop_store)->entries); \
43 } while(0)
44
45 void mb_prop_store_destroy(mb_prop_store_t *prop_store);
46 void *mb_prop_set(mb_prop_store_t *prop_store, int id, void *value);
47 void *mb_prop_get(mb_prop_store_t *prop_store, int id);
48 void mb_prop_del(mb_prop_store_t *prop_store, int id);
49 int mb_prop_has(mb_prop_store_t *prop_store, int id);
50
51 /* @} */
52
53 #endif /* __MB_PROP_H_ */