summaryrefslogtreecommitdiff
path: root/textscreen/guitest.c
blob: d65aa67cede96705e8d18cc128d15c9a897f1436 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <stdlib.h>
#include <string.h>

#include "txt_main.h"

#include "txt_button.h"
#include "txt_separator.h"
#include "txt_window.h"

txt_window_t *firstwin;

void SetupWindow(void)
{
    txt_window_t *window;
    char buf[100];
    int i;
    
    window = TXT_NewWindow("Window test", 40, 12);

    strcpy(buf, "This is a button label: ");

    TXT_AddWidget(window, TXT_NewSeparator("Main Section"));

    for (i=0; i<8; ++i)
    {
        strcat(buf, "a");
        TXT_AddWidget(window, TXT_NewButton(buf));

        if (i == 4)
        {
            TXT_AddWidget(window, TXT_NewSeparator("Section"));
        }

        if (i == 6)
        {
            TXT_AddWidget(window, TXT_NewSeparator(NULL));
        }
    }

    firstwin = window;
}

void Window2(void)
{
    txt_window_t *window;
    int i;
    
    window = TXT_NewWindow("Another test", 30, 7);

    for (i=0; i<5; ++i)
    {
        TXT_AddWidget(window, TXT_NewButton("hello there blah blah blah blah"));
    }
}

int main()
{
    TXT_Init();
    TXT_SetDesktopTitle("Not Chocolate Doom Setup");

    Window2();
    SetupWindow();

    for (;;)
    {
        firstwin->selected = (firstwin->selected + 1) % firstwin->num_widgets;

        TXT_DrawAllWindows();

    }
}