Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_TreeNode

TreeView node
Contained in: global
Derived from: none
Derived by: CL_TreeView
Group: GUI (Controls)

#include <ClanLib/gui.h>

### public function member index:

### Construction:

`` | `CL_TreeNode` | `(`CL_TreeView`* `root_tree`)`;
``virtual`` | `~CL_TreeNode` | `()`;

### Attributes:

``bool`` | `is_selected` | `() `const``;
``bool`` | `is_collapsed` | `() `const``;
``bool`` | `has_children` | `() `const``;
``void`*` | `get_userdata` | `() `const``;
``CL_Component`*` | `get_component` | `() `const``;

### Operations:

``CL_TreeNode`*` | `insert_item` | `(`const` `std::string`& `text`, `int` `index` = -1)`;
``CL_TreeNode`*` | `insert_item` | `(`CL_Component`* `component`, `bool` `delete_component` = false, `int` `index` = -1)`;
``void`` | `set_component` | `(`CL_Component`* `component`, `bool` `delete_component` = false)`;
``void`` | `set_collapsed` | `(`bool` `collapse` = true)`;
``void`` | `set_selected` | `(`bool` `select` = true)`;
``void`` | `set_selected` | `(`CL_TreeNode`* `node`, `bool` `select` = true)`;
``void`` | `clear_selection` | `()`;
``void`` | `invert_selection` | `()`;
``void`` | `clear` | `()`;
``void`` | `set_userdata` | `(`void`* `data`)`;
``void`` | `draw_nodes` | `(`CL_Point`& `point`)`;

### private function member index:

### Implementation:

`` | `CL_TreeNode` | `(`const` `CL_TreeNode`& `copy`)`;

## Description:

## Function Member Descriptions:

CL_TreeNode::CL_TreeNode - The treenode constructor.
Not to be constructed by user - use insert_item() instead, which
creates a CL_TreeNode.
`` `CL_TreeNode` `(`CL_TreeView`* `root_tree`)`;

CL_TreeNode::clear - Deletes all items in the tree.
``void`` `clear` `()`;

CL_TreeNode::clear_selection - Deselects current selected item.
``void`` `clear_selection` `()`;

CL_TreeNode::get_component - Returns the CL_Component this node uses.
``CL_Component`*` `get_component` `() `const``;

CL_TreeNode::get_userdata - Returns the attaches userdata, if any.
``void`*` `get_userdata` `() `const``;

CL_TreeNode::has_children - Return true if node has sub-items
``bool`` `has_children` `() `const``;

CL_TreeNode::insert_item - Inserts an item at index.
``CL_TreeNode`*` `insert_item` `(`const` `std::string`& `text`, `int` `index` = -1)`;

> If index is negative, text is inserted at the end of the list.
> Returns the node of the item.

CL_TreeNode::insert_item - Inserts an item (uses any type of component) at index.
``CL_TreeNode`*` `insert_item` `(`CL_Component`* `component`, `bool` `delete_component` = false, `int` `index` = -1)`;

> If index is negative, text is inserted at the end of the list.
> Set delete_component to true if you want the component to be deleted when
> this node gets deleted.
> Returns the node of the item.

CL_TreeNode::invert_selection - Inverts the selection.
Works only in Multi selection mode.
``void`` `invert_selection` `()`;

CL_TreeNode::is_collapsed - Return true if node is collapsed
``bool`` `is_collapsed` `() `const``;

CL_TreeNode::is_selected - Returns true if node is selected
``bool`` `is_selected` `() `const``;

CL_TreeNode::set_collapsed - Collapse this node.
``void`` `set_collapsed` `(`bool` `collapse` = true)`;

CL_TreeNode::set_component - Sets/changes a new component for the node.
``void`` `set_component` `(`CL_Component`* `component`, `bool` `delete_component` = false)`;

> Mostly used when add(CL_Component *) is used with a NULL parameter.
> Set delete_component to true if you want the component to be deleted when
> this node gets deleted.

CL_TreeNode::set_selected - Select this node.
``void`` `set_selected` `(`bool` `select` = true)`;

CL_TreeNode::set_selected - Select any of the children nodes.
``void`` `set_selected` `(`CL_TreeNode`* `node`, `bool` `select` = true)`;

CL_TreeNode::set_userdata - Attaches userdata to node.
``void`` `set_userdata` `(`void`* `data`)`;

## Variable Member Descriptions: