Sleeping Wombat GUI  0.100
swGUI
HostLogic.h
Go to the documentation of this file.
1 #pragma once
2 
10 
11 #include <vector>
12 #include <map>
13 
14 
15 
16 namespace sw {
17 namespace gui
18 {
19 
20 class HostWindow;
21 
22 
26 class HostLogic
27 {
28  friend class HostLogicTester;
29 private:
30 
31  std::vector< UIElement* > m_controlsTree;
32 
33  std::vector< UIElement* > m_mousePath;
34  std::vector< UIElement* > m_keyboardFocus;
36 
37  std::vector< UIElement* > m_invalidated;
38 
39 
42 
45  std::map< UIElement*, std::string > m_controlsNames;
46 
48 
49 protected:
50 public:
51  explicit HostLogic ( HostWindow* hostWindow );
52  ~HostLogic () = default;
53 
54 
55  void RemoveControl ( UIElement* control );
56 
57  void RegisterControlName ( UIElement* control, const std::string& name );
58  const std::string& GetControlName ( UIElement* control );
59 
60 
63  void LostFocus ();
64  void GotFocus ();
65 
66  void OnResized ( uint16 newWidth, uint16 newHeight );
67  void OnMaximized ();
68  void OnMinimized ();
70 
71 
72 public:
75  void HandleKeyInput ( const input::DeviceEvent& event, input::Device* device );
76  void HandleCharInput ( const input::DeviceEvent& event, input::Device* device );
77  void HandleMouseButtonInput ( const input::DeviceEvent& event, input::Device* device );
78  void HandleMouseWheelInput ( const input::DeviceEvent& event, input::Device* device );
79  void HandleMouseMoveInput ( const input::DeviceEvent& event, input::Device* device );
81 
82 private:
83 
85 
86 public:
87 
89 };
90 
91 
92 
93 } // gui
94 } // sw
95 
uint16_t uint16
Definition: TypesDefinitions.h:29
void OnMaximized()
Definition: HostLogic.cpp:87
std::vector< UIElement * > m_mousePath
Controls hierarchy that have mouse over in this frame.
Definition: HostLogic.h:33
void OnMinimized()
Definition: HostLogic.cpp:92
void HandleMouseMoveInput(const input::DeviceEvent &event, input::Device *device)
Definition: HostLogic.cpp:189
~HostLogic()=default
UIElement * HitTesting()
Definition: DirectInputModule.cpp:11
void HandleMouseButtonInput(const input::DeviceEvent &event, input::Device *device)
Definition: HostLogic.cpp:144
KeyStates changed events.
Definition: InputDeviceEvent.h:313
void RemoveControl(UIElement *control)
Definition: HostLogic.cpp:43
void HandleMouseWheelInput(const input::DeviceEvent &event, input::Device *device)
Definition: HostLogic.cpp:184
Interface for all controls in tree.
Definition: UIElement.h:57
UIElement * m_mouseCapture
Element that captured mouse. Can be nullptr.
Definition: HostLogic.h:35
std::vector< UIElement * > m_invalidated
Controls which needs to be redrawn in this frame.
Definition: HostLogic.h:37
Interface class for input devices.
Definition: Device.h:21
const std::string & GetControlName(UIElement *control)
Definition: HostLogic.cpp:56
void OnResized(uint16 newWidth, uint16 newHeight)
Definition: HostLogic.cpp:82
size_t Size
Definition: TypesDefinitions.h:35
friend class HostLogicTester
Definition: HostLogic.h:28
void RegisterControlName(UIElement *control, const std::string &name)
Definition: HostLogic.cpp:48
void GotFocus()
Definition: HostLogic.cpp:77
void HandleKeyInput(const input::DeviceEvent &event, input::Device *device)
Definition: HostLogic.cpp:103
void HandleCharInput(const input::DeviceEvent &event, input::Device *device)
Definition: HostLogic.cpp:139
std::vector< UIElement * > m_controlsTree
Top level controls. This vector holds entire tree.
Definition: HostLogic.h:31
HostLogic(HostWindow *hostWindow)
Definition: HostLogic.cpp:34
std::vector< UIElement * > m_keyboardFocus
Path of controls that have keyboard focus and all events are directed to them.
Definition: HostLogic.h:34
Size GetMemorySize()
Definition: HostLogic.cpp:200
Logic of host window for managing child controls.
Definition: HostLogic.h:26
void LostFocus()
Definition: HostLogic.cpp:72
Root class for controls hierarchy, contains native window.
Definition: HostWindow.h:33
std::map< UIElement *, std::string > m_controlsNames
Definition: HostLogic.h:45