Skip to content

TableNode<TRow> ​

Namespace: Hex1b.Nodes

Assembly: Hex1b.dll

Node for rendering a table with columns, rows, and optional header/footer. Implements ILayoutProvider to clip scrollable content area.

csharp
public class TableNode<TRow> : Hex1bNode, ILayoutProvider, IDisposable

Inheritance ​

Object → Hex1bNode → TableNode<TRow>

Implements ​

Properties ​

ClipMode ​

The clip mode for this layout region.

Returns: ClipMode

csharp
public ClipMode ClipMode { get; }

ClipRect ​

The clip rectangle for the scrollable content area.

Returns: Rect

csharp
public Rect ClipRect { get; }

Data ​

The data source for table rows.

Returns: IReadOnlyList<<TRow>>

csharp
public IReadOnlyList<TRow>? Data { get; set; }

DataSource ​

Async data source for virtualized tables. When set, Data property is ignored.

Returns: ITableDataSource<<TRow>>

csharp
public ITableDataSource<TRow>? DataSource { get; set; }

DeselectAllCallback ​

Callback invoked when deselect all is triggered.

Returns: Action

csharp
public Action? DeselectAllCallback { get; set; }

EmptyBuilder ​

Builder for empty state widget.

Returns: Func<RootContext, Hex1bWidget>

csharp
public Func<RootContext, Hex1bWidget>? EmptyBuilder { get; set; }

FocusChangedHandler ​

Handler for focus changes.

Returns: Func<Object, Task>

csharp
public Func<object?, Task>? FocusChangedHandler { get; set; }

FocusedKey ​

The key of the currently focused row.

Returns: Object

csharp
public object? FocusedKey { get; set; }

FooterBuilder ​

Builder for footer cells.

Returns: Func<TableFooterContext, TableCell>>

csharp
public Func<TableFooterContext, IReadOnlyList<TableCell>>? FooterBuilder { get; set; }

HeaderBuilder ​

Builder for header cells.

Returns: Func<TableHeaderContext, TableCell>>

csharp
public Func<TableHeaderContext, IReadOnlyList<TableCell>>? HeaderBuilder { get; set; }

IsFocusable ​

Returns true if this node can receive focus.

Returns: Boolean

csharp
public override bool IsFocusable { get; }

IsFocused ​

Gets or sets whether this node is currently focused. Only meaningful for focusable nodes (where IsFocusable is true).

Returns: Boolean

csharp
public override bool IsFocused { get; set; }

IsScrollable ​

Whether the table content is scrollable (more rows than viewport).

Returns: Boolean

csharp
public bool IsScrollable { get; }

IsSelectedSelector ​

Selector to determine if a row is selected (reads from view model).

Returns: Func<<TRow>, Boolean>

csharp
public Func<TRow, bool>? IsSelectedSelector { get; set; }

MaxScrollOffset ​

The maximum scroll offset.

Returns: Int32

csharp
public int MaxScrollOffset { get; }

ParentLayoutProvider ​

Parent layout provider for nested clipping.

Returns: ILayoutProvider

csharp
public ILayoutProvider? ParentLayoutProvider { get; set; }

RenderMode ​

The render mode for the table (Compact or Full).

Returns: TableRenderMode

csharp
public TableRenderMode RenderMode { get; set; }

RowActivatedHandler ​

Handler for row activation.

Returns: Func<Object, <TRow>, Task>

csharp
public Func<object, TRow, Task>? RowActivatedHandler { get; set; }

RowBuilder ​

Builder for row cells. Receives row context, row data, and row state.

Returns: Func<TableRowContext, <TRow>, TableRowState, TableCell>>

csharp
public Func<TableRowContext, TRow, TableRowState, IReadOnlyList<TableCell>>? RowBuilder { get; set; }

RowKeySelector ​

Selector function to extract a unique key from each row.

Returns: Func<<TRow>, Object>

csharp
public Func<TRow, object>? RowKeySelector { get; set; }

ScrollOffset ​

The current scroll offset (first visible row index).

Returns: Int32

csharp
public int ScrollOffset { get; }

SelectAllCallback ​

Callback invoked when select all is triggered.

Returns: Action

csharp
public Action? SelectAllCallback { get; set; }

SelectionChangedCallback ​

Callback invoked when a row's selection state changes.

Returns: Action<<TRow>, Boolean>

csharp
public Action<TRow, bool>? SelectionChangedCallback { get; set; }

ShowSelectionColumn ​

Whether to show a selection column with checkboxes.

Returns: Boolean

csharp
public bool ShowSelectionColumn { get; set; }

ViewportRowCount ​

The number of rows visible in the viewport.

Returns: Int32

csharp
public int ViewportRowCount { get; }

Methods ​

ArrangeCore(Rect) ​

Override this method to implement arranging logic for this node. The base implementation saves previous bounds, marks dirty on change, and sets bounds.

Parameters:

csharp
protected override void ArrangeCore(Rect rect)

ClipString(int, int, string) ​

Clips a string that starts at the given position, returning only the visible portion.

Parameters:

Returns: ValueTuple<Int32, String>

csharp
public (int adjustedX, string clippedText) ClipString(int x, int y, string text)

ConfigureDefaultBindings(InputBindingsBuilder) ​

Configures the default input bindings for this node type. Override in derived classes to add default key bindings. These bindings can be inspected and modified by the user's callback.

Parameters:

csharp
public override void ConfigureDefaultBindings(InputBindingsBuilder bindings)

Dispose() ​

Disposes resources and unsubscribes from events.

csharp
public void Dispose()

GetEffectiveData() ​

Gets the effective data to use, either from Data property or cached from DataSource.

Returns: IReadOnlyList<<TRow>>

csharp
public IReadOnlyList<TRow>? GetEffectiveData()

GetEffectiveItemCount() ​

Gets the total item count, either from Data or cached from DataSource.

Returns: Int32

csharp
public int GetEffectiveItemCount()

GetFocusableNodes() ​

Returns focusable nodes including this table and any focusable children in row cells.

Returns: IEnumerable<Hex1bNode>

csharp
public override IEnumerable<Hex1bNode> GetFocusableNodes()

GetVisibleRowRange(int) ​

Gets the range of rows that should be materialized (visible + buffer).

Parameters:

  • totalRows (Int32): Total number of data rows.

Returns: ValueTuple<Int32, Int32>

Tuple of (startIndex, endIndex) for rows to materialize.

csharp
public (int Start, int End) GetVisibleRowRange(int totalRows)

LoadDataAsync(int, int, CancellationToken) ​

Loads data from the async data source for the visible range. Called during reconciliation.

Parameters:

Returns: ValueTask

csharp
public ValueTask LoadDataAsync(int startIndex, int count, CancellationToken cancellationToken = default)

MeasureCore(Constraints) ​

Override this method to implement measuring logic for this node.

Parameters:

Returns: Size

csharp
protected override Size MeasureCore(Constraints constraints)

Render(Hex1bRenderContext) ​

Renders the node to the given context.

Parameters:

csharp
public override void Render(Hex1bRenderContext context)

ShouldRenderAt(int, int) ​

Determines if a character at the given absolute position should be rendered.

Parameters:

Returns: Boolean

csharp
public bool ShouldRenderAt(int x, int y)

Released under the MIT License.