Sleeping Wombat GUI  0.100
swGUI
GUISystem.h
Go to the documentation of this file.
1 #pragma once
2 
6 #include "Events/EventsSystem.h"
8 
9 #include "HostWindow.h"
10 
11 class ResourceManager;
12 
13 
14 namespace sw {
15 namespace gui
16 {
17 
18 
204 {
206  char** Arguments;
207 
208 
209  CommandLineArgs( int argc, char** argv )
210  : ArgsCount( argc )
211  , Arguments( argv )
212  { }
213 
214  const char* ProgramName () { return Arguments[ 0 ]; }
215 };
216 
217 
244 {
245  friend class GUISystemTester;
246 private:
247 
249 
250 protected:
251 
255 
257  RenderingSystemOPtr m_renderingSystem;
258 
259  std::vector< HostWindow* > m_windows;
261 
263 
264 public:
265  explicit GUISystem ( int argc, char** argv, INativeGUI* gui );
266  virtual ~GUISystem ();
267 
268  Size GetMemorySize ();
269 
270  int NumCommandLineArgs ();
271  const char* CommandLineArg ( int num );
272  const char* ProgramPath ();
273 
274 protected:
277  virtual void Initialize ();
278  virtual void OnInitialized () = 0;
279  virtual void OnClosing () = 0;
280  virtual void OnIdle () = 0;
282 
285  void DefaultInitWithoutWindow ();
286  void DefaultInit ( uint16 width, uint16 height, const std::string& windowTitle );
287  bool DefaultInitNativeGUI ();
288  bool DefaultInitGraphicAPI ();
291 
292 public:
293 
296  void Init ();
297  int MainLoop ();
298  bool MainLoopCore ();
299  void HandleEvents ();
301 
302 public:
303 
304  void OnFocusChanged ( INativeWindow* window, bool value );
305  void OnResized ( INativeWindow* window, uint16 newWidth, uint16 newHeight );
306  void OnMaximized ( INativeWindow* window );
307  void OnMinimized ( INativeWindow* window );
308 
311  HostWindow* CreateNativeHostWindow ( uint16 width, uint16 height, const std::string& windowTitle );
316 
317 
318 public:
319  static GUISystem& Get ();
320 };
321 
322 
323 } // gui
324 } // sw
void OnMaximized(INativeWindow *window)
uint16_t uint16
Definition: TypesDefinitions.h:29
virtual void OnIdle()=0
void OnFocusChanged(INativeWindow *window, bool value)
Changes focused window.
Definition: GUISystem.cpp:199
Interfejs klasy do inicjowania API graficznego.
Definition: IGraphicAPIInitializer.h:97
void OnResized(INativeWindow *window, uint16 newWidth, uint16 newHeight)
bool MainLoopCore()
One step of main loop.
Definition: GUISystem.cpp:71
const char * CommandLineArg(int num)
Returns command line argument. 0 is first argument not program name.
Definition: GUISystem.cpp:288
virtual void OnInitialized()=0
void HandleEvents()
Processes messages and passes them to focused window.
Definition: GUISystem.cpp:88
Interface encasulates native GUI system.
Definition: INativeGUI.h:33
static GUISystem & Get()
Definition: GUISystem.cpp:302
int NumCommandLineArgs()
Gets number of commnad line arguments.
Definition: GUISystem.cpp:281
int MainLoop()
Application main loop.
Definition: GUISystem.cpp:54
Definition: DirectInputModule.cpp:11
char ** Arguments
Definition: GUISystem.h:206
Structure for command line arguments.
Definition: GUISystem.h:203
IGraphicAPIInitializer * m_graphicApi
Contains object responsible for dealing with specifics graphic apis.
Definition: GUISystem.h:252
Size GetMemorySize()
Definition: GUISystem.cpp:267
HostWindow * CreateNativeHostWindow(uint16 width, uint16 height, const std::string &windowTitle)
Calls CreateNativeHostWindow with default values.
Definition: GUISystem.cpp:243
friend class GUISystemTester
Definition: GUISystem.h:245
int ArgsCount
Definition: GUISystem.h:205
void OnMinimized(INativeWindow *window)
virtual void OnClosing()=0
Dedcriptor used to create native GUI window.
Definition: INativeWindow.h:17
virtual void Initialize()
GUI subsystems initialization.
Definition: GUISystem.cpp:121
CommandLineArgs(int argc, char **argv)
Definition: GUISystem.h:209
void DefaultInitWithoutWindow()
Makes initialization but leaves window creation for user.
Definition: GUISystem.cpp:127
std::vector< HostWindow * > m_windows
Definition: GUISystem.h:259
const char * ProgramPath()
Returns program name retrived from 0 command line argument.
Definition: GUISystem.cpp:294
static GUISystem * m_instance
Definition: GUISystem.h:248
RenderingSystemOPtr m_renderingSystem
All rendering connceted functionalities.
Definition: GUISystem.h:257
void DefaultInit(uint16 width, uint16 height, const std::string &windowTitle)
Default GUI system initialization function.
Definition: GUISystem.cpp:137
size_t Size
Definition: TypesDefinitions.h:35
virtual ~GUISystem()
Definition: GUISystem.cpp:39
bool DefaultInitGraphicAPI()
Default graphic api initialization.
Definition: GUISystem.cpp:166
HostWindow * m_focusedWindow
Only one window can have focus and only this will be processed.
Definition: GUISystem.h:260
Interface for native window sing OS specific ffunctions.
Definition: INativeWindow.h:74
Main GUI application class.
Definition: GUISystem.h:243
input::IInput * m_input
Input processor.
Definition: GUISystem.h:254
bool DefaultInitRenderingSystem()
Initializes rendering system.
Definition: GUISystem.cpp:182
ResourceManager * m_resourceManager
Resources.
Definition: GUISystem.h:256
GUISystem(int argc, char **argv, INativeGUI *gui)
Definition: GUISystem.cpp:26
CommandLineArgs m_cmdArgs
Definition: GUISystem.h:262
Deklaracja interfejsu IGraphicAPIInitializer.
Interface for input classes for capturing user input.
Definition: IInput.h:65
const char * ProgramName()
Definition: GUISystem.h:214
bool DefaultInitNativeGUI()
Default native GUI initialization.
Definition: GUISystem.cpp:152
Root class for controls hierarchy, contains native window.
Definition: HostWindow.h:33
void Init()
Invoke this function in application entry point (main).
Definition: GUISystem.cpp:110
Manager for low level resources.
Definition: ResourceManager.h:24
INativeGUI * m_nativeGUI
Native window system used to display main application window.
Definition: GUISystem.h:253