10 #include <FL/Fl_Image.H>
66 #if FLTK_ABI_VERSION >= 10301
68 unsigned short _flags;
77 int _collapse_xywh[4];
84 #if FLTK_ABI_VERSION >= 10301
91 void draw_vertical_connector(
int x,
int y1,
int y2,
const Fl_Tree_Prefs &prefs);
92 void draw_horizontal_connector(
int x1,
int x2,
int y,
const Fl_Tree_Prefs &prefs);
97 int x()
const {
return(_xywh[0]); }
98 int y()
const {
return(_xywh[1]); }
99 int w()
const {
return(_xywh[2]); }
100 int h()
const {
return(_xywh[3]); }
103 void show_self(
const char *indent =
"")
const;
104 void label(
const char *val);
105 const char *label()
const;
108 inline void user_data(
void* data ) { _userdata = data; }
139 return(_labelfgcolor);
143 return(_labelfgcolor);
153 return(_labelbgcolor);
165 return(_children.
total());
169 return(_children[index]);
177 int find_child(
const char *name);
180 int remove_child(
const char *new_label);
181 void clear_children();
182 void swap_children(
int ax,
int bx);
200 void update_prev_next(
int index);
225 return(is_flag(OPEN));
229 return(is_flag(OPEN)?0:1);
233 is_open()?close():open();
239 set_flag(SELECTED, val);
243 if ( is_selected() ) {
255 if ( ! is_selected() ) {
259 for (
int t=0; t<children(); t++ ) {
260 count += child(t)->select_all();
266 set_flag(SELECTED, 0);
274 if ( is_selected() ) {
278 for (
int t=0; t<children(); t++ ) {
279 count += child(t)->deselect_all();
285 return(is_flag(SELECTED));
297 set_flag(ACTIVE,val);
298 if ( _widget && val != (
int)_widget->
active() ) {
315 return(is_flag(ACTIVE));
319 return(is_activated());
323 return(is_visible());
327 return(is_flag(VISIBLE));
329 int visible_r()
const;
344 int event_on_collapse_icon(
const Fl_Tree_Prefs &prefs)
const;
348 return(_parent==0?1:0);
353 #if FLTK_ABI_VERSION >= 10301
354 inline void set_flag(
unsigned short flag,
int val) {
356 if ( val ) _flags |= flag;
else _flags &= ~flag;
359 inline int is_flag(
unsigned short val)
const {
360 return(_flags & val ? 1 : 0);
363 void set_flag(
unsigned short flag,
int val) {
366 case OPEN: _open = val;
break;
367 case VISIBLE: _visible = val;
break;
368 case ACTIVE: _active = val;
break;
369 case SELECTED: _selected = val;
break;
375 case OPEN:
return(_open ? 1 : 0);
376 case VISIBLE:
return(_visible ? 1 : 0);
377 case ACTIVE:
return(_active ? 1 : 0);
378 case SELECTED:
return(_selected ? 1 : 0);
int is_root() const
Is this item the root of the tree?
Definition: Fl_Tree_Item.H:347
void select(int val=1)
Change the item's selection state to the optionally specified 'val'.
Definition: Fl_Tree_Item.H:238
int visible() const
See if the item is visible. Alias for is_visible().
Definition: Fl_Tree_Item.H:322
int deselect_all()
Deselect item and all its children.
Definition: Fl_Tree_Item.H:272
void parent(Fl_Tree_Item *val)
Set the parent for this item.
Definition: Fl_Tree_Item.H:215
Fl_Color labelcolor() const
Return item's label text color.
Definition: Fl_Tree_Item.H:138
void deselect()
Disable the item's selection state.
Definition: Fl_Tree_Item.H:265
Fl_Image is the base class used for caching and drawing all kinds of images in FLTK.
Definition: Fl_Image.H:44
void user_data(void *data)
Set a user-data value for the item.
Definition: Fl_Tree_Item.H:108
void labelfont(Fl_Font val)
Set item's label font face.
Definition: Fl_Tree_Item.H:114
int select_all()
Select item and all its children.
Definition: Fl_Tree_Item.H:253
Fl_Widget * widget() const
Return FLTK widget assigned to this item.
Definition: Fl_Tree_Item.H:160
void labelsize(Fl_Fontsize val)
Set item's label font size.
Definition: Fl_Tree_Item.H:122
void labelbgcolor(Fl_Color val)
Set item's label background color.
Definition: Fl_Tree_Item.H:147
void usericon(Fl_Image *val)
Set the item's user icon to an Fl_Image. '0' will disable.
Definition: Fl_Tree_Item.H:332
void activate(int val=1)
Change the item's activation state to the optionally specified 'val'.
Definition: Fl_Tree_Item.H:296
Fl_Font labelfont() const
Get item's label font face.
Definition: Fl_Tree_Item.H:118
void select_toggle()
Toggle the item's selection state.
Definition: Fl_Tree_Item.H:242
char is_active() const
See if the item is activated.
Definition: Fl_Tree_Item.H:318
Fl_Color labelbgcolor() const
Return item's background text color.
Definition: Fl_Tree_Item.H:152
int has_children() const
See if this item has children.
Definition: Fl_Tree_Item.H:174
void labelcolor(Fl_Color val)
Set item's label text color.
Definition: Fl_Tree_Item.H:134
int is_close() const
See if the item is 'closed'.
Definition: Fl_Tree_Item.H:228
Fl_Image * usericon() const
Get the item's user icon as an Fl_Image. Returns '0' if disabled.
Definition: Fl_Tree_Item.H:336
void open_toggle()
Toggle the item's open/closed state.
Definition: Fl_Tree_Item.H:232
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:746
Fl_Tree_Item * child(int index)
Return the child item for the given 'index'.
Definition: Fl_Tree_Item.H:168
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:209
int is_flag(unsigned short flag) const
See if flag set. Returns 0 or 1.
Definition: Fl_Tree_Item.H:373
utility header to pull drawing functions together
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:774
Tree item.
Definition: Fl_Tree_Item.H:54
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:717
This file defines a class that manages an array of Fl_Tree_Item pointers.
int total() const
Return the total items in the array, or 0 if empty.
Definition: Fl_Tree_Item_Array.H:66
This file contains the definitions for Fl_Tree's preferences.
int children() const
Return the number of children this item has.
Definition: Fl_Tree_Item.H:164
Manages an array of Fl_Tree_Item pointers.
Definition: Fl_Tree_Item_Array.H:47
Fl_Tree_Item * parent()
Return the parent for this item. Returns NULL if we are the root.
Definition: Fl_Tree_Item.H:205
Fl_Fontsize labelsize() const
Get item's label font size.
Definition: Fl_Tree_Item.H:126
int is_visible() const
See if the item is visible.
Definition: Fl_Tree_Item.H:326
Tree widget's preferences.
Definition: Fl_Tree_Prefs.H:104
void widget(Fl_Widget *val)
Assign an FLTK widget to this item.
Definition: Fl_Tree_Item.H:156
Fl_Color labelfgcolor() const
Return item's label foreground text color.
Definition: Fl_Tree_Item.H:142
void * user_data() const
Retrieve the user-data value that has been assigned to the item.
Definition: Fl_Tree_Item.H:111
char is_selected() const
See if the item is selected.
Definition: Fl_Tree_Item.H:284
void labelfgcolor(Fl_Color val)
Set item's label foreground text color.
Definition: Fl_Tree_Item.H:130
char is_activated() const
See if the item is activated.
Definition: Fl_Tree_Item.H:314
int is_open() const
See if the item is 'open'.
Definition: Fl_Tree_Item.H:224
void deactivate()
Deactivate the item; the callback() won't be invoked when clicked.
Definition: Fl_Tree_Item.H:310