Sleeping Wombat GUI  0.100
swGUI
HostWindow.h
Go to the documentation of this file.
1 #pragma once
2 
10 #include "HostLogic.h"
12 
14 
15 #include <vector>
16 #include <map>
17 
19 
20 
21 
22 namespace sw {
23 namespace gui
24 {
25 
33 class HostWindow : public UIElement
34 {
36  friend class HostWindowTester;
37 private:
38 
42 
45 
47 
48 protected:
49 public:
50  explicit HostWindow ( INativeWindow* nativeWindow, input::IInput* input, ResourceManager* resourceManager, IGraphicAPIInitializer* graphicApi );
51  virtual ~HostWindow ();
52 
53 
55 
56 
58  void RemoveControl ( UIElement* control );
59 
60  void RegisterControlName ( UIElement* control, const std::string& name );
61  const std::string& GetControlName ( UIElement* control );
62 
63 
66 
68 
69 public:
72  void LostFocus ();
73  void GotFocus ();
74 
75  void OnResized ( uint16 newWidth, uint16 newHeight );
76  void OnMaximized ();
77  void OnMinimized ();
78 
79  void HandleInput ();
81 
82 
83  // Inherited via UIElement
84  virtual bool HitTest ( const Position& point ) override;
85  virtual void OnRender ( DrawingContext& context ) override;
86  virtual Size2D Measure ( Size2D availableSize ) override;
87  virtual void Arrange ( Rect& finalRect ) override;
88  virtual Size GetNumChildren () override;
89  virtual UIElement* GetUIChild ( Size idx ) override;
90  virtual bool AddChild ( UIElementOPtr&& child ) override;
91 
92 
93 };
94 
97 
98 
99 } // gui
100 } // sw
virtual bool HitTest(const Position &point) override
Checks if point is within this object.
Definition: HostWindow.cpp:208
uint16_t uint16
Definition: TypesDefinitions.h:29
virtual Size GetNumChildren() override
Get number of children in visual tree.
Definition: HostWindow.cpp:232
void RemoveControl(UIElement *control)
Removes control from GUI system.
Definition: HostWindow.cpp:86
Interfejs klasy do inicjowania API graficznego.
Definition: IGraphicAPIInitializer.h:97
const std::string & GetControlName(UIElement *control)
Gets name of registered control.
Definition: HostWindow.cpp:98
virtual void Arrange(Rect &finalRect) override
Arragement pass. Check WPF documentation.
Definition: HostWindow.cpp:227
void RegisterControlName(UIElement *control, const std::string &name)
Allows control to register it's name.
Definition: HostWindow.cpp:92
virtual void OnRender(DrawingContext &context) override
Control rendering behavior.
Definition: HostWindow.cpp:215
HostLogic m_hostLogic
Definition: HostWindow.h:46
RTTR_ENABLE(UIElement)
Definition: DirectInputModule.cpp:11
INativeWindow * m_nativeWindow
Definition: HostWindow.h:39
Interface for all controls in tree.
Definition: UIElement.h:57
HostWindow(INativeWindow *nativeWindow, input::IInput *input, ResourceManager *resourceManager, IGraphicAPIInitializer *graphicApi)
Definition: HostWindow.cpp:33
Rectangle structure.
Definition: CommonTypes.h:32
virtual ~HostWindow()
Definition: HostWindow.cpp:56
DirectX::XMFLOAT2 Size2D
Definition: CommonTypes.h:28
void OnMaximized()
Definition: HostWindow.cpp:157
virtual UIElement * GetUIChild(Size idx) override
Gets child in visual tree.
Definition: HostWindow.cpp:239
void HandleInput()
Definition: HostWindow.cpp:171
void LostFocus()
Definition: HostWindow.cpp:130
size_t Size
Definition: TypesDefinitions.h:35
Size GetMemorySize()
Returns memory consumed by this object and all object owned by this.
Definition: HostWindow.cpp:69
Klasa bazowa dla obiektów, które mają być dostępne w edytorze poprzez rttr. Należy po niej odziedzicz...
Definition: EngineObject.h:22
Context passed to rendering functions.
Definition: DrawingContext.h:22
Definition: HostWindowTester.h:9
DEFINE_PTR_TYPE(HostWindow)
ResourcePtr< SwapChain > GetSwapChain()
Definition: HostWindow.cpp:112
Interface for native window sing OS specific ffunctions.
Definition: INativeWindow.h:74
void GotFocus()
Definition: HostWindow.cpp:140
DirectX::XMFLOAT2 Position
Definition: CommonTypes.h:27
virtual Size2D Measure(Size2D availableSize) override
Meassure pass. Check documentation in WPF.
Definition: HostWindow.cpp:220
DEFINE_OPTR_TYPE(UIElement)
EngineObject *& DataContext()
Pozwala ustawić i pobrać DataContext.
Definition: HostWindow.cpp:80
ResourcePtr< RenderTargetObject > GetRenderTarget()
Definition: HostWindow.cpp:105
ResourcePtr< SwapChain > m_swapChain
Definition: HostWindow.h:44
virtual bool AddChild(UIElementOPtr &&child) override
Add child. This function should set child parent to this pointer.
Definition: HostWindow.cpp:246
ResourceManager * m_resourceManager
Definition: HostWindow.h:41
void OnMinimized()
Definition: HostWindow.cpp:164
Logic of host window for managing child controls.
Definition: HostLogic.h:26
input::IInput * m_input
Definition: HostWindow.h:40
INativeWindow * GetNativeWindow()
Definition: HostWindow.cpp:119
Interface for input classes for capturing user input.
Definition: IInput.h:65
void OnResized(uint16 newWidth, uint16 newHeight)
Definition: HostWindow.cpp:150
Root class for controls hierarchy, contains native window.
Definition: HostWindow.h:33
ResourcePtr< RenderTargetObject > m_renderTarget
Definition: HostWindow.h:43
Manager for low level resources.
Definition: ResourceManager.h:24