summaryrefslogtreecommitdiff
path: root/textscreen/txt_window.c
diff options
context:
space:
mode:
authorSimon Howard2006-05-23 19:33:35 +0000
committerSimon Howard2006-05-23 19:33:35 +0000
commit240a1cfcca8f53a114a4302e93af793be21809d0 (patch)
treef9f92c2454d274902f2e1edf36c4f7300404bbb5 /textscreen/txt_window.c
parent59864df095516a0e6a1fecb5a6abfeedc1e56188 (diff)
downloadchocolate-doom-240a1cfcca8f53a114a4302e93af793be21809d0.tar.gz
chocolate-doom-240a1cfcca8f53a114a4302e93af793be21809d0.tar.bz2
chocolate-doom-240a1cfcca8f53a114a4302e93af793be21809d0.zip
Add a default action to close windows when escape is pressed. Do not
make escape quit the program unless there are no open windows. Add TXT_ExitMainLoop(). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 518
Diffstat (limited to 'textscreen/txt_window.c')
-rw-r--r--textscreen/txt_window.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c
index b66995d7..9c1f0257 100644
--- a/textscreen/txt_window.c
+++ b/textscreen/txt_window.c
@@ -45,6 +45,13 @@ void TXT_SetWindowAction(txt_window_t *window,
window->actions[position] = action;
}
+static void DefaultCancelAction(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(window))
+{
+ TXT_CAST_ARG(txt_window_t, window);
+
+ TXT_CloseWindow(window);
+}
+
txt_window_t *TXT_NewWindow(char *title)
{
int i;
@@ -74,6 +81,7 @@ txt_window_t *TXT_NewWindow(char *title)
cancel_action = TXT_NewWindowAction(KEY_ESCAPE, "Abort");
TXT_SetWindowAction(win, TXT_HORIZ_LEFT, cancel_action);
+ TXT_SignalConnect(cancel_action, "pressed", DefaultCancelAction, win);
accept_action = TXT_NewWindowAction(KEY_ENTER, "Accept");
TXT_SetWindowAction(win, TXT_HORIZ_RIGHT, accept_action);