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

# Class CL_MenuNode

MenuNode
Contained in: global
Derived from: none
Derived by: CL_PopupMenu
Group: GUI (Controls)

#include <ClanLib/gui.h>

### public function member index:
### Construction:
`` | `CL_MenuNode` | `(`CL_PopupMenu`* `popupmenu`)`;
``virtual`` | `~CL_MenuNode` | `()`;
### Attributes:
``bool`` | `is_selected` | `() `const``;
``bool`` | `is_collapsed` | `() `const``;
``bool`` | `has_children` | `() `const``;
``void`*` | `get_userdata` | `() `const``;
``CL_Component`*` | `get_component` | `() `const``;
### Operations:
``CL_MenuNode`*` | `insert_item` | `(`const` `std::string`& `text`, `int` `index` = -1)`;
``CL_MenuNode`*` | `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_MenuNode`* `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_MenuNode` | `(`const` `CL_MenuNode`& `copy`)`;

## Description:

## Function Member Descriptions:

CL_MenuNode::CL_MenuNode - The menunode constructor.
Not to be constructed by user - use insert_item() instead, which
creates a CL_MenuNode.
`` `CL_MenuNode``(`CL_PopupMenu`* `popupmenu`)`;

CL_MenuNode::clear - Deletes all items.
``void`` `clear``()`;

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

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

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

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

CL_MenuNode::insert_item - Inserts an item at index.
``CL_MenuNode`*` `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_MenuNode::insert_item - Inserts an item (uses any type of component) at index.
``CL_MenuNode`*` `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_MenuNode::invert_selection - Inverts the selection.
Works only in Multi selection mode.
``void`` `invert_selection``()`;

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

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

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

CL_MenuNode::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_MenuNode::set_selected - Select this node.
``void`` `set_selected``(`bool` `select` = true)`;

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

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

## Variable Member Descriptions: