]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.c
Add a refresh button
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / mainwindow.c
1 #ifdef INTERFACE
2 CLASS(MainWindow) EXTENDS(ModalController)
3         METHOD(MainWindow, configureMainWindow, void(entity))
4         ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
5         ATTRIB(MainWindow, advancedDialog, entity, NULL)
6         ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
7         ATTRIB(MainWindow, weaponsDialog, entity, NULL)
8         ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
9         ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
10         ATTRIB(MainWindow, winnerDialog, entity, NULL)
11         ATTRIB(MainWindow, waypointDialog, entity, NULL)
12         ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
13         ATTRIB(MainWindow, cvarsDialog, entity, NULL)
14         ATTRIB(MainWindow, mainNexposee, entity, NULL)
15         ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
16 ENDCLASS(MainWindow)
17 #endif
18
19 #ifdef IMPLEMENTATION
20
21 void DemoButton_Click(entity me, entity other)
22 {
23         if(me.text == "Do not press this button again!")
24                 DialogOpenButton_Click(me, other);
25         else
26                 me.setText(me, "Do not press this button again!");
27 }
28
29 void MainWindow_configureMainWindow(entity me)
30 {
31         entity n, i;
32
33         i = spawnXonoticTeamSelectDialog();
34         i.configureDialog(i);
35         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
36         
37         i = spawnXonoticHUDExitDialog();
38         i.configureDialog(i);
39         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
40         
41         i = spawnXonoticHUDNotificationDialog();
42         i.configureDialog(i);
43         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
44         
45         i = spawnXonoticHUDAmmoDialog();
46         i.configureDialog(i);
47         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
48         
49         i = spawnXonoticHUDHealthArmorDialog();
50         i.configureDialog(i);
51         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
52         
53         i = spawnXonoticHUDChatDialog();
54         i.configureDialog(i);
55         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
56         
57         i = spawnXonoticHUDModIconsDialog();
58         i.configureDialog(i);
59         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
60         
61         i = spawnXonoticHUDPowerupsDialog();
62         i.configureDialog(i);
63         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
64         
65         i = spawnXonoticHUDPressedKeysDialog();
66         i.configureDialog(i);
67         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
68         
69         i = spawnXonoticHUDRaceTimerDialog();
70         i.configureDialog(i);
71         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
72         
73         i = spawnXonoticHUDRadarDialog();
74         i.configureDialog(i);
75         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
76         
77         i = spawnXonoticHUDScoreDialog();
78         i.configureDialog(i);
79         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
80         
81         i = spawnXonoticHUDTimerDialog();
82         i.configureDialog(i);
83         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
84         
85         i = spawnXonoticHUDVoteDialog();
86         i.configureDialog(i);
87         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
88         
89         i = spawnXonoticHUDWeaponsDialog();
90         i.configureDialog(i);
91         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
92
93         i = spawnXonoticHUDEngineInfoDialog();
94         i.configureDialog(i);
95         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
96
97         i = spawnXonoticHUDInfoMessagesDialog();
98         i.configureDialog(i);
99         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
100
101         me.screenshotViewerDialog = i = spawnXonoticScreenshotViewerDialog();
102         i.configureDialog(i);
103         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
104
105         me.advancedDialog = i = spawnXonoticAdvancedDialog();
106         i.configureDialog(i);
107         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
108
109         me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
110         i.configureDialog(i);
111         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
112
113         me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
114         i.configureDialog(i);
115         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
116
117         me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
118         i.configureDialog(i);
119         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
120
121         me.winnerDialog = i = spawnXonoticWinnerDialog();
122         i.configureDialog(i);
123         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
124
125         me.weaponsDialog = i = spawnXonoticWeaponsDialog();
126         i.configureDialog(i);
127         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
128
129         me.waypointDialog = i = spawnXonoticWaypointDialog();
130         i.configureDialog(i);
131         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
132         
133         me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
134         i.configureDialog(i);
135         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
136         
137         me.cvarsDialog = i = spawnXonoticCvarsDialog();
138         i.configureDialog(i);
139         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
140         
141         me.mainNexposee = n = spawnXonoticNexposee();
142         /*
143                 if(checkextension("DP_GECKO_SUPPORT"))
144                 {
145                         i = spawnXonoticNewsDialog();
146                         i.configureDialog(i);
147                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
148                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
149                 }
150         */
151                 i = spawnXonoticSingleplayerDialog();
152                 i.configureDialog(i);
153                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
154                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
155                 
156                 i = spawnXonoticMultiplayerDialog();
157                 i.configureDialog(i);
158                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
159                 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
160
161                 i = spawnXonoticSettingsDialog();
162                 i.configureDialog(i);
163                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
164                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
165
166                 i = spawnXonoticCreditsDialog();
167                 i.configureDialog(i);
168                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
169                 n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
170                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
171
172                 i = spawnXonoticQuitDialog();
173                 i.configureDialog(i);
174                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
175                 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
176                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
177         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
178         me.moveItemAfter(me, n, NULL);
179
180         me.initializeDialog(me, n);
181 }
182 #endif
183
184 /* Click. The c-word is here so you can grep for it :-) */