Table of Contents

Class InlineMultiControl

Namespace
ItTiger.TigerCli.Tui.Controls
Assembly
ItTiger.TigerCli.dll
Base class for dialog-hostable inline controls composed from several top-level widgets.
public abstract class InlineMultiControl : InlineControlBase, ICliRenderable
Inheritance
InlineMultiControl
Implements
Derived
Inherited Members

Remarks

Composite controls keep the dialog contract as one hosted control while arranging several reusable InlineWidget instances across InlineDialogArea regions. Tab moves focus forward, Shift+Tab moves focus backward, and other keys are routed to the focused widget through HandleFocusedWidgetKey(KeyEvent). Non-focusable widgets are skipped by focus traversal.

Constructors

InlineMultiControl(ICliAppShell)

Creates a composite control hosted by the supplied shell.
protected InlineMultiControl(ICliAppShell shell)

Parameters

shell ICliAppShell
The shell hosting the control.

Properties

FocusedWidget

The currently focused widget, or null when none is focused.
protected InlineWidget? FocusedWidget { get; }

Property Value

InlineWidget

FocusedWidgetIndex

Index of the currently focused widget slot, or -1 when none is focused.
protected int FocusedWidgetIndex { get; }

Property Value

int

FocusedWidgetSlot

The currently focused widget slot metadata, or null when none is focused.
protected InlineMultiControl.InlineMultiControlWidget? FocusedWidgetSlot { get; }

Property Value

InlineMultiControl.InlineMultiControlWidget

Hint

Hint for the focused slot or widget.
public override string? Hint { get; }

Property Value

string

HintReservedWidth

Reserves width for the widest hint this composite can surface across all of its widget slots, so moving focus between widgets (and thus changing the exposed hint) does not resize the dialog.
public override int HintReservedWidth { get; }

Property Value

int

Widgets

Registered widget slots in focus/navigation order.
protected IReadOnlyList<InlineMultiControl.InlineMultiControlWidget> Widgets { get; }

Property Value

IReadOnlyList<InlineMultiControl.InlineMultiControlWidget>

Methods

AddWidget(InlineWidget, InlineDialogArea, CliControlDecoration, CliScrollMode, CliScrollThumbMode, CliCellStyle?, string?)

Registers a widget slot and returns its index. The first focusable widget is focused automatically.
protected int AddWidget(InlineWidget widget, InlineDialogArea area, CliControlDecoration decoration = CliControlDecoration.None, CliScrollMode scrollMode = CliScrollMode.None, CliScrollThumbMode thumbMode = CliScrollThumbMode.Offset, CliCellStyle? contentStyle = null, string? hint = null)

Parameters

widget InlineWidget
area InlineDialogArea
decoration CliControlDecoration
scrollMode CliScrollMode
thumbMode CliScrollThumbMode
contentStyle CliCellStyle
hint string

Returns

int

GetWidgets()

Returns widget descriptors for the hosting dialog, with exactly the focused slot marked active.
public override IReadOnlyList<InlineDialogWidget> GetWidgets()

Returns

IReadOnlyList<InlineDialogWidget>

HandleFocusedWidgetKey(KeyEvent)

Handles a non-focus-traversal key for the focused widget. Override to coordinate domain state across widgets before or after forwarding the key.
protected virtual InlineKeyResult HandleFocusedWidgetKey(KeyEvent key)

Parameters

key KeyEvent

Returns

InlineKeyResult

HandleKey(KeyEvent)

Handles Tab/Shift+Tab focus traversal, otherwise routes to the focused widget.
public override InlineKeyResult HandleKey(KeyEvent key)

Parameters

key KeyEvent

Returns

InlineKeyResult

OnFocusChanged(int, int)

Called after focus changes from one widget index to another.
protected virtual void OnFocusChanged(int previousIndex, int currentIndex)

Parameters

previousIndex int
currentIndex int

SetFocusedWidgetIndex(int)

Moves focus to a focusable widget slot by index. Returns false when the index is invalid or the target widget is not focusable.
protected bool SetFocusedWidgetIndex(int index)

Parameters

index int

Returns

bool

ToGrid()

Renders the focused widget grid, or an empty grid when no widget exists.
public override CliGrid ToGrid()

Returns

CliGrid