TreeItemNode
Namespace: Hex1b
Assembly: Hex1b.dll
Render node for a single tree item. Managed by the parent TreeNode which handles tree structure and navigation.
public sealed class TreeItemNode : Hex1bNodeInheritance
Object → Hex1bNode → TreeItemNode
Properties
CanExpand
Determines if this item can be expanded (has children or hints at having children).
Returns: Boolean
public bool CanExpand { get; }CheckboxNode
Checkbox node for multi-select mode. Null when not in multi-select.
Returns: CheckboxNode
public CheckboxNode? CheckboxNode { get; set; }Children
Child tree item nodes.
Returns: IReadOnlyList<TreeItemNode>
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
public int Depth { get; set; }ExpandIndicatorNode
Expand indicator node (▶/▼). Null for leaf nodes.
Returns: IconNode
public IconNode? ExpandIndicatorNode { get; set; }HasChildren
Whether this item has children (actual or hinted for lazy loading).
Returns: Boolean
public bool HasChildren { get; set; }Icon
Optional icon/emoji prefix displayed before the label.
Returns: String
public string? Icon { get; set; }IsExpanded
Returns: Boolean
public bool IsExpanded { get; set; }IsFocusable
Returns true if this node can receive focus.
Returns: Boolean
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
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
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[]
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
public bool IsLastChild { get; set; }IsLoading
Whether children are currently being loaded (async lazy load in progress).
Returns: Boolean
public bool IsLoading { get; set; }IsSelected
Returns: Boolean
public bool IsSelected { get; set; }Label
The display label for this item.
Returns: String
public string Label { get; set; }LoadingSpinnerNode
Spinner node for loading animation. Reconciled when IsLoading is true.
Returns: SpinnerNode
public SpinnerNode? LoadingSpinnerNode { get; set; }SourceWidget
The source widget for this node.
Returns: TreeItemWidget
public TreeItemWidget? SourceWidget { get; set; }UserIconNode
User icon node. Null if no icon specified.
Returns: IconNode
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.
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
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:
bindings(InputBindingsBuilder): The builder to add bindings to.
public override void ConfigureDefaultBindings(InputBindingsBuilder bindings)GetChildren()
Gets the composed child nodes (indicator, checkbox, icon) for hit testing.
Returns: IEnumerable<Hex1bNode>
public override IEnumerable<Hex1bNode> GetChildren()GetData<T>()
Gets the typed data associated with this item.
Returns: <T>
The data cast to the specified type.
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.
public T? GetDataOrDefault<T>(T? defaultValue = default)GetDisplayText()
Gets the display text for this item (icon + label).
Returns: String
public string GetDisplayText()GetFocusableNodes()
Gets focusable nodes in this item's composed children. The checkbox is focusable for click handling.
Returns: IEnumerable<Hex1bNode>
public override IEnumerable<Hex1bNode> GetFocusableNodes()MeasureCore(Constraints)
Override this method to implement measuring logic for this node.
Parameters:
constraints(Constraints):
Returns: Size
protected override Size MeasureCore(Constraints constraints)Render(Hex1bRenderContext)
Renders the node to the given context.
Parameters:
context(Hex1bRenderContext):
public override void Render(Hex1bRenderContext context)SetSelectionCascade(bool)
Sets the selection state for this item and all descendants (for cascade selection).
Parameters:
selected(Boolean):
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.
public bool TryGetData<T>(out T data)