diff options
author | Simon Howard | 2011-10-23 19:25:55 +0000 |
---|---|---|
committer | Simon Howard | 2011-10-23 19:25:55 +0000 |
commit | dd52766c7be893a6a5db31bc396ccef8d758af45 (patch) | |
tree | 0ece2688a18f5f8f3d893047973d1c6ab4c82df1 /textscreen/txt_widget.h | |
parent | 71d316afb2ae7191a4ef6fac2d757238ae3616e1 (diff) | |
download | chocolate-doom-dd52766c7be893a6a5db31bc396ccef8d758af45.tar.gz chocolate-doom-dd52766c7be893a6a5db31bc396ccef8d758af45.tar.bz2 chocolate-doom-dd52766c7be893a6a5db31bc396ccef8d758af45.zip |
Rework textscreen focus handling so that input boxes will stop editing
when they lose their focus (thanks Twelve).
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2460
Diffstat (limited to 'textscreen/txt_widget.h')
-rw-r--r-- | textscreen/txt_widget.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/textscreen/txt_widget.h b/textscreen/txt_widget.h index ebb5a292..f64b9517 100644 --- a/textscreen/txt_widget.h +++ b/textscreen/txt_widget.h @@ -71,13 +71,14 @@ typedef struct txt_widget_class_s txt_widget_class_t; typedef struct txt_callback_table_s txt_callback_table_t; typedef void (*TxtWidgetSizeCalc)(TXT_UNCAST_ARG(widget)); -typedef void (*TxtWidgetDrawer)(TXT_UNCAST_ARG(widget), int selected); +typedef void (*TxtWidgetDrawer)(TXT_UNCAST_ARG(widget)); typedef void (*TxtWidgetDestroy)(TXT_UNCAST_ARG(widget)); typedef int (*TxtWidgetKeyPress)(TXT_UNCAST_ARG(widget), int key); typedef void (*TxtWidgetSignalFunc)(TXT_UNCAST_ARG(widget), void *user_data); typedef void (*TxtMousePressFunc)(TXT_UNCAST_ARG(widget), int x, int y, int b); typedef void (*TxtWidgetLayoutFunc)(TXT_UNCAST_ARG(widget)); typedef int (*TxtWidgetSelectableFunc)(TXT_UNCAST_ARG(widget)); +typedef void (*TxtWidgetFocusFunc)(TXT_UNCAST_ARG(widget), int focused); struct txt_widget_class_s { @@ -88,6 +89,7 @@ struct txt_widget_class_s TxtWidgetDestroy destructor; TxtMousePressFunc mouse_press; TxtWidgetLayoutFunc layout; + TxtWidgetFocusFunc focus_change; }; struct txt_widget_s @@ -96,6 +98,7 @@ struct txt_widget_s txt_callback_table_t *callback_table; int visible; txt_horiz_align_t align; + int focused; // These are set automatically when the window is drawn and should // not be set manually. @@ -110,7 +113,7 @@ struct txt_widget_s void TXT_InitWidget(TXT_UNCAST_ARG(widget), txt_widget_class_t *widget_class); void TXT_CalcWidgetSize(TXT_UNCAST_ARG(widget)); -void TXT_DrawWidget(TXT_UNCAST_ARG(widget), int selected); +void TXT_DrawWidget(TXT_UNCAST_ARG(widget)); void TXT_EmitSignal(TXT_UNCAST_ARG(widget), const char *signal_name); int TXT_WidgetKeyPress(TXT_UNCAST_ARG(widget), int key); void TXT_WidgetMousePress(TXT_UNCAST_ARG(widget), int x, int y, int b); @@ -118,6 +121,7 @@ void TXT_DestroyWidget(TXT_UNCAST_ARG(widget)); void TXT_LayoutWidget(TXT_UNCAST_ARG(widget)); int TXT_AlwaysSelectable(TXT_UNCAST_ARG(widget)); int TXT_NeverSelectable(TXT_UNCAST_ARG(widget)); +void TXT_SetWidgetFocus(TXT_UNCAST_ARG(widget), int focused); /** * Set a callback function to be invoked when a signal occurs. @@ -167,7 +171,7 @@ int TXT_HoveringOverWidget(TXT_UNCAST_ARG(widget)); * @param selected Whether the widget is selected. */ -void TXT_SetWidgetBG(TXT_UNCAST_ARG(widget), int selected); +void TXT_SetWidgetBG(TXT_UNCAST_ARG(widget)); /** * Query whether the specified widget is contained within another |