Component

Description

abstract class Tinman.Engine.GUI.Component

Base class for all user interface components.

The default layout settings of a component are defined by LayoutDefault. Subclasses may override it, in order to define custom default layout settings. If they do so, the class documentation should list these values.

Public / Methods

FocusLeaf


public virtual method FocusLeaf → ()

returns → Component

The focussed component or null.

Returns the bottom-most component in the hierarchy that has the input focus.

HoveredLeaf


public virtual method HoveredLeaf → ()

returns → Component

The hovered component or null.

Returns the bottom-most component in the hierarchy that is hovered by the mouse.

OverlayAdd


public method OverlayAdd → (1)

overlay in : ComponentOverlayDelegate

[not-null]
The overlay to add.

Adds an overlay to this component.

OverlayRemove


public method OverlayRemove → (1)

overlay in : ComponentOverlayDelegate

[not-null]
The overlay to remove.

Removes the given component overlay.

Public / Attributes

Action


public attribute Action → (get,set)

value : InputClick

The input click or InputClick.None.

The input click of the default action of this component.

Defaults to InputClick.None.

ActualLayoutBaseline


public attribute ActualLayoutBaseline → (get)

value : int32

The actual layout baseline.

The actual layout baseline, as computed by ComputeLayoutBaseline.

ActualLayoutMargin


public attribute ActualLayoutMargin → (get)

value : Edging

The actual layout margin.

The actual layout margin, as computed by ComputeLayoutMargin.

ActualLayoutSize


public attribute ActualLayoutSize → (get)

value : Vec2I

The actual layout size.

The actual layout size, as computed by ComputeLayoutSize.

Bounds


public attribute Bounds → (get)

value : Box2I

The component bounds.

Returns the bounds of this component in the client area of its parent container.

Focusable


public attribute Focusable → (get,set)

value : bool

true if the component can receive the input focus, false if not.

Can this component receive the input focus?

Defaults to false.

Graphics


public attribute Graphics → (get)

value : Graphics

The graphics object or null if not attached.

The current graphics object.

IsFocussed


public virtual attribute IsFocussed → (get)

value : bool

true if this component has the input focus, false if not.

Does this component have the input focus?

IsHighlighted


public virtual attribute IsHighlighted → (get)

value : bool

true if the component shall be highlighted,
false if not.

Is this component being highlighted?

IsHovered


public attribute IsHovered → (get)

value : bool

true if the mouse cursor hovers above this component, false if not.

Does the mouse cursor currently hover above this component?

IsVisible


public attribute IsVisible → (get)

value : bool

true if this component is visible, false if it is not.

Is this component currently visible?

A component is visible if its state is not ComponentState.Hidden and its parent is also visible.

LayoutAlign


public attribute LayoutAlign → (get,set)

value : Anchor

The anchor.

The alignment anchor of this component.

LayoutDefault


public virtual attribute LayoutDefault → (get)

value : Layout

The default layout settings.

Returns the default Layout settings that are recommended for this component.

Subclasses may override this method, in order to define custom default layout settings. If they do so, the documentation of the declaring class should list these values.

The default implementation returns Layout.Default.

LayoutFill


public virtual attribute LayoutFill → (get,set)

value : Axis

The fill mode.

The fill mode of this component.

LayoutGrid


public attribute LayoutGrid → (get,set)

value : Box2I

The layout grid bounds.

The bounds of this component in its parent containers layout grid.

LayoutGrow


public attribute LayoutGrow → (get,set)

value : Axis

The axes that will grow.

Defines how the layout grid column resp. row in the components parent container grows.

LayoutInfo


public virtual attribute LayoutInfo → (get,set)

value : Layout

The Layout info object.

The current layout settings of this component.

Defaults to LayoutDefault.

LayoutLimit


public attribute LayoutLimit → (get,set)

value : Vec2I

The maximum size. A value equal to 0 means no maximum size limit.

The maximum size of this component, in pixels.

LayoutMargin


public attribute LayoutMargin → (get,set)

value : Edging

The outer margin.

The outer margin of this component.

LayoutShrink


public attribute LayoutShrink → (get,set)

value : Axis

The axes that will shrink.

Defines how the layout grid column resp. row in the components parent container grows.

LayoutSize


public attribute LayoutSize → (get,set)

value : Vec2I

The minimum size.

The minimum size of this component, in pixels.

OnAction


public attribute OnAction → (get)

value : IEventGeneric<Component>

[not-null]
The event object.

The components default action has been triggered.

Parent


public attribute Parent → (get)

value : Container

The parent container or null if this component is the root.

The parent container of this component.

ParentCorners


public attribute ParentCorners → (get)

value : Corner

The shared client area corners.

Returns the corners that this component shares with the client area of its parent container.

ParentEdges


public attribute ParentEdges → (get)

value : Anchor

The shared client area edges.

Returns the edges that this component shares with the client area of its parent container.

State


public virtual attribute State → (get,set)

value : ComponentState

The component state.

The component state.

StyleClassType


public abstract attribute StyleClassType → (get)

value : StyleClass

The style class (e.g. 'InputField' for InputField).

Returns the style class for this component type.

StyleClassVariant


public attribute StyleClassVariant → (get,set)

value : string

The variant name or null.

Optional style class variant of this component.

Stylesheet


public attribute Stylesheet → (get,set)

value : Stylesheet

The stylesheet object to use or null.

The stylesheet object to use for this user interface element.

Protected / Constructors

Component


protected constructor Component → ()

Creates a new instance of Component.

Protected / Methods

ActionClick


protected virtual method ActionClick → ()

The action click has been performed.

The default implementation simply calls ActionNotify.

See also

Component.Action

ActionNotify


protected method ActionNotify → (1)

flash opt : bool = true

Render a visual flash to indicate the action?

Notifies all listeners of the OnAction event.

BorderColor


protected method BorderColor → (1)

border in : bool

true for a visible border, false for a border the blends with the background.

returns → int64

The border color (see Colors).

Returns the border color to use for this component in its current state.

ComputeLayoutBaseline


protected virtual method ComputeLayoutBaseline → ()

returns → int32

The actual layout baseline.

Computes the actual layout baseline of this component.

The default implementation returns the current value of Style.Baseline, which defaults to 0, i.e. no baseline. Subclasses may return a different value.

Subclasses must call InvalidateLayout with LayoutAction.ComputeLayoutGridExtend to notify when ComputeLayoutBaseline returns a different value.

ComputeLayoutMargin


protected virtual method ComputeLayoutMargin → ()

returns → Edging

The actual margin value.

Computes the actual margin of this component.

The default implementation returns LayoutMargin. Subclasses can perform additional computations here.

Subclasses must call InvalidateLayout with LayoutAction.ComputeLayoutGridExtend to notify when ComputeLayoutMargin returns a different value.

ComputeLayoutSize


protected virtual method ComputeLayoutSize → ()

returns → Vec2I

The actual requested layout size.

Computes the actual requested layout size of this component.

During layout computations, the ComputeLayoutSize will always be called first, so subclasses may compute and store information here and rely on that information later.

The default implementation returns the maximum of LayoutSize and the current value of the Style.Size style (which defaults to Vec2I.Zero) and adds the horizontal and vertical padding. Subclasses can perform additional computations here.

Subclasses must call InvalidateLayout with LayoutAction.ComputeLayoutGridExtend to notify when ComputeLayoutSize returns a different value.

ConsumeKeyboard


[EmptyBody]
protected virtual method ConsumeKeyboard → (1)

key in : InputEvent

The mouse event.

returns → bool

true if the component has consumed the input event, false if not.

Processes the given input event.

ConsumeKeyboardScroll


protected method ConsumeKeyboardScroll → (2)

key in : InputEvent

The key input event.

modifiers opt : InputModifiers = InputModifiers.Shift

The required modifiers for performing scrolling actions.

returns → bool

true if a scrolling action has been performed, false if not.

Applies default keyboard controls for scrolling.

ConsumeMouse


protected virtual method ConsumeMouse → (1)

mouse in : InputEvent

The mouse event, translated to the client-area of this component.

returns → bool

true if the component has consumed the input event, false if not.

Processes the given input event.

The default implementation calls IFocusable.Focus if focusable (see Focusable) when pressing the left mouse button.

ConsumeMouseScroll


protected method ConsumeMouseScroll → (3)

mouse in : InputEvent

The mouse event, translated to the client-area of this component.

allowMouseWheel opt : bool = false

Use mouse wheel rotation for scrolling?

mouseButtons opt : InputModifiers = InputModifiers.Middle

The mouse buttons to drag for scrolling.

returns → bool

true if a scrolling action has been performed, false if not.

Applies default mouse controls for scrolling.

Dirty


protected method Dirty → ()

Causes IUpdateableFrameTime.UpdateFrameTime to return true once when called the next time.

DoRender


[EmptyBody]
protected virtual method DoRender → (1)

graphics in : Graphics

The Graphics object to use.

Performs component specific rendering.

DoStylesheetApply


protected virtual method DoStylesheetApply → ()

Applies the current stylesheet settings to this component.

Implementing methods should query fetch style property values and store them somewhere for using them later quickly.

All graphics resources that are acquired during DoStylesheetApply must be properly disposed in IGraphicsComponent.GraphicsDetach.

DrawBackground


protected method DrawBackground → (2)

border in : bool

Draw a border?

round opt : int32 = 4

Size of round corners.

Draws the background rectangle of this component.

DrawHint


protected method DrawHint → (4)

text in : string

The hint text.

in : int32

X-coordinate of anchor point.

in : int32

Y-coordinate of anchor point.

anchor in : Anchor

The text anchor point.

Draws a hint text.

DrawString


protected method DrawString → (4)

text in : string

The text.

in : int32

X-coordinate of anchor point.

in : int32

Y-coordinate of anchor point.

anchor in : Anchor

The text anchor point.

Draws a text.

InvalidateLayout


protected method InvalidateLayout → (1)

layoutAction opt : LayoutAction = LayoutAction.ComputeLayoutGridExtend

The layout action that needs to be performed.

Invalidates the layout grid of the parent container of this component.

OnBoundsChanged


[EmptyBody]
protected virtual method OnBoundsChanged → ()

This method is called each time the Bounds of this component have changed.

OnFocusChanged


[EmptyBody]
protected virtual method OnFocusChanged → ()

This method is called when this component has lost or gained the input focus.

Depending on the value of IsFocussed when this method is called, the following holds true:
true: the component has gained input focus.
false: the component has gained input focus.

OnGraphicsAttached


protected virtual method OnGraphicsAttached → (1)

graphics in : Graphics

The Graphics object to use.

This method is called when this component is attached to the a graphics component.

OnHoveredClear


protected virtual method OnHoveredClear → ()

Clears the IsHovered state.

OnLayoutValidated


[EmptyBody]
protected virtual method OnLayoutValidated → ()

The layout of this component has been validated.

SetBounds


protected virtual method SetBounds → (2)

screenBounds in : Box2I

The screen bounds.

scrollSize in : Vec2I

The scroll size.

returns → bool

true if the component bounds have changed, false if not.

Sets the bounds of this component in its parent containers client area.

Shown


[EmptyBody]
protected virtual method Shown → ()

This method is called once after the component has been shown initially.

Protected / Attributes

color


protected attribute color → (ColorScheme)

The current color scheme.

graphics


protected attribute graphics → (Graphics)

The current Graphics object or null if this component is not attached.

IsAttached


protected attribute IsAttached → (get)

value : bool

true if this component is attached to a live hierarchy, false if not.

Is this component currently attached to a live component hierarchy?

padding


protected attribute padding → (Edging)

The inner padding, based on the Style.Padding style.

textFont


[Owner]
protected attribute textFont → (PixelFont)

The Style.TextFont value for this component.

textFontHint


[Owner]
protected attribute textFontHint → (PixelFont)

The Style.TextFontHint value for this component.

Logging

Logger


public static readonly attribute Logger → (ILogger)

The logger object of this class.