73 enum Fl_Tree_Item_Flags {
79 unsigned short _flags;
81 int _collapse_xywh[4];
109 int x()
const {
return(_xywh[0]); }
111 int y()
const {
return(_xywh[1]); }
114 int w()
const {
return(_xywh[2]); }
116 int h()
const {
return(_xywh[3]); }
119 int label_x()
const {
return(_label_xywh[0]); }
122 int label_y()
const {
return(_label_xywh[1]); }
126 int label_w()
const {
return(_label_xywh[2]); }
129 int label_h()
const {
return(_label_xywh[3]); }
130 virtual int draw_item_content(
int render);
131 void draw(
int X,
int &Y,
int W,
Fl_Tree_Item *itemfocus,
132 int &tree_item_xmax,
int lastchild=1,
int render=1);
133 void show_self(
const char *indent =
"")
const;
134 void label(
const char *val);
135 const char *label()
const;
138 inline void user_data(
void* data ) { _userdata = data; }
167 return(_labelfgcolor);
187 return(_labelbgcolor);
200 return(_children.total());
204 return(_children[index]);
212 int find_child(
const char *name);
215 int remove_child(
const char *new_label);
216 void clear_children();
217 void swap_children(
int ax,
int bx);
219 const Fl_Tree_Item *find_child_item(
const char *name)
const;
229 const char *new_label,
232 const char *new_label);
244 int move(
int to,
int from);
254 void update_prev_next(
int index);
326 for (
int t=0; t<
children(); t++ ) {
327 count +=
child(t)->select_all();
345 for (
int t=0; t<
children(); t++ ) {
346 count +=
child(t)->deselect_all();
364 if ( _widget && val != (
int)_widget->active() ) {
368 _widget->deactivate();
404 int is_visible_r()
const;
463 int event_on_collapse_icon(
const Fl_Tree_Prefs &prefs)
const;
468 return(_parent==0?1:0);
475 inline void set_flag(
unsigned short flag,
int val) {
476 if ( flag==OPEN || flag==VISIBLE ) {
479 if ( val ) _flags |= flag;
else _flags &= ~flag;
482 inline int is_flag(
unsigned short val)
const {
483 return(_flags & val ? 1 : 0);
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1056
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition Enumerations.H:1113
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1085
Fl_Image, Fl_RGB_Image classes.
This file defines a class that manages an array of Fl_Tree_Item pointers.
This file contains the definitions for Fl_Tree's preferences.
Base class for image caching, scaling and drawing.
Definition Fl_Image.H:60
Manages an array of Fl_Tree_Item pointers.
Definition Fl_Tree_Item_Array.H:45
Tree widget item.
Definition Fl_Tree_Item.H:65
int has_children() const
See if this item has children.
Definition Fl_Tree_Item.H:209
int w() const
The entire item's width to right edge of Fl_Tree's inner width within scrollbars.
Definition Fl_Tree_Item.H:114
int is_visible() const
See if the item is visible.
Definition Fl_Tree_Item.H:392
void usericon(Fl_Image *val)
Set the item's user icon to an Fl_Image.
Definition Fl_Tree_Item.H:415
int visible() const
See if the item is visible. Alias for is_visible().
Definition Fl_Tree_Item.H:388
Fl_Tree * tree()
Return the tree for this item.
Definition Fl_Tree_Item.H:282
void userdeicon(Fl_Image *val)
Set the usericon to draw when the item is deactivated.
Definition Fl_Tree_Item.H:449
void deactivate()
Deactivate the item; the callback() won't be invoked when clicked.
Definition Fl_Tree_Item.H:376
void draw_horizontal_connector(int x1, int x2, int y, const Fl_Tree_Prefs &prefs)
Internal: Horizontal connector line based on preference settings.
Definition Fl_Tree_Item.cxx:714
Fl_Widget * widget() const
Return FLTK widget assigned to this item.
Definition Fl_Tree_Item.H:195
Fl_Color drawbgcolor() const
Returns the recommended background color used for drawing this item.
Definition Fl_Tree_Item.cxx:847
void deselect()
Disable the item's selection state.
Definition Fl_Tree_Item.H:332
Fl_Image * userdeicon() const
Return the deactivated version of the user icon, if any.
Definition Fl_Tree_Item.H:454
const Fl_Tree_Prefs & prefs() const
Return the parent tree's prefs.
Definition Fl_Tree_Item.cxx:588
void open_toggle()
Toggle the item's open/closed state.
Definition Fl_Tree_Item.H:299
void hide_widgets()
Internal: Hide the FLTK widget() for this item and all children.
Definition Fl_Tree_Item.cxx:1246
int visible_r() const
See if item and all its parents are open() and visible().
Definition Fl_Tree_Item.H:401
Fl_Tree_Item * parent()
Return the parent for this item. Returns NULL if we are the root.
Definition Fl_Tree_Item.H:261
void open()
Open this item and all its children.
Definition Fl_Tree_Item.cxx:1254
int label_y() const
The item's label y position relative to the window.
Definition Fl_Tree_Item.H:122
Fl_Tree_Item * child(int index)
Return the child item for the given 'index'.
Definition Fl_Tree_Item.H:203
int select_all()
Select item and all its children.
Definition Fl_Tree_Item.H:320
Fl_Color labelfgcolor() const
Return item's label foreground text color.
Definition Fl_Tree_Item.H:166
int is_close() const
See if the item is 'closed'.
Definition Fl_Tree_Item.H:295
void labelsize(Fl_Fontsize val)
Set item's label font size.
Definition Fl_Tree_Item.H:153
void user_data(void *data)
Set a user-data value for the item.
Definition Fl_Tree_Item.H:138
Fl_Tree_Item(const Fl_Tree_Prefs &prefs)
Constructor.
Definition Fl_Tree_Item.cxx:42
void * user_data() const
Retrieve the user-data value that has been assigned to the item.
Definition Fl_Tree_Item.H:141
void recalc_tree()
Call this when our geometry is changed.
Definition Fl_Tree_Item.cxx:1476
void select(int val=1)
Change the item's selection state to the optionally specified 'val'.
Definition Fl_Tree_Item.H:305
void show_widgets()
Internal: Show the FLTK widget() for this item and all children.
Definition Fl_Tree_Item.cxx:1234
void draw_vertical_connector(int x, int y1, int y2, const Fl_Tree_Prefs &prefs)
Internal: Vertical connector line based on preference settings.
Definition Fl_Tree_Item.cxx:739
const Fl_Tree_Item * parent() const
Return the const parent for this item. Returns NULL if we are the root.
Definition Fl_Tree_Item.H:265
const Fl_Tree * tree() const
Return the tree for this item.
Definition Fl_Tree_Item.H:277
int y() const
The item's y position relative to the window.
Definition Fl_Tree_Item.H:111
Fl_Color labelbgcolor() const
Return item's label background text color.
Definition Fl_Tree_Item.H:186
int label_h() const
The item's label height.
Definition Fl_Tree_Item.H:129
char is_selected() const
See if the item is selected.
Definition Fl_Tree_Item.H:351
Fl_Color labelcolor() const
Return item's label text color. Alias for labelfgcolor() const).
Definition Fl_Tree_Item.H:174
void close()
Close this item and all its children.
Definition Fl_Tree_Item.cxx:1264
void labelfont(Fl_Font val)
Set item's label font face.
Definition Fl_Tree_Item.H:144
Fl_Font labelfont() const
Get item's label font face.
Definition Fl_Tree_Item.H:149
int label_w() const
The item's maximum label width to right edge of Fl_Tree's inner width within scrollbars.
Definition Fl_Tree_Item.H:126
void select_toggle()
Toggle the item's selection state.
Definition Fl_Tree_Item.H:309
void labelcolor(Fl_Color val)
Set item's label text color. Alias for labelfgcolor(Fl_Color)).
Definition Fl_Tree_Item.H:170
int is_flag(unsigned short val) const
See if flag set. Returns 0 or 1.
Definition Fl_Tree_Item.H:482
void activate(int val=1)
Change the item's activation state to the optionally specified 'val'.
Definition Fl_Tree_Item.H:362
int h() const
The item's height.
Definition Fl_Tree_Item.H:116
int calc_item_height(const Fl_Tree_Prefs &prefs) const
Return the item's 'visible' height.
Definition Fl_Tree_Item.cxx:812
int is_open() const
See if the item is 'open'.
Definition Fl_Tree_Item.H:291
void set_flag(unsigned short flag, int val)
Set a flag to an on or off value. val is 0 or 1.
Definition Fl_Tree_Item.H:475
int is_root() const
Is this item the root of the tree?
Definition Fl_Tree_Item.H:467
Fl_Fontsize labelsize() const
Get item's label font size.
Definition Fl_Tree_Item.H:158
Fl_Color drawfgcolor() const
Returns the recommended foreground color used for drawing this item.
Definition Fl_Tree_Item.cxx:837
void widget(Fl_Widget *val)
Assign an FLTK widget to this item.
Definition Fl_Tree_Item.H:190
void parent(Fl_Tree_Item *val)
Set the parent for this item.
Definition Fl_Tree_Item.H:271
char is_active() const
See if the item is activated. Alias for is_activated().
Definition Fl_Tree_Item.H:384
int children() const
Return the number of children this item has.
Definition Fl_Tree_Item.H:199
void labelfgcolor(Fl_Color val)
Set item's label foreground text color.
Definition Fl_Tree_Item.H:162
int is_visible_r() const
See if item and all its parents are open() and visible().
Definition Fl_Tree_Item.cxx:1464
int x() const
The item's x position relative to the window.
Definition Fl_Tree_Item.H:109
int label_x() const
The item's label x position relative to the window.
Definition Fl_Tree_Item.H:119
char is_activated() const
See if the item is activated.
Definition Fl_Tree_Item.H:380
void labelbgcolor(Fl_Color val)
Set item's label background color.
Definition Fl_Tree_Item.H:179
int deselect_all()
Deselect item and all its children.
Definition Fl_Tree_Item.H:339
Fl_Image * usericon() const
Get the item's user icon as an Fl_Image. Returns '0' if disabled.
Definition Fl_Tree_Item.H:420
Tree widget's preferences.
Definition Fl_Tree_Prefs.H:105
Tree widget.
Definition Fl_Tree.H:286
utility header to pull drawing functions together