ConsoleForge 0.3.0
Elm-architecture TUI framework for .NET 8
Loading...
Searching...
No Matches
ConsoleForge.Core.FocusManager Class Reference

Stateless helper that traverses a widget tree depth-first and finds all IFocusable instances in declaration order. More...

Static Public Member Functions

static IReadOnlyList< IFocusableCollectFocusable (IWidget root)
 Collect all IFocusable widgets from the tree rooted at root in depth-first, declaration order.
static IReadOnlyList< string > CollectFocusKeys (IWidget root)
 Collect the focus key of every IFocusable in the tree rooted at root , in depth-first, declaration order.
static ? IFocusable FindFocusableAt (IWidget root, ResolvedLayout layout, int col, int row)
 Returns the IFocusable whose allocated region in layout contains the point (col , row ), or null if none.
static ? string GetNext (string? currentKey, IReadOnlyList< string > keys)
 Return the key after currentKey in keys , wrapping past the end.
static ? string GetPrev (string? currentKey, IReadOnlyList< string > keys)
 Return the key before currentKey in keys , wrapping past the start.

Detailed Description

Stateless helper that traverses a widget tree depth-first and finds all IFocusable instances in declaration order.

Member Function Documentation

◆ CollectFocusKeys()

IReadOnlyList< string > ConsoleForge.Core.FocusManager.CollectFocusKeys ( IWidget root)
static

Collect the focus key of every IFocusable in the tree rooted at root , in depth-first, declaration order.

A widget whose IFocusable.FocusKey is null is skipped — it is not a focus target.

◆ FindFocusableAt()

? IFocusable ConsoleForge.Core.FocusManager.FindFocusableAt ( IWidget root,
ResolvedLayout layout,
int col,
int row )
static

Returns the IFocusable whose allocated region in layout contains the point (col , row ), or null if none.

When multiple widgets overlap (e.g. inside a ZStack), the last one in depth-first order wins (topmost layer).

◆ GetNext()

? string ConsoleForge.Core.FocusManager.GetNext ( string? currentKey,
IReadOnlyList< string > keys )
static

Return the key after currentKey in keys , wrapping past the end.

If currentKey is null or not present, returns the first key. Returns null if keys is empty.

◆ GetPrev()

? string ConsoleForge.Core.FocusManager.GetPrev ( string? currentKey,
IReadOnlyList< string > keys )
static

Return the key before currentKey in keys , wrapping past the start.

If currentKey is null or not present, returns the last key. Returns null if keys is empty.


The documentation for this class was generated from the following file:
  • src/ConsoleForge/Core/FocusManager.cs