namespace Terminal.Gui;
///
/// Interface to implement when you want the regular (non-generic) to automatically
/// determine children for your class (without having to specify an )
///
public interface ITreeNode
{
/// The children of your class which should be rendered underneath it when expanded
///
IList Children { get; }
/// Optionally allows you to store some custom data/class here.
object Tag { get; set; }
/// Text to display when rendering the node
string Text { get; set; }
}
/// Simple class for representing nodes, use with regular (non-generic) .
public class TreeNode : ITreeNode
{
/// Initialises a new instance with no
public TreeNode () { }
/// Initialises a new instance and sets starting
public TreeNode (string text) { Text = text; }
/// Children of the current node
///
public virtual IList Children { get; set; } = new List ();
/// Text to display in tree node for current entry
///
public virtual string Text { get; set; }
/// Optionally allows you to store some custom data/class here.
public object Tag { get; set; }
/// returns
///
public override string ToString () { return Text ?? "Unnamed Node"; }
}