Skip to content

TreeItemNode ​

Namespace: Hex1b

Assembly: Hex1b.dll

Render node for a single tree item. Managed by the parent TreeNode which handles tree structure and navigation.

csharp
public sealed class TreeItemNode : Hex1bNode

Inheritance ​

Object → Hex1bNode → TreeItemNode

Properties ​

CanExpand ​

Determines if this item can be expanded (has children or hints at having children).

Returns: Boolean

csharp
public bool CanExpand { get; }

CheckboxNode ​

Checkbox node for multi-select mode. Null when not in multi-select.

Returns: CheckboxNode

csharp
public CheckboxNode? CheckboxNode { get; set; }

Children ​

Child tree item nodes.

Returns: IReadOnlyList<TreeItemNode>

csharp
public IReadOnlyList<TreeItemNode> Children { get; set; }

Depth ​

The depth of this item in the tree (0 = root level). Set by the parent TreeNode during arrangement.

Returns: Int32

csharp
public int Depth { get; set; }

ExpandIndicatorNode ​

Expand indicator node (▶/▼). Null for leaf nodes.

Returns: IconNode

csharp
public IconNode? ExpandIndicatorNode { get; set; }

HasChildren ​

Whether this item has children (actual or hinted for lazy loading).

Returns: Boolean

csharp
public bool HasChildren { get; set; }

Icon ​

Optional icon/emoji prefix displayed before the label.

Returns: String

csharp
public string? Icon { get; set; }

IsExpanded ​

Returns: Boolean

csharp
public bool IsExpanded { 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; }

IsHovered ​

Gets or sets whether the mouse is currently hovering over this node. Set by Hex1bApp based on mouse position during each frame. Only set on focusable nodes (tracked via FocusRing hit testing).

Returns: Boolean

csharp
public override bool IsHovered { get; set; }

IsLastAtDepth ​

Array tracking whether ancestors at each depth are last children. Used by TreeNode to draw correct vertical guide lines.

Returns: Boolean[]

csharp
public bool[] IsLastAtDepth { get; set; }

IsLastChild ​

Whether this is the last child at its level. Used by TreeNode to draw correct guide lines.

Returns: Boolean

csharp
public bool IsLastChild { get; set; }

IsLoading ​

Whether children are currently being loaded (async lazy load in progress).

Returns: Boolean

csharp
public bool IsLoading { get; set; }

IsSelected ​

Returns: Boolean

csharp
public bool IsSelected { get; set; }

Label ​

The display label for this item.

Returns: String

csharp
public string Label { get; set; }

LoadingSpinnerNode ​

Spinner node for loading animation. Reconciled when IsLoading is true.

Returns: SpinnerNode

csharp
public SpinnerNode? LoadingSpinnerNode { get; set; }

SourceWidget ​

The source widget for this node.

Returns: TreeItemWidget

csharp
public TreeItemWidget? SourceWidget { get; set; }

UserIconNode ​

User icon node. Null if no icon specified.

Returns: IconNode

csharp
public IconNode? UserIconNode { get; set; }

Methods ​

ArrangeComposedNodes(int, int, Hex1bTheme) ​

Arranges the composed child nodes with real bounds. Called by TreeNode during arrangement.

Parameters:

  • x (Int32): Starting X position for this item's content (after guides).
  • y (Int32): Y position for this item.
  • theme (Hex1bTheme): Theme for measuring elements.
csharp
public void ArrangeComposedNodes(int x, int y, Hex1bTheme theme)

ComputeSelectionState() ​

Computes the selection state for cascade selection mode. Returns Selected if this item and all descendants are selected, Indeterminate if some descendants are selected, None otherwise.

Returns: TreeSelectionState

csharp
public TreeSelectionState ComputeSelectionState()

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)

GetChildren() ​

Gets the composed child nodes (indicator, checkbox, icon) for hit testing.

Returns: IEnumerable<Hex1bNode>

csharp
public override IEnumerable<Hex1bNode> GetChildren()

GetData<T>() ​

Gets the typed data associated with this item.

Returns: <T>

The data cast to the specified type.

csharp
public T GetData<T>()

GetDataOrDefault<T>(T?) ​

Gets the typed data, or a default value if not set or wrong type.

Parameters:

  • defaultValue (<T>): The default value to return if data is not available.

Returns: <T>

The data or the default value.

csharp
public T? GetDataOrDefault<T>(T? defaultValue = default)

GetDisplayText() ​

Gets the display text for this item (icon + label).

Returns: String

csharp
public string GetDisplayText()

GetFocusableNodes() ​

Gets focusable nodes in this item's composed children. The checkbox is focusable for click handling.

Returns: IEnumerable<Hex1bNode>

csharp
public override IEnumerable<Hex1bNode> GetFocusableNodes()

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)

SetSelectionCascade(bool) ​

Sets the selection state for this item and all descendants (for cascade selection).

Parameters:

csharp
public void SetSelectionCascade(bool selected)

TryGetData<T>(out T) ​

Tries to get the typed data associated with this item.

Parameters:

  • data (<T>): The data if successful, default otherwise.

Returns: Boolean

True if data exists and matches the type, false otherwise.

csharp
public bool TryGetData<T>(out T data)

Released under the MIT License.