Wanzyee Studio

Item node to show and select in a TreeView window, optional to include child nodes. More...

Inherits IEnumerable< TreeNode >.

Public Member Functions

 TreeNode (string label, params TreeNode[] nodes)
 Initialize with specified label and child nodes. More...
 
 TreeNode (GUIContent label, params TreeNode[] nodes)
 Initialize with specified label and child nodes. More...
 
 TreeNode (string label, bool enable, bool expand=false, params TreeNode[] nodes)
 Initialize with specified label, default states, and child nodes. More...
 
 TreeNode (GUIContent label, bool enable, bool expand=false, params TreeNode[] nodes)
 Initialize with specified label, default states, and child nodes. More...
 
 TreeNode (object data, string label, bool enable=false)
 Initialize an end node with custom data and label. More...
 
TreeNode(object data, GUIContent label, bool enable=false) IEnumerable< TreeNodeGetNodes (int depth)
 Initialize an end node with custom data and label. More...
 
IEnumerator< TreeNodeGetEnumerator ()
 Return an enumerator that iterates through the nodes collection. More...
 
override string ToString ()
 Return a string of the label and data. More...
 

Public Attributes

readonly GUIContent label
 The label to show in the TreeView. More...
 
readonly IEnumerable< TreeNodenodes
 The child nodes. More...
 
readonly IEnumerable< TreeNodeall
 All nodes include this and all progenies. More...
 
readonly IEnumerable< TreeNodeends
 All the end nodes which have no children. More...
 
bool enable
 The flag if this be checked. More...
 
bool expand
 The flag if expand to show child nodes. More...
 
object data
 The custom data set and used by the creator. More...
 

Detailed Description

Item node to show and select in a TreeView window, optional to include child nodes.

It's designed to allow assigning child nodes only when constructor to avoid self looping. Implement System.Collections.Generic.IEnumerable to iterate through the nodes.

3

Constructor & Destructor Documentation

TreeNode ( string  label,
params TreeNode[]  nodes 
)

Initialize with specified label and child nodes.

Parameters
labelLabel.
nodesNodes.
Returns
The instance.
TreeNode ( GUIContent  label,
params TreeNode[]  nodes 
)

Initialize with specified label and child nodes.

Parameters
labelLabel.
nodesNodes.
Returns
The instance.
TreeNode ( string  label,
bool  enable,
bool  expand = false,
params TreeNode[]  nodes 
)

Initialize with specified label, default states, and child nodes.

Parameters
labelLabel.
enableIf set to true enable.
expandIf set to true expand.
nodesNodes.
Returns
The instance.
TreeNode ( GUIContent  label,
bool  enable,
bool  expand = false,
params TreeNode[]  nodes 
)

Initialize with specified label, default states, and child nodes.

Parameters
labelLabel.
enableIf set to true enable.
expandIf set to true expand.
nodesNodes.
Returns
The instance.
TreeNode ( object  data,
string  label,
bool  enable = false 
)

Initialize an end node with custom data and label.

Parameters
dataData.
labelLabel.
enableIf set to true enable.
Returns
The instance.

Member Function Documentation

TreeNode (object data, GUIContent label, bool enable = false) IEnumerable<TreeNode> GetNodes ( int  depth)

Initialize an end node with custom data and label.

Parameters
dataData.
labelLabel.
enableIf set to true enable.
Returns
The instance.

Get the progeny nodes by the specified depth, e.g., 0 is self, 2 is grandchildren.

Parameters
depthDepth.
Returns
The nodes.
IEnumerator<TreeNode> GetEnumerator ( )

Return an enumerator that iterates through the nodes collection.

Returns
The enumerator.
override string ToString ( )

Return a string of the label and data.

Returns
A string represents this.

Member Data Documentation

readonly GUIContent label

The label to show in the TreeView.

readonly IEnumerable<TreeNode> nodes

The child nodes.

readonly IEnumerable<TreeNode> all

All nodes include this and all progenies.

readonly IEnumerable<TreeNode> ends

All the end nodes which have no children.

bool enable

The flag if this be checked.

bool expand

The flag if expand to show child nodes.

object data

The custom data set and used by the creator.