summaryrefslogtreecommitdiff
path: root/textscreen/guitest.c
blob: 66f2a363fe087cf9018ec68308143b11533e326d (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
#include <stdlib.h>
#include <string.h>

#include "txt_main.h"

#include "txt_button.h"
#include "txt_desktop.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");

    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");
    TXT_SetWindowPosition(window, 
                          TXT_HORIZ_RIGHT, 
                          TXT_VERT_TOP, 
                          TXT_SCREEN_W - 1, 1);

    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();

    TXT_GUIMainLoop();
}