Sleeping Wombat GUI  0.100
swGUI
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
sw::gui::HostWindow Class Reference

Root class for controls hierarchy, contains native window. More...

#include <HostWindow.h>

Inheritance diagram for sw::gui::HostWindow:
sw::gui::UIElement sw::gui::Visual sw::gui::DependencyObject EngineObject

Public Member Functions

 HostWindow (INativeWindow *nativeWindow, input::IInput *input, ResourceManager *resourceManager, IGraphicAPIInitializer *graphicApi)
 
virtual ~HostWindow ()
 
Size GetMemorySize ()
 Returns memory consumed by this object and all object owned by this. More...
 
EngineObject *& DataContext ()
 Pozwala ustawić i pobrać DataContext. More...
 
void RemoveControl (UIElement *control)
 Removes control from GUI system. More...
 
void RegisterControlName (UIElement *control, const std::string &name)
 Allows control to register it's name. More...
 
const std::string & GetControlName (UIElement *control)
 Gets name of registered control. More...
 
ResourcePtr< RenderTargetObjectGetRenderTarget ()
 
ResourcePtr< SwapChainGetSwapChain ()
 
INativeWindowGetNativeWindow ()
 
virtual bool HitTest (const Position &point) override
 Checks if point is within this object. More...
 
virtual void OnRender (DrawingContext &context) override
 Control rendering behavior. More...
 
virtual Size2D Measure (Size2D availableSize) override
 Meassure pass. Check documentation in WPF. More...
 
virtual void Arrange (Rect &finalRect) override
 Arragement pass. Check WPF documentation. More...
 
virtual Size GetNumChildren () override
 Get number of children in visual tree. More...
 
virtual UIElementGetUIChild (Size idx) override
 Gets child in visual tree. More...
 
virtual bool AddChild (UIElementOPtr &&child) override
 Add child. This function should set child parent to this pointer. More...
 
GUI system interaction
void LostFocus ()
 
void GotFocus ()
 
void OnResized (uint16 newWidth, uint16 newHeight)
 
void OnMaximized ()
 
void OnMinimized ()
 
void HandleInput ()
 
- Public Member Functions inherited from sw::gui::UIElement
 UIElement ()=default
 
virtual ~UIElement ()=default
 
 REGISTER_EVENT_DECLARATION (PreviewMouseUp, RoutingStrategy::Tunnel, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (PreviewMouseDown, RoutingStrategy::Tunnel, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (PreviewMouseRightButtonUp, RoutingStrategy::Direct, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (PreviewMouseRightButtonDown, RoutingStrategy::Direct, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (PreviewMouseLeftButtonDown, RoutingStrategy::Direct, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (PreviewMouseLeftButtonUp, RoutingStrategy::Direct, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (PreviewMouseWheel, RoutingStrategy::Tunnel, UIElement, MouseWheelEventArgs)
 
 REGISTER_EVENT_DECLARATION (PreviewMouseMove, RoutingStrategy::Tunnel, UIElement, MouseMoveEventArgs)
 
 REGISTER_EVENT_DECLARATION (PreviewKeyDown, RoutingStrategy::Tunnel, UIElement, KeyEventArgs)
 
 REGISTER_EVENT_DECLARATION (PreviewKeyUp, RoutingStrategy::Tunnel, UIElement, KeyEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseUp, RoutingStrategy::Bubble, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseDown, RoutingStrategy::Bubble, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseRightButtonDown, RoutingStrategy::Direct, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseRightButtonUp, RoutingStrategy::Direct, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseLeftButtonDown, RoutingStrategy::Direct, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseLeftButtonUp, RoutingStrategy::Direct, UIElement, MouseButtonEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseWheel, RoutingStrategy::Bubble, UIElement, MouseWheelEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseMove, RoutingStrategy::Bubble, UIElement, MouseMoveEventArgs)
 
 REGISTER_EVENT_DECLARATION (KeyUp, RoutingStrategy::Tunnel, UIElement, KeyEventArgs)
 
 REGISTER_EVENT_DECLARATION (KeyDown, RoutingStrategy::Tunnel, UIElement, KeyEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseEnter, RoutingStrategy::Direct, UIElement, MouseEventArgs)
 
 REGISTER_EVENT_DECLARATION (MouseLeave, RoutingStrategy::Direct, UIElement, MouseEventArgs)
 
virtual void SetParent (UIElement *parent)
 Set control parent. Internal use. More...
 
virtual UIElementGetParent ()
 Returns control parent. More...
 
virtual void InvokeEventDelegates (EventType eventID, UIElement *sender, IEventArgs *e, AccessKey)
 
virtual void OnLoaded (UIElement *sender, IEventArgs *e)
 
virtual void OnUnloaded (UIElement *sender, IEventArgs *e)
 
virtual void OnGotFocus (UIElement *sender, IEventArgs *e)
 
virtual void OnLostFocus (UIElement *sender, IEventArgs *e)
 
virtual void OnMouseEnter (UIElement *sender, MouseEventArgs *e)
 
virtual void OnMouseLeave (UIElement *sender, MouseEventArgs *e)
 
virtual void OnMouseMove (UIElement *sender, MouseMoveEventArgs *e)
 
virtual void OnMouseWheel (UIElement *sender, MouseWheelEventArgs *e)
 
virtual void OnMouseDown (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnMouseUp (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnMouseRightButtonDown (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnMouseRightButtonUp (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnMouseLeftButtonDown (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnMouseLeftButtonUp (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnPreviewMouseMove (UIElement *sender, MouseMoveEventArgs *e)
 
virtual void OnPreviewMouseWheel (UIElement *sender, MouseWheelEventArgs *e)
 
virtual void OnPreviewMouseDown (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnPreviewMouseUp (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnPreviewMouseRightButtonDown (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnPreviewMouseRightButtonUp (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnPreviewMouseLeftButtonDown (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnPreviewMouseLeftButtonUp (UIElement *sender, MouseButtonEventArgs *e)
 
virtual void OnKeyDown (UIElement *sender, KeyEventArgs *e)
 
virtual void OnKeyUp (UIElement *sender, KeyEventArgs *e)
 
virtual void OnPreviewKeyDown (UIElement *sender, KeyEventArgs *e)
 
virtual void OnPreviewKeyUp (UIElement *sender, KeyEventArgs *e)
 
- Public Member Functions inherited from sw::gui::Visual
 Visual ()=default
 
 ~Visual ()=default
 
- Public Member Functions inherited from sw::gui::DependencyObject
 DependencyObject ()
 
 ~DependencyObject ()=default
 
- Public Member Functions inherited from EngineObject
TypeID GetType () const
 
std::string GetTypeName () const
 
virtual void Serialize (ISerializer *ser) const
 Implements default serialization. Serializes only declared properties. More...
 
virtual void Deserialize (IDeserializer *deser)
 Implements default deserialization. More...
 
virtual Size MemorySize ()
 
template<typename TargetType >
TargetType * DynamicCast ()
 

Private Member Functions

 RTTR_ENABLE (UIElement)
 

Private Attributes

INativeWindowm_nativeWindow
 
input::IInputm_input
 
ResourceManagerm_resourceManager
 
ResourcePtr< RenderTargetObjectm_renderTarget
 
ResourcePtr< SwapChainm_swapChain
 
HostLogic m_hostLogic
 

Friends

class HostWindowTester
 

Additional Inherited Members

- Protected Attributes inherited from sw::gui::UIElement
UIElementm_parent
 Parent in controls visual tree. More...
 
bool m_isVisible: 1
 
bool m_isEnabled: 1
 
bool m_isMouseOver: 1
 
bool m_isFocused: 1
 This is logical focus. More...
 
bool m_isKeyboardFocus: 1
 This element has keyboard focus and will receive keyboard events. More...
 
bool m_isKeyboardFocusWithin: 1
 This element or it's children have keyboard focus. More...
 
bool m_isMouseCaptured: 1
 Check if element have captured mouse. More...
 
bool m_isMouseCapturedWithin: 1
 Element or it's children have captured mouse. More...
 
bool m_isFocusable: 1
 
Size2D m_desiredSize
 Desired size after Messure pass. More...
 
EventHandlers m_eventHandlers
 Managing delegates. More...
 
- Protected Attributes inherited from sw::gui::DependencyObject
EngineObjectm_dataContext
 Context for binding. More...
 

Detailed Description

Root class for controls hierarchy, contains native window.

This class connects native window and gui windows. GUI system logic is redirected to HostLogic class. HostWindow is responsible for rendering and presenting content on native window by using render target and swap chain.

Constructor & Destructor Documentation

sw::gui::HostWindow::HostWindow ( INativeWindow nativeWindow,
input::IInput input,
ResourceManager resourceManager,
IGraphicAPIInitializer graphicApi 
)
explicit
sw::gui::HostWindow::~HostWindow ( )
virtual

Member Function Documentation

bool sw::gui::HostWindow::AddChild ( UIElementOPtr &&  child)
overridevirtual

Add child. This function should set child parent to this pointer.

Returns
Returns false if this control can't have children.

Implements sw::gui::UIElement.

void sw::gui::HostWindow::Arrange ( Rect finalRect)
overridevirtual

Arragement pass. Check WPF documentation.

Implements sw::gui::UIElement.

EngineObject *& sw::gui::HostWindow::DataContext ( )

Pozwala ustawić i pobrać DataContext.

DataContext zostanie przepropagowany do wszystkich kontrolek w hierarchii.

const std::string & sw::gui::HostWindow::GetControlName ( UIElement control)

Gets name of registered control.

Size sw::gui::HostWindow::GetMemorySize ( )

Returns memory consumed by this object and all object owned by this.

INativeWindow * sw::gui::HostWindow::GetNativeWindow ( )
Size sw::gui::HostWindow::GetNumChildren ( )
overridevirtual

Get number of children in visual tree.

Implements sw::gui::UIElement.

ResourcePtr< RenderTargetObject > sw::gui::HostWindow::GetRenderTarget ( )
ResourcePtr< SwapChain > sw::gui::HostWindow::GetSwapChain ( )
UIElement * sw::gui::HostWindow::GetUIChild ( Size  idx)
overridevirtual

Gets child in visual tree.

Implements sw::gui::UIElement.

void sw::gui::HostWindow::GotFocus ( )
void sw::gui::HostWindow::HandleInput ( )
bool sw::gui::HostWindow::HitTest ( const Position point)
overridevirtual

Checks if point is within this object.

Todo:
We must specify if point is in relative coordinates or absolut.

Implements sw::gui::Visual.

void sw::gui::HostWindow::LostFocus ( )
Size2D sw::gui::HostWindow::Measure ( Size2D  availableSize)
overridevirtual

Meassure pass. Check documentation in WPF.

Implements sw::gui::UIElement.

void sw::gui::HostWindow::OnMaximized ( )
void sw::gui::HostWindow::OnMinimized ( )
void sw::gui::HostWindow::OnRender ( DrawingContext context)
overridevirtual

Control rendering behavior.

Implements sw::gui::Visual.

void sw::gui::HostWindow::OnResized ( uint16  newWidth,
uint16  newHeight 
)
void sw::gui::HostWindow::RegisterControlName ( UIElement control,
const std::string &  name 
)

Allows control to register it's name.

void sw::gui::HostWindow::RemoveControl ( UIElement control)

Removes control from GUI system.

sw::gui::HostWindow::RTTR_ENABLE ( UIElement  )
private

Friends And Related Function Documentation

friend class HostWindowTester
friend

Member Data Documentation

HostLogic sw::gui::HostWindow::m_hostLogic
private
input::IInput* sw::gui::HostWindow::m_input
private
INativeWindow* sw::gui::HostWindow::m_nativeWindow
private
ResourcePtr< RenderTargetObject > sw::gui::HostWindow::m_renderTarget
private
ResourceManager* sw::gui::HostWindow::m_resourceManager
private
ResourcePtr< SwapChain > sw::gui::HostWindow::m_swapChain
private

The documentation for this class was generated from the following files: