FLTK 1.3.2
Fl_Tree_Prefs.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Tree_Prefs.H 9706 2012-11-06 20:46:14Z matt $"
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 -- 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 
71 };
73 
74 #if FLTK_ABI_VERSION >= 10301
75 enum Fl_Tree_Item_Reselect_Mode {
80  FL_TREE_SELECTABLE_ONCE=0,
81  FL_TREE_SELECTABLE_ALWAYS,
82 };
83 
88 enum Fl_Tree_Item_Draw_Mode {
89  FL_TREE_ITEM_DRAW_DEFAULT=0,
90  FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET=1,
92  FL_TREE_ITEM_HEIGHT_FROM_WIDGET=2
93 };
94 #endif /*FLTK_ABI_VERSION*/
95 
104 class FL_EXPORT Fl_Tree_Prefs {
105  Fl_Font _labelfont; // label's font face
106  Fl_Fontsize _labelsize; // label's font size
107  int _margintop; // --
108  int _marginleft; // |- tree's controllable margins
109 #if FLTK_ABI_VERSION >= 10301
110  int _marginbottom; // --
111 #endif
112  int _openchild_marginbottom; // extra space below an open child tree
113  int _usericonmarginleft; // space to left of user icon (if any)
114  int _labelmarginleft; // space to left of label
115 #if FLTK_ABI_VERSION >= 10301
116  int _widgetmarginleft; // space to left of widget
117 #endif
118  int _connectorwidth; // connector width (right of open/close icon)
119  int _linespacing; // vertical space between lines
120  // Colors
121  Fl_Color _labelfgcolor; // label's foreground color
122  Fl_Color _labelbgcolor; // label's background color
123  Fl_Color _connectorcolor; // connector dotted line color
124  Fl_Tree_Connector _connectorstyle; // connector line style
125  Fl_Image *_openimage; // the 'open' icon [+]
126  Fl_Image *_closeimage; // the 'close' icon [-]
127  Fl_Image *_userimage; // user's own icon
128  char _showcollapse; // 1=show collapse icons, 0=don't
129  char _showroot; // show the root item as part of the tree
130  Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
131  Fl_Boxtype _selectbox; // selection box type
132  Fl_Tree_Select _selectmode; // selection mode
133 #if FLTK_ABI_VERSION >= 10301
134  Fl_Tree_Item_Reselect_Mode _itemreselectmode; // controls item selection callback() behavior
135  Fl_Tree_Item_Draw_Mode _itemdrawmode; // controls how items draw label + widget()
136 #endif /*FLTK_ABI_VERSION*/
137 public:
138  Fl_Tree_Prefs();
139 
141  // Labels
144  inline Fl_Font item_labelfont() const { return(_labelfont); }
146  inline void item_labelfont(Fl_Font val) { _labelfont = val; }
148  inline Fl_Fontsize item_labelsize() const { return(_labelsize); }
150  inline void item_labelsize(Fl_Fontsize val) { _labelsize = val; }
152  inline Fl_Color item_labelfgcolor() const { return(_labelfgcolor); }
154  inline void item_labelfgcolor(Fl_Color val) { _labelfgcolor = val; }
155 #if FLTK_ABI_VERSION >= 10301
156  inline Fl_Color item_labelbgcolor() const {
161  return _labelbgcolor;
162  }
166  inline void item_labelbgcolor(Fl_Color val) {
167  _labelbgcolor = val;
168  }
169 #else /*FLTK_ABI_VERSION*/
170  inline Fl_Color item_labelbgcolor() const {
172  return(_labelbgcolor);
173  }
175  inline void item_labelbgcolor(Fl_Color val) {
176  _labelbgcolor = val;
177  }
178 #endif /*FLTK_ABI_VERSION*/
179 
181  // Obsolete names - for 1.3.0 backwards compat
184  inline Fl_Font labelfont() const { return(_labelfont); }
186  inline void labelfont(Fl_Font val) { _labelfont = val; }
188  inline Fl_Fontsize labelsize() const { return(_labelsize); }
190  inline void labelsize(Fl_Fontsize val) { _labelsize = val; }
192  inline Fl_Color labelfgcolor() const { return(_labelfgcolor); }
194  inline void labelfgcolor(Fl_Color val) { _labelfgcolor = val; }
196  inline Fl_Color labelbgcolor() const { return(item_labelbgcolor()); }
198  inline void labelbgcolor(Fl_Color val) { item_labelbgcolor(val); }
199 
201  // Margins
204  inline int marginleft() const {
205  return(_marginleft);
206  }
208  inline void marginleft(int val) {
209  _marginleft = val;
210  }
212  inline int margintop() const {
213  return(_margintop);
214  }
216  inline void margintop(int val) {
217  _margintop = val;
218  }
219 #if FLTK_ABI_VERSION >= 10301
220  inline int marginbottom() const {
223  return(_marginbottom);
224  }
227  inline void marginbottom(int val) {
228  _marginbottom = val;
229  }
230 #endif /*FLTK_ABI_VERSION*/
231  inline int openchild_marginbottom() const {
233  return(_openchild_marginbottom);
234  }
236  inline void openchild_marginbottom(int val) {
237  _openchild_marginbottom = val;
238  }
240  inline int usericonmarginleft() const {
241  return(_usericonmarginleft);
242  }
244  inline void usericonmarginleft(int val) {
245  _usericonmarginleft = val;
246  }
248  inline int labelmarginleft() const {
249  return(_labelmarginleft);
250  }
252  inline void labelmarginleft(int val) {
253  _labelmarginleft = val;
254  }
255 #if FLTK_ABI_VERSION >= 10301
256  inline int widgetmarginleft() const {
258  return(_widgetmarginleft);
259  }
261  inline void widgetmarginleft(int val) {
262  _widgetmarginleft = val;
263  }
264 #endif /*FLTK_ABI_VERSION*/
265  inline int linespacing() const {
267  return(_linespacing);
268  }
270  inline void linespacing(int val) {
271  _linespacing = val;
272  }
273 
275  // Colors and Styles
278  inline Fl_Color connectorcolor() const {
279  return(_connectorcolor);
280  }
282  inline void connectorcolor(Fl_Color val) {
283  _connectorcolor = val;
284  }
287  return(_connectorstyle);
288  }
291  _connectorstyle = val;
292  }
294  inline void connectorstyle(int val) {
295  _connectorstyle = Fl_Tree_Connector(val);
296  }
298  inline int connectorwidth() const {
299  return(_connectorwidth);
300  }
302  inline void connectorwidth(int val) {
303  _connectorwidth = val;
304  }
305 
307  // Icons
312  inline Fl_Image *openicon() const {
313  return(_openimage);
314  }
315  void openicon(Fl_Image *val);
319  inline Fl_Image *closeicon() const {
320  return(_closeimage);
321  }
322  void closeicon(Fl_Image *val);
324  inline Fl_Image *usericon() const {
325  return(_userimage);
326  }
330  inline void usericon(Fl_Image *val) {
331  _userimage = val;
332  }
333 
335  // Options
338  inline char showcollapse() const {
339  return(_showcollapse);
340  }
349  inline void showcollapse(int val) {
350  _showcollapse = val;
351  }
353  inline Fl_Tree_Sort sortorder() const {
354  return(_sortorder);
355  }
360  inline void sortorder(Fl_Tree_Sort val) {
361  _sortorder = val;
362  }
364  inline Fl_Boxtype selectbox() const {
365  return(_selectbox);
366  }
368  inline void selectbox(Fl_Boxtype val) {
369  _selectbox = val;
370  }
372  inline int showroot() const {
373  return(int(_showroot));
374  }
379  inline void showroot(int val) {
380  _showroot = char(val);
381  }
383  inline Fl_Tree_Select selectmode() const {
384  return(_selectmode);
385  }
391  inline void selectmode(Fl_Tree_Select val) {
392  _selectmode = val;
393  }
394 #if FLTK_ABI_VERSION >= 10301
395  Fl_Tree_Item_Reselect_Mode item_reselect_mode() const {
397  return _itemreselectmode;
398  }
400  void item_reselect_mode(Fl_Tree_Item_Reselect_Mode mode) {
401  _itemreselectmode = mode;
402  }
404  inline Fl_Tree_Item_Draw_Mode item_draw_mode() const {
405  return(_itemdrawmode);
406  }
412  inline void item_draw_mode(Fl_Tree_Item_Draw_Mode val) {
413  _itemdrawmode = val;
414  }
415 #endif /*FLTK_ABI_VERSION*/
416 };
417 
418 #endif /*FL_TREE_PREFS_H*/
419 
420 //
421 // End of "$Id: Fl_Tree_Prefs.H 9706 2012-11-06 20:46:14Z matt $".
422 //
Fl_Image * openicon() const
Get the current default 'open' icon.
Definition: Fl_Tree_Prefs.H:312
Fl_Image * usericon() const
Gets the default 'user icon' (default is 0)
Definition: Fl_Tree_Prefs.H:324
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:192
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's box drawing style as an Fl_Boxtype.
Definition: Fl_Tree_Prefs.H:364
Fl_Tree_Select selectmode() const
Get the selection mode used for the tree.
Definition: Fl_Tree_Prefs.H:383
void item_labelfont(Fl_Font val)
Set the label's font to val.
Definition: Fl_Tree_Prefs.H:146
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:379
Fl static class.
int marginleft() const
Get the left margin's value in pixels.
Definition: Fl_Tree_Prefs.H:204
void selectmode(Fl_Tree_Select val)
Set the selection mode used for the tree to val.
Definition: Fl_Tree_Prefs.H:391
void labelbgcolor(Fl_Color val)
Obsolete: Set the default label background color. Please use item_labelbgcolor(Fl_Color) instead...
Definition: Fl_Tree_Prefs.H:198
Use solid lines connecting items.
Definition: Fl_Tree_Prefs.H:61
int margintop() const
Get the top margin's value in pixels.
Definition: Fl_Tree_Prefs.H:212
Fl_Color item_labelfgcolor() const
Get the default label foreground color.
Definition: Fl_Tree_Prefs.H:152
void usericonmarginleft(int val)
Set the user icon's left margin value in pixels.
Definition: Fl_Tree_Prefs.H:244
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:44
void labelfont(Fl_Font val)
Obsolete: Set the label's font to val. Please use item_labelfont(Fl_Font) instead.
Definition: Fl_Tree_Prefs.H:186
void connectorcolor(Fl_Color val)
Set the connector color used for tree connection lines.
Definition: Fl_Tree_Prefs.H:282
void showcollapse(int val)
Set if we should show the collapse icon or not.
Definition: Fl_Tree_Prefs.H:349
void labelfgcolor(Fl_Color val)
Obsolete: Set the default label foreground color. Please use item_labelfgcolor(Fl_Color) instead...
Definition: Fl_Tree_Prefs.H:194
Fl_Boxtype
Definition: Enumerations.H:469
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 'close' icon Returns the Fl_Image* of the icon, or 0 if none.
Definition: Fl_Tree_Prefs.H:319
void connectorwidth(int val)
Set the tree connection line's width.
Definition: Fl_Tree_Prefs.H:302
void item_labelbgcolor(Fl_Color val)
Set the default label background color.
Definition: Fl_Tree_Prefs.H:175
void sortorder(Fl_Tree_Sort val)
Set the default sort order value.
Definition: Fl_Tree_Prefs.H:360
void item_labelfgcolor(Fl_Color val)
Set the default label foreground color.
Definition: Fl_Tree_Prefs.H:154
Fl_Font item_labelfont() const
Return the label's font.
Definition: Fl_Tree_Prefs.H:144
void item_labelsize(Fl_Fontsize val)
Set the label's size in pixels to val.
Definition: Fl_Tree_Prefs.H:150
void connectorstyle(Fl_Tree_Connector val)
Set the connector style.
Definition: Fl_Tree_Prefs.H:290
void connectorstyle(int val)
Set the connector style [integer].
Definition: Fl_Tree_Prefs.H:294
Fl_Fontsize labelsize() const
Obsolete: Return the label's size in pixels. Please use item_labelsize() instead. ...
Definition: Fl_Tree_Prefs.H:188
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's size in pixels to val. Please use item_labelsize(Fl_Fontsize) instead...
Definition: Fl_Tree_Prefs.H:190
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:746
void marginleft(int val)
Set the left margin's value in pixels.
Definition: Fl_Tree_Prefs.H:208
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:286
Fl_Color labelbgcolor() const
Obsolete: Get the default label background color. Please use item_labelbgcolor() instead.
Definition: Fl_Tree_Prefs.H:196
Fl_Tree_Sort sortorder() const
Get the default sort order value.
Definition: Fl_Tree_Prefs.H:353
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:774
void labelmarginleft(int val)
Set the label's left margin value in pixels.
Definition: Fl_Tree_Prefs.H:252
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:717
Add items in descending sort order.
Definition: Fl_Tree_Prefs.H:52
Fl_Font labelfont() const
Obsolete: Return the label's font. Please use item_labelfont() instead.
Definition: Fl_Tree_Prefs.H:184
void linespacing(int val)
Set the line spacing value in pixels.
Definition: Fl_Tree_Prefs.H:270
void usericon(Fl_Image *val)
Sets the default 'user icon' Returns the Fl_Image* of the icon, or 0 if none (default).
Definition: Fl_Tree_Prefs.H:330
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:338
int usericonmarginleft() const
Get the user icon's left margin value in pixels.
Definition: Fl_Tree_Prefs.H:240
Tree widget's preferences.
Definition: Fl_Tree_Prefs.H:104
int connectorwidth() const
Get the tree connection line's width.
Definition: Fl_Tree_Prefs.H:298
void margintop(int val)
Set the top margin's value in pixels.
Definition: Fl_Tree_Prefs.H:216
void selectbox(Fl_Boxtype val)
Set the default selection box's box drawing style to val.
Definition: Fl_Tree_Prefs.H:368
void openchild_marginbottom(int val)
Set the margin below an open child in pixels.
Definition: Fl_Tree_Prefs.H:236
Fl_Color connectorcolor() const
Get the connector color used for tree connection lines.
Definition: Fl_Tree_Prefs.H:278
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:372
Fl_Fontsize item_labelsize() const
Return the label's size in pixels.
Definition: Fl_Tree_Prefs.H:148
int labelmarginleft() const
Get the label's left margin value in pixels.
Definition: Fl_Tree_Prefs.H:248