7 #define TX_EXT(type, var) type *var = (type *)obj->extend
8 #define MIN(a,b) (((a) < (b) ? (a) : (b)))
9 #define MAX(a,b) (((a) < (b) ? (a) : (b)))
11 typedef struct _TXObj TXObj
;
13 typedef void (*obj_fn
) (TXObj
*);
14 typedef int (*getc_fn
)(TXObj
*);
15 typedef int (*draw_fn
)(TXObj
*);
16 typedef int (*size_fn
)(TXObj
*, int, int);
17 typedef void (*oper_fn
)(TXObj
*, int);
20 struct list_head node
;
42 /* passed to the above functions */
45 /* spare variable, useful for bindings */
50 extern TXObj
*tx_obj_root
;
51 extern TXObj
*tx_obj_focus
;
53 enum {TX_LIST
= 1, TX_BOX
= 2};
55 /* XXX: BORDER MUST BE 1 << 0 because it uses the value 1 as an offset when drawing */
56 enum {TX_OBJ_BORDER
= 1<<0, TX_OBJ_ROOT
= 1<<1, TX_OBJ_FOCUS
= 1<<2, TX_OBJ_TITLE
= 1<<3};
58 int tx_obj_init (TXObj
*obj
, int type
, int flags
);
59 void tx_obj_border (TXObj
*obj
);
60 void tx_obj_free (TXObj
*obj
);
61 void tx_obj_get_type (TXObj
*obj
);
62 void tx_obj_reset (TXObj
*obj
);
64 void tx_obj_title_set (TXObj
*obj
, char *title
);
65 void tx_obj_size_set (TXObj
*obj
, int x
, int y
, int w
, int h
);
66 void tx_obj_map (TXObj
*obj
, void (*fn
)(TXObj
*));
67 void tx_obj_flag_set (TXObj
*obj
, int flag
, int set
);
68 int tx_obj_flag_get (TXObj
*obj
, int flag
);
69 int tx_obj_flag_toggle (TXObj
*obj
, int flag
);
72 /* object functions */
73 void tx_obj_draw (TXObj
*obj
);
74 void tx_obj_resize (TXObj
*obj
);
75 void tx_obj_idle (TXObj
*obj
);
76 void tx_obj_operate (TXObj
*obj
);
78 /* set object cb functions */
79 void tx_obj_size_cb_set (TXObj
*obj
, size_fn
);
80 void tx_obj_rsze_cb_set (TXObj
*obj
, obj_fn
);
81 void tx_obj_idle_cb_set (TXObj
*obj
, obj_fn
);
82 void tx_obj_getc_cb_set (TXObj
*obj
, getc_fn
);