ApplicationWindowBase

Description

abstract class Tinman.Engine.Application.ApplicationWindowBase

Derived from

Disposable abstract
IApplicationWindow

Extended by

ApplicationWindow

Abstract base class for IApplicationWindow implementations.

To implement an application window, the following steps are necessary:

  • Implement all abstract members.

  • Use KeyCodeMap (preferably in the constructor) to establish a mapping between key codes of the native API and the KeyboardKey enumeration.

  • Setup event handlers using the native API and call into the On* handler methods.

  • Override IApplicationWindow.Resolution to support high-DPI rendering. The default implementation returns 96 DPI.

When implementing a top-level application window, the following no-op virtual members should be overridden:

Public / Attributes

Is​Recreate​Native​Window


public attribute IsRecreateNativeWindow → (get)

value : bool

true if the native window is being re-created, false if not.

Is the native window being re-created in a call to INativeWindowRecreate.RecreateNativeWindowIfNecessary?

Protected / Constructors

Application​Window​Base


protected constructor ApplicationWindowBase → ()

Creates a new instance of ApplicationWindow.

Protected / Methods

Key​Code​Map


protected method KeyCodeMap → (2)

keyCode in : int32

The native virtual keycode.

key in : KeyboardKey

The KeyboardKey value.

Maps the given native virtual keycode to the specified KeyboardKey value.

Key​Code​Map_​Win32


protected method KeyCodeMap_Win32 → ()

Creates the virtual keycode mapping for the WIN32 API.

Mouse​Cursor​Set


protected abstract method MouseCursorSet → (1)

mouseCursor in : MouseCursor

The new mouse cursor.

Sets the mouse cursor for the window.

Mouse​Track


protected abstract method MouseTrack → ()

This method ensures that events are generated when the mouse cursor leaves the window.

On​Button


protected method OnButton → (2)

button in : MouseButton

The mouse button.

pressed in : bool

Pressed or released?

A mouse button event has been received.

On​Char


protected method OnChar → (1)

keyChar in : char

The character value.

A character value has been typed in.

On​Key


protected method OnKey → (2)

keyCode in : int32

The native virtual keycode.

pressed in : bool

true if the key has been pressed, false if it has been released.

A keyboard key has been pressed or released.

On​Message_​Win32


protected method OnMessage_Win32 → (3)

msg in : int32

Message code.

wParam in : int64

Message WPARAM.

lParam in : int64

Message LPARAM.

returns → bool

true if the message has been consumed, false if not.

Processes a window message of the WIN32 API and calls the required handler methods.

If this method returns true, the WIN32 window procedure should return 0.

On​Mouse​Leave


protected method OnMouseLeave → ()

returns → bool

true if the InputEventType.MouseLeave event has been sent, false if not.

The mouse cursor has left the application window client area.

On​Mouse​Move


protected method OnMouseMove → (3)

positionX in : int32

X-coordinate of new position of mouse cursor in application window client area.

positionY in : int32

Y-coordinate of new position of mouse cursor in application window client area.

wheel in : int32

The mouse wheel movement.

The mouse has moved.

On​Window​Bounds​Changed


protected virtual method OnWindowBoundsChanged → ()

The bounds of the application window have changed.

On​Window​Focus


protected method OnWindowFocus → (1)

focused in : bool

true if the window has gained focus, false if it has lost it.

The application window has gained or lost focus.

Recreate​Native​Window


[EmptyBody]
protected virtual method RecreateNativeWindow → ()

Re-creates the native window.

RenderException

If a graphics subsystem error has occurred.

Protected / Attributes

Client​Rect


protected abstract attribute ClientRect → (get)

value : Box2I

The client area rectangle, in screen coordinates.

Returns the bounds of the application windows client area.

dirty


protected attribute dirty → (bool)

Can be set to true in order to make the next call to IApplicationWindow.ProcessSystemMessages return true once.

Mouse​Buttons


protected abstract attribute MouseButtons → (get)

value : int32

The mouse button state bitmask:
1 : left
2 : right
4 : middle

Returns the states of the mouse buttons.

Mouse​Clip


protected abstract attribute MouseClip → (get,set)

value : Box2I

The clip rectangle, in screen coordinates.

The mouse cursor clip rectangle.

mouse​Position


protected attribute mousePosition → (Vec2I)

Relative position of mouse cursor in application window client area.

Mouse​Position


protected abstract attribute MousePosition → (get,set)

value : Vec2I

The mouse cursor position, in screen coordinates.

Position of the mouse cursor.

Mouse​Visible


protected abstract attribute MouseVisible → (set)

value : bool

true to show the mouse cursor, false to hide it.

Shows or hides the mouse cursor when hovering the application window.

resolution


protected attribute resolution → (int32)

The window resolution, in DPI.

This field will be set to 96 by the constructor of this class. It will be updated by OnMessage_Win32 when receiving a WM_DPICHANGED message.