Skip to content
ConsoleMonster

API Reference

Class

Tree

Namespace ConsoleMonster.Widgets
Assembly ConsoleMonster
Source Tree.cs:84
Implements
Modifiers sealed

A hierarchy with guide lines (├──, └──, │ on Full/Basic; |-- on Ascii). Guides use the border colour so the labels carry the attention. Long labels are truncated with an ellipsis.

Inheritance

  • Object
  • Tree

Usage

Explore 15 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 9

Accepted by parameters 6

Constructors

public Tree(String? rootLabel = null) #

Creates a tree.

Parameters

rootLabel System.String? = null optionalposition: 0
The root label (markup), or null to show only the children as top-level nodes.

Methods

Add 2 overloads
public TreeNode Add(String label, StatusKind? status = null, String? note = null) #
Returns: TreeNode

Adds a top-level node.

Parameters

label System.String requiredposition: 0
The label (markup).
status ConsoleMonster.Styling.StatusKind? = null optionalposition: 1
An optional status.
note System.String? = null optionalposition: 2
An optional muted note.

Returns

The new node.

public TreeNode Add(RichText label, StatusKind? status = null, String? note = null) #
Returns: TreeNode

Adds a top-level node with a multicolour label.

Parameters

label ConsoleMonster.Text.RichText requiredposition: 0
The label.
status ConsoleMonster.Styling.StatusKind? = null optionalposition: 1
An optional status.
note System.String? = null optionalposition: 2
An optional muted note.

Returns

The new node.

public Size Measure(Constraints constraints, RenderContext context) #
Returns: Size

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints requiredposition: 0
The space offered.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Returns

The desired size, never larger than the constraints.

public Void Render(Region region, RenderContext context) #
Returns: Void

Renders into a region. The region may be smaller or larger than the measured size.

Parameters

region ConsoleMonster.Canvas.Region requiredposition: 0
The target region.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Properties

public TreeNode Root { get; } #

The root node.

public Boolean ShowRoot { get; set; } #

Whether the root label is shown.

public PresentationOptions Presentation { get; set; } #

Culture, clock and time zone for node values.

Extension Methods

WithPresentation 2 overloads
public static Tree WithPresentation(Tree tree, PresentationOptions value) #
Returns: Tree

Sets Tree.Presentation: Culture, clock and time zone for node values.

Parameters

tree ConsoleMonster.Widgets.Tree requiredposition: 0
The instance.
value ConsoleMonster.Presenters.PresentationOptions requiredposition: 1
The value.

Returns

The same instance.

public static Tree WithPresentation(Tree tree, Action<PresentationOptions> configure) #
Returns: Tree

Configures Tree.Presentation in place (creating it when not set): Culture, clock and time zone for node values.

Parameters

tree ConsoleMonster.Widgets.Tree requiredposition: 0
The instance.
configure System.Action<ConsoleMonster.Presenters.PresentationOptions> requiredposition: 1
Configures the value.

Returns

The same instance.

public static Tree WithRoot(Tree tree, Action<TreeNode> configure) #
Returns: Tree

Configures Tree.Root in place: The root node.

Parameters

tree ConsoleMonster.Widgets.Tree requiredposition: 0
The instance.
configure System.Action<ConsoleMonster.Widgets.TreeNode> requiredposition: 1
Configures the value.

Returns

The same instance.

public static Tree WithShowRoot(Tree tree, Boolean value = true) #
Returns: Tree

Sets Tree.ShowRoot: Whether the root label is shown.

Parameters

tree ConsoleMonster.Widgets.Tree requiredposition: 0
The instance.
value System.Boolean = true optionalposition: 1
The value (default true).

Returns

The same instance.