Class WindowBase
Native platform window object.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Platform/Base/WindowBase.h
Syntax
public class WindowBase : public ScriptingObject
Constructors
~WindowBase()
Declaration
protected virtual ~WindowBase()
WindowBase(const CreateWindowSettings& settings)
Declaration
protected WindowBase(const CreateWindowSettings& settings)
Parameters
CreateWindowSettings
settings
|
Fields
_clientSize
Declaration
protected Float2 _clientSize
Field Value
Float2
|
_cursor
_dpi
Declaration
protected int _dpi
Field Value
int
|
_dpiScale
Declaration
protected float _dpiScale
Field Value
float
|
_focused
Declaration
protected bool _focused
Field Value
bool
|
_isClippingCursor
Declaration
protected bool _isClippingCursor = false
Field Value
bool
|
_isClosing
Declaration
protected bool _isClosing
Field Value
bool
|
_isHorizontalFlippingMouse
Declaration
protected bool _isHorizontalFlippingMouse = false
Field Value
bool
|
_isTrackingMouse
Declaration
protected bool _isTrackingMouse = false
Field Value
bool
|
_isUsingMouseOffset
Declaration
protected bool _isUsingMouseOffset = false
Field Value
bool
|
_isVerticalFlippingMouse
Declaration
protected bool _isVerticalFlippingMouse = false
Field Value
bool
|
_maximized
Declaration
protected bool _maximized
Field Value
bool
|
_minimized
Declaration
protected bool _minimized
Field Value
bool
|
_mouseOffsetScreenSize
_settings
_showAfterFirstPaint
Declaration
protected bool _showAfterFirstPaint
Field Value
bool
|
_swapChain
_title
_trackingMouseOffset
Declaration
protected Float2 _trackingMouseOffset
Field Value
Float2
|
_visible
Declaration
protected bool _visible
Field Value
bool
|
CharInput
Event fired on character input.
Declaration
public CharDelegate CharInput
Field Value
CharDelegate
|
Closed
Event fired when window gets closed.
Declaration
public Action Closed
Field Value
Action
|
Closing
Event fired when window is closing. Can be used to cancel the operation.
Declaration
public ClosingDelegate Closing
Field Value
ClosingDelegate
|
DragDrop
Event fired when drag&drop ends over window with drop.
Declaration
public DragDelegate DragDrop
Field Value
DragDelegate
|
DragEnter
Event fired when drag&drop enters window.
Declaration
public DragDelegate DragEnter
Field Value
DragDelegate
|
DragLeave
Event fired when drag&drop leaves window.
Declaration
public Action DragLeave
Field Value
Action
|
DragOver
Event fired when drag&drop moves over window.
Declaration
public DragDelegate DragOver
Field Value
DragDelegate
|
Draw
Event fired when window draws UI.
Declaration
public Action Draw
Field Value
Action
|
GotFocus
Event fired when window gets focused.
Declaration
public Action GotFocus
Field Value
Action
|
Hidden
Event fired when window gets hidden.
Declaration
public Action Hidden
Field Value
Action
|
HitTest
Event fired when system tests if the specified location is part of the window.
Declaration
public HitTestDelegate HitTest
Field Value
HitTestDelegate
|
KeyDown
Event fired on key pressed.
Declaration
public KeyboardDelegate KeyDown
Field Value
KeyboardDelegate
|
KeyUp
Event fired on key released.
Declaration
public KeyboardDelegate KeyUp
Field Value
KeyboardDelegate
|
LeftButtonHit
Event fired when system tests if the left button hit the window for the given hit code.
Declaration
public ButtonHitDelegate LeftButtonHit
Field Value
ButtonHitDelegate
|
LostFocus
Event fired when window lost focus.
Declaration
public Action LostFocus
Field Value
Action
|
MouseDoubleClick
Event fired when mouse button double clicks.
Declaration
public MouseButtonDelegate MouseDoubleClick
Field Value
MouseButtonDelegate
|
MouseDown
Event fired when mouse button goes down.
Declaration
public MouseButtonDelegate MouseDown
Field Value
MouseButtonDelegate
|
MouseLeave
Event fired when mouse leaves window.
Declaration
public Action MouseLeave
Field Value
Action
|
MouseMove
Event fired when mouse moves.
Declaration
public MouseDelegate MouseMove
Field Value
MouseDelegate
|
MouseUp
Event fired when mouse button goes up.
Declaration
public MouseButtonDelegate MouseUp
Field Value
MouseButtonDelegate
|
MouseWheel
Event fired when mouse wheel is scrolling (wheel delta is normalized).
Declaration
public MouseWheelDelegate MouseWheel
Field Value
MouseWheelDelegate
|
RenderTask
The rendering task for that window.
Declaration
public RenderTask* RenderTask
Field Value
RenderTask
|
Resized
Event fired when window gets resized.
Declaration
public Delegate<Float2> Resized
Field Value
Delegate<Float2>
|
Shown
Event fired when window gets shown.
Declaration
public Action Shown
Field Value
Action
|
TouchDown
Event fired when touch action begins.
Declaration
public TouchDelegate TouchDown
Field Value
TouchDelegate
|
TouchMove
Event fired when touch action moves.
Declaration
public TouchDelegate TouchMove
Field Value
TouchDelegate
|
TouchUp
Event fired when touch action ends.
Declaration
public TouchDelegate TouchUp
Field Value
TouchDelegate
|
Update
Event fired when window updates UI.
Declaration
public Delegate<float> Update
Field Value
Delegate<float>
|
Methods
BringToFront(bool force=false)
Brings window to the front of the Z order.
Declaration
public virtual void BringToFront(bool force=false)
Parameters
bool
force
True if move to the front by force, otherwise false. |
ClientToScreen(const Float2& clientPos)
Converts window space location into screen space coordinates.
Declaration
public virtual Float2 ClientToScreen(const Float2& clientPos) const
Parameters
Float2
clientPos
The client position. |
Returns
Float2
The screen space position. |
Close(ClosingReason reason=ClosingReason::CloseEvent)
Closes the window.
Declaration
public virtual void Close(ClosingReason reason=ClosingReason::CloseEvent)
Parameters
ClosingReason
reason
The closing reason. |
DoDragDrop(const StringView& data)
Starts drag and drop operation
Declaration
public virtual DragDropEffect DoDragDrop(const StringView& data)
Parameters
StringView
data
The data. |
Returns
DragDropEffect
The result. |
EndClippingCursor()
Ends the cursor clipping.
Declaration
public virtual void EndClippingCursor()
EndTrackingMouse()
Ends the mouse tracking.
Declaration
public virtual void EndTrackingMouse()
FlashWindow()
Flashes the window to bring use attention.
Declaration
public virtual void FlashWindow()
Focus()
Focuses this window.
Declaration
public virtual void Focus()
GetClientBounds()
Gets the client bounds of the window (client area not including border).
Declaration
public Rectangle GetClientBounds() const
Returns
Rectangle
|
GetClientPosition()
Gets the client position of the window (client area not including border).
Declaration
public Float2 GetClientPosition() const
Returns
Float2
|
GetClientSize()
Gets the size of the client area of the window (not including border).
Declaration
public virtual Float2 GetClientSize() const
Returns
Float2
|
GetCursor()
GetDpi()
Gets the window DPI setting.
Declaration
public int GetDpi() const
Returns
int
|
GetDpiScale()
Gets the window DPI scale factor (1 is default). Includes custom DPI scale
Declaration
public float GetDpiScale() const
Returns
float
|
GetInputText()
Gets the text entered during the current frame (Unicode).
Declaration
public StringView GetInputText() const
Returns
StringView
The input text (Unicode). |
GetKey(KeyboardKeys key)
Gets the key state (true if key is being pressed during this frame).
Declaration
public bool GetKey(KeyboardKeys key) const
Parameters
KeyboardKeys
key
Key ID to check |
Returns
bool
True while the user holds down the key identified by id |
GetKeyDown(KeyboardKeys key)
Gets the key 'down' state (true if key was pressed in this frame).
Declaration
public bool GetKeyDown(KeyboardKeys key) const
Parameters
KeyboardKeys
key
Key ID to check |
Returns
bool
True during the frame the user starts pressing down the key |
GetKeyUp(KeyboardKeys key)
Gets the key 'up' state (true if key was released in this frame).
Declaration
public bool GetKeyUp(KeyboardKeys key) const
Parameters
KeyboardKeys
key
Key ID to check |
Returns
bool
True during the frame the user releases the key |
GetMouseButton(MouseButton button)
Gets the mouse button state.
Declaration
public bool GetMouseButton(MouseButton button) const
Parameters
MouseButton
button
Mouse button to check |
Returns
bool
True while the user holds down the button |
GetMouseButtonDown(MouseButton button)
Gets the mouse button down state.
Declaration
public bool GetMouseButtonDown(MouseButton button) const
Parameters
MouseButton
button
Mouse button to check |
Returns
bool
True during the frame the user starts pressing down the button |
GetMouseButtonUp(MouseButton button)
Gets the mouse button up state.
Declaration
public bool GetMouseButtonUp(MouseButton button) const
Parameters
MouseButton
button
Mouse button to check |
Returns
bool
True during the frame the user releases the button |
GetMousePosition()
Gets the mouse position in window coordinates.
Declaration
public Float2 GetMousePosition() const
Returns
Float2
|
GetMousePositionDelta()
Gets the mouse position change during the last frame.
Declaration
public Float2 GetMousePositionDelta() const
Returns
Float2
Mouse cursor position delta |
GetMouseScrollDelta()
Gets the mouse wheel change during the last frame.
Declaration
public float GetMouseScrollDelta() const
Returns
float
|
GetNativePtr()
Gets the native window handle.
Declaration
public virtual void* GetNativePtr() const = 0
Returns
void
The native window object handle. |
GetOpacity()
Gets window opacity value (valid only for windows created with SupportsTransparency flag). Opacity values are normalized to range [0;1].
Declaration
public virtual float GetOpacity() const
Returns
float
|
GetPosition()
Gets the window position (in screen coordinates).
Declaration
public virtual Float2 GetPosition() const
Returns
Float2
|
GetRenderingEnabled()
Gets the value indicating whenever rendering to this window enabled.
Declaration
public bool GetRenderingEnabled() const
Returns
bool
|
GetSettings()
GetSize()
Gets the window size (including border).
Declaration
public virtual Float2 GetSize() const
Returns
Float2
|
GetSwapChain()
GetTitle()
Gets the window title.
Declaration
public virtual String GetTitle() const
Returns
String
The window title. |
GetTrackingMouseOffset()
Gets the mouse tracking offset.
Declaration
public Float2 GetTrackingMouseOffset() const
Returns
Float2
|
Hide()
Hides the window.
Declaration
public virtual void Hide()
InitSwapChain()
Initializes the swap chain and the rendering task.
Declaration
public virtual bool InitSwapChain()
Returns
bool
True if failed, otherwise false. |
IsClosed()
Checks if window is closed.
Declaration
public virtual bool IsClosed() const
Returns
bool
|
IsCursorClipping()
Gets the value indicating whenever the cursor is being clipped.
Declaration
public bool IsCursorClipping() const
Returns
bool
|
IsFocused()
Determines whether this window is focused.
Declaration
public bool IsFocused() const
Returns
bool
|
IsForegroundWindow()
Checks if window is foreground (the window with which the user is currently working).
Declaration
public virtual bool IsForegroundWindow() const
Returns
bool
|
IsFullscreen()
Gets a value that indicates whether a window is in a fullscreen mode.
Declaration
public bool IsFullscreen() const
Returns
bool
|
IsMain()
Declaration
public bool IsMain() const
Returns
bool
|
IsMaximized()
Gets a value that indicates whether a window is maximized.
Declaration
public bool IsMaximized() const
Returns
bool
|
IsMinimized()
Gets a value that indicates whether a window is minimized.
Declaration
public bool IsMinimized() const
Returns
bool
|
IsMouseFlippingHorizontally()
Gets the value indicating if the mouse flipped to the other screen edge horizontally
Declaration
public bool IsMouseFlippingHorizontally() const
Returns
bool
|
IsMouseFlippingVertically()
Gets the value indicating if the mouse flipped to the other screen edge vertically
Declaration
public bool IsMouseFlippingVertically() const
Returns
bool
|
IsMouseTracking()
Gets the value indicating whenever mouse input is tracked by this window.
Declaration
public bool IsMouseTracking() const
Returns
bool
|
IsVisible()
Gets a value that indicates whether a window is visible (hidden or shown).
Declaration
public bool IsVisible() const
Returns
bool
|
IsWindowed()
Gets a value that indicates whether a window is not in a fullscreen mode.
Declaration
public bool IsWindowed() const
Returns
bool
|
Maximize()
Maximizes the window.
Declaration
public virtual void Maximize()
Minimize()
Minimizes the window.
Declaration
public virtual void Minimize()
OnCharInput(Char c)
Declaration
public void OnCharInput(Char c)
Parameters
Char
c
|
OnClosed()
Declaration
public void OnClosed()
OnClosing(ClosingReason reason, bool& cancel)
Declaration
public void OnClosing(ClosingReason reason, bool& cancel)
Parameters
ClosingReason
reason
|
bool
cancel
|
OnDeleteObject()
Deletes the object. Called by the ObjectsRemovalService. Can be overriden to provide custom logic per object (cleanup, etc.).
Declaration
public virtual void OnDeleteObject() override
Overrides
OnDragDrop(IGuiData* data, const Float2& mousePosition, DragDropEffect& result)
Declaration
public void OnDragDrop(IGuiData* data, const Float2& mousePosition, DragDropEffect& result)
Parameters
IGuiData
data
|
Float2
mousePosition
|
DragDropEffect
result
|
OnDragEnter(IGuiData* data, const Float2& mousePosition, DragDropEffect& result)
Declaration
public void OnDragEnter(IGuiData* data, const Float2& mousePosition, DragDropEffect& result)
Parameters
IGuiData
data
|
Float2
mousePosition
|
DragDropEffect
result
|
OnDragLeave()
Declaration
public void OnDragLeave()
OnDragOver(IGuiData* data, const Float2& mousePosition, DragDropEffect& result)
Declaration
public void OnDragOver(IGuiData* data, const Float2& mousePosition, DragDropEffect& result)
Parameters
IGuiData
data
|
Float2
mousePosition
|
DragDropEffect
result
|
OnDraw()
Performs the window UI rendering using Render2D.
Declaration
public virtual void OnDraw()
OnGotFocus()
Declaration
public void OnGotFocus()
OnHitTest(const Float2& mousePosition, WindowHitCodes& result, bool& handled)
Declaration
public void OnHitTest(const Float2& mousePosition, WindowHitCodes& result, bool& handled)
Parameters
Float2
mousePosition
|
WindowHitCodes
result
|
bool
handled
|
OnKeyDown(KeyboardKeys key)
OnKeyUp(KeyboardKeys key)
OnLeftButtonHit(WindowHitCodes hit, bool& result)
Declaration
public void OnLeftButtonHit(WindowHitCodes hit, bool& result)
Parameters
WindowHitCodes
hit
|
bool
result
|
OnLostFocus()
Declaration
public void OnLostFocus()
OnMouseDoubleClick(const Float2& mousePosition, MouseButton button)
Declaration
public void OnMouseDoubleClick(const Float2& mousePosition, MouseButton button)
Parameters
Float2
mousePosition
|
MouseButton
button
|
OnMouseDown(const Float2& mousePosition, MouseButton button)
Declaration
public void OnMouseDown(const Float2& mousePosition, MouseButton button)
Parameters
Float2
mousePosition
|
MouseButton
button
|
OnMouseLeave()
Declaration
public void OnMouseLeave()
OnMouseMove(const Float2& mousePosition)
Declaration
public void OnMouseMove(const Float2& mousePosition)
Parameters
Float2
mousePosition
|
OnMouseUp(const Float2& mousePosition, MouseButton button)
Declaration
public void OnMouseUp(const Float2& mousePosition, MouseButton button)
Parameters
Float2
mousePosition
|
MouseButton
button
|
OnMouseWheel(const Float2& mousePosition, float delta)
Declaration
public void OnMouseWheel(const Float2& mousePosition, float delta)
Parameters
Float2
mousePosition
|
float
delta
|
OnResize(int32 width, int32 height)
Declaration
public void OnResize(int32 width, int32 height)
Parameters
int32
width
|
int32
height
|
OnShow()
Declaration
public void OnShow()
OnTouchDown(const Float2& pointerPosition, int32 pointerIndex)
Declaration
public void OnTouchDown(const Float2& pointerPosition, int32 pointerIndex)
Parameters
Float2
pointerPosition
|
int32
pointerIndex
|
OnTouchMove(const Float2& pointerPosition, int32 pointerIndex)
Declaration
public void OnTouchMove(const Float2& pointerPosition, int32 pointerIndex)
Parameters
Float2
pointerPosition
|
int32
pointerIndex
|
OnTouchUp(const Float2& pointerPosition, int32 pointerIndex)
Declaration
public void OnTouchUp(const Float2& pointerPosition, int32 pointerIndex)
Parameters
Float2
pointerPosition
|
int32
pointerIndex
|
OnUpdate(float dt)
Performs the UI update.
Declaration
public virtual void OnUpdate(float dt)
Parameters
float
dt
The delta time (in seconds). |
Restore()
Restores the window state before minimizing or maximizing.
Declaration
public virtual void Restore()
ScreenToClient(const Float2& screenPos)
Converts screen space location into window space coordinates.
Declaration
public virtual Float2 ScreenToClient(const Float2& screenPos) const
Parameters
Float2
screenPos
The screen position. |
Returns
Float2
The client space position. |
SetBorderless(bool isBorderless, bool maximized=false)
Sets the window to be borderless or not and to be fullscreen.
Declaration
public virtual void SetBorderless(bool isBorderless, bool maximized=false)
Parameters
bool
isBorderless
Whether or not to have borders on window. |
bool
maximized
Whether or not to make the borderless window fullscreen (maximize to cover whole screen). |
SetClientBounds(const Rectangle& clientArea)
Sets the client bounds of the window (client area not including border).
Declaration
public virtual void SetClientBounds(const Rectangle& clientArea)
Parameters
Rectangle
clientArea
The client area. |
SetClientPosition(const Float2& position)
Sets the client position of the window (client area not including border)
Declaration
public virtual void SetClientPosition(const Float2& position)
Parameters
Float2
position
The client area position. |
SetClientSize(const Float2& size)
Sets the size of the client area of the window (not including border).
Declaration
public void SetClientSize(const Float2& size)
Parameters
Float2
size
The window client area size. |
SetCursor(CursorType type)
Sets the mouse cursor.
Declaration
public virtual void SetCursor(CursorType type)
Parameters
CursorType
type
The cursor type. |
SetIcon(TextureData& icon)
Sets the window icon.
Declaration
public virtual void SetIcon(TextureData& icon)
Parameters
TextureData
icon
The icon. |
SetIsFullscreen(bool isFullscreen)
Sets a value that indicates whether a window is in a fullscreen mode.
Declaration
public virtual void SetIsFullscreen(bool isFullscreen)
Parameters
bool
isFullscreen
If set to |
SetIsVisible(bool isVisible)
Sets a value that indicates whether a window is visible (hidden or shown).
Declaration
public void SetIsVisible(bool isVisible)
Parameters
bool
isVisible
True if show window, otherwise false if hide it. |
SetMousePosition(const Float2& position)
Sets the mouse position in window coordinates.
Declaration
public void SetMousePosition(const Float2& position) const
Parameters
Float2
position
Mouse position to set on |
SetOpacity(float opacity)
Sets window opacity value (valid only for windows created with SupportsTransparency flag). Opacity values are normalized to range [0;1].
Declaration
public virtual void SetOpacity(float opacity)
Parameters
float
opacity
The opacity. |
SetPosition(const Float2& position)
Sets the window position (in screen coordinates).
Declaration
public virtual void SetPosition(const Float2& position)
Parameters
Float2
position
The position. |
SetRenderingEnabled(bool value)
Sets the value indicating whenever rendering to this window enabled.
Declaration
public void SetRenderingEnabled(bool value)
Parameters
bool
value
|
SetTitle(const StringView& title)
Sets the window title.
Declaration
public virtual void SetTitle(const StringView& title)
Parameters
StringView
title
The title. |
Show()
Shows the window.
Declaration
public virtual void Show()
StartClippingCursor(const Rectangle& bounds)
Starts the cursor clipping.
Declaration
public virtual void StartClippingCursor(const Rectangle& bounds)
Parameters
Rectangle
bounds
The screen-space bounds that the cursor will be confined to. |
StartTrackingMouse(bool useMouseScreenOffset)
Starts the mouse tracking.
Declaration
public virtual void StartTrackingMouse(bool useMouseScreenOffset)
Parameters
bool
useMouseScreenOffset
If set to |
ToString()
Gets the string representation of this object.
Declaration
public virtual String ToString() const override
Returns
String
|