Sleeping Wombat GUI  0.100
swGUI
WinAPIGUI.h
Go to the documentation of this file.
1 #pragma once
2 
3 
5 
6 #include <Windows.h>
7 #undef CreateWindow
8 #undef XBUTTON1
9 #undef XBUTTON2
10 
11 
12 
13 //struct tagMSG;
14 //typedef tagMSG MSG;
15 //
16 //struct HWND__;
17 //typedef HWND__* HWND;
18 //
19 //typedef UINT_PTR WPARAM;
20 //typedef LONG_PTR LPARAM;
21 
22 
23 
24 namespace sw {
25 namespace input
26 {
27 class WinApiInputProxy;
28 
29 }} // sw::input
30 
31 
32 
33 
39 namespace sw {
40 namespace gui
41 {
42 
43 
46 class WinAPIGUI : public INativeGUI
47 {
48 private:
51 
52 protected:
53 public:
54  explicit WinAPIGUI ();
55  virtual ~WinAPIGUI () = default;
56 
57 
58 // Inherited via INativeGUI
59  virtual bool MainLoop ( bool blockingMode ) override;
60  virtual bool Init ( const NativeGUIInitData& initData ) override;
61  virtual sw::input::IInput* UseNativeInput () override;
62  virtual INativeWindow* CreateWindow ( NativeWindowDescriptor& descriptor ) override;
63 
64  static WinAPIGUI* Create ();
65 
66 private:
67  void RegisterWindowClass ();
68  bool MainLoopCore ( MSG* msg );
69 
70 public:
71  // Helpers
72  static void PrintLastError ();
73  static const wchar_t* GetWindowClassName ();
74 
75 public:
78  void HandleEvent ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
80 };
81 
82 } // GUI
83 } // sw
Interface encasulates native GUI system.
Definition: INativeGUI.h:33
Klasa do przekierowywania do silnika wejścia pobranego z WPFa.
Definition: WinApiInputProxy.h:31
Definition: DirectInputModule.cpp:11
virtual sw::input::IInput * UseNativeInput() override
Initalize native api for this gui system and return IInput object. GUI can use native input api for s...
Definition: WinAPIGUI.cpp:50
Definition: WinAPIGUI.h:46
virtual bool MainLoop(bool blockingMode) override
Invokes main loop of native GUI.
Definition: WinAPIGUI.cpp:198
NativeGUIInitData m_initData
Definition: WinAPIGUI.h:50
Dedcriptor used to create native GUI window.
Definition: INativeWindow.h:17
void HandleEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Captures important events like changing focus.
Definition: WinAPIGUI.cpp:177
Provides data needed for native GUI system initialization.
Definition: INativeGUI.h:25
virtual bool Init(const NativeGUIInitData &initData) override
Initializes native GUI.
Definition: WinAPIGUI.cpp:140
static WinAPIGUI * Create()
Creates WinAPIGUI object.
Definition: WinAPIGUI.cpp:28
Interface for native window sing OS specific ffunctions.
Definition: INativeWindow.h:74
static const wchar_t * GetWindowClassName()
Window class registered in WinAPI.
Definition: WinAPIGUI.cpp:43
sw::input::WinApiInputProxy * m_input
Definition: WinAPIGUI.h:49
static void PrintLastError()
Gets last win api error and prints to debug window.
Definition: WinAPIGUI.cpp:115
Interface for input classes for capturing user input.
Definition: IInput.h:65
void RegisterWindowClass()
Registers window class.
Definition: WinAPIGUI.cpp:90
bool MainLoopCore(MSG *msg)
Core functionality of main loop function.
Definition: WinAPIGUI.cpp:157
virtual ~WinAPIGUI()=default
WinAPIGUI()
Definition: WinAPIGUI.cpp:22
virtual INativeWindow * CreateWindow(NativeWindowDescriptor &descriptor) override
Creates native GUI window.
Definition: WinAPIGUI.cpp:70