]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu-div0test/nexuiz/mainwindow.c
Morphed's graphics; checkbox, radiobutton
[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, cb;
20
21         n = spawnNexposee();
22         me.addItem(me, n, '0 0 0', '1 1 0', 1);
23
24         dlg = spawnInputContainer();
25                 cb = spawnButton();
26                 cb.configureButton(cb, "", 12, "qcsrc/menu-div0test/baseclosebutton");
27                 cb.onClick = DialogCloseButton_Click; cb.onClickEntity = dlg;
28                 cb.srcMulti = 0;
29
30                 i = spawnBorderImage();
31                 i.configureBorderImage(i, "I told you...", 18, '0.5 0.5 1', "qcsrc/menu-div0test/baseborder", 1.5);
32                 i.closeButton = cb;
33                 dlg.addItem(dlg, i, '0 0 0', '1 1 0', 1);
34
35                 i = spawnLabel();
36                 i.configureLabel(i, "Swim swim hungry, swim swim hungry...", 8, 0.5);
37                 dlg.addItem(dlg, i, '0 0.3 0', '1 0.1 0', 1);
38
39                 i = spawnRadioButton();
40                 i.configureRadioButton(i, "RadioButton1", 12, "qcsrc/menu-div0test/baseradiobutton", 1, 0);
41                 dlg.addItem(dlg, i, '0.1 0.4 0', '0.4 0.1 0', 1);
42
43                 i = spawnRadioButton();
44                 i.configureRadioButton(i, "RadioButton2", 12, "qcsrc/menu-div0test/baseradiobutton", 1, 1);
45                 dlg.addItem(dlg, i, '0.5 0.4 0', '0.8 0.1 0', 1);
46
47                 i = spawnCheckBox();
48                 i.configureCheckBox(i, "Do not show this dialog again", 12, "qcsrc/menu-div0test/basecheckbox");
49                 i.checked = 1;
50                 dlg.addItem(dlg, i, '0.1 0.5 0', '0.8 0.1 0', 1);
51
52                 i = spawnButton();
53                 i.configureButton(i, "Close", 12, "qcsrc/menu-div0test/basebutton");
54                 i.onClick = DialogCloseButton_Click; i.onClickEntity = dlg;
55                 dlg.addItem(dlg, i, '0.3 0.7 0', '0.4 0.2 0', 1);
56
57                 dlg.addItem(dlg, cb, '0.3 0.7 0', '0.4 0.2 0', 1);
58         me.addItem(me, dlg, '0.2 0.3 0', '0.6 0.4 0', 1);
59         
60         i = spawnImage();
61         i.configureImage(i, "gfx/0.tga");
62         n.addItem(n, i, '0.4 0.45 0', '0.2 0.1 0', 1);
63         n.setNexposee(n, i, '0.5 0.5 0', 0.2, 0.5);
64         
65         c = spawnInputContainer();
66
67                 i = spawnImage();
68                 i.configureImage(i, "gfx/0.tga");
69                 c.addItem(c, i, '0 0 0', '1 1 0', 1);
70
71                 mc = spawnModalController();
72                         b = spawnButton();
73                         b.configureButton(b, "1!", 12, "qcsrc/menu-div0test/basebutton");
74                         c.addItem(c, b, '0 0 0', '0.2 0.2 0', 1);
75                         i = spawnButton();
76                         i.configureButton(i, "Do not press this button!", 12, "qcsrc/menu-div0test/basebutton"); // click n gently with a chainsaw
77                                 i.onClick = DemoButton_Click; i.onClickEntity = dlg;
78                         mc.addTab(mc, i, b);
79                         t1 = i;
80
81                         b = spawnButton();
82                         b.configureButton(b, "2!", 12, "qcsrc/menu-div0test/basebutton");
83                         c.addItem(c, b, '0.2 0 0', '0.2 0.2 0', 1);
84                         i = spawnButton();
85                         i.configureButton(i, "Close", 12, "qcsrc/menu-div0test/basebutton"); // click n plenty
86                                 i.onClick = ExposeeCloseButton_Click; i.onClickEntity = n;
87                         mc.addTab(mc, i, b);
88                         t2 = i;
89
90                         b = spawnButton();
91                         b.configureButton(b, "3!", 12, "qcsrc/menu-div0test/basebutton");
92                         c.addItem(c, b, '0.4 0 0', '0.2 0.2 0', 1);
93                         i = spawnButton();
94                         i.configureButton(i, "Close", 12, "qcsrc/menu-div0test/basebutton"); // click n plenty
95                                 i.onClick = ExposeeCloseButton_Click; i.onClickEntity = n;
96                         mc.addTab(mc, i, b);
97                         t3 = i;
98                 c.addItem(c, mc, '0 0.2 0', '1 0.8 0', 1);
99
100         n.addItem(n, c, '0.03 0.06 0', '0.9 0.9 0', 0.5);
101         n.setNexposee(n, c, '0.1 0.2 0', 0.2, 0.5);
102         
103         i = spawnImage();
104         i.configureImage(i, "gfx/2.tga");
105         n.addItem(n, i, '0.04 0.01 0', '0.9 0.9 0', 1);
106         n.setNexposee(n, i, '0.95 0.8 0', 0.2, 0.5);
107         
108         i = spawnImage();
109         i.configureImage(i, "gfx/3.tga");
110         n.addItem(n, i, '0.02 0.03 0', '0.9 0.9 0', 1);
111         n.setNexposee(n, i, '0.99 0.1 0', 0.2, 0.5);
112         
113         i = spawnImage();
114         i.configureImage(i, "gfx/4.tga");
115         n.addItem(n, i, '0.01 0.09 0', '0.9 0.9 0', 1);
116         n.setNexposee(n, i, '0.1 0.9 0', 0.2, 0.5);
117
118         me.initializeDialog(me, n);
119 }
120 #endif
121
122 // click. The C-word so you can grep for it.