diff 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
line wrap: on
line diff
--- a/include/mb_types.h	Wed Nov 19 20:54:27 2008 +0800
+++ b/include/mb_types.h	Tue Dec 09 17:34:10 2008 +0800
@@ -11,9 +11,27 @@
 typedef struct _area area_t;
 typedef struct _shnode shnode_t;
 typedef struct _paint paint_t;
+typedef struct _mb_obj mb_obj_t;
 
 struct _redraw_man;
 
+struct _mb_obj {
+    int obj_type;
+};
+
+enum { MBO_DUMMY,
+       MBO_COORD,
+       MBO_SHAPES=0x1000,
+       MBO_PATH,
+       MBO_TEXT,
+       MBO_RECT
+};
+#define MBO_CLASS_MASK 0xf000
+#define MBO_CLASS(x) (((mb_obj_t *)(x))->obj_type & MBO_CLASS_MASK)
+#define MBO_TYPE(x) (((mb_obj_t *)(x))->obj_type)
+#define IS_MBO_SHAPES(obj) (MBO_CLASS(obj) == MBO_SHAPES)
+#define IS_MBO_COORD(obj) (MBO_TYPE(obj) == MB_COORD)
+
 /*! \brief Base of paint types.
  *
  * Paints should be freed by users by calling rdman_paint_free() of
@@ -93,6 +111,7 @@
  * \enddot
  */
 typedef struct _coord {
+    mb_obj_t obj;
     unsigned int order;
     unsigned int flags;
     co_aix opacity;
@@ -161,7 +180,7 @@
  * \enddot
  */
 struct _shape {
-    int sh_type;
+    mb_obj_t obj;
     geo_t *geo;
     coord_t *coord;
     paint_t *fill, *stroke;
@@ -171,7 +190,7 @@
     struct _shape *sh_next;	/*!< Link all shapes of a rdman together. */
     void (*free)(shape_t *shape);
 };
-enum { SHT_UNKNOW, SHT_PATH, SHT_TEXT, SHT_RECT };
+/* enum { SHT_UNKNOW, SHT_PATH, SHT_TEXT, SHT_RECT }; */
 
 #define sh_get_mouse_event_subject(sh) ((sh)->geo->mouse_event)
 #define sh_hide(sh)			     \