ApplicationWindow
Description
- Derived from
-
Disposable abstract
IApplicationWindow - Extended by
Abstract base class for IApplicationWindow implementations.
To create a new top-level window, use Create or an IApplicationWindowFactory. To wrap an embedded native window or control, create a subclass and perform callbacks from the native windows message loop. For the latter case, several built-in implementations exist:
-
Tinman.AddOns.WinForms.ApplicationControl
(C#) -
Tinman.AddOns.WPF.ApplicationControlWpf
(C#) -
Tinman::AddOns::MFC::CApplicationControlMfc
(C++)
To implement a new application window subclass, 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.
When implementing a top-level application window, these no-op members should be overridden:
The following platform-dependent helper methods may be used to implement the above:
Public / Constructors
Create
Creates a new top-level window by delegating to IApplicationWindowFactory.CreateApplicationWindow of a suitable registered IApplicationWindowFactory instance.
- TinmanException
-
If none of the registered factories was able to create a window or if TinmanEnginePrivileges.WindowOpen is not granted.
- See also
CreateNull
Creates a new top-level window by delegating to IApplicationWindowFactory.CreateApplicationWindow of a suitable registered IApplicationWindowFactory instance.
- See also
Public / Attributes
DebugMousePositionHack
Enables or disables the code hack for the problem when the mouse position cannot be set.
Under some circumstances (for example, in a Remote Desktop session on Windows or when running X11 / Wayland in WSL2), trying to set the mouse position has no effect, although the system API reports success. As result, all user controls that depend on relative mouse movement become unusable. When the code hack is enabled, these controls do not reposition the mouse, which uglifies the user experience on the one hand but still provides a workable solution on the other hand.
IsRecreateNativeWindow
Is the native window being re-created in a call to INativeWindowRecreate.RecreateNativeWindowIfNecessary?
Protected / Methods
MouseCapture
This method captures the mouse.
While captured, the mouse cursor is invisible and the application window receives relative mouse movement. The default implementation uses ClientRect, MouseClip, MousePosition and MouseVisible to emulate that behaviour. Subclasses should override this method if they can provide a dedicated relative mouse input mode.
OnMessage_WinAPI
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
.
RecreateNativeWindow
Re-creates the native window.
- RenderException
-
If a graphics subsystem error has occurred.
Protected / Attributes
dirty
Can be set to true
in order to make the next call to IApplicationWindow.ProcessSystemMessages return true
once.
ToStringType
Returns a machine-readable and human-understandable identifier for the implementation type of this application window, to be used by object.ToString.