9 #include <FL/Fl_Group.H>
10 #include <FL/Fl_Scrollbar.H>
215 callback_reason(reason);
222 Fl_Tree(
int X,
int Y,
int W,
int H,
const char *L=0);
236 if ( ! _root )
return;
237 _root->label(new_label);
258 if ( item == _root ) {
262 if ( ! parent )
return(-1);
271 if ( ! _root )
return;
272 _root->clear_children();
273 delete _root; _root = 0;
290 int item_pathname(
char *pathname,
int pathnamelen,
const Fl_Tree_Item *item)
const;
304 return(_callback_item);
337 if ( item->
is_open() )
return(0);
368 int open(
const char *path,
int docallback=1) {
370 if ( ! item )
return(-1);
371 return(open(item, docallback));
390 close(item, docallback);
392 open(item, docallback);
444 int close(
const char *path,
int docallback=1) {
446 if ( ! item )
return(-1);
447 return(close(item, docallback));
478 if ( ! item )
return(-1);
504 if ( ! item )
return(-1);
556 int select(
const char *path,
int docallback=1) {
558 if ( ! item )
return(-1);
559 return(select(item, docallback));
633 if ( ! item )
return(-1);
634 return(deselect(item, docallback));
637 int deselect_all(
Fl_Tree_Item *item=0,
int docallback=1);
638 int select_only(
Fl_Tree_Item *selitem,
int docallback=1);
666 if ( ! item )
return(-1);
667 return(is_selected(item));
673 if ( ! _root )
return;
683 return(_prefs.labelsize());
689 _prefs.labelsize(val);
693 return(_prefs.labelfont());
699 _prefs.labelfont(val);
703 return(_prefs.labelfgcolor());
709 _prefs.labelfgcolor(val);
713 return(_prefs.labelbgcolor());
719 _prefs.labelbgcolor(val);
723 return(_prefs.connectorcolor());
727 _prefs.connectorcolor(val);
733 return(_prefs.marginleft());
739 _prefs.marginleft(val);
746 return(_prefs.margintop());
752 _prefs.margintop(val);
759 return(_prefs.openchild_marginbottom());
765 _prefs.openchild_marginbottom(val);
772 return(_prefs.connectorwidth());
778 _prefs.connectorwidth(val);
786 return(_prefs.usericon());
798 _prefs.usericon(val);
806 return(_prefs.openicon());
814 _prefs.openicon(val);
822 return(_prefs.closeicon());
830 _prefs.closeicon(val);
835 return(_prefs.showcollapse());
846 _prefs.showcollapse(val);
851 return(_prefs.showroot());
858 _prefs.showroot(val);
863 return(_prefs.connectorstyle());
867 _prefs.connectorstyle(val);
874 return(_prefs.sortorder());
878 _prefs.sortorder(val);
886 return(_prefs.selectbox());
893 _prefs.selectbox(val);
898 return(_prefs.selectmode());
902 _prefs.selectmode(val);
911 int vposition()
const;
912 void vposition(
int ypos);
927 return( ( w == _vscroll ) ? 1 : 0 );
938 return(_scrollbar_size);
959 _scrollbar_size =
size;
961 if ( _vscroll->w() != scrollsize ) {
962 _vscroll->resize(
x()+
w()-scrollsize,
h(), scrollsize, _vscroll->h());
974 _callback_item = item;
980 return(_callback_item);
986 _callback_reason = reason;
1005 return(_callback_reason);
int openchild_marginbottom() const
Get the amount of white space (in pixels) that should appear below an open child tree's contents...
Definition: Fl_Tree.H:758
void marginleft(int val)
Set the amount of white space (in pixels) that should appear between the widget's left border and the...
Definition: Fl_Tree.H:738
an item was opened
Definition: Fl_Tree.H:194
void select(int val=1)
Change the item's selection state to the optionally specified 'val'.
Definition: Fl_Tree_Item.H:223
int is_open(const char *path) const
See if item specified by path (eg: "Parent/child/item") is open.
Definition: Fl_Tree.H:476
Fl_Tree_Select selectmode() const
Gets the tree's current selection mode.
Definition: Fl_Tree.H:897
Fl_Tree_Sort
Sort order options for items added to the tree.
Definition: Fl_Tree_Prefs.H:52
Fl_Tree_Connector connectorstyle() const
Returns the line drawing style for inter-connecting items.
Definition: Fl_Tree.H:862
int close(const char *path, int docallback=1)
Closes the item specified by path, eg: "Parent/child/item".
Definition: Fl_Tree.H:444
Fl_Tree_Select
Tree selection style.
Definition: Fl_Tree_Prefs.H:70
Fl_Color item_labelbgcolor(void) const
Get the default label background color used for creating new items.
Definition: Fl_Tree.H:712
Tree widget.
Definition: Fl_Tree.H:199
Fl_Font item_labelfont() const
Get the default font face used for creating new items.
Definition: Fl_Tree.H:692
an item was selected
Definition: Fl_Tree.H:192
Fl_Color item_labelfgcolor(void) const
Get the default label foreground color used for creating new items.
Definition: Fl_Tree.H:702
void open()
Open this item and all its children.
Definition: Fl_Tree_Item.cxx:744
void item_labelbgcolor(Fl_Color val)
Set the default label background color used for creating new items.
Definition: Fl_Tree.H:718
Fl_Tree_Item * callback_item()
Gets the item that caused the callback.
Definition: Fl_Tree.H:979
void open_toggle(Fl_Tree_Item *item, int docallback=1)
Toggle the open state of item.
Definition: Fl_Tree.H:388
Fl_Tree_Item * item_clicked()
Return the item that was last clicked.
Definition: Fl_Tree.H:303
void selectmode(Fl_Tree_Select val)
Sets the tree's selection mode.
Definition: Fl_Tree.H:901
void deselect()
Disable the item's selection state.
Definition: Fl_Tree_Item.H:250
void margintop(int val)
Sets the amount of white space (in pixels) that should appear between the widget's top border and the...
Definition: Fl_Tree.H:751
int scrollbar_size() const
Gets the current size of the scrollbars' troughs, in pixels.
Definition: Fl_Tree.H:937
Fl_Image * closeicon() const
Returns the icon to be used as the 'close' icon.
Definition: Fl_Tree.H:821
Fl_Image is the base class used for caching and drawing all kinds of images in FLTK.
Definition: Fl_Image.H:51
int open(Fl_Tree_Item *item, int docallback=1)
Open the specified 'item'.
Definition: Fl_Tree.H:336
int showcollapse() const
Returns 1 if the collapse icon is enabled, 0 if not.
Definition: Fl_Tree.H:834
void select_toggle(Fl_Tree_Item *item, int docallback=1)
Toggle the select state of the specified item.
Definition: Fl_Tree.H:574
int is_scrollbar(Fl_Widget *w)
See if widget w is one of the Fl_Tree widget's scrollbars.
Definition: Fl_Tree.H:926
void connectorcolor(Fl_Color val)
Set the connector color used for tree connection lines.
Definition: Fl_Tree.H:726
Fl_Boxtype selectbox() const
Sets the style of box used to draw selected items.
Definition: Fl_Tree.H:885
int is_close(const char *path) const
See if item specified by path (eg: "Parent/child/item") is closed.
Definition: Fl_Tree.H:502
void close()
Close this item and all its children.
Definition: Fl_Tree_Item.cxx:753
void draw()
Draws the widget.
Definition: Fl_Group.cxx:741
Fl_Boxtype
Definition: Enumerations.H:464
void clear()
Deletes all child widgets from memory recursively.
Definition: Fl_Group.cxx:386
void selectbox(Fl_Boxtype val)
Gets the style of box used to draw selected items.
Definition: Fl_Tree.H:892
Fl_Tree_Reason
The reason the callback was invoked.
Definition: Fl_Tree.H:190
Fl_Scrollbar * _vscroll
Vertical scrollbar.
Definition: Fl_Tree.H:209
int is_selected(Fl_Tree_Item *item) const
See if the specified item is selected.
Definition: Fl_Tree.H:650
void insert(Fl_Widget &, int i)
The widget is removed from its current group (if any) and then inserted into this group...
Definition: Fl_Group.cxx:461
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:45
an item was closed
Definition: Fl_Tree.H:195
Fl_Color connectorcolor() const
Get the connector color used for tree connection lines.
Definition: Fl_Tree.H:722
void select_toggle()
Toggle the item's selection state.
Definition: Fl_Tree_Item.H:227
void add(Fl_Widget &)
The widget is removed from its current group (if any) and then added to the end of this group...
Definition: Fl_Group.cxx:494
void callback_item(Fl_Tree_Item *item)
Sets the item that was changed for this callback.
Definition: Fl_Tree.H:973
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:150
Fl_Image * usericon() const
Returns the Fl_Image being used as the default user icon for all newly created items.
Definition: Fl_Tree.H:785
void do_callback_for_item(Fl_Tree_Item *item, Fl_Tree_Reason reason)
Do the callback for the item, setting the item and reason.
Definition: Fl_Tree.H:214
int close(Fl_Tree_Item *item, int docallback=1)
Closes the specified item.
Definition: Fl_Tree.H:413
int is_selected(const char *path)
See if item specified by path (eg: "Parent/child/item") is selected.
Definition: Fl_Tree.H:664
int marginleft() const
Get the amount of white space (in pixels) that should appear between the widget's left border and the...
Definition: Fl_Tree.H:732
void clear_children()
Clear all the children for this item.
Definition: Fl_Tree_Item.cxx:147
int connectorwidth() const
Gets the width of the horizontal connection lines (in pixels) that appear to the left of each tree it...
Definition: Fl_Tree.H:771
int is_close(Fl_Tree_Item *item) const
See if the specified item is closed.
Definition: Fl_Tree.H:488
int remove_child(Fl_Tree_Item *item)
Remove child by item.
Definition: Fl_Tree_Item.cxx:345
int has_children() const
See if this item has children.
Definition: Fl_Tree_Item.H:160
void sortorder(Fl_Tree_Sort val)
Gets the sort order used to add items to the tree.
Definition: Fl_Tree.H:877
void item_labelsize(Fl_Fontsize val)
Set the default label font size used for creating new items.
Definition: Fl_Tree.H:688
void callback_reason(Fl_Tree_Reason reason)
Sets the reason for this callback.
Definition: Fl_Tree.H:985
int deselect(Fl_Tree_Item *item, int docallback=1)
De-select the specified item.
Definition: Fl_Tree.H:599
void showcollapse(int val)
Set if we should show the collapse icon or not.
Definition: Fl_Tree.H:845
Fl_Preferences provides methods to store user settings between application starts.
Definition: Fl_Preferences.H:69
int showroot() const
Returns 1 if the root item is to be shown, or 0 if not.
Definition: Fl_Tree.H:850
Fl_Tree_Connector
Defines the style of connection lines between items.
Definition: Fl_Tree_Prefs.H:61
int is_close() const
See if the item is 'closed'.
Definition: Fl_Tree_Item.H:213
int deselect(const char *path, int docallback=1)
Deselect an item specified by path (eg: "Parent/child/item").
Definition: Fl_Tree.H:631
int open(const char *path, int docallback=1)
Opens the item specified by path (eg: "Parent/child/item").
Definition: Fl_Tree.H:368
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:741
void showroot(int val)
Set if the root item should be shown or not.
Definition: Fl_Tree.H:857
Fl_Fontsize item_labelsize() const
Get the default label fontsize used for creating new items.
Definition: Fl_Tree.H:682
Fl_Tree_Sort sortorder() const
Set the default sort order used when items are added to the tree.
Definition: Fl_Tree.H:873
void connectorstyle(Fl_Tree_Connector val)
Sets the line drawing style for inter-connecting items.
Definition: Fl_Tree.H:866
void root_label(const char *new_label)
Set the label for the root item.
Definition: Fl_Tree.H:235
void openicon(Fl_Image *val)
Sets the icon to be used as the 'open' icon.
Definition: Fl_Tree.H:813
an item was de-selected
Definition: Fl_Tree.H:193
void item_labelfont(Fl_Font val)
Set the default font face used for creating new items.
Definition: Fl_Tree.H:698
utility header to pull drawing functions together
void connectorwidth(int val)
Sets the width of the horizontal connection lines (in pixels) that appear to the left of each tree it...
Definition: Fl_Tree.H:777
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:769
Tree item.
Definition: Fl_Tree_Item.H:59
static int scrollbar_size()
Gets the default scrollbar size used by Fl_Browser_, Fl_Help_View, Fl_Scroll, and Fl_Text_Display wid...
Definition: Fl.cxx:151
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:712
Fl_Image * openicon() const
Returns the icon to be used as the 'open' icon.
Definition: Fl_Tree.H:805
int select(const char *path, int docallback=1)
Select the item specified by path (eg: "Parent/child/item").
Definition: Fl_Tree.H:556
Fl_Tree_Reason callback_reason() const
Gets the reason for this callback.
Definition: Fl_Tree.H:1004
void item_labelfgcolor(Fl_Color val)
Set the default label foreground color used for creating new items.
Definition: Fl_Tree.H:708
This file contains the definitions for Fl_Tree's preferences.
void show_self()
Print the tree as 'ascii art' to stdout.
Definition: Fl_Tree.H:672
void openchild_marginbottom(int val)
Set the amount of white space (in pixels) that should appear below an open child tree's contents...
Definition: Fl_Tree.H:764
Fl_Tree_Item * parent()
Return the parent for this item. Returns NULL if we are the root.
Definition: Fl_Tree_Item.H:190
void scrollbar_size(int size)
Sets the pixel size of the scrollbars' troughs to the size, in pixels.
Definition: Fl_Tree.H:958
int select(Fl_Tree_Item *item, int docallback=1)
Select the specified item.
Definition: Fl_Tree.H:524
void clear_children(Fl_Tree_Item *item)
Clear all the children of a particular node in the tree specified by item.
Definition: Fl_Tree.H:278
Fl_Tree_Item * root()
Returns the root item.
Definition: Fl_Tree.H:240
Tree widget's preferences.
Definition: Fl_Tree_Prefs.H:85
void usericon(Fl_Image *val)
Sets the Fl_Image to be used as the default user icon for all newly created items.
Definition: Fl_Tree.H:797
void closeicon(Fl_Image *val)
Sets the icon to be used as the 'close' icon.
Definition: Fl_Tree.H:829
This file contains the definitions for Fl_Tree_Item.
char is_selected() const
See if the item is selected.
Definition: Fl_Tree_Item.H:269
void clear()
Clear all children from the tree.
Definition: Fl_Tree.H:270
unknown reason
Definition: Fl_Tree.H:191
int is_open() const
See if the item is 'open'.
Definition: Fl_Tree_Item.H:209
int is_open(Fl_Tree_Item *item) const
See if item is open.
Definition: Fl_Tree.H:459
int margintop() const
Get the amount of white space (in pixels) that should appear between the widget's top border and the ...
Definition: Fl_Tree.H:745