#include <Flu_Tree_Browser.h>
Public Types | |
enum | { MOVE_BEFORE, MOVE_INSIDE, MOVE_AFTER } |
Public Member Functions | |
Flu_Tree_Browser (int x, int y, int w, int h, const char *label=0) | |
Normal FLTK widget constructor. | |
virtual | ~Flu_Tree_Browser () |
Default destructor. | |
Node * | add (const char *fullpath, Fl_Widget *w=0, bool showLabel=true) |
Add the entry specified by fullpath to the tree. If w is not NULL then that widget is the entry and its label is visible depending on the value of showLabel. Note that the widget is destroyed by the tree/node on clear() or the destructor. | |
Node * | add (const char *path, const char *name, Fl_Widget *w=0, bool showLabel=true) |
Convenience function that is the same as add() except path and name are concatenated (with a '/' added if necessary) to create the full path. | |
Node * | add (Node *n, const char *name, Fl_Widget *w=0, bool showLabel=true) |
Add entry name to node n. If w is not NULL then that widget is the entry and its label is visible depending on the value of showLabel. Note that the widget is destroyed by the tree/node on clear() or the destructor. | |
Node * | add_branch (const char *fullpath, Fl_Widget *w=0, bool showLabel=true) |
Convenience function that is the same as add() except it appends a '/' to fullpath if one does not exist. | |
Node * | add_branch (const char *path, const char *name, Fl_Widget *w=0, bool showLabel=true) |
Convenience function that is the same as add() except path and name are concatenated (with a '/' added if necessary) to create the full path. | |
Node * | add_branch (Node *n, const char *name, Fl_Widget *w=0, bool showLabel=true) |
Convenience function that is the same as add() except it appends a '/' to name if one does not exist. | |
Node * | add_leaf (const char *fullpath, Fl_Widget *w=0, bool showLabel=true) |
Convenience function that is the same as add() except it removes any '/' at the end of fullpath. | |
Node * | add_leaf (const char *path, const char *name, Fl_Widget *w=0, bool showLabel=true) |
Convenience function that is the same as add() except path and name are concatenated (with a '/' added if necessary) to create the full path. | |
Node * | add_leaf (Node *n, const char *name, Fl_Widget *w=0, bool showLabel=true) |
Convenience function that is the same as add() except it removes any '/' at the end of fullpath. | |
void | all_branches_always_open (bool b) |
Set whether all branches are always open. Default value is false . | |
bool | all_branches_always_open () |
Get whether all branches are always open. Default value is false . | |
void | allow_leaf_duplication (bool b) |
Set whether multiple leaves with the same path are allowed. Default value is true . | |
bool | allow_leaf_duplication () |
Get whether multiple leaves with the same path are allowed. | |
bool | have_dnd () |
true if drag and drop support has been compiled in, false otherwise | |
void | allow_dnd (bool b) |
Set whether drag and drop processing is enabled for the browser. Default is false . | |
bool | allow_dnd () |
Get whether drag and drop processing is enabled for the browser. | |
void | always_open (bool b) |
Set whether the root node is always open. Shortcut for get_root()->always_open(b) . Default is false . | |
bool | always_open () |
Get whether the root node is always open. | |
void | animate (bool b) |
Set whether animations of opening/closing branches are enabled. Default is false . | |
bool | animate () |
Get whether animations of opening/closing branches are enabled. | |
void | auto_branches (bool b) |
Set whether the tree automatically determines whether a node is a branch or a leaf based on whether it has any children. Default is false . | |
bool | auto_branches () const |
Get whether the tree automatically determines whether a node is a branch or a leaf based on whether it has any children. | |
Fl_Color | branch_color () const |
Get the default branch text color. | |
Fl_Font | branch_font () const |
Get the default branch text font. | |
int | branch_size () const |
Get the default branch text size. | |
void | branch_text (Fl_Color color, Fl_Font font, int size) |
Set the default color, font and size to use for the text of all subsequent branches added to the tree. | |
void | branch_icons (Fl_Image *closed, Fl_Image *open) |
Set the default branch icons to use for all subsequent branches added to the tree. | |
Fl_Boxtype | box () const |
Get the type of box to draw the browser in. | |
void | box (Fl_Boxtype b) |
Set the type of box to draw the browser in. Default is FL_FLAT_BOX. | |
int | callback_reason () const |
Get the reason why the last callback happened. This can be one of FLU_UNHILIGHTED, FLU_HILIGHTED, FLU_SELECTED, FLU_UNSELECTED, FLU_OPENED, FLU_CLOSED, FLU_DOUBLE_CLICK, FLU_WIDGET_CALLBACK, FLU_MOVED_CALLBACK, FLU_NEW_NODE_CALLBACK. | |
Node * | callback_node () const |
Get the node on which the last callback happened. | |
void | clear () |
Clear all entries from the tree. | |
void | collapse_icons (Fl_Image *closed, Fl_Image *open) |
Set the default collapse icons to use for all subsequent branches added to the tree. | |
float | collapse_time () const |
Get the amount of time to take when animating an open/close. Use in conjunction with frame_rate(). | |
void | collapse_time (float t) |
Set the amount of time to take when animating an open/close. Use in conjunction with frame_rate(). Default is 0.1 seconds. | |
Fl_Color | color () const |
Get the background color of the browser. | |
void | color (Fl_Color c) |
Set the background color of the browser. Default is FL_WHITE. | |
void | color (unsigned c) |
Set the background color of the browser. Default is FL_WHITE. | |
void | connector_style (Fl_Color color, int style, int width=1) |
Set the color, style, and width of the connector lines. Default is FL_DARK2, FL_DOT, 1. | |
Fl_Color | connector_color () const |
Get the color of the connector lines. | |
int | connector_style () const |
Get the style of the connector lines. | |
int | connector_width () const |
Get the width of the connector lines. | |
void | double_click_opens (bool b) |
Set whether double-clicking a branch opens/closes it. | |
bool | double_click_opens () |
Get whether double-clicking a branch opens/closes it. | |
Fl_Color | even_shaded_entry_color () const |
Get the color to use for shading even entries. | |
Node * | find (const char *fullpath) |
Find the entry identified by fullpath. | |
Node * | find (const char *path, const char *name) |
Find entry name in path path. | |
Node * | find (unsigned int id) |
Find the entry identified by unique id id. | |
Node * | find (Node *n) |
Search for Node n in the tree. | |
Node * | find (Fl_Widget *w) |
Find the entry containing the widget w. | |
Node * | find_next (const char *fullpath, Node *startNode=NULL) |
Find the next entry identified by fullpath after startNode. | |
Node * | find_next (const char *path, const char *name) |
Find the next entry name in path path after startNode. | |
int | find_number (const char *fullpath) |
the number of discovered nodes matching path fullpath | |
int | find_number (const char *path, const char *name) |
the number of discovered nodes with name name in path path | |
const char * | find_path (unsigned int id) |
the full path of the entry identified by unique id id, or the empty string if no matching entry was found | |
const char * | find_path (Fl_Widget *w) |
the full path of the entry containing the widget w, or the empty string if no matching entry was found | |
const char * | find_path (Node *n) |
the full path of Node n, or the empty string if n is not in the tree | |
Node * | first () |
the first node in the tree (i.e. the root) | |
Node * | first_branch () |
the first branch encountered in a depth-first traversal of the tree. NULL means there are no branches | |
Node * | first_leaf () |
the first leaf encountered in a depth-first traversal of the tree. NULL means there are no leaves | |
float | frame_rate () const |
Get the frame rate to use during the open/close animation. Use in conjunction with collapse_time(). | |
void | frame_rate (float f) |
Set the frame rate to use during the open/close animation. Use in conjunction with collapse_time(). Default is 100 frames per second. | |
Node * | get_hilighted () |
the currently highlighted node | |
Node * | get_root () |
a pointer to the root node of the tree | |
Node * | get_selected (int index) |
the selected Node that is at index among all selected nodes, or NULL if no Node is selected | |
int | handle (int event) |
Override of Fl_Widget::handle. | |
void | horizontal_gap (int g) |
Set the horizontal icon gap for each entry. Default is 2. | |
int | horizontal_gap () const |
Get the horizontal icon gap for each entry. | |
void | insertion_mode (int m) |
Set how entries are inserted into the tree. This can be one of FLU_INSERT_FRONT, FLU_INSERT_BACK, FLU_INSERT_SORTED, FLU_INSERT_SORTED_REVERSE. Default is FLU_INSERT_SORTED. | |
int | insertion_mode () |
Get how entries are inserted into the tree. | |
bool | inside_entry_area (int x, int y) |
whether the point (x,y) is inside the entry area (not on the scrollbars) | |
void | label (const char *l) |
Set the title of the Tree (also the label for the root entry). | |
const char * | label () const |
Get the title of the Tree (also the label for the root entry). | |
Node * | last () |
the last node in the tree | |
Node * | last_branch () |
the last branch encountered in a depth-first traversal of the tree. NULL means there are no branches | |
Node * | last_leaf () |
the last leaf encountered in a depth-first traversal of the tree. NULL means there are no leaves | |
Fl_Color | leaf_color () const |
Get the default leaf text color. | |
Fl_Font | leaf_font () const |
Get the default leaf text font. | |
int | leaf_size () const |
Get the default leaf text size. | |
void | leaf_icon (Fl_Image *icon) |
Set the default leaf icon to use for all subsequent leaves added to the tree. | |
void | leaf_text (Fl_Color color, Fl_Font font, int size) |
Set the default color, font and size to use for the text of all subsequent leaves added to the tree, Default is FL_BLACK, FL_HELVETICA, 12. | |
void | move_only_same_group (bool b) |
Set whether items can be moved only within their group ( true ) or can be moved anywhere in the tree ( false ). Default is false . Used only when selection_drag_mode() is FLU_DRAG_TO_MOVE. | |
bool | move_only_same_group () |
Get whether items can be moved only within their group ( true ) or can be moved anywhere in the tree ( false ). Used only when selection_drag_mode() is FLU_DRAG_TO_MOVE. | |
int | num_selected () |
the number of selected entries | |
Fl_Color | odd_shaded_entry_color () const |
Get the color to use for shading odd entries. | |
void | only_one_open_branch (bool b) |
Set whether only a single branch (except the root branch) is allowed open at a time. Default is false . | |
bool | only_one_open_branch () |
Get whether only a single branch (except the root branch) is allowed open at a time. | |
void | open (bool b) |
Open or close the root node. | |
bool | open () const |
Is the root node open or closed? | |
void | open_without_children (bool b) |
Set whether you can open/close a branch even if it has no children. Default is false . | |
bool | open_without_children () const |
Get whether you can open/close a branch even if it has no children. | |
void | open_on_select (bool b) |
Set whether selecting a branch also opens it. Default is false . | |
bool | open_on_select () const |
Get whether selecting a branch also opens it. | |
void | print () |
Print the tree to stdout. | |
unsigned int | remove (const char *fullpath) |
Remove the entry identified by path fullpath from the tree. | |
unsigned int | remove (const char *path, const char *name) |
Remove entry name in path path from the tree. | |
unsigned int | remove (unsigned int id) |
Remove the entry identified by unique id id from the tree. | |
unsigned int | remove (Fl_Widget *w) |
Remove the entry containing the widget w from the tree. Note that the widget is automatically destroyed. | |
unsigned int | remove (Node *n) |
Remove Node n from the tree. | |
void | resize (int X, int Y, int W, int H) |
Override of Fl_Widget::resize. | |
void | root_color (Fl_Color c) |
Convenience routine to set the root label color. See Flu_Tree_Browser::Node::label_color(). | |
Fl_Color | root_color () |
Convenience routine to set the root label color. See Flu_Tree_Browser::Node::label_color(). | |
void | root_font (Fl_Font f) |
Convenience routine to set the root label font. See Flu_Tree_Browser::Node::label_font(). | |
Fl_Font | root_font () |
Convenience routine to set the root label font. See Flu_Tree_Browser::Node::label_font(). | |
void | root_size (unsigned char s) |
Convenience routine to set the root label size. See Flu_Tree_Browser::Node::label_size(). | |
unsigned char | root_size () |
Convenience routine to set the root label size. See Flu_Tree_Browser::Node::label_size(). | |
void | select_all () |
Select all entries in the tree. | |
Fl_Color | selection_color () const |
Get the color to use when hilighting selected entries. | |
void | selection_color (Fl_Color c) |
Set the color to use when hilighting selected entries. Default is FL_SELECTION_COLOR. | |
void | selection_color (unsigned c) |
Set the color to use when hilighting selected entries. Default is FL_SELECTION_COLOR. | |
void | selection_drag_mode (int m) |
Set how selection is affected when the mouse is dragged. This can be one of FLU_DRAG_IGNORE, FLU_DRAG_TO_SELECT, FLU_DRAG_TO_MOVE. Default is FLU_DRAG_TO_SELECT. | |
int | selection_drag_mode () const |
Get how selection is affected when the mouse is dragged. | |
void | selection_follows_hilight (bool b) |
Set whether the hilighted node is always selected. Default is false . | |
bool | selection_follows_hilight () |
Get whether the hilighted node is always selected. | |
void | selection_mode (int m) |
Set how individual entries are selected using the mouse. This can be one of FLU_NO_SELECT, FLU_SINGLE_SELECT, FLU_MULTI_SELECT. Default is FLU_MULTI_SELECT. | |
int | selection_mode () const |
Get how individual entries are selected using the mouse. | |
void | select_under_mouse (bool b) |
If selection_mode() is FLU_SINGLE_SELECT , then whichever node is under the mouse will always be selected, with all others unselected. Default is false . | |
bool | select_under_mouse () const |
If selection_mode() is FLU_SINGLE_SELECT , then whichever node is under the mouse will always be selected, with all others unselected. Default is false . | |
void | set_default_branch_icons () |
Calling this will cause any newly added branches to use the default branch icon. | |
void | set_hilighted (Node *n) |
Set which node is hilighted and ready to be selected or unselected. This also scrolls the browser so n is visible. | |
Node * | set_root (const char *label, Fl_Widget *w=0, bool showLabel=true) |
Set the title of the root of the tree to label. If w is not NULL then that widget is the entry and its label is visible depending on the value of showLabel. Note that the widget is destroyed by the tree/node on clear() or the destructor. | |
void | shaded_entry_colors (Fl_Color even, Fl_Color odd) |
Set the colors to use for shading every other entry. Default is FL_WHITE, FL_WHITE. | |
void | show_branches (bool b) |
Set whether branch entries are visible. Default is true . | |
bool | show_branches () const |
Get whether branch entries are visible. | |
void | show_connectors (bool b) |
Set whether the connectors between entries are visible. Default is true . | |
bool | show_connectors () const |
Get whether the connectors between entries are visible. | |
void | show_root (bool b) |
Set whether the root branch (i.e. the name of the tree) is visible. Default is true . | |
bool | show_root () const |
Get whether the root branch (i.e. the name of the tree) is visible. | |
void | show_leaves (bool b) |
Set whether leaf entries are visible. Default is true . | |
bool | show_leaves () const |
Get whether leaf entries are visible. | |
void | sort () |
Sort the tree according to insertion_mode(). | |
void | unselect_all () |
Unselect all entries in the tree. | |
void | vertical_gap (int g) |
Set the vertical gap between tree entries. Default is 0. | |
int | vertical_gap () const |
Get the vertical gap between tree entries. | |
void | widget_gap (int g) |
Set the gap between the widget and the icon that precedes it. Default is 2. | |
int | widget_gap () const |
Get the gap between the widget and the icon that precedes it. | |
Static Public Member Functions | |
void | use_FLU_WIDGET_CALLBACK (bool b) |
Protected Member Functions | |
void | timerRedrawCB () |
void | timerScrollCB () |
void | on_dnd_leave () |
void | on_dnd_release () |
bool | on_dnd_drag (int X, int Y) |
void | on_dnd_drop (const Flu_DND_Event *e) |
void | draw () |
Static Protected Member Functions | |
void | _scrollCB (Fl_Widget *w, void *arg) |
void | _timerRedrawCB (void *arg) |
void | _timerScrollCB (void *arg) |
Protected Attributes | |
Fl_Group * | scrollBox |
Fl_Scrollbar * | scrollH |
Fl_Scrollbar * | scrollV |
Fl_Group * | _box |
Node | root |
RData | rdata |
float | autoScrollX |
float | autoScrollY |
bool | scrolledTimerOn |
Friends | |
class | Node |
|
Add entry name to node n. If w is not If name ends in a slash ("/"), then the entry is added as a branch, else it is added as a leaf
|
|
Add the entry specified by fullpath to the tree. If w is not If fullpath ends in a slash ("/"), then the entry is added as a branch, else it is added as a leaf
|
|
Set whether drag and drop processing is enabled for the browser. Default is If DND is enabled, either text or instances of Flu_Tree_Browser::DND_Object from outside the tree can be dragged and dropped onto the tree to create a new node. Nodes within the tree can be dragged and dropped (only within the same tree) according to the value of selection_drag_mode(). |
|
Set the default branch icons to use for all subsequent branches added to the tree.
Passing in |
|
Get the node on which the last callback happened.
|
|
Find the entry containing the widget w.
|
|
Search for Node n in the tree.
|
|
Find the entry identified by unique id id.
|
|
Find entry name in path path.
|
|
Find the entry identified by fullpath.
|
|
Find the next entry name in path path after startNode.
|
|
Find the next entry identified by fullpath after startNode.
|
|
the full path of Node n, or the empty string if n is not in the tree
|
|
the full path of the entry containing the widget w, or the empty string if no matching entry was found
|
|
the full path of the entry identified by unique id id, or the empty string if no matching entry was found
|
|
the selected Node that is at index among all selected nodes, or
For example, |
|
Remove Node n from the tree.
|
|
Remove the entry containing the widget w from the tree. Note that the widget is automatically destroyed.
|
|
Remove the entry identified by unique id id from the tree.
|
|
Remove entry name in path path from the tree.
|
|
Remove the entry identified by path fullpath from the tree.
|
|
Set the title of the root of the tree to label. If w is not The root icons, color, font and size are set to the current branch icons and text color, font and size |
|
Set the gap between the widget and the icon that precedes it. Default is 2. When the callback occurs, you can use callback_reason() to determine exactly what cause the callback and callback_node() to get the node that was affected. |