FLTK 1.3.3
Fl_Tree_Prefs.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Tree_Prefs.H 10280 2014-09-06 09:31:53Z cand $"
3 //
4 
5 #ifndef FL_TREE_PREFS_H
6 #define FL_TREE_PREFS_H
7 
8 #include <FL/Fl.H> // needed for ABI version features (via Enumerations.H)
9 
11 // FL/Fl_Tree_Prefs.H
13 //
14 // Fl_Tree_Prefs -- This file is part of the Fl_Tree widget for FLTK
15 // Copyright (C) 2009-2010 by Greg Ercolano.
16 //
17 // This library is free software. Distribution and use rights are outlined in
18 // the file "COPYING" which should have been included with this file. If this
19 // file is missing or damaged, see the license at:
20 //
21 // http://www.fltk.org/COPYING.php
22 //
23 // Please report all bugs and problems on the following page:
24 //
25 // http://www.fltk.org/str.php
26 //
27 
42 
45 
53 };
54 
62 };
63 
73 };
75 
76 #if FLTK_ABI_VERSION >= 10301
77 enum Fl_Tree_Item_Reselect_Mode {
82  FL_TREE_SELECTABLE_ONCE=0,
83  FL_TREE_SELECTABLE_ALWAYS,
84 };
85 
90 enum Fl_Tree_Item_Draw_Mode {
91  FL_TREE_ITEM_DRAW_DEFAULT=0,
92  FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET=1,
94  FL_TREE_ITEM_HEIGHT_FROM_WIDGET=2
95 };
96 #endif /*FLTK_ABI_VERSION*/
97 
98 #if FLTK_ABI_VERSION >= 10303
99 class Fl_Tree_Item;
100 typedef void (Fl_Tree_Item_Draw_Callback)(Fl_Tree_Item*, void*);
101 #endif
102 
111 class FL_EXPORT Fl_Tree_Prefs {
112  Fl_Font _labelfont; // label's font face
113  Fl_Fontsize _labelsize; // label's font size
114  int _margintop; // --
115  int _marginleft; // |- tree's controllable margins
116 #if FLTK_ABI_VERSION >= 10301
117  int _marginbottom; // --
118 #endif
119  int _openchild_marginbottom; // extra space below an open child tree
120  int _usericonmarginleft; // space to left of user icon (if any)
121  int _labelmarginleft; // space to left of label
122 #if FLTK_ABI_VERSION >= 10301
123  int _widgetmarginleft; // space to left of widget
124 #endif
125  int _connectorwidth; // connector width (right of open/close icon)
126  int _linespacing; // vertical space between lines
127  // Colors
128  Fl_Color _labelfgcolor; // label's foreground color
129  Fl_Color _labelbgcolor; // label's background color
130  Fl_Color _connectorcolor; // connector dotted line color
131  Fl_Tree_Connector _connectorstyle; // connector line style
132  Fl_Image *_openimage; // the 'open' icon [+]
133  Fl_Image *_closeimage; // the 'close' icon [-]
134  Fl_Image *_userimage; // user's own icon
135  char _showcollapse; // 1=show collapse icons, 0=don't
136  char _showroot; // show the root item as part of the tree
137  Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
138  Fl_Boxtype _selectbox; // selection box type
139  Fl_Tree_Select _selectmode; // selection mode
140 #if FLTK_ABI_VERSION >= 10301
141  Fl_Tree_Item_Reselect_Mode _itemreselectmode; // controls item selection callback() behavior
142  Fl_Tree_Item_Draw_Mode _itemdrawmode; // controls how items draw label + widget()
143 #endif /*FLTK_ABI_VERSION*/
144 #if FLTK_ABI_VERSION >= 10303
145  Fl_Tree_Item_Draw_Callback *_itemdrawcallback; // callback to handle drawing items (0=none)
146  void *_itemdrawuserdata; // data for drawing items (0=none)
147 #endif
148 public:
149  Fl_Tree_Prefs();
150 
152  // Labels
155  inline Fl_Font item_labelfont() const { return(_labelfont); }
157  inline void item_labelfont(Fl_Font val) { _labelfont = val; }
159  inline Fl_Fontsize item_labelsize() const { return(_labelsize); }
161  inline void item_labelsize(Fl_Fontsize val) { _labelsize = val; }
163  inline Fl_Color item_labelfgcolor() const { return(_labelfgcolor); }
165  inline void item_labelfgcolor(Fl_Color val) { _labelfgcolor = val; }
166 #if FLTK_ABI_VERSION >= 10301
167  inline Fl_Color item_labelbgcolor() const {
172  return _labelbgcolor;
173  }
177  inline void item_labelbgcolor(Fl_Color val) {
178  _labelbgcolor = val;
179  }
180 #else /*FLTK_ABI_VERSION*/
181  inline Fl_Color item_labelbgcolor() const {
183  return(_labelbgcolor);
184  }
186  inline void item_labelbgcolor(Fl_Color val) {
187  _labelbgcolor = val;
188  }
189 #endif /*FLTK_ABI_VERSION*/
190 
192  // Obsolete names - for 1.3.0 backwards compat
195  inline Fl_Font labelfont() const { return(_labelfont); }
197  inline void labelfont(Fl_Font val) { _labelfont = val; }
199  inline Fl_Fontsize labelsize() const { return(_labelsize); }
201  inline void labelsize(Fl_Fontsize val) { _labelsize = val; }
203  inline Fl_Color labelfgcolor() const { return(_labelfgcolor); }
205  inline void labelfgcolor(Fl_Color val) { _labelfgcolor = val; }
207  inline Fl_Color labelbgcolor() const { return(item_labelbgcolor()); }
209  inline void labelbgcolor(Fl_Color val) { item_labelbgcolor(val); }
210 
212  // Margins
215  inline int marginleft() const {
216  return(_marginleft);
217  }
219  inline void marginleft(int val) {
220  _marginleft = val;
221  }
223  inline int margintop() const {
224  return(_margintop);
225  }
227  inline void margintop(int val) {
228  _margintop = val;
229  }
230 #if FLTK_ABI_VERSION >= 10301
231  inline int marginbottom() const {
234  return(_marginbottom);
235  }
238  inline void marginbottom(int val) {
239  _marginbottom = val;
240  }
241 #endif /*FLTK_ABI_VERSION*/
242  inline int openchild_marginbottom() const {
244  return(_openchild_marginbottom);
245  }
247  inline void openchild_marginbottom(int val) {
248  _openchild_marginbottom = val;
249  }
251  inline int usericonmarginleft() const {
252  return(_usericonmarginleft);
253  }
255  inline void usericonmarginleft(int val) {
256  _usericonmarginleft = val;
257  }
259  inline int labelmarginleft() const {
260  return(_labelmarginleft);
261  }
263  inline void labelmarginleft(int val) {
264  _labelmarginleft = val;
265  }
266 #if FLTK_ABI_VERSION >= 10301
267  inline int widgetmarginleft() const {
269  return(_widgetmarginleft);
270  }
272  inline void widgetmarginleft(int val) {
273  _widgetmarginleft = val;
274  }
275 #endif /*FLTK_ABI_VERSION*/
276  inline int linespacing() const {
278  return(_linespacing);
279  }
281  inline void linespacing(int val) {
282  _linespacing = val;
283  }
284 
286  // Colors and Styles
289  inline Fl_Color connectorcolor() const {
290  return(_connectorcolor);
291  }
293  inline void connectorcolor(Fl_Color val) {
294  _connectorcolor = val;
295  }
298  return(_connectorstyle);
299  }
302  _connectorstyle = val;
303  }
305  inline void connectorstyle(int val) {
306  _connectorstyle = Fl_Tree_Connector(val);
307  }
309  inline int connectorwidth() const {
310  return(_connectorwidth);
311  }
313  inline void connectorwidth(int val) {
314  _connectorwidth = val;
315  }
316 
318  // Icons
323  inline Fl_Image *openicon() const {
324  return(_openimage);
325  }
326  void openicon(Fl_Image *val);
330  inline Fl_Image *closeicon() const {
331  return(_closeimage);
332  }
333  void closeicon(Fl_Image *val);
335  inline Fl_Image *usericon() const {
336  return(_userimage);
337  }
341  inline void usericon(Fl_Image *val) {
342  _userimage = val;
343  }
344 
346  // Options
349  inline char showcollapse() const {
350  return(_showcollapse);
351  }
360  inline void showcollapse(int val) {
361  _showcollapse = val;
362  }
364  inline Fl_Tree_Sort sortorder() const {
365  return(_sortorder);
366  }
371  inline void sortorder(Fl_Tree_Sort val) {
372  _sortorder = val;
373  }
375  inline Fl_Boxtype selectbox() const {
376  return(_selectbox);
377  }
379  inline void selectbox(Fl_Boxtype val) {
380  _selectbox = val;
381  }
383  inline int showroot() const {
384  return(int(_showroot));
385  }
390  inline void showroot(int val) {
391  _showroot = char(val);
392  }
394  inline Fl_Tree_Select selectmode() const {
395  return(_selectmode);
396  }
402  inline void selectmode(Fl_Tree_Select val) {
403  _selectmode = val;
404  }
405 #if FLTK_ABI_VERSION >= 10301
406  Fl_Tree_Item_Reselect_Mode item_reselect_mode() const {
408  return _itemreselectmode;
409  }
411  void item_reselect_mode(Fl_Tree_Item_Reselect_Mode mode) {
412  _itemreselectmode = mode;
413  }
415  inline Fl_Tree_Item_Draw_Mode item_draw_mode() const {
416  return(_itemdrawmode);
417  }
423  inline void item_draw_mode(Fl_Tree_Item_Draw_Mode val) {
424  _itemdrawmode = val;
425  }
426 #endif
427 #if FLTK_ABI_VERSION >= 10303
428  void item_draw_callback(Fl_Tree_Item_Draw_Callback *cb, void *data=0) {
429  _itemdrawcallback = cb;
430  _itemdrawuserdata = data;
431  }
432  Fl_Tree_Item_Draw_Callback* item_draw_callback() const {
433  return(_itemdrawcallback);
434  }
435  void* item_draw_user_data() const {
436  return(_itemdrawuserdata);
437  }
438  void do_item_draw_callback(Fl_Tree_Item *o) const {
439  _itemdrawcallback(o, _itemdrawuserdata);
440  }
441 #endif
442 };
443 
444 #endif /*FL_TREE_PREFS_H*/
445 
446 //
447 // End of "$Id: Fl_Tree_Prefs.H 10280 2014-09-06 09:31:53Z cand $".
448 //
Fl_Image * openicon() const
Get the current default &#39;open&#39; icon.
Definition: Fl_Tree_Prefs.H:323
Fl_Image * usericon() const
Gets the default &#39;user icon&#39; (default is 0)
Definition: Fl_Tree_Prefs.H:335
Add items in ascending sort order.
Definition: Fl_Tree_Prefs.H:51
Fl_Color labelfgcolor() const
Obsolete: Get the default label foreground color. Please use item_labelfgcolor() instead.
Definition: Fl_Tree_Prefs.H:203
Fl_Tree_Sort
Sort order options for items added to the tree.
Definition: Fl_Tree_Prefs.H:49
Fl_Boxtype selectbox() const
Get the default selection box&#39;s box drawing style as an Fl_Boxtype.
Definition: Fl_Tree_Prefs.H:375
Fl_Tree_Select selectmode() const
Get the selection mode used for the tree.
Definition: Fl_Tree_Prefs.H:394
void item_labelfont(Fl_Font val)
Set the label&#39;s font to val.
Definition: Fl_Tree_Prefs.H:157
Fl_Tree_Select
Tree selection style.
Definition: Fl_Tree_Prefs.H:67
void showroot(int val)
Set if the root item should be shown or not.
Definition: Fl_Tree_Prefs.H:390
Fl static class.
int marginleft() const
Get the left margin&#39;s value in pixels.
Definition: Fl_Tree_Prefs.H:215
void selectmode(Fl_Tree_Select val)
Set the selection mode used for the tree to val.
Definition: Fl_Tree_Prefs.H:402
void labelbgcolor(Fl_Color val)
Obsolete: Set the default label background color. Please use item_labelbgcolor(Fl_Color) instead...
Definition: Fl_Tree_Prefs.H:209
Use solid lines connecting items.
Definition: Fl_Tree_Prefs.H:61
int margintop() const
Get the top margin&#39;s value in pixels.
Definition: Fl_Tree_Prefs.H:223
Fl_Color item_labelfgcolor() const
Get the default label foreground color.
Definition: Fl_Tree_Prefs.H:163
void usericonmarginleft(int val)
Set the user icon&#39;s left margin value in pixels.
Definition: Fl_Tree_Prefs.H:255
Use no lines connecting items.
Definition: Fl_Tree_Prefs.H:59
Fl_Image is the base class used for caching and drawing all kinds of images in FLTK.
Definition: Fl_Image.H:52
void labelfont(Fl_Font val)
Obsolete: Set the label&#39;s font to val. Please use item_labelfont(Fl_Font) instead.
Definition: Fl_Tree_Prefs.H:197
void connectorcolor(Fl_Color val)
Set the connector color used for tree connection lines.
Definition: Fl_Tree_Prefs.H:293
void showcollapse(int val)
Set if we should show the collapse icon or not.
Definition: Fl_Tree_Prefs.H:360
void labelfgcolor(Fl_Color val)
Obsolete: Set the default label foreground color. Please use item_labelfgcolor(Fl_Color) instead...
Definition: Fl_Tree_Prefs.H:205
Fl_Boxtype
Definition: Enumerations.H:473
Multiple items can be selected by clicking with SHIFT, CTRL or mouse drags.
Definition: Fl_Tree_Prefs.H:70
Fl_Image * closeicon() const
Gets the default &#39;close&#39; icon Returns the Fl_Image* of the icon, or 0 if none.
Definition: Fl_Tree_Prefs.H:330
void connectorwidth(int val)
Set the tree connection line&#39;s width.
Definition: Fl_Tree_Prefs.H:313
void item_labelbgcolor(Fl_Color val)
Set the default label background color.
Definition: Fl_Tree_Prefs.H:186
void sortorder(Fl_Tree_Sort val)
Set the default sort order value.
Definition: Fl_Tree_Prefs.H:371
void item_labelfgcolor(Fl_Color val)
Set the default label foreground color.
Definition: Fl_Tree_Prefs.H:165
Fl_Font item_labelfont() const
Return the label&#39;s font.
Definition: Fl_Tree_Prefs.H:155
void item_labelsize(Fl_Fontsize val)
Set the label&#39;s size in pixels to val.
Definition: Fl_Tree_Prefs.H:161
void connectorstyle(Fl_Tree_Connector val)
Set the connector style.
Definition: Fl_Tree_Prefs.H:301
void connectorstyle(int val)
Set the connector style [integer].
Definition: Fl_Tree_Prefs.H:305
Fl_Fontsize labelsize() const
Obsolete: Return the label&#39;s size in pixels. Please use item_labelsize() instead. ...
Definition: Fl_Tree_Prefs.H:199
Fl_Tree_Connector
Defines the style of connection lines between items.
Definition: Fl_Tree_Prefs.H:58
void labelsize(Fl_Fontsize val)
Obsolete: Set the label&#39;s size in pixels to val. Please use item_labelsize(Fl_Fontsize) instead...
Definition: Fl_Tree_Prefs.H:201
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:768
void marginleft(int val)
Set the left margin&#39;s value in pixels.
Definition: Fl_Tree_Prefs.H:219
Nothing selected when items are clicked.
Definition: Fl_Tree_Prefs.H:68
Fl_Tree_Connector connectorstyle() const
Get the connector style.
Definition: Fl_Tree_Prefs.H:297
Fl_Color labelbgcolor() const
Obsolete: Get the default label background color. Please use item_labelbgcolor() instead.
Definition: Fl_Tree_Prefs.H:207
Fl_Tree_Sort sortorder() const
Get the default sort order value.
Definition: Fl_Tree_Prefs.H:364
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition: Enumerations.H:796
void labelmarginleft(int val)
Set the label&#39;s left margin value in pixels.
Definition: Fl_Tree_Prefs.H:263
Tree widget item.
Definition: Fl_Tree_Item.H:67
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:739
Add items in descending sort order.
Definition: Fl_Tree_Prefs.H:52
Fl_Font labelfont() const
Obsolete: Return the label&#39;s font. Please use item_labelfont() instead.
Definition: Fl_Tree_Prefs.H:195
void linespacing(int val)
Set the line spacing value in pixels.
Definition: Fl_Tree_Prefs.H:281
void usericon(Fl_Image *val)
Sets the default &#39;user icon&#39; Returns the Fl_Image* of the icon, or 0 if none (default).
Definition: Fl_Tree_Prefs.H:341
Use dotted lines connecting items (default)
Definition: Fl_Tree_Prefs.H:60
char showcollapse() const
Returns 1 if the collapse icon is enabled, 0 if not.
Definition: Fl_Tree_Prefs.H:349
int usericonmarginleft() const
Get the user icon&#39;s left margin value in pixels.
Definition: Fl_Tree_Prefs.H:251
Tree widget&#39;s preferences.
Definition: Fl_Tree_Prefs.H:111
int connectorwidth() const
Get the tree connection line&#39;s width.
Definition: Fl_Tree_Prefs.H:309
void margintop(int val)
Set the top margin&#39;s value in pixels.
Definition: Fl_Tree_Prefs.H:227
void selectbox(Fl_Boxtype val)
Set the default selection box&#39;s box drawing style to val.
Definition: Fl_Tree_Prefs.H:379
void openchild_marginbottom(int val)
Set the margin below an open child in pixels.
Definition: Fl_Tree_Prefs.H:247
Fl_Color connectorcolor() const
Get the connector color used for tree connection lines.
Definition: Fl_Tree_Prefs.H:289
Single item selected when item is clicked (default)
Definition: Fl_Tree_Prefs.H:69
No sorting; items are added in the order defined (default).
Definition: Fl_Tree_Prefs.H:50
int showroot() const
Returns 1 if the root item is to be shown, or 0 if not.
Definition: Fl_Tree_Prefs.H:383
Fl_Fontsize item_labelsize() const
Return the label&#39;s size in pixels.
Definition: Fl_Tree_Prefs.H:159
int labelmarginleft() const
Get the label&#39;s left margin value in pixels.
Definition: Fl_Tree_Prefs.H:259
Single items may be selected, and they may be.
Definition: Fl_Tree_Prefs.H:72