diff options
author | Simon Howard | 2006-06-02 20:50:51 +0000 |
---|---|---|
committer | Simon Howard | 2006-06-02 20:50:51 +0000 |
commit | 48d2fd26ca4c1de5112103788841751619ebfe9c (patch) | |
tree | 874a0b5bfe6052ad7c389726d3b93b19353af32e | |
parent | ef92ce016e328c1270597f2f1627c72bc3490d64 (diff) | |
download | chocolate-doom-48d2fd26ca4c1de5112103788841751619ebfe9c.tar.gz chocolate-doom-48d2fd26ca4c1de5112103788841751619ebfe9c.tar.bz2 chocolate-doom-48d2fd26ca4c1de5112103788841751619ebfe9c.zip |
Make clicking on "accept" action buttons send enter keypresses to the window.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 554
-rw-r--r-- | textscreen/txt_window.c | 2 | ||||
-rw-r--r-- | textscreen/txt_window_action.c | 16 | ||||
-rw-r--r-- | textscreen/txt_window_action.h | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index 7481ccfa..5da2e008 100644 --- a/textscreen/txt_window.c +++ b/textscreen/txt_window.c @@ -73,7 +73,7 @@ txt_window_t *TXT_NewWindow(char *title) // Default actions TXT_SetWindowAction(win, TXT_HORIZ_LEFT, TXT_NewWindowEscapeAction(win)); - TXT_SetWindowAction(win, TXT_HORIZ_RIGHT, TXT_NewWindowAcceptAction()); + TXT_SetWindowAction(win, TXT_HORIZ_RIGHT, TXT_NewWindowAcceptAction(win)); return win; } diff --git a/textscreen/txt_window_action.c b/textscreen/txt_window_action.c index a70d0002..aabae15b 100644 --- a/textscreen/txt_window_action.c +++ b/textscreen/txt_window_action.c @@ -100,6 +100,13 @@ static void WindowCloseCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(window)) TXT_CloseWindow(window); } +static void WindowAcceptCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(window)) +{ + TXT_CAST_ARG(txt_window_t, window); + + TXT_WidgetKeyPress(window, KEY_ENTER); +} + txt_window_action_t *TXT_NewWindowEscapeAction(txt_window_t *window) { txt_window_action_t *action; @@ -110,8 +117,13 @@ txt_window_action_t *TXT_NewWindowEscapeAction(txt_window_t *window) return action; } -txt_window_action_t *TXT_NewWindowAcceptAction(void) +txt_window_action_t *TXT_NewWindowAcceptAction(txt_window_t *window) { - return TXT_NewWindowAction(KEY_ENTER, "Accept"); + txt_window_action_t *action; + + action = TXT_NewWindowAction(KEY_ENTER, "Accept"); + TXT_SignalConnect(action, "pressed", WindowAcceptCallback, window); + + return action; } diff --git a/textscreen/txt_window_action.h b/textscreen/txt_window_action.h index 2310547f..80e1d3e5 100644 --- a/textscreen/txt_window_action.h +++ b/textscreen/txt_window_action.h @@ -45,7 +45,7 @@ txt_window_action_t *TXT_NewWindowEscapeAction(txt_window_t *window); // Accept button that does nothing -txt_window_action_t *TXT_NewWindowAcceptAction(void); +txt_window_action_t *TXT_NewWindowAcceptAction(txt_window_t *window); #endif /* #ifndef TXT_WINDOW_ACTION_H */ |