]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/mainframe.h
Wrap 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 typedef struct _GtkWidget GtkWidget;
41 typedef struct _GtkWindow GtkWindow;
42
43 const int c_command_status = 0;
44 const int c_position_status = 1;
45 const int c_brushcount_status = 2;
46 const int c_texture_status = 3;
47 const int c_grid_status = 4;
48 const int c_count_status = 5;
49
50 class MainFrame
51 {
52 public:
53 enum EViewStyle
54 {
55         eRegular = 0,
56         eFloating = 1,
57         eSplit = 2,
58         eRegularLeft = 3,
59 };
60
61 MainFrame();
62 ~MainFrame();
63
64 ui::Window m_window;
65
66 CopiedString m_command_status;
67 CopiedString m_position_status;
68 CopiedString m_brushcount_status;
69 CopiedString m_texture_status;
70 CopiedString m_grid_status;
71 private:
72
73 void Create();
74 void SaveWindowInfo();
75 void Shutdown();
76
77 ui::Widget m_vSplit;
78 ui::Widget m_hSplit;
79 ui::Widget m_vSplit2;
80
81 XYWnd* m_pXYWnd;
82 XYWnd* m_pYZWnd;
83 XYWnd* m_pXZWnd;
84 CamWnd* m_pCamWnd;
85 ZWnd* m_pZWnd;
86 XYWnd* m_pActiveXY;
87
88 bool m_bSleeping;
89
90 ui::Widget m_pStatusLabel[c_count_status];
91
92
93 EViewStyle m_nCurrentStyle;
94 WindowPositionTracker m_position_tracker;
95
96 IdleDraw m_idleRedrawStatusText;
97
98 public:
99
100 bool IsSleeping(){
101         return m_bSleeping;
102 }
103 void OnSleep();
104
105 void SetStatusText( CopiedString& status_text, const char* pText );
106 void UpdateStatusText();
107 void RedrawStatusText();
108 typedef MemberCaller<MainFrame, &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
109
110 void SetGridStatus();
111 typedef MemberCaller<MainFrame, &MainFrame::SetGridStatus> SetGridStatusCaller;
112
113 void SetActiveXY( XYWnd* p );
114 XYWnd* ActiveXY(){
115         return m_pActiveXY;
116 };
117 XYWnd* GetXYWnd(){
118         return m_pXYWnd;
119 }
120 XYWnd* GetXZWnd(){
121         return m_pXZWnd;
122 }
123 XYWnd* GetYZWnd(){
124         return m_pYZWnd;
125 }
126 ZWnd* GetZWnd(){
127         return m_pZWnd;
128 }
129 CamWnd* GetCamWnd(){
130         return m_pCamWnd;
131 }
132
133 void ReleaseContexts();
134 void CreateContexts();
135
136 EViewStyle CurrentStyle(){
137         return m_nCurrentStyle;
138 };
139 bool FloatingGroupDialog(){
140         return CurrentStyle() == eFloating || CurrentStyle() == eSplit;
141 };
142 };
143
144 extern MainFrame* g_pParentWnd;
145
146 ui::Window MainFrame_getWindow();
147
148 enum EMouseButtonMode
149 {
150         ETwoButton = 0,
151         EThreeButton = 1,
152 };
153
154 struct glwindow_globals_t
155 {
156         int m_nMouseType;
157
158         glwindow_globals_t() :
159                 m_nMouseType( EThreeButton ){
160         }
161 };
162
163 void GLWindow_Construct();
164 void GLWindow_Destroy();
165
166 extern glwindow_globals_t g_glwindow_globals;
167 template<typename Value>
168 class LatchedValue;
169 typedef LatchedValue<bool> LatchedBool;
170 extern LatchedBool g_Layout_enableDetachableMenus;
171
172 void deleteSelection();
173
174
175 void Sys_Status( const char* status );
176
177
178 void ScreenUpdates_Disable( const char* message, const char* title );
179 void ScreenUpdates_Enable();
180 bool ScreenUpdates_Enabled();
181 void ScreenUpdates_process();
182
183 class ScopeDisableScreenUpdates
184 {
185 public:
186 ScopeDisableScreenUpdates( const char* message, const char* title ){
187         ScreenUpdates_Disable( message, title );
188 }
189 ~ScopeDisableScreenUpdates(){
190         ScreenUpdates_Enable();
191 }
192 };
193
194
195 void EnginePath_Realise();
196 void EnginePath_Unrealise();
197
198 class ModuleObserver;
199
200 void Radiant_attachEnginePathObserver( ModuleObserver& observer );
201 void Radiant_detachEnginePathObserver( ModuleObserver& observer );
202
203 void Radiant_attachGameToolsPathObserver( ModuleObserver& observer );
204 void Radiant_detachGameToolsPathObserver( ModuleObserver& observer );
205
206 extern CopiedString g_strEnginePath;
207 void EnginePath_verify();
208 const char* EnginePath_get();
209 const char* QERApp_GetGamePath();
210
211 extern CopiedString g_strAppPath;
212 const char* AppPath_get();
213
214 extern CopiedString g_strSettingsPath;
215 const char* SettingsPath_get();
216
217 const char* LocalRcPath_get( void );
218
219 const char* const g_pluginsDir = "plugins/"; ///< name of plugins directory, always sub-directory of toolspath
220 const char* const g_modulesDir = "modules/"; ///< name of modules directory, always sub-directory of toolspath
221
222 extern CopiedString g_strGameToolsPath;
223 const char* GameToolsPath_get();
224
225 void Radiant_Initialise();
226 void Radiant_Shutdown();
227
228 void SaveMapAs();
229
230
231 void XY_UpdateAllWindows();
232 void UpdateAllWindows();
233
234
235 void ClipperChangeNotify();
236
237 void DefaultMode();
238
239 const char* basegame_get();
240 const char* gamename_get();
241 void gamename_set( const char* gamename );
242 void Radiant_attachGameNameObserver( ModuleObserver& observer );
243 void Radiant_detachGameNameObserver( ModuleObserver& observer );
244 const char* gamemode_get();
245 void gamemode_set( const char* gamemode );
246 void Radiant_attachGameModeObserver( ModuleObserver& observer );
247 void Radiant_detachGameModeObserver( ModuleObserver& observer );
248
249 void VFS_Refresh();
250 void VFS_Restart();
251 void VFS_Construct();
252 void VFS_Destroy();
253
254 void HomePaths_Construct();
255 void HomePaths_Destroy();
256 void Radiant_attachHomePathsObserver( ModuleObserver& observer );
257 void Radiant_detachHomePathsObserver( ModuleObserver& observer );
258
259
260 void MainFrame_Construct();
261 void MainFrame_Destroy();
262
263
264 extern float ( *GridStatus_getGridSize )();
265 extern int ( *GridStatus_getRotateIncrement )();
266 extern int ( *GridStatus_getFarClipDistance )();
267 extern bool ( *GridStatus_getTextureLockEnabled )();
268 void GridStatus_onTextureLockEnabledChanged();
269
270 SignalHandlerId XYWindowDestroyed_connect( const SignalHandler& handler );
271 void XYWindowDestroyed_disconnect( SignalHandlerId id );
272 MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
273 void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
274
275 extern ui::Widget g_page_entity;
276
277 #endif