diff options
author | Simon Howard | 2006-05-22 00:20:48 +0000 |
---|---|---|
committer | Simon Howard | 2006-05-22 00:20:48 +0000 |
commit | 283f71d0f500541b6273316120e252b03f22fb03 (patch) | |
tree | 7a46a0b56e025a70872f54b5e97d6d7773e5144e /textscreen/txt_widget.h | |
parent | d90a63ed267516f8d35b4d8399dbcb5e52a1e692 (diff) | |
download | chocolate-doom-283f71d0f500541b6273316120e252b03f22fb03.tar.gz chocolate-doom-283f71d0f500541b6273316120e252b03f22fb03.tar.bz2 chocolate-doom-283f71d0f500541b6273316120e252b03f22fb03.zip |
Add a signals architecture to allow callbacks on GUI events.
Make all widget classes initialise widgets by calling TXT_InitWidget.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 501
Diffstat (limited to 'textscreen/txt_widget.h')
-rw-r--r-- | textscreen/txt_widget.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/textscreen/txt_widget.h b/textscreen/txt_widget.h index d852ccd1..a166791a 100644 --- a/textscreen/txt_widget.h +++ b/textscreen/txt_widget.h @@ -29,11 +29,13 @@ 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); struct txt_widget_class_s { @@ -46,12 +48,17 @@ struct txt_widget_class_s struct txt_widget_s { txt_widget_class_t *widget_class; + txt_callback_table_t *callback_table; int selectable; 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, + 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); |