From 5a122d591e8fdecd767f12e93f13974cfc86f75a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 29 Jan 2009 22:54:13 +0000 Subject: Add scrollable pane widget to textscreen library. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1437 --- textscreen/examples/guitest.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'textscreen/examples') diff --git a/textscreen/examples/guitest.c b/textscreen/examples/guitest.c index 94483236..2a4d78cb 100644 --- a/textscreen/examples/guitest.c +++ b/textscreen/examples/guitest.c @@ -119,7 +119,7 @@ void SetupWindow(void) } UpdateLabel(NULL, NULL); - + TXT_AddWidget(window, TXT_NewButton2("Close Window", CloseWindow, NULL)); pwn = TXT_NewWindowAction(KEY_F1, "PWN!"); @@ -133,8 +133,9 @@ void Window2(void) { txt_window_t *window; txt_table_t *table; + txt_scrollpane_t *scrollpane; int i; - + window = TXT_NewWindow("Another test"); TXT_SetWindowPosition(window, TXT_HORIZ_RIGHT, @@ -155,6 +156,22 @@ void Window2(void) TXT_AddWidget(table, TXT_NewIntInputBox(&numbox_value, 10)); TXT_AddWidget(table, TXT_NewLabel("Spin control:")); TXT_AddWidget(table, TXT_NewSpinControl(&numbox_value, 0, 15)); + + TXT_AddWidget(window, TXT_NewSeparator("Scroll pane test")); + scrollpane = TXT_NewScrollPane(40, 5, TXT_NewLabel( + "This is a scrollable pane. The contents\n" + "of this box are larger than the box\n" + "itself, but it can be scrolled around\n" + "to explore the full contents.\n" + "\n" + "Scrollable panes can be scrolled both\n" + "vertically and horizontally. They\n" + "can contain any widget. The scroll bars\n" + "appear automatically as needed.\n" + "\n" + "This is a very long line of text that forces a horizontal scrollbar" + )); + TXT_AddWidget(window, scrollpane); } int main(int argc, char *argv[]) -- cgit v1.2.3 From a6be65e608b72b3e08ea66278e3972864c085495 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 29 Jan 2009 23:26:03 +0000 Subject: Shrink text box slightly. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1439 --- textscreen/examples/guitest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'textscreen/examples') diff --git a/textscreen/examples/guitest.c b/textscreen/examples/guitest.c index 2a4d78cb..893974df 100644 --- a/textscreen/examples/guitest.c +++ b/textscreen/examples/guitest.c @@ -151,7 +151,7 @@ void Window2(void) table = TXT_NewTable(2); TXT_AddWidget(window, table); TXT_AddWidget(table, TXT_NewLabel("String: ")); - TXT_AddWidget(table, TXT_NewInputBox(&textbox_value, 30)); + TXT_AddWidget(table, TXT_NewInputBox(&textbox_value, 20)); TXT_AddWidget(table, TXT_NewLabel("Int: ")); TXT_AddWidget(table, TXT_NewIntInputBox(&numbox_value, 10)); TXT_AddWidget(table, TXT_NewLabel("Spin control:")); -- cgit v1.2.3 From 39b7cb7bb2e14169af5dc07c7d429fc939200639 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 30 Jan 2009 23:53:47 +0000 Subject: Fix layout of widgets within scroll panes. Scroll scroll panes in response to keyboard events. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1440 --- textscreen/examples/guitest.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'textscreen/examples') diff --git a/textscreen/examples/guitest.c b/textscreen/examples/guitest.c index 893974df..792e38cc 100644 --- a/textscreen/examples/guitest.c +++ b/textscreen/examples/guitest.c @@ -82,6 +82,7 @@ void SetupWindow(void) TXT_AddWidget(window, toplabel); TXT_SetWidgetAlign(toplabel, TXT_HORIZ_CENTER); + //TXT_AddWidget(window, TXT_NewScrollPane(15, 4, table)); TXT_AddWidget(window, table); for (i=0; i<5; ++i) @@ -174,6 +175,35 @@ void Window2(void) TXT_AddWidget(window, scrollpane); } +void ScrollingMenu(void) +{ + txt_window_t *window; + txt_button_t *button; + txt_table_t *table; + + window = TXT_NewWindow("Scrollable menu"); + + table = TXT_NewTable(1); + + TXT_AddWidgets(table, + TXT_NewButton("Configure display"), + TXT_NewButton("Configure joystick"), + TXT_NewButton("Configure keyboard"), + TXT_NewButton("Configure mouse"), + TXT_NewButton("Configure sound"), + TXT_NewStrut(0, 1), + button = TXT_NewButton("Save Parameters and launch DOOM"), + TXT_NewStrut(0, 1), + TXT_NewButton("Start a network game"), + TXT_NewButton("Join a network game"), + TXT_NewButton("Multiplayer configuration"), + NULL); + + TXT_SignalConnect(button, "pressed", PwnBox, NULL); + + TXT_AddWidget(window, TXT_NewScrollPane(0, 6, table)); +} + int main(int argc, char *argv[]) { if (!TXT_Init()) @@ -184,6 +214,7 @@ int main(int argc, char *argv[]) TXT_SetDesktopTitle("Not Chocolate Doom Setup"); + ScrollingMenu(); Window2(); SetupWindow(); -- cgit v1.2.3