]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu-div0test/nexuiz/mainwindow.c
added checkbox, radio button; removed unnecessary setFocus override in Nexposee and...
[divverent/nexuiz.git] / data / qcsrc / menu-div0test / nexuiz / mainwindow.c
1 #ifdef INTERFACE
2 CLASS(MainWindow) EXTENDS(ModalController)
3         METHOD(MainWindow, configureMainWindow, void(entity))
4 ENDCLASS(MainWindow)
5 #endif
6
7 #ifdef IMPLEMENTATION
8
9 void DemoButton_Click(entity me, entity other)
10 {
11         if(me.text == "Do not press this button again!")
12                 DialogOpenButton_Click(me, other);
13         else
14                 me.setText(me, "Do not press this button again!");
15 }
16
17 void configureMainWindowMainWindow(entity me)
18 {
19         entity dlg, n, i, b, c, mc, t1, t2, t3;
20
21         n = spawnNexposee();
22         me.addItem(me, n, '0 0 0', '1 1 0', 1);
23
24         dlg = spawnInputContainer();
25                 i = spawnImage();
26                 i.configureImage(i, "gfx/4.tga");
27                 dlg.addItem(dlg, i, '0 0 0', '1 1 0', 1);
28
29                 i = spawnLabel();
30                 i.configureLabel(i, "I told you...", 24, 0.5);
31                 dlg.addItem(dlg, i, '0 0 0', '1 0.2 0', 1);
32
33                 i = spawnLabel();
34                 i.configureLabel(i, "Swim swim hungry, swim swim hungry...", 8, 0.5);
35                 dlg.addItem(dlg, i, '0 0.3 0', '1 0.1 0', 1);
36
37                 i = spawnRadioButton();
38                 i.configureRadioButton(i, "RadioButton1", 12, "qcsrc/menu-div0test/baseradiobutton", 1, 0);
39                 dlg.addItem(dlg, i, '0.1 0.4 0', '0.4 0.1 0', 1);
40
41                 i = spawnRadioButton();
42                 i.configureRadioButton(i, "RadioButton2", 12, "qcsrc/menu-div0test/baseradiobutton", 1, 1);
43                 dlg.addItem(dlg, i, '0.5 0.4 0', '0.8 0.1 0', 1);
44
45                 i = spawnCheckBox();
46                 i.configureCheckBox(i, "Do not show this dialog again", 12, "qcsrc/menu-div0test/basecheckbox");
47                 i.checked = 1;
48                 dlg.addItem(dlg, i, '0.1 0.5 0', '0.8 0.1 0', 1);
49
50                 i = spawnButton();
51                 i.configureButton(i, "Close", 12, "qcsrc/menu-div0test/basebutton");
52                 i.onClick = DialogCloseButton_Click; i.onClickEntity = dlg;
53                 dlg.addItem(dlg, i, '0.3 0.7 0', '0.4 0.2 0', 1);
54         me.addItem(me, dlg, '0.2 0.3 0', '0.6 0.4 0', 1);
55         
56         i = spawnImage();
57         i.configureImage(i, "gfx/0.tga");
58         n.addItem(n, i, '0.4 0.45 0', '0.2 0.1 0', 1);
59         n.setNexposee(n, i, '0.5 0.5 0', 0.2, 0.5);
60         
61         c = spawnInputContainer();
62
63                 i = spawnImage();
64                 i.configureImage(i, "gfx/0.tga");
65                 c.addItem(c, i, '0 0 0', '1 1 0', 1);
66
67                 mc = spawnModalController();
68                         b = spawnButton();
69                         b.configureButton(b, "1!", 12, "qcsrc/menu-div0test/basebutton");
70                         c.addItem(c, b, '0 0 0', '0.2 0.2 0', 1);
71                         i = spawnButton();
72                         i.configureButton(i, "Do not press this button!", 12, "qcsrc/menu-div0test/basebutton"); // click n gently with a chainsaw
73                                 i.onClick = DemoButton_Click; i.onClickEntity = dlg;
74                         mc.addTab(mc, i, b);
75                         t1 = i;
76
77                         b = spawnButton();
78                         b.configureButton(b, "2!", 12, "qcsrc/menu-div0test/basebutton");
79                         c.addItem(c, b, '0.2 0 0', '0.2 0.2 0', 1);
80                         i = spawnButton();
81                         i.configureButton(i, "Close", 12, "qcsrc/menu-div0test/basebutton"); // click n plenty
82                                 i.onClick = ExposeeCloseButton_Click; i.onClickEntity = n;
83                         mc.addTab(mc, i, b);
84                         t2 = i;
85
86                         b = spawnButton();
87                         b.configureButton(b, "3!", 12, "qcsrc/menu-div0test/basebutton");
88                         c.addItem(c, b, '0.4 0 0', '0.2 0.2 0', 1);
89                         i = spawnButton();
90                         i.configureButton(i, "Close", 12, "qcsrc/menu-div0test/basebutton"); // click n plenty
91                                 i.onClick = ExposeeCloseButton_Click; i.onClickEntity = n;
92                         mc.addTab(mc, i, b);
93                         t3 = i;
94                 c.addItem(c, mc, '0 0.2 0', '1 0.8 0', 1);
95
96         n.addItem(n, c, '0.03 0.06 0', '0.9 0.9 0', 0.5);
97         n.setNexposee(n, c, '0.1 0.2 0', 0.2, 0.5);
98         
99         i = spawnImage();
100         i.configureImage(i, "gfx/2.tga");
101         n.addItem(n, i, '0.04 0.01 0', '0.9 0.9 0', 1);
102         n.setNexposee(n, i, '0.95 0.8 0', 0.2, 0.5);
103         
104         i = spawnImage();
105         i.configureImage(i, "gfx/3.tga");
106         n.addItem(n, i, '0.02 0.03 0', '0.9 0.9 0', 1);
107         n.setNexposee(n, i, '0.99 0.1 0', 0.2, 0.5);
108         
109         i = spawnImage();
110         i.configureImage(i, "gfx/4.tga");
111         n.addItem(n, i, '0.01 0.09 0', '0.9 0.9 0', 1);
112         n.setNexposee(n, i, '0.1 0.9 0', 0.2, 0.5);
113
114         me.initializeDialog(me, n);
115 }
116 #endif
117
118 // click. The C-word so you can grep for it.