diff options
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 */ |