ref: a27b3c92870be04d2ea919ca9a510931d96619b6
parent: 1de18c1397bfb069771c02336e47b89e098b6f43
author: Simon Howard <[email protected]>
date: Mon May 22 20:25:36 EDT 2006
Add actions demonstration to guitest. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 516
--- 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_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 @@
txt_table_t *leftpane, *rightpane;
txt_button_t *button;
txt_checkbox_t *cheesy_checkbox;
+ txt_window_action_t *pwn;
char buf[100];
int i;
@@ -105,6 +130,10 @@
TXT_AddWidget(window, button);
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;
}