Search Results for

    Show / Hide Table of Contents

    Class Window

    Native platform window object.

    Inheritance
    System.Object
    Object
    Window
    Inherited Members
    Object.__unmanagedPtr
    Object.__internalId
    Object.Finalize()
    Object.As<T>()
    Object.NewValue(Type)
    Object.New(String)
    Object.Find<T>(Guid, Boolean)
    Object.Find(Guid, Type, Boolean)
    Object.TryFind<T>(Guid)
    Object.TryFind(Guid, Type)
    Object.Destroy(Object, Single)
    Object.DestroyNow(Object)
    Object.Destroy<T>(T, Single)
    Object.Equals(Object)
    Object.GetUnmanagedPtr(Object)
    Object.GetUnmanagedInterface(Object, Type)
    Object.FromUnmanagedPtr(IntPtr)
    Object.MapObjectID(Guid)
    Object.RemapObjectID(Guid)
    Object.GetHashCode()
    Object.ID
    Object.TypeName
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public sealed class Window : Object

    Fields

    GUI

    The window GUI root object.

    Declaration
    public readonly WindowRootControl GUI
    Field Value
    FlaxEngine.GUI.WindowRootControl

    HitTest

    Event fired when window performs hit test, parameter is a mouse position

    Declaration
    public Window.HitTestDelegate HitTest
    Field Value
    Window.HitTestDelegate

    LeftButtonHit

    Event fired when left mouse button goes down (hit test performed etc.). Returns true if event has been processed and further actions should be canceled, otherwise false.

    Declaration
    public Func<WindowHitCodes, bool> LeftButtonHit
    Field Value
    System.Func<WindowHitCodes, System.Boolean>

    Properties

    ClientBounds

    Gets or sets the client bounds of the window (client area not including border).

    Declaration
    [Unmanaged]
    public Rectangle ClientBounds { get; set; }
    Property Value
    Rectangle

    ClientPosition

    Gets or sets the client position of the window (client area not including border).

    Declaration
    [Unmanaged]
    public Float2 ClientPosition { get; set; }
    Property Value
    Float2

    ClientSize

    Gets or sets the size of the client area of the window (not including border).

    Declaration
    [Unmanaged]
    public Float2 ClientSize { get; set; }
    Property Value
    Float2

    Cursor

    Gets or sets the mouse cursor.

    Declaration
    [Unmanaged]
    public CursorType Cursor { get; set; }
    Property Value
    CursorType

    Dpi

    Gets the window DPI setting.

    Declaration
    [Unmanaged]
    public int Dpi { get; }
    Property Value
    System.Int32

    DpiScale

    Gets the window DPI scale factor (1 is default). Includes custom DPI scale

    Declaration
    [Unmanaged]
    public float DpiScale { get; }
    Property Value
    System.Single

    InputText

    Gets the text entered during the current frame (Unicode).

    Declaration
    [Unmanaged]
    public string InputText { get; }
    Property Value
    System.String

    IsClosed

    Checks if window is closed.

    Declaration
    [Unmanaged]
    public bool IsClosed { get; }
    Property Value
    System.Boolean

    IsCursorClipping

    Gets the value indicating whenever the cursor is being clipped.

    Declaration
    [Unmanaged]
    public bool IsCursorClipping { get; }
    Property Value
    System.Boolean

    IsFocused

    Determines whether this window is focused.

    Declaration
    [Unmanaged]
    public bool IsFocused { get; }
    Property Value
    System.Boolean

    IsForegroundWindow

    Checks if window is foreground (the window with which the user is currently working).

    Declaration
    [Unmanaged]
    public bool IsForegroundWindow { get; }
    Property Value
    System.Boolean

    IsFullscreen

    Gets or sets a value that indicates whether a window is in a fullscreen mode.

    Declaration
    [Unmanaged]
    public bool IsFullscreen { get; set; }
    Property Value
    System.Boolean

    IsMaximized

    Gets a value that indicates whether a window is maximized.

    Declaration
    [Unmanaged]
    public bool IsMaximized { get; }
    Property Value
    System.Boolean

    IsMinimized

    Gets a value that indicates whether a window is minimized.

    Declaration
    [Unmanaged]
    public bool IsMinimized { get; }
    Property Value
    System.Boolean

    IsMouseFlippingHorizontally

    Gets the value indicating if the mouse flipped to the other screen edge horizontally

    Declaration
    [Unmanaged]
    public bool IsMouseFlippingHorizontally { get; }
    Property Value
    System.Boolean

    IsMouseFlippingVertically

    Gets the value indicating if the mouse flipped to the other screen edge vertically

    Declaration
    [Unmanaged]
    public bool IsMouseFlippingVertically { get; }
    Property Value
    System.Boolean

    IsMouseTracking

    Gets the value indicating whenever mouse input is tracked by this window.

    Declaration
    [Unmanaged]
    public bool IsMouseTracking { get; }
    Property Value
    System.Boolean

    IsVisible

    Gets or sets a value that indicates whether a window is visible (hidden or shown).

    Declaration
    [Unmanaged]
    public bool IsVisible { get; set; }
    Property Value
    System.Boolean

    IsWindowed

    Gets a value that indicates whether a window is not in a fullscreen mode.

    Declaration
    [Unmanaged]
    public bool IsWindowed { get; }
    Property Value
    System.Boolean

    MousePosition

    Gets or sets the mouse position in window coordinates.

    Declaration
    [Unmanaged]
    public Float2 MousePosition { get; set; }
    Property Value
    Float2

    MousePositionDelta

    Gets the mouse position change during the last frame.

    Declaration
    [Unmanaged]
    public Float2 MousePositionDelta { get; }
    Property Value
    Float2

    MouseScrollDelta

    Gets the mouse wheel change during the last frame.

    Declaration
    [Unmanaged]
    public float MouseScrollDelta { get; }
    Property Value
    System.Single

    NativePtr

    Gets the native window handle.

    Declaration
    [Unmanaged]
    public IntPtr NativePtr { get; }
    Property Value
    System.IntPtr

    Opacity

    Gets or sets window opacity value (valid only for windows created with SupportsTransparency flag). Opacity values are normalized to range [0;1].

    Declaration
    [Unmanaged]
    public float Opacity { get; set; }
    Property Value
    System.Single

    Position

    Gets or sets the window position (in screen coordinates).

    Declaration
    [Unmanaged]
    public Float2 Position { get; set; }
    Property Value
    Float2

    RenderingEnabled

    Gets or sets the value indicating whenever rendering to this window enabled.

    Declaration
    [Unmanaged]
    public bool RenderingEnabled { get; set; }
    Property Value
    System.Boolean

    Size

    Gets the window size (including border).

    Declaration
    [Unmanaged]
    public Float2 Size { get; }
    Property Value
    Float2

    Title

    Gets the window title.

    Declaration
    [Unmanaged]
    public string Title { get; set; }
    Property Value
    System.String

    TrackingMouseOffset

    Gets the mouse tracking offset.

    Declaration
    [Unmanaged]
    public Float2 TrackingMouseOffset { get; }
    Property Value
    Float2

    Methods

    add_Closing(Window.ClosingDelegate)

    Declaration
    public void add_Closing(Window.ClosingDelegate value)
    Parameters
    Window.ClosingDelegate value

    add_KeyDown(Window.KeyboardDelegate)

    Declaration
    public void add_KeyDown(Window.KeyboardDelegate value)
    Parameters
    Window.KeyboardDelegate value

    add_KeyUp(Window.KeyboardDelegate)

    Declaration
    public void add_KeyUp(Window.KeyboardDelegate value)
    Parameters
    Window.KeyboardDelegate value

    add_MouseDoubleClick(Window.MouseButtonDelegate)

    Declaration
    public void add_MouseDoubleClick(Window.MouseButtonDelegate value)
    Parameters
    Window.MouseButtonDelegate value

    add_MouseDown(Window.MouseButtonDelegate)

    Declaration
    public void add_MouseDown(Window.MouseButtonDelegate value)
    Parameters
    Window.MouseButtonDelegate value

    add_MouseMove(Window.MouseMoveDelegate)

    Declaration
    public void add_MouseMove(Window.MouseMoveDelegate value)
    Parameters
    Window.MouseMoveDelegate value

    add_MouseUp(Window.MouseButtonDelegate)

    Declaration
    public void add_MouseUp(Window.MouseButtonDelegate value)
    Parameters
    Window.MouseButtonDelegate value

    add_MouseWheel(Window.MouseWheelDelegate)

    Declaration
    public void add_MouseWheel(Window.MouseWheelDelegate value)
    Parameters
    Window.MouseWheelDelegate value

    add_OnCharInput(Window.CharDelegate)

    Declaration
    public void add_OnCharInput(Window.CharDelegate value)
    Parameters
    Window.CharDelegate value

    add_TouchDown(Window.TouchDelegate)

    Declaration
    public void add_TouchDown(Window.TouchDelegate value)
    Parameters
    Window.TouchDelegate value

    add_TouchMove(Window.TouchDelegate)

    Declaration
    public void add_TouchMove(Window.TouchDelegate value)
    Parameters
    Window.TouchDelegate value

    add_TouchUp(Window.TouchDelegate)

    Declaration
    public void add_TouchUp(Window.TouchDelegate value)
    Parameters
    Window.TouchDelegate value

    BringToFront(Boolean)

    Brings window to the front of the Z order.

    Declaration
    [Unmanaged]
    public void BringToFront(bool force = false)
    Parameters
    System.Boolean force

    True if move to the front by force, otherwise false.

    ClientToScreen(Float2)

    Converts window space location into screen space coordinates.

    Declaration
    [Unmanaged]
    public Float2 ClientToScreen(Float2 clientPos)
    Parameters
    Float2 clientPos

    The client position.

    Returns
    Float2

    The screen space position.

    Close(ClosingReason)

    Closes the window.

    Declaration
    [Unmanaged]
    public void Close(ClosingReason reason)
    Parameters
    ClosingReason reason

    The closing reason.

    DoDragDrop(DragData)

    Starts the drag and drop operation.

    Declaration
    public void DoDragDrop(DragData data)
    Parameters
    DragData data

    The data.

    DoDragDrop(String)

    Starts drag and drop operation

    Declaration
    [Unmanaged]
    public DragDropEffect DoDragDrop(string data)
    Parameters
    System.String data

    The data.

    Returns
    DragDropEffect

    The result.

    EndClippingCursor()

    Ends the cursor clipping.

    Declaration
    [Unmanaged]
    public void EndClippingCursor()

    EndTrackingMouse()

    Ends the mouse tracking.

    Declaration
    [Unmanaged]
    public void EndTrackingMouse()

    FlashWindow()

    Flashes the window to bring use attention.

    Declaration
    [Unmanaged]
    public void FlashWindow()

    Focus()

    Focuses this window.

    Declaration
    [Unmanaged]
    public void Focus()

    GetKey(KeyboardKeys)

    Gets the key state (true if key is being pressed during this frame).

    Declaration
    [Unmanaged]
    public bool GetKey(KeyboardKeys key)
    Parameters
    KeyboardKeys key

    Key ID to check

    Returns
    System.Boolean

    True while the user holds down the key identified by id

    GetKeyDown(KeyboardKeys)

    Gets the key 'down' state (true if key was pressed in this frame).

    Declaration
    [Unmanaged]
    public bool GetKeyDown(KeyboardKeys key)
    Parameters
    KeyboardKeys key

    Key ID to check

    Returns
    System.Boolean

    True during the frame the user starts pressing down the key

    GetKeyUp(KeyboardKeys)

    Gets the key 'up' state (true if key was released in this frame).

    Declaration
    [Unmanaged]
    public bool GetKeyUp(KeyboardKeys key)
    Parameters
    KeyboardKeys key

    Key ID to check

    Returns
    System.Boolean

    True during the frame the user releases the key

    GetMouseButton(MouseButton)

    Gets the mouse button state.

    Declaration
    [Unmanaged]
    public bool GetMouseButton(MouseButton button)
    Parameters
    MouseButton button

    Mouse button to check

    Returns
    System.Boolean

    True while the user holds down the button

    GetMouseButtonDown(MouseButton)

    Gets the mouse button down state.

    Declaration
    [Unmanaged]
    public bool GetMouseButtonDown(MouseButton button)
    Parameters
    MouseButton button

    Mouse button to check

    Returns
    System.Boolean

    True during the frame the user starts pressing down the button

    GetMouseButtonUp(MouseButton)

    Gets the mouse button up state.

    Declaration
    [Unmanaged]
    public bool GetMouseButtonUp(MouseButton button)
    Parameters
    MouseButton button

    Mouse button to check

    Returns
    System.Boolean

    True during the frame the user releases the button

    Hide()

    Hides the window.

    Declaration
    [Unmanaged]
    public void Hide()

    Maximize()

    Maximizes the window.

    Declaration
    [Unmanaged]
    public void Maximize()

    Minimize()

    Minimizes the window.

    Declaration
    [Unmanaged]
    public void Minimize()

    remove_Closing(Window.ClosingDelegate)

    Declaration
    public void remove_Closing(Window.ClosingDelegate value)
    Parameters
    Window.ClosingDelegate value

    remove_KeyDown(Window.KeyboardDelegate)

    Declaration
    public void remove_KeyDown(Window.KeyboardDelegate value)
    Parameters
    Window.KeyboardDelegate value

    remove_KeyUp(Window.KeyboardDelegate)

    Declaration
    public void remove_KeyUp(Window.KeyboardDelegate value)
    Parameters
    Window.KeyboardDelegate value

    remove_MouseDoubleClick(Window.MouseButtonDelegate)

    Declaration
    public void remove_MouseDoubleClick(Window.MouseButtonDelegate value)
    Parameters
    Window.MouseButtonDelegate value

    remove_MouseDown(Window.MouseButtonDelegate)

    Declaration
    public void remove_MouseDown(Window.MouseButtonDelegate value)
    Parameters
    Window.MouseButtonDelegate value

    remove_MouseMove(Window.MouseMoveDelegate)

    Declaration
    public void remove_MouseMove(Window.MouseMoveDelegate value)
    Parameters
    Window.MouseMoveDelegate value

    remove_MouseUp(Window.MouseButtonDelegate)

    Declaration
    public void remove_MouseUp(Window.MouseButtonDelegate value)
    Parameters
    Window.MouseButtonDelegate value

    remove_MouseWheel(Window.MouseWheelDelegate)

    Declaration
    public void remove_MouseWheel(Window.MouseWheelDelegate value)
    Parameters
    Window.MouseWheelDelegate value

    remove_OnCharInput(Window.CharDelegate)

    Declaration
    public void remove_OnCharInput(Window.CharDelegate value)
    Parameters
    Window.CharDelegate value

    remove_TouchDown(Window.TouchDelegate)

    Declaration
    public void remove_TouchDown(Window.TouchDelegate value)
    Parameters
    Window.TouchDelegate value

    remove_TouchMove(Window.TouchDelegate)

    Declaration
    public void remove_TouchMove(Window.TouchDelegate value)
    Parameters
    Window.TouchDelegate value

    remove_TouchUp(Window.TouchDelegate)

    Declaration
    public void remove_TouchUp(Window.TouchDelegate value)
    Parameters
    Window.TouchDelegate value

    Restore()

    Restores the window state before minimizing or maximizing.

    Declaration
    [Unmanaged]
    public void Restore()

    ScreenToClient(Float2)

    Converts screen space location into window space coordinates.

    Declaration
    [Unmanaged]
    public Float2 ScreenToClient(Float2 screenPos)
    Parameters
    Float2 screenPos

    The screen position.

    Returns
    Float2

    The client space position.

    SetBorderless(Boolean, Boolean)

    Sets the window to be borderless or not and to be fullscreen.

    Declaration
    [Unmanaged]
    public void SetBorderless(bool isBorderless, bool maximized = false)
    Parameters
    System.Boolean isBorderless

    Whether or not to have borders on window.

    System.Boolean maximized

    Whether or not to make the borderless window fullscreen (maximize to cover whole screen).

    Show()

    Shows the window.

    Declaration
    [Unmanaged]
    public void Show()

    StartClippingCursor(Rectangle)

    Starts the cursor clipping.

    Declaration
    [Unmanaged]
    public void StartClippingCursor(Rectangle bounds)
    Parameters
    Rectangle bounds

    The screen-space bounds that the cursor will be confined to.

    StartTrackingMouse(Boolean)

    Starts the mouse tracking.

    Declaration
    [Unmanaged]
    public void StartTrackingMouse(bool useMouseScreenOffset)
    Parameters
    System.Boolean useMouseScreenOffset

    If set to true will use mouse screen offset.

    Events

    Closed

    Event fired when gets closed and deleted, all references to the window object should be removed at this point.

    Declaration
    public event Action Closed
    Event Type
    System.Action

    Closing

    Event fired when windows wants to be closed. Should return true if suspend window closing, otherwise returns false

    Declaration
    public event Window.ClosingDelegate Closing
    Event Type
    Window.ClosingDelegate

    GotFocus

    Event fired when window gets focus.

    Declaration
    public event Action GotFocus
    Event Type
    System.Action

    KeyDown

    Event fired on key pressed.

    Declaration
    public event Window.KeyboardDelegate KeyDown
    Event Type
    Window.KeyboardDelegate

    KeyUp

    Event fired on key released.

    Declaration
    public event Window.KeyboardDelegate KeyUp
    Event Type
    Window.KeyboardDelegate

    LostFocus

    Event fired when window lost focus.

    Declaration
    public event Action LostFocus
    Event Type
    System.Action

    MouseDoubleClick

    Event fired when mouse double clicks.

    Declaration
    public event Window.MouseButtonDelegate MouseDoubleClick
    Event Type
    Window.MouseButtonDelegate

    MouseDown

    Event fired when mouse goes down.

    Declaration
    public event Window.MouseButtonDelegate MouseDown
    Event Type
    Window.MouseButtonDelegate

    MouseLeave

    Event fired when mouse leaves window.

    Declaration
    public event Action MouseLeave
    Event Type
    System.Action

    MouseMove

    Event fired when mouse moves

    Declaration
    public event Window.MouseMoveDelegate MouseMove
    Event Type
    Window.MouseMoveDelegate

    MouseUp

    Event fired when mouse goes up.

    Declaration
    public event Window.MouseButtonDelegate MouseUp
    Event Type
    Window.MouseButtonDelegate

    MouseWheel

    Event fired when mouse wheel is scrolling.

    Declaration
    public event Window.MouseWheelDelegate MouseWheel
    Event Type
    Window.MouseWheelDelegate

    OnCharInput

    Event fired on character input.

    Declaration
    public event Window.CharDelegate OnCharInput
    Event Type
    Window.CharDelegate

    TouchDown

    Event fired when touch begins.

    Declaration
    public event Window.TouchDelegate TouchDown
    Event Type
    Window.TouchDelegate

    TouchMove

    Event fired when touch moves.

    Declaration
    public event Window.TouchDelegate TouchMove
    Event Type
    Window.TouchDelegate

    TouchUp

    Event fired when touch ends.

    Declaration
    public event Window.TouchDelegate TouchUp
    Event Type
    Window.TouchDelegate

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat