IWidget

Description

interface Tinman.Engine.Widgets.IWidget

Base interface for general-purpose application widgets.

Usually, an IApplication hosts one or more IWidget objects. Application input events are forwarded to widgets unmodified, i.e. the widget is responsible for translating them to its Bounds as necessary (e.g. using a BoundedInput object). Widgets are not required to limit their rendering to their bounds.

The ILocalizable.Localize2 will store the given labels in an own set that belongs to the widget. The ILocalizable.Localize1 method will delegate to the attached widget GUI (see IWidgetGuiConsumer.WidgetGuiAttach), if a label is not present in that set.

Public / Attributes

Actual­Bounds


public attribute ActualBounds → (get)

value : Box2I

The actual pixel bounds or Box2I.Empty.

Returns the actual pixel bounds of this widget.

Bounds


public attribute Bounds → (get,set)

value : IWidgetBounds

[not-null]
The pixel bounds.

The pixel bounds of this widget.

Mouse­Cursor


public attribute MouseCursor → (get)

value : MouseCursor

The mouse cursor

The mouse cursor to show for this widget.

Extensions

Render2DWith­Setup


public static method Render2DWithSetup → (1)

in : Graphics

[not-null]
The graphics object to use.

Calls IRenderable2D.Render2D of this IWidget after having performed the necessary setup.

The setup involves these steps:

  1. Call IBeginEnd.Begin on in.

  2. Set Graphics.Bounds of in to IWidget.ActualBounds.

  3. Delegate to IRenderable2D.Render2D of this widget, passing in.

  4. Call IBeginEnd.End on in.

To­Application


[OwnerReturn] [OwnerThis]
public static method ToApplication → (2)

frameRateLimit opt : int32 = 100

Frame rate limit (see IApplicationInfo.FrameRateLimit).

autoSettings opt : bool = true

The value to set for WidgetApplication.AutoSettings.

returns → WidgetApplication

The application object.

Wraps this IWidget in a IApplication object.

This widget must already be in the state LifecycleState.Initialized when this method is called, i.e. the caller is responsible for calling IWidgetSettings.Initialize.