diff options
author | Simon Howard | 2006-05-22 00:56:12 +0000 |
---|---|---|
committer | Simon Howard | 2006-05-22 00:56:12 +0000 |
commit | 11643c088751a2d3797467463bce4476d3b03292 (patch) | |
tree | 3647ce861bdd91ce90a1fecf02c9d31d8540a9cc /textscreen/txt_widget.h | |
parent | 8d188ff3d11c199621c56275d4fd6730d6f63c1b (diff) | |
download | chocolate-doom-11643c088751a2d3797467463bce4476d3b03292.tar.gz chocolate-doom-11643c088751a2d3797467463bce4476d3b03292.tar.bz2 chocolate-doom-11643c088751a2d3797467463bce4476d3b03292.zip |
Add casting macros to allow for easy casts between types.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 503
Diffstat (limited to 'textscreen/txt_widget.h')
-rw-r--r-- | textscreen/txt_widget.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/textscreen/txt_widget.h b/textscreen/txt_widget.h index a166791a..1a256c64 100644 --- a/textscreen/txt_widget.h +++ b/textscreen/txt_widget.h @@ -27,15 +27,18 @@ #ifndef TXT_WIDGET_H #define TXT_WIDGET_H +#define UNCAST(name) void *uncast_ ## name +#define CAST(type, name) type *name = (type *) uncast_ ## name + typedef struct txt_widget_class_s txt_widget_class_t; typedef struct txt_widget_s txt_widget_t; typedef struct txt_callback_table_s txt_callback_table_t; -typedef void (*TxtWidgetSizeCalc)(txt_widget_t *widget, int *w, int *h); -typedef void (*TxtWidgetDrawer)(txt_widget_t *widget, int w, int selected); -typedef void (*TxtWidgetDestroy)(txt_widget_t *widget); -typedef int (*TxtWidgetKeyPress)(txt_widget_t *widget, int key); -typedef void (*TxtWidgetSignalFunc)(txt_widget_t *widget, void *user_data); +typedef void (*TxtWidgetSizeCalc)(UNCAST(widget), int *w, int *h); +typedef void (*TxtWidgetDrawer)(UNCAST(widget), int w, int selected); +typedef void (*TxtWidgetDestroy)(UNCAST(widget)); +typedef int (*TxtWidgetKeyPress)(UNCAST(widget), int key); +typedef void (*TxtWidgetSignalFunc)(UNCAST(widget), void *user_data); struct txt_widget_class_s { @@ -53,14 +56,14 @@ struct txt_widget_s int visible; }; -void TXT_InitWidget(void *widget, txt_widget_class_t *widget_class); -void TXT_CalcWidgetSize(txt_widget_t *widget, int *w, int *h); -void TXT_DrawWidget(txt_widget_t *widget, int w, int selected); -void TXT_SignalConnect(txt_widget_t *widget, char *signal_name, +void TXT_InitWidget(UNCAST(widget), txt_widget_class_t *widget_class); +void TXT_CalcWidgetSize(UNCAST(widget), int *w, int *h); +void TXT_DrawWidget(UNCAST(widget), int w, int selected); +void TXT_SignalConnect(UNCAST(widget), char *signal_name, TxtWidgetSignalFunc func, void *user_data); -void TXT_EmitSignal(txt_widget_t *widget, char *signal_name); -int TXT_WidgetKeyPress(txt_widget_t *widget, int key); -void TXT_DestroyWidget(txt_widget_t *widget); +void TXT_EmitSignal(UNCAST(widget), char *signal_name); +int TXT_WidgetKeyPress(UNCAST(widget), int key); +void TXT_DestroyWidget(UNCAST(widget)); #endif /* #ifndef TXT_WIDGET_H */ |