Class InlineMultiControl
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
shellICliAppShell- The shell hosting the control.
Properties
FocusedWidget
The currently focused widget, or
null when none is focused.protected InlineWidget? FocusedWidget { get; }
Property Value
FocusedWidgetIndex
Index of the currently focused widget slot, or
-1 when none is focused.protected int FocusedWidgetIndex { get; }
Property Value
FocusedWidgetSlot
The currently focused widget slot metadata, or
null when none is focused.protected InlineMultiControl.InlineMultiControlWidget? FocusedWidgetSlot { get; }
Property Value
Hint
Hint for the focused slot or widget.
public override string? Hint { get; }
Property Value
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
Widgets
Registered widget slots in focus/navigation order.
protected IReadOnlyList<InlineMultiControl.InlineMultiControlWidget> Widgets { get; }
Property Value
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
widgetInlineWidgetareaInlineDialogAreadecorationCliControlDecorationscrollModeCliScrollModethumbModeCliScrollThumbModecontentStyleCliCellStylehintstring
Returns
GetWidgets()
Returns widget descriptors for the hosting dialog, with exactly the focused slot marked active.
public override IReadOnlyList<InlineDialogWidget> GetWidgets()
Returns
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
keyKeyEvent
Returns
HandleKey(KeyEvent)
Handles Tab/Shift+Tab focus traversal, otherwise routes to the focused widget.
public override InlineKeyResult HandleKey(KeyEvent key)
Parameters
keyKeyEvent
Returns
OnFocusChanged(int, int)
Called after focus changes from one widget index to another.
protected virtual void OnFocusChanged(int previousIndex, int currentIndex)
Parameters
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
indexint
Returns
ToGrid()
Renders the focused widget grid, or an empty grid when no widget exists.
public override CliGrid ToGrid()