UITreeView Class
Definition
Namespace: Brine2D.UI
Hierarchical tree widget with expand/collapse, single-row selection, keyboard navigation, and a virtual scrollbar.
Inheritance System.Object → UITreeView
Implements IUIComponent, IAnchoredUIComponent
Remarks
Populate via AddRoot\(UITreeNode\) or SetRoots\(IEnumerable<UITreeNode>\). Add to a UICanvas with Add\(IUIComponent\); the canvas handles all input routing automatically.
| Properties | |
|---|---|
| Font | Optional font. Null uses the renderer default. |
| HoveredIndex | Row index \(in the flattened visible list\) that is currently hovered, or -1. |
| IndentWidth | Indent step per depth level in pixels. Defaults to 16. |
| MinThumbSize | Minimum scrollbar thumb height in pixels. Defaults to 10. |
| Roots | Read-only access to the root nodes. |
| RowHeight | Pixel height of each tree row. Defaults to 22. |
| ScrollbarWidth | Width of the vertical scrollbar. Defaults to 10. |
| SelectedIndex | Row index \(in the flattened visible list\) that is currently selected, or -1. |
| SelectedNode | The currently selected node, or null. |
| Methods | |
|---|---|
| AddRoot\(UITreeNode\) | Adds a root-level node and marks the flat list as dirty. |
| ClearRoots() | Removes all root nodes. |
| Invalidate() | Forces the flat visible list to be rebuilt on the next render or hit-test call. Call this after externally modifying node children or expanded state. |
| SetRoots\(IEnumerable<UITreeNode>\) | Replaces all roots and resets scroll/selection. |
| Events | |
|---|---|
| OnFocusGained | Fired when keyboard focus is gained. |
| OnFocusLost | Fired when keyboard focus is lost. |
| OnNodeToggled | Fired when a node is expanded or collapsed. Argument is the toggled node. |
| OnSelectionChanged | Fired when the selected node changes. Argument is the newly selected node \(null = deselected\). |