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