]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/mainframe.h
Wrap more GTK
[xonotic/netradiant.git] / radiant / mainframe.h
1 /*
2    Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #if !defined( INCLUDED_MAINFRAME_H )
23 #define INCLUDED_MAINFRAME_H
24
25 #include <uilib/uilib.h>
26 #include "gtkutil/window.h"
27 #include "gtkutil/idledraw.h"
28 #include "gtkutil/widget.h"
29 #include "string/string.h"
30
31 #include "qerplugin.h"
32
33 class IPlugIn;
34 class IToolbarButton;
35
36 class XYWnd;
37 class CamWnd;
38 class ZWnd;
39
40
41 const int c_command_status = 0;
42 const int c_position_status = 1;
43 const int c_brushcount_status = 2;
44 const int c_texture_status = 3;
45 const int c_grid_status = 4;
46 const int c_count_status = 5;
47
48 class MainFrame
49 {
50 public:
51 enum EViewStyle
52 {
53         eRegular = 0,
54         eFloating = 1,
55         eSplit = 2,
56         eRegularLeft = 3,
57 };
58
59 MainFrame();
60 ~MainFrame();
61
62 ui::Window m_window{ui::null};
63
64 CopiedString m_command_status;
65 CopiedString m_position_status;
66 CopiedString m_brushcount_status;
67 CopiedString m_texture_status;
68 CopiedString m_grid_status;
69 private:
70
71 void Create();
72 void SaveWindowInfo();
73 void Shutdown();
74
75 ui::Widget m_vSplit{ui::null};
76 ui::Widget m_hSplit{ui::null};
77 ui::Widget m_vSplit2{ui::null};
78
79 XYWnd* m_pXYWnd;
80 XYWnd* m_pYZWnd;
81 XYWnd* m_pXZWnd;
82 CamWnd* m_pCamWnd;
83 ZWnd* m_pZWnd;
84 XYWnd* m_pActiveXY;
85
86 bool m_bSleeping;
87
88 void *m_pStatusLabel[c_count_status];
89
90
91 EViewStyle m_nCurrentStyle;
92 WindowPositionTracker m_position_tracker;
93
94 IdleDraw m_idleRedrawStatusText;
95
96 public:
97
98 bool IsSleeping(){
99         return m_bSleeping;
100 }
101 void OnSleep();
102
103 void SetStatusText( CopiedString& status_text, const char* pText );
104 void UpdateStatusText();
105 void RedrawStatusText();
106 typedef MemberCaller<MainFrame, &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
107
108 void SetGridStatus();
109 typedef MemberCaller<MainFrame, &MainFrame::SetGridStatus> SetGridStatusCaller;
110
111 void SetActiveXY( XYWnd* p );
112 XYWnd* ActiveXY(){
113         return m_pActiveXY;
114 };
115 XYWnd* GetXYWnd(){
116         return m_pXYWnd;
117 }
118 XYWnd* GetXZWnd(){
119         return m_pXZWnd;
120 }
121 XYWnd* GetYZWnd(){
122         return m_pYZWnd;
123 }
124 ZWnd* GetZWnd(){
125         return m_pZWnd;
126 }
127 CamWnd* GetCamWnd(){
128         return m_pCamWnd;
129 }
130
131 void ReleaseContexts();
132 void CreateContexts();
133
134 EViewStyle CurrentStyle(){
135         return m_nCurrentStyle;
136 };
137 bool FloatingGroupDialog(){
138         return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
139 };
140 };
141
142 extern MainFrame* g_pParentWnd;
143
144 ui::Window MainFrame_getWindow();
145
146 enum EMouseButtonMode
147 {
148         ETwoButton = 0,
149         EThreeButton = 1,
150 };
151
152 struct glwindow_globals_t
153 {
154         int m_nMouseType;
155
156         glwindow_globals_t() :
157                 m_nMouseType( EThreeButton ){
158         }
159 };
160
161 void GLWindow_Construct();
162 void GLWindow_Destroy();
163
164 extern glwindow_globals_t g_glwindow_globals;
165 template<typename Value>
166 class LatchedValue;
167 typedef LatchedValue<bool> LatchedBool;
168 extern LatchedBool g_Layout_enableDetachableMenus;
169
170 void deleteSelection();
171
172
173 void Sys_Status( const char* status );
174
175
176 void ScreenUpdates_Disable( const char* message, const char* title );
177 void ScreenUpdates_Enable();
178 bool ScreenUpdates_Enabled();
179 void ScreenUpdates_process();
180
181 class ScopeDisableScreenUpdates
182 {
183 public:
184 ScopeDisableScreenUpdates( const char* message, const char* title ){
185         ScreenUpdates_Disable( message, title );
186 }
187 ~ScopeDisableScreenUpdates(){
188         ScreenUpdates_Enable();
189 }
190 };
191
192
193 void EnginePath_Realise();
194 void EnginePath_Unrealise();
195
196 class ModuleObserver;
197
198 void Radiant_attachEnginePathObserver( ModuleObserver& observer );
199 void Radiant_detachEnginePathObserver( ModuleObserver& observer );
200
201 void Radiant_attachGameToolsPathObserver( ModuleObserver& observer );
202 void Radiant_detachGameToolsPathObserver( ModuleObserver& observer );
203
204 extern CopiedString g_strEnginePath;
205 void EnginePath_verify();
206 const char* EnginePath_get();
207 const char* QERApp_GetGamePath();
208
209 extern CopiedString g_strAppPath;
210 const char* AppPath_get();
211
212 extern CopiedString g_strSettingsPath;
213 const char* SettingsPath_get();
214
215 const char* LocalRcPath_get( void );
216
217 const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
218 const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
219
220 extern CopiedString g_strGameToolsPath;
221 const char* GameToolsPath_get();
222
223 void Radiant_Initialise();
224 void Radiant_Shutdown();
225
226 void SaveMapAs();
227
228
229 void XY_UpdateAllWindows();
230 void UpdateAllWindows();
231
232
233 void ClipperChangeNotify();
234
235 void DefaultMode();
236
237 const char* basegame_get();
238 const char* gamename_get();
239 void gamename_set( const char* gamename );
240 void Radiant_attachGameNameObserver( ModuleObserver& observer );
241 void Radiant_detachGameNameObserver( ModuleObserver& observer );
242 const char* gamemode_get();
243 void gamemode_set( const char* gamemode );
244 void Radiant_attachGameModeObserver( ModuleObserver& observer );
245 void Radiant_detachGameModeObserver( ModuleObserver& observer );
246
247 void VFS_Refresh();
248 void VFS_Restart();
249 void VFS_Construct();
250 void VFS_Destroy();
251
252 void HomePaths_Construct();
253 void HomePaths_Destroy();
254 void Radiant_attachHomePathsObserver( ModuleObserver& observer );
255 void Radiant_detachHomePathsObserver( ModuleObserver& observer );
256
257
258 void MainFrame_Construct();
259 void MainFrame_Destroy();
260
261
262 extern float ( *GridStatus_getGridSize )();
263 extern int ( *GridStatus_getRotateIncrement )();
264 extern int ( *GridStatus_getFarClipDistance )();
265 extern bool ( *GridStatus_getTextureLockEnabled )();
266 void GridStatus_onTextureLockEnabledChanged();
267
268 SignalHandlerId XYWindowDestroyed_connect( const SignalHandler& handler );
269 void XYWindowDestroyed_disconnect( SignalHandlerId id );
270 MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
271 void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
272
273 extern ui::Widget g_page_entity;
274
275 #endif