tbx  0.7.6
Public Member Functions | List of all members
tbx::ext::TreeViewCurrentNode Class Reference

Class representing the current node in a tree view. More...

#include <treeview.h>

Inheritance diagram for tbx::ext::TreeViewCurrentNode:
tbx::Component

Public Member Functions

 TreeViewCurrentNode ()
 Construct an uninitialised TreeViewCurrentNode.
 
 TreeViewCurrentNode (TreeView &tree_view)
 Construct the current node for the given tree view. More...
 
 TreeViewCurrentNode (const TreeViewCurrentNode &other)
 Construct from an existing tree view current node. More...
 
TreeViewCurrentNodeoperator= (const TreeViewCurrentNode &other)
 Assign from an existing tree view current node. More...
 
bool operator== (const TreeViewCurrentNode &other) const
 Check if this current tree node item refers to the current node of the same tree view. More...
 
bool operator!= (const TreeViewCurrentNode &other) const
 Check if this current tree node item refers to the current node of the same tree view. More...
 
TreeNodeId node_id () const
 Get the ID of the current node.
 
void text (const std::string &text)
 
std::string text () const
 
void sprite (int sprite_area_id, const std::string &sprite_name, const std::string &expanded_sprite_name)
 Set the sprites used for the current tree_view node. More...
 
std::string sprite_name () const
 Get the name of the sprite for the current node. More...
 
std::string expanded_sprite_name () const
 Get the name of the expanded sprite for the current node. More...
 
void private_word (void *word)
 
void * private_word () const
 
void move_to (TreeNodeId id)
 Move current node to a give node id. More...
 
bool move_next (bool sorted=false)
 Move current node to next sibling. More...
 
bool move_prev (bool sorted=false)
 Move current node to previous sibling. More...
 
bool move_child (bool sorted=false)
 Move current node to first child. More...
 
bool move_parent ()
 Move current node to the parent. More...
 
bool move_first_selected ()
 Move current node to first selected node. More...
 
bool move_next_selected ()
 Move current node to the next selected node. More...
 
void expand (bool expand, bool recurse=false)
 Expand or contract the current node. More...
 
void select (bool select, bool add)
 Select/deselect a node. More...
 
void make_visible ()
 Make current node visible in the tree.
 
unsigned int state () const
 
bool has_next_sibling () const
 
bool has_prev_sibling () const
 
bool has_child () const
 
bool parent_is_root () const
 
bool has_sprite () const
 
bool has_expanded_sprite () const
 
bool has_text () const
 
bool expanded () const
 
bool selected () const
 
TreeNodeId add_child (const std::string &text)
 Add a new node as the child of the current node. More...
 
TreeNodeId add_sibling (const std::string &text)
 Add a new node as the child of the current node. More...
 
void erase ()
 Delete the current tree node.
 
- Public Member Functions inherited from tbx::Component
 Component ()
 Construct an uninitialised component. More...
 
 Component (Object obj, ComponentId id)
 Construct a component from an object and component id. More...
 
 Component (ObjectId handle, ComponentId id)
 Construct a component from an object handle and component id. More...
 
bool null () const
 Check if this component is in an uninitialised state. More...
 
Object object ()
 Return the object his component belongs to.
 
Object object () const
 Return the object his component belongs to.
 
ObjectId handle () const
 Return the object handle for his component.
 
ComponentId id () const
 Get the component ID of this component. More...
 
Componentoperator= (const Component &other)
 Assign the Component to refer to the same underlying toolbox component.
 
bool operator== (const Component &other) const
 Check if this component refers to the same underlying toolbox component. More...
 
bool operator!= (const Component &other) const
 Check if this component refers to the same underlying toolbox gadget. More...
 
 operator bool () const
 Operator to check if this component has been initialised. More...
 
void add_command (int command_id, Command *command)
 Add a command to this Component. More...
 
void remove_command (int command_id, Command *command)
 Remove a command from this component. More...
 
void add_user_event_listener (int event_id, UserEventListener *listener)
 Add a user event listener. More...
 
void remove_user_event_listener (int event_id, UserEventListener *listener)
 Remove a user event listener from this component. More...
 
void remove_all_listeners ()
 Remove all the listeners on this component. More...
 

Additional Inherited Members

- Protected Member Functions inherited from tbx::Component
void add_listener (int action, Listener *listener, RawToolboxEventHandler handler)
 Helper function to add listeners to this component. More...
 
void remove_listener (int action, Listener *listener)
 Helper function to remove listeners from this component.
 
void add_window_listener (int event_code, Listener *listener)
 Helper function to add a listener for a WIMP window event.
 
void remove_window_listener (int event_code, Listener *listener)
 Helper function to remove a listener for a WIMP window event.
 
int int_property (int property_id) const
 Get an integer property from the toolbox Component. More...
 
void int_property (int property_id, int value)
 Set an integer property from the toolbox object. More...
 
bool bool_property (int property_id) const
 Get a boolean property from the toolbox Component. More...
 
void bool_property (int property_id, bool value)
 Set a boolean property from the toolbox object. More...
 
std::string string_property (int property_id) const
 Get a string property from the toolbox object. More...
 
int string_property_length (int property_id) const
 Get a the length of a string property from the toolbox object. More...
 
void string_property (int property_id, const std::string &value)
 Set a string property in the toolbox object. More...
 
bool flag_property (int property_id, int flag) const
 Check if a particular flag is set in a property. More...
 
void flag_property (int property_id, int flag, bool value)
 Set a particular flag in a property. More...
 
- Protected Attributes inherited from tbx::Component
ObjectId _handle
 Underlying toolbox handle.
 
int _id
 Underlying toolbox component id.
 

Detailed Description

Class representing the current node in a tree view.

The nodes in a tree view are created, updated and properties checked by setting the current node to the node in question and calling the appropriate methods on it.

Constructor & Destructor Documentation

◆ TreeViewCurrentNode() [1/2]

tbx::ext::TreeViewCurrentNode::TreeViewCurrentNode ( TreeView tree_view)

Construct the current node for the given tree view.

Construct the current tree node for the give tree view.

Parameters
tree_viewtree view watch the current node on
tree_viewtree view to reference the current node from

◆ TreeViewCurrentNode() [2/2]

tbx::ext::TreeViewCurrentNode::TreeViewCurrentNode ( const TreeViewCurrentNode other)
inline

Construct from an existing tree view current node.

Both nodes refer to the same item.

Member Function Documentation

◆ add_child()

TreeNodeId tbx::ext::TreeViewCurrentNode::add_child ( const std::string &  text)

Add a new node as the child of the current node.

Parameters
textText for the child node
Returns
node id of new node

◆ add_sibling()

TreeNodeId tbx::ext::TreeViewCurrentNode::add_sibling ( const std::string &  text)

Add a new node as the child of the current node.

Parameters
textText for the child node
Returns
node id of new node

◆ expand()

void tbx::ext::TreeViewCurrentNode::expand ( bool  expand,
bool  recurse = false 
)

Expand or contract the current node.

Parameters
expandtrue to expand, false to contract
recurserecursively expand or contract the descendents (default = false)

◆ expanded_sprite_name()

std::string tbx::ext::TreeViewCurrentNode::expanded_sprite_name ( ) const

Get the name of the expanded sprite for the current node.

Returns
the name of the expanded sprite

◆ move_child()

bool tbx::ext::TreeViewCurrentNode::move_child ( bool  sorted = false)

Move current node to first child.

Parameters
sortedtrue to traverse nodes in their sorted order
Returns
true if move is successful

◆ move_first_selected()

bool tbx::ext::TreeViewCurrentNode::move_first_selected ( )

Move current node to first selected node.

Returns
true if move is successful

◆ move_next()

bool tbx::ext::TreeViewCurrentNode::move_next ( bool  sorted = false)

Move current node to next sibling.

Parameters
sortedtrue to traverse nodes in their sorted order
Returns
true if move is successful

◆ move_next_selected()

bool tbx::ext::TreeViewCurrentNode::move_next_selected ( )

Move current node to the next selected node.

Returns
true if move is successful

◆ move_parent()

bool tbx::ext::TreeViewCurrentNode::move_parent ( )

Move current node to the parent.

Returns
true if move is successful

◆ move_prev()

bool tbx::ext::TreeViewCurrentNode::move_prev ( bool  sorted = false)

Move current node to previous sibling.

Parameters
sortedtrue to traverse nodes in their sorted order
Returns
true if move is successful

◆ move_to()

void tbx::ext::TreeViewCurrentNode::move_to ( TreeNodeId  id)

Move current node to a give node id.

Parameters
idnode id to move to

◆ operator!=()

bool tbx::ext::TreeViewCurrentNode::operator!= ( const TreeViewCurrentNode other) const
inline

Check if this current tree node item refers to the current node of the same tree view.

Returns
true if they are not the same

◆ operator=()

TreeViewCurrentNode& tbx::ext::TreeViewCurrentNode::operator= ( const TreeViewCurrentNode other)
inline

Assign from an existing tree view current node.

Both nodes refer to the same item.

◆ operator==()

bool tbx::ext::TreeViewCurrentNode::operator== ( const TreeViewCurrentNode other) const
inline

Check if this current tree node item refers to the current node of the same tree view.

Returns
true if they are the same

◆ select()

void tbx::ext::TreeViewCurrentNode::select ( bool  select,
bool  add 
)

Select/deselect a node.

Parameters
selecttrue to select a node
addtrue add to current selection, false replace current selection

◆ sprite()

void tbx::ext::TreeViewCurrentNode::sprite ( int  sprite_area_id,
const std::string &  sprite_name,
const std::string &  expanded_sprite_name 
)

Set the sprites used for the current tree_view node.

Parameters
spritearea_id (
See also
Sprite::area_id() or use 1 for the wimp sprite area)
Parameters
sprite_namename of sprite to show (empty string for none)
expanded_sprite_namename of sprite to show when node is expanded (empty string for none)

◆ sprite_name()

std::string tbx::ext::TreeViewCurrentNode::sprite_name ( ) const

Get the name of the sprite for the current node.

Returns
the name of the sprite

The documentation for this class was generated from the following files: