ComponentBuilder

Description

struct Tinman.Engine.GUI.ComponentBuilder

A helper for performing additional building on Component objects, usually after having added them to a Container.

Public / Methods

With​Action

3 overloads


public method WithAction1 → (2)

key in : KeyboardKey

The keyboard key.

modifier opt : InputModifiers = InputModifiers.None

The input modifiers.

returns → ComponentBuilder

this


public method WithAction2 → (2)

button in : MouseButton

The mouse button.

modifier opt : InputModifiers = InputModifiers.None

The input modifiers.

returns → ComponentBuilder

this


public method WithAction3 → (1)

click in : InputClick

The input click.

returns → ComponentBuilder

this

With​Delegate

2 overloads


public method WithDelegate1 → (1)

listener in : EventDelegate

The listener to add or null to add nothing.

returns → ComponentBuilder

this

Adds the given listener in to Component.OnAction.


public method WithDelegate2 → (1)

listener in : EventDelegateGeneric<Component>

The listener to add or null to add nothing.

returns → ComponentBuilder

this

Adds the given listener in to Component.OnAction.

With​Label


public method WithLabel → (2)

label in : string

The label text or null to not create a label.

layout opt : Layout = default(Layout)

The layout settings to use.

returns → ComponentBuilder

this

Adds a label for the component.

The grid bounds of the created LabelView will be derived from Box2I.X1 (x), Box2I.Y1 (y) and IBox2Ops.Width (w) of Component.LayoutGrid : if x is greater than zero, the grid bounds (x-1,y,1,1) are used. Otherwise, the grid bounds (x,y-1,w,1) are used.

With​Listener

2 overloads


public method WithListener1 → (1)

listener in : IEventListener

The listener to add or null to add nothing.

returns → ComponentBuilder

this

Adds the given listener in to Component.OnAction.


public method WithListener2 → (1)

listener in : IEventListenerGeneric<Component>

The listener to add or null to add nothing.

returns → ComponentBuilder

this

Adds the given listener in to Component.OnAction.

With​Option

2 overloads


public method WithOption1 → (2)

option in : string

The option to add or null to add nothing.

select opt : bool = false

Also set Choice.SelectedIndex to the added option?

returns → ComponentBuilder

this

Adds an option to Choice.Options.


public method WithOption2 → (2)

option in : ChoiceOption

The option to add or null to add nothing.

select opt : bool = false

Also set Choice.SelectedIndex to the added option?

returns → ComponentBuilder

this

Adds an option to Choice.Options.

With​Scroll​Bar


public method WithScrollBar → (2)

which opt : Axis = Axis.Vertical

The axes for which to add a scrollbar.

stateNotNeeded opt : ComponentState = ComponentState.Hidden

The value for ScrollBar.StateNotNeeded.

returns → ComponentBuilder

this

Adds a scroll bar to the current component.

Given the layout grid box (x,y,w,h) of the current component, the grids for the vertical and horizontal scroll bars are (x+w,y,1,h) and (x,y+h,w,1).

With​Style

2 overloads


public method WithStyle1 → (2)<T>

style in : StyleProperty<T>

The style property to set or null to set nothing.

value in : T

The value to set.

returns → ComponentBuilder

this

Sets a style with StyleProperty.Set1.


public method WithStyle2 → (3)<T>

style in : StyleProperty<T>

The style property to set or null to set nothing.

value in : T

The value to set.

styleClass in : StyleClass

The style class.

returns → ComponentBuilder

this

Sets a style with StyleProperty.Set2.

Wrap


public method Wrap → (1)

layout opt : Layout = default(Layout)

The layout values to use for the wrapping container. If Layout.LayoutFill, Layout.LayoutGrow or Layout.LayoutShrink is not set, it will default to Axis.Both.

returns → ComponentBuilder

this

Wraps the current component in a separate Container which then replaces the current component within its original parent.

The layout grid box of the current component is changed to (0,0,1,1) while retaining the other Layout values. The wrapping container uses the original layout grid box and the given layout opt values.