diff options
Diffstat (limited to 'textscreen/txt_window.c')
-rw-r--r-- | textscreen/txt_window.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index b08ac658..9ab6da9b 100644 --- a/textscreen/txt_window.c +++ b/textscreen/txt_window.c @@ -20,10 +20,12 @@ // #include <stdlib.h> +#include <stdarg.h> #include <string.h> #include "doomkeys.h" +#include "txt_label.h" #include "txt_desktop.h" #include "txt_gui.h" #include "txt_io.h" @@ -502,3 +504,24 @@ void TXT_SetWindowFocus(txt_window_t *window, int focused) TXT_SetWidgetFocus(window, focused); } +txt_window_t *TXT_MessageBox(char *title, char *message, ...) +{ + txt_window_t *window; + char buf[256]; + va_list args; + + va_start(args, message); + vsnprintf(buf, sizeof(buf), message, args); + va_end(args); + + window = TXT_NewWindow(title); + TXT_AddWidget(window, TXT_NewLabel(buf)); + + TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); + TXT_SetWindowAction(window, TXT_HORIZ_CENTER, + TXT_NewWindowEscapeAction(window)); + TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); + + return window; +} + |