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

TreeView wrapper class for an underlying toolbox TreeView gadget. More...

#include <treeview.h>

Inheritance diagram for tbx::ext::TreeView:
tbx::Gadget tbx::Component

Public Types

enum  { TOOLBOX_CLASS = 0x4028 }
 

Public Member Functions

 TreeView ()
 Construct an uninitialised TreeView.
 
 ~TreeView ()
 Destroy a TreeView gadget. More...
 
 TreeView (const TreeView &other)
 Construct a TreeView from another TreeView. More...
 
 TreeView (const Gadget &other)
 Construct a TreeView from another gadget. More...
 
 TreeView (const Component &other)
 Construct a TreeView field from a Component. More...
 
TreeViewoperator= (const TreeView &other)
 Assign a TreeView field to refer to the same underlying toolbox gadget as another.
 
TreeViewoperator= (const Gadget &other)
 Assign a writable field to refer to the same underlying toolbox gadget as an existing Gadget. More...
 
TreeViewoperator= (const Component &other)
 Assign a TreeView field to refer to the same underlying toolbox component as an existing Gadget. More...
 
bool operator== (const Gadget &other) const
 Check if this TreeView refers to the same underlying toolbox gadget as another gadget. More...
 
bool operator!= (const Gadget &other) const
 Check if this TreeView refers to the same underlying toolbox gadget as another gadget. More...
 
unsigned int state () const
 
void state (unsigned int new_state)
 
bool state_flag (unsigned int flag) const
 
void state_flag (unsigned int flag, bool set)
 Set or clear and state flag. More...
 
bool allow_vscroll () const
 
void allow_vscroll (bool value)
 
bool allow_hscroll () const
 
void allow_hscroll (bool value)
 
bool auto_update () const
 
void auto_update (bool value)
 
bool show_current_node () const
 
void show_current_node (bool value)
 
bool plot_lines () const
 
void plot_lines (bool value)
 
bool allow_selection () const
 
void allow_selection (bool value)
 
bool notify_selection () const
 
void notify_selection (bool value)
 
bool select_children () const
 
void select_children (bool value)
 
bool allow_expand () const
 
void allow_expand (bool value)
 
bool notify_expansion () const
 
void notify_expansion (bool value)
 
bool expand_by_default () const
 
void expand_by_default (bool value)
 
bool allow_rename () const
 
void allow_rename (bool value)
 
bool notify_rename () const
 
void notify_rename (bool value)
 
bool allow_drags () const
 
void allow_drags (bool value)
 
bool notify_drag_end () const
 
void notify_drag_end (bool value)
 
bool all_events () const
 
void all_events (bool value)
 
bool double_click_expands () const
 
void double_click_expands (bool value)
 
bool flat_mode () const
 
void flat_mode (bool value)
 
bool text_below_sprite () const
 
void text_below_sprite (bool value)
 
bool sort_display () const
 
void sort_display (bool value)
 
bool sort_reversed () const
 
void sort_reversed (bool value)
 
bool sort_by_sprite () const
 
void sort_by_sprite (bool value)
 
void menu (Menu menu)
 Set menu for treeview.
 
TreeViewCurrentNode current_node ()
 Get the current tree view node. More...
 
TreeViewCurrentNode current_node (TreeNodeId id)
 Move the current node in the tree to the given node id. More...
 
TreeNodeId find_node (int x, int y)
 Find the tree node at the given location. More...
 
void clear ()
 Delete all nodes from the tree.
 
void update_display ()
 Update the display. More...
 
Window underlying_window () const
 Get underlying window used for the treeview.
 
void add_node_selected_listener (TreeViewNodeSelectedListener *listener)
 Add a listener for when a node is selected or deselected. More...
 
void remove_node_selected_listener (TreeViewNodeSelectedListener *listener)
 Remove a listener for when a node is selected or deselected. More...
 
void add_node_expanded_listener (TreeViewNodeExpandedListener *listener)
 Add a listener for when a node is expanded or contracted. More...
 
void remove_node_expanded_listener (TreeViewNodeExpandedListener *listener)
 Remove a listener for when a node is expanded or contracted. More...
 
void add_node_dragged_listener (TreeViewNodeDraggedListener *listener)
 Add a listener for when a node is dragged. More...
 
void remove_node_dragged_listener (TreeViewNodeDraggedListener *listener)
 Remove a listener for when a node is dragged. More...
 
void add_scroll_listener (TreeViewScrollListener *listener)
 Add a listener for when the tree view is scrolled. More...
 
void remove_scroll_listener (TreeViewScrollListener *listener)
 Remove a listener for when the tree view is scrolled. More...
 
- Public Member Functions inherited from tbx::Gadget
 Gadget ()
 Construct an uninitialised gadget. More...
 
 Gadget (const Gadget &other)
 Construct a gadget as a copy of another gadget object. More...
 
 Gadget (const Component &other)
 Construct a gadget as a copy of another component object. More...
 
Window window ()
 Get the window that contains this gadget.
 
Window window () const
 Get the window that contains this gadget.
 
Gadgetoperator= (const Gadget &other)
 Assign this gadget to refer to the same underlying toolbox gadget as another gadget.
 
Gadgetoperator= (const Component &other)
 Assign this gadget to refer to the same underlying toolbox gadget as the specified Component. More...
 
bool operator== (const Component &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Component. More...
 
bool operator!= (const Component &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Component. More...
 
bool operator== (const Gadget &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Gadget. More...
 
bool operator!= (const Gadget &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Gadget. More...
 
void check_toolbox_class (int class_id) const
 Check the underlying gadget class for this object has the given class id. More...
 
int toolbox_class () const
 Get the toolbox class for a gadget. More...
 
int toolbox_class_and_size () const
 Get the toolbox class and size for a gadget. More...
 
unsigned int flags () const
 Return the gadget flags. More...
 
void set_flag (unsigned int set)
 Sets bits in the gadgets flags. More...
 
void clear_flag (unsigned int clear)
 Clear bits in the gadget flags. More...
 
void fade ()
 Fade the gadget.
 
void unfade ()
 Clear the gadgets fade state.
 
void fade (bool fade)
 Fade/unfade the gadget. More...
 
bool faded () const
 Check if the gadget is faded. More...
 
void focus ()
 Set input focus to the gadget. More...
 
std::vector< IconHandleicon_list ()
 Get list of icons used in this gadget. More...
 
BBox bounds () const
 Get the bounding box of the gadget.
 
void bounds (const BBox &bounds)
 Set the bounds of the gadget. More...
 
Point bottom_left () const
 Get the bottom left location of gadget. More...
 
Point top_left () const
 Get the top left location of gadget. More...
 
void move_to (const Point &pos)
 Move gadget (without resizing) More...
 
void move_to (int x, int y)
 Move gadget without resizing. More...
 
void move_by (int bx, int by)
 Move gadget relative to it's current position without resizing. More...
 
Size size () const
 Return the size of the gadget. More...
 
void size (const Size &sz)
 Set size of gadget without moving it. More...
 
void add_loader (Loader *loader, int file_type=-2)
 Add a file loader. More...
 
void remove_loader (Loader *loader, int file_type=-2)
 Remove a file loader. More...
 
- 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

TreeView wrapper class for an underlying toolbox TreeView gadget.

A TreeView is a gadget that shows a hiearchical list of items.

The tree view has a concept of the current node and the tree is built up and interrogated by moving the current node and calling the methods on it.

See also
TreeViewCurrentNode

To use a TreeView gadget you will need to install the TreeView module written by Rik Griffin and ensure it is loaded before running your program using RMEnsure.

Constructor & Destructor Documentation

◆ ~TreeView()

tbx::ext::TreeView::~TreeView ( )
inline

Destroy a TreeView gadget.

This does not delete the underlying toolbox gadget.

◆ TreeView() [1/3]

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

Construct a TreeView from another TreeView.

Both TreeViews will refer to the same underlying toolbox gadget.

◆ TreeView() [2/3]

tbx::ext::TreeView::TreeView ( const Gadget other)
inline

Construct a TreeView from another gadget.

The TreeView and the Gadget will refer to the same underlying toolbox gadget.

Exceptions
GadgetClassErrorif the underlying toolbox gadget isn't a TreeView

◆ TreeView() [3/3]

tbx::ext::TreeView::TreeView ( const Component other)
inline

Construct a TreeView field from a Component.

Exceptions
ObjectClassErrorif the component is not in a window.
GadgetClassErrorif the underlying toolbox gadget isn't a TreeView

Member Function Documentation

◆ add_node_dragged_listener()

void tbx::ext::TreeView::add_node_dragged_listener ( TreeViewNodeDraggedListener listener)

Add a listener for when a node is dragged.

Parameters
listenerlistener to add

◆ add_node_expanded_listener()

void tbx::ext::TreeView::add_node_expanded_listener ( TreeViewNodeExpandedListener listener)

Add a listener for when a node is expanded or contracted.

Parameters
listenerlistener to add

◆ add_node_selected_listener()

void tbx::ext::TreeView::add_node_selected_listener ( TreeViewNodeSelectedListener listener)

Add a listener for when a node is selected or deselected.

Parameters
listenerlistener to add

◆ add_scroll_listener()

void tbx::ext::TreeView::add_scroll_listener ( TreeViewScrollListener listener)

Add a listener for when the tree view is scrolled.

Parameters
listenerlistener to add

◆ current_node() [1/2]

TreeViewCurrentNode tbx::ext::TreeView::current_node ( )

Get the current tree view node.

Use this node to update, add nodes and set values on the nodes of the tree.

◆ current_node() [2/2]

TreeViewCurrentNode tbx::ext::TreeView::current_node ( TreeNodeId  id)

Move the current node in the tree to the given node id.

Parameters
TreeNodeIdid to move current node to
Returns
TreeViewCurrentNode of the moved node
Exceptions
tbx::OsErrorif node id is invalid

◆ find_node()

TreeNodeId tbx::ext::TreeView::find_node ( int  x,
int  y 
)

Find the tree node at the given location.

Parameters
xscreen x coordinate of location
yscreen y coordinate of location
Returns
id of tree node at that location or 0 if none.

◆ operator!=()

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

Check if this TreeView refers to the same underlying toolbox gadget as another gadget.

Returns
true if they do not refer to the same underlying toolbox gadget.

◆ operator=() [1/2]

TreeView& tbx::ext::TreeView::operator= ( const Component other)
inline

Assign a TreeView field to refer to the same underlying toolbox component as an existing Gadget.

Exceptions
ObjectClassErrorif the component is not in a window.
GadgetClassErrorif the underlying toolbox gadget isn't a TreeView

◆ operator=() [2/2]

TreeView& tbx::ext::TreeView::operator= ( const Gadget other)
inline

Assign a writable field to refer to the same underlying toolbox gadget as an existing Gadget.

Exceptions
GadgetClassErrorif the underlying toolbox gadget isn't a TreeView

◆ operator==()

bool tbx::ext::TreeView::operator== ( const Gadget other) const
inline

Check if this TreeView refers to the same underlying toolbox gadget as another gadget.

Returns
true if they refer to the same underlying toolbox gadget.

◆ remove_node_dragged_listener()

void tbx::ext::TreeView::remove_node_dragged_listener ( TreeViewNodeDraggedListener listener)

Remove a listener for when a node is dragged.

Parameters
listenerlistener to remove

◆ remove_node_expanded_listener()

void tbx::ext::TreeView::remove_node_expanded_listener ( TreeViewNodeExpandedListener listener)

Remove a listener for when a node is expanded or contracted.

Parameters
listenerlistener to remove

◆ remove_node_selected_listener()

void tbx::ext::TreeView::remove_node_selected_listener ( TreeViewNodeSelectedListener listener)

Remove a listener for when a node is selected or deselected.

Parameters
listenerlistener to remove

◆ remove_scroll_listener()

void tbx::ext::TreeView::remove_scroll_listener ( TreeViewScrollListener listener)

Remove a listener for when the tree view is scrolled.

Parameters
listenerlistener to remove

◆ state_flag()

void tbx::ext::TreeView::state_flag ( unsigned int  flag,
bool  set 
)

Set or clear and state flag.

Parameters
flagto modify
settrue to set, false to clear

◆ update_display()

void tbx::ext::TreeView::update_display ( )

Update the display.

Call this after nodes are added/deleted or modified to reflect the change in the treeview display


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