]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu-div0test/nexuiz/mainwindow.c
first attempt at teamselect dialog... not good yet (need a better way to implement...
[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...", 10, 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 = spawnSlider();
48                 i.configureSliderVisuals(i, "", " fps", 12, 0.2, "qcsrc/menu-div0test/baseslider");
49                 i.configureSliderValues(i, 1, 50, 200, 1, 1, 20);
50                 dlg.addItem(dlg, i, '0.1 0.5 0', '0.8 0.1 0', 1);
51
52                 i = spawnCheckBox();
53                 i.configureCheckBox(i, "Do not show this dialog again", 12, "qcsrc/menu-div0test/basecheckbox");
54                 i.checked = 1;
55                 dlg.addItem(dlg, i, '0.1 0.6 0', '0.8 0.1 0', 1);
56
57                 i = spawnButton();
58                 i.configureButton(i, "Close", 12, "qcsrc/menu-div0test/basebutton");
59                 i.onClick = DialogCloseButton_Click; i.onClickEntity = dlg;
60                 dlg.addItem(dlg, i, '0.3 0.7 0', '0.4 0.2 0', 1);
61
62                 dlg.addItem(dlg, cb, '0.3 0.7 0', '0.4 0.2 0', 1);
63         me.addItem(me, dlg, '0.2 0.3 0', '0.6 0.4 0', 1);
64         
65         i = spawnTeamSelectDialog();
66         i.configureDialog(i);
67         me.addItem(me, i, ('1 1 0' - i.intendedWidth * eX - i.intendedHeight * eY) * 0.5, i.intendedWidth * eX + i.intendedHeight * eY, 1);
68
69         i = spawnImage();
70         i.configureImage(i, "gfx/0.tga");
71         n.addItem(n, i, '0.4 0.45 0', '0.2 0.1 0', 1);
72         n.setNexposee(n, i, '0.5 0.5 0', 0.2, 0.5);
73         
74         c = spawnInputContainer();
75
76                 i = spawnImage();
77                 i.configureImage(i, "gfx/0.tga");
78                 c.addItem(c, i, '0 0 0', '1 1 0', 1);
79
80                 mc = spawnModalController();
81                         b = spawnButton();
82                         b.configureButton(b, "1!", 12, "qcsrc/menu-div0test/basebutton");
83                         c.addItem(c, b, '0 0 0', '0.2 0.2 0', 1);
84                         i = spawnButton();
85                         i.configureButton(i, "Do not press this button!", 12, "qcsrc/menu-div0test/basebutton"); // click n gently with a chainsaw
86                                 i.onClick = DemoButton_Click; i.onClickEntity = dlg;
87                         mc.addTab(mc, i, b);
88                         t1 = i;
89
90                         b = spawnButton();
91                         b.configureButton(b, "2!", 12, "qcsrc/menu-div0test/basebutton");
92                         c.addItem(c, b, '0.2 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                         t2 = i;
98
99                         b = spawnButton();
100                         b.configureButton(b, "3!", 12, "qcsrc/menu-div0test/basebutton");
101                         c.addItem(c, b, '0.4 0 0', '0.2 0.2 0', 1);
102                         i = spawnButton();
103                         i.configureButton(i, "Close", 12, "qcsrc/menu-div0test/basebutton"); // click n plenty
104                                 i.onClick = ExposeeCloseButton_Click; i.onClickEntity = n;
105                         mc.addTab(mc, i, b);
106                         t3 = i;
107                 c.addItem(c, mc, '0 0.2 0', '1 0.8 0', 1);
108
109         n.addItem(n, c, '0.03 0.06 0', '0.9 0.9 0', 0.5);
110         n.setNexposee(n, c, '0.1 0.2 0', 0.2, 0.5);
111         
112         i = spawnImage();
113         i.configureImage(i, "gfx/2.tga");
114         n.addItem(n, i, '0.04 0.01 0', '0.9 0.9 0', 1);
115         n.setNexposee(n, i, '0.95 0.8 0', 0.2, 0.5);
116         
117         i = spawnImage();
118         i.configureImage(i, "gfx/3.tga");
119         n.addItem(n, i, '0.02 0.03 0', '0.9 0.9 0', 1);
120         n.setNexposee(n, i, '0.99 0.1 0', 0.2, 0.5);
121         
122         i = spawnImage();
123         i.configureImage(i, "gfx/4.tga");
124         n.addItem(n, i, '0.01 0.09 0', '0.9 0.9 0', 1);
125         n.setNexposee(n, i, '0.1 0.9 0', 0.2, 0.5);
126
127         me.initializeDialog(me, n);
128
129 }
130 #endif
131
132 // click. The C-word so you can grep for it.