abstract class Tinman.Engine.Application.ApplicationWindowBase

Derived from

Disposable abstract

Extended by


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


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


protected constructor ApplicationWindowBase → ()

Creates a new instance of ApplicationWindow.

Protected / Methods


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.


protected method KeyCodeMap_Win32 → ()

Creates the virtual keycode mapping for the WIN32 API.


protected abstract method MouseCursorSet → (1)

mouseCursor in : MouseCursor

The new mouse cursor.

Sets the mouse cursor for the window.


protected abstract method MouseTrack → ()

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


protected method OnButton → (2)

button in : MouseButton

The mouse button.

pressed in : bool

Pressed or released?

A mouse button event has been received.


protected method OnChar → (1)

keyChar in : char

The character value.

A character value has been typed in.


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.


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.


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.


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.


protected virtual method OnWindowBoundsChanged → ()

The bounds of the application window have changed.


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.


protected virtual method RecreateNativeWindow → ()

Re-creates the native window.


If a graphics subsystem error has occurred.

Protected / Attributes


protected abstract attribute ClientRect → (get)

value : Box2I

The client area rectangle, in screen coordinates.

Returns the bounds of the application windows client area.


protected attribute dirty → (bool)

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


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.


protected abstract attribute MouseClip → (get,set)

value : Box2I

The clip rectangle, in screen coordinates.

The mouse cursor clip rectangle.


protected attribute mousePosition → (Vec2I)

Relative position of mouse cursor in application window client area.


protected abstract attribute MousePosition → (get,set)

value : Vec2I

The mouse cursor position, in screen coordinates.

Position of the mouse cursor.


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.


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.