Vixen
02b45cc4
csharp
public sealed class TreeNode

One item of a TreeView.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A model object, not an element. A tree of a hundred thousand nodes has a hundred thousand of these and perhaps thirty rows on screen; making the node an element would put a style slot, a layout node and a draw command behind every one of them, which is exactly what doc 09 makes virtualisation a first-class primitive to avoid.

⚠ HasChildren is a claim, not a count. A node that has not been populated still has to draw a chevron — the project browser cannot enumerate a folder to find out whether it is worth showing one — so "might have children" and "has children loaded" are two different questions, and only the first is answerable cheaply.

Fields and properties (10)

  • public string? Text

    What it says.

  • public object? Tag

    Whatever the application hung off it.

  • public PathBuilder? Icon

    The glyph drawn between the chevron and the text, or null for none.

  • public IconArt? Art

    Several paths in colours of their own, drawn instead of Icon.

  • public TreeNode? Parent

    The node this is under, or null for a root.

  • public IReadOnlyList<TreeNode> Children

    Its children, in order.

  • public bool IsExpanded

    Whether its children are showing.

  • public bool HasChildren

    Whether it may have children, whether or not any have been loaded.

  • public Action<TreeNode>? Populate

    What to run the first time it is expanded, if its children are loaded on demand.

  • public int Depth

    How deep it is. A root is zero.

Methods (6)

  • public TreeNode(string? text = null, object? tag = null)

    Creates a node.

  • public TreeNode Add(TreeNode child, int index = -1)

    Adds a child.

  • public TreeNode Add(string? text, object? tag = null)

    Adds a child with some text.

  • public int IndexOf(TreeNode child)

    Where a child sits among the others, or -1 if it is not one.

  • public bool Remove(TreeNode child)

    Takes a child out.

  • public bool Contains(TreeNode node)

    Whether a node is this one or somewhere under it.

Used by (24)

  • ShellHelloUi
  • ResizeTestsVixen.Ui.Controls.Advanced.Tests
  • TreeRowVixen.Ui.Controls.Advanced
  • TreeViewVixen.Ui.Controls.Advanced
  • TreeViewTestsVixen.Ui.Controls.Advanced.Tests
  • AddressableGroupsViewVixen.Editor.AssetEditors
  • ChromeFixtureVixen.Editor.Ui.Tests
  • EditorAffordanceTestsVixen.Editor.App.Tests
  • EditorApplicationVixen.Editor.App
  • EditorSessionVixen.Editor.Testing
  • FrameDebuggerViewVixen.Editor.Debugger
  • GridViewTestsVixen.Editor.App.Tests
  • IconContributionTestsVixen.Editor.App.Tests
  • ImportViewTestsVixen.Editor.AssetEditors.Tests
  • InputActionsViewVixen.Editor.AssetEditors
  • InspectorPanelTestsVixen.Editor.App.Tests
  • ModelImportViewVixen.Editor.AssetEditors
  • OutlinerColumnTestsVixen.Editor.App.Tests
  • OutlinerTestsVixen.Editor.App.Tests
  • PanelBehaviourTestsVixen.Editor.App.Tests
  • ProjectBrowserVixen.Editor.App
  • RemoteInspectorViewVixen.Editor.Debugger
  • SceneHierarchyViewVixen.Editor.AssetEditors
  • SelectionTestsVixen.Editor.App.Tests