summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2006-05-23 00:25:36 +0000
committerSimon Howard2006-05-23 00:25:36 +0000
commita27b3c92870be04d2ea919ca9a510931d96619b6 (patch)
tree98d52139650ad4f6867b5c1885bb6cef7fceca4e
parent1de18c1397bfb069771c02336e47b89e098b6f43 (diff)
downloadchocolate-doom-a27b3c92870be04d2ea919ca9a510931d96619b6.tar.gz
chocolate-doom-a27b3c92870be04d2ea919ca9a510931d96619b6.tar.bz2
chocolate-doom-a27b3c92870be04d2ea919ca9a510931d96619b6.zip
Add actions demonstration to guitest.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 516
-rw-r--r--textscreen/guitest.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/textscreen/guitest.c b/textscreen/guitest.c
index 8362589c..cf1079b3 100644
--- a/textscreen/guitest.c
+++ b/textscreen/guitest.c
@@ -2,6 +2,8 @@
#include <stdlib.h>
#include <string.h>
+#include "doomkeys.h"
+
#include "txt_main.h"
#include "txt_checkbox.h"
@@ -25,6 +27,28 @@ txt_label_t *value_label;
txt_window_t *firstwin;
int cheesy;
+void ClosePwnBox(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(window))
+{
+ TXT_CAST_ARG(txt_window_t, window);
+
+ TXT_CloseWindow(window);
+}
+
+void PwnBox(TXT_UNCAST_ARG(widget), void *user_data)
+{
+ txt_window_t *window;
+ txt_window_action_t *close_button;
+
+ window = TXT_NewWindow("Pwned!");
+ TXT_AddWidget(window, TXT_NewLabel(" BOOM! HEADSHOT! "));
+
+ close_button = TXT_NewWindowAction(KEY_ENTER, "Close");
+ TXT_SignalConnect(close_button, "pressed", ClosePwnBox, window);
+
+ TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
+ TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, close_button);
+}
+
void UpdateLabel(TXT_UNCAST_ARG(widget), void *user_data)
{
char buf[40];
@@ -52,6 +76,7 @@ void SetupWindow(void)
txt_table_t *leftpane, *rightpane;
txt_button_t *button;
txt_checkbox_t *cheesy_checkbox;
+ txt_window_action_t *pwn;
char buf[100];
int i;
@@ -106,6 +131,10 @@ void SetupWindow(void)
TXT_SignalConnect(button, "pressed", CloseWindow, NULL);
+ pwn = TXT_NewWindowAction(KEY_F1, "PWN!");
+ TXT_SetWindowAction(window, TXT_HORIZ_CENTER, pwn);
+ TXT_SignalConnect(pwn, "pressed", PwnBox, NULL);
+
firstwin = window;
}