FLTK 1.3.0
Fl_Tree_Prefs.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Tree_Prefs.H 8340 2011-01-30 20:22:06Z greg.ercolano $"
3 //
4 
5 #ifndef FL_TREE_PREFS_H
6 #define FL_TREE_PREFS_H
7 
9 // FL/Fl_Tree_Prefs.H
11 //
12 // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
13 // Copyright (C) 2009-2010 by Greg Ercolano.
14 //
15 // This library is free software; you can redistribute it and/or
16 // modify it under the terms of the GNU Library General Public
17 // License as published by the Free Software Foundation; either
18 // version 2 of the License, or (at your option) any later version.
19 //
20 // This library is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 // Library General Public License for more details.
24 //
25 // You should have received a copy of the GNU Library General Public
26 // License along with this library; if not, write to the Free Software
27 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28 // USA.
29 //
30 
45 
48 
56 };
57 
65 };
66 
74 };
76 
85 class FL_EXPORT Fl_Tree_Prefs {
86  Fl_Font _labelfont; // label's font face
87  Fl_Fontsize _labelsize; // label's font size
88  int _margintop; // --
89  int _marginleft; // |- tree's margins
90  //int _marginright; // |
91  //int _marginbottom; // --
92  int _openchild_marginbottom; // extra space below an open child tree
93  int _usericonmarginleft; // space to left of user icon (if any)
94  int _labelmarginleft; // space to left of label
95  int _connectorwidth; // connector width (right of open/close icon)
96  int _linespacing; // vertical space between lines
97  // Colors
98  Fl_Color _labelfgcolor; // label's foreground color
99  Fl_Color _labelbgcolor; // background color
100  Fl_Color _connectorcolor; // connector dotted line color
101  Fl_Tree_Connector _connectorstyle; // connector line style
102  Fl_Image *_openimage; // the 'open' icon [+]
103  Fl_Image *_closeimage; // the 'close' icon [-]
104  Fl_Image *_userimage; // user's own icon
105  char _showcollapse; // 1=show collapse icons, 0=don't
106  char _showroot; // show the root item as part of the tree
107  Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
108  Fl_Boxtype _selectbox; // selection box type
109  Fl_Tree_Select _selectmode; // selection mode
110 public:
111  Fl_Tree_Prefs();
112 
114  // Labels
117  inline Fl_Font labelfont() const {
118  return(_labelfont);
119  }
121  inline void labelfont(Fl_Font val) {
122  _labelfont = val;
123  }
125  inline Fl_Fontsize labelsize() const {
126  return(_labelsize);
127  }
129  inline void labelsize(Fl_Fontsize val) {
130  _labelsize = val;
131  }
132 
134  // Margins
137  inline int marginleft() const {
138  return(_marginleft);
139  }
141  inline void marginleft(int val) {
142  _marginleft = val;
143  }
145  inline int margintop() const {
146  return(_margintop);
147  }
149  inline void margintop(int val) {
150  _margintop = val;
151  }
153  inline int openchild_marginbottom() const {
154  return(_openchild_marginbottom);
155  }
157  inline void openchild_marginbottom(int val) {
158  _openchild_marginbottom = val;
159  }
160 
161  /****** NOT IMPLEMENTED
162  inline int marginright() const {
163  return(_marginright);
164  }
165  inline void marginright(int val) {
166  _marginright = val;
167  }
168  inline int marginbottom() const {
169  return(_marginbottom);
170  }
171  inline void marginbottom(int val) {
172  _marginbottom = val;
173  }
174  *******/
175 
177  inline int usericonmarginleft() const {
178  return(_usericonmarginleft);
179  }
181  inline void usericonmarginleft(int val) {
182  _usericonmarginleft = val;
183  }
185  inline int labelmarginleft() const {
186  return(_labelmarginleft);
187  }
189  inline void labelmarginleft(int val) {
190  _labelmarginleft = val;
191  }
193  inline int linespacing() const {
194  return(_linespacing);
195  }
197  inline void linespacing(int val) {
198  _linespacing = val;
199  }
200 
202  // Colors and Styles
205  inline Fl_Color labelfgcolor() const {
206  return(_labelfgcolor);
207  }
209  inline void labelfgcolor(Fl_Color val) {
210  _labelfgcolor = val;
211  }
213  inline Fl_Color labelbgcolor() const {
214  return(_labelbgcolor);
215  }
217  inline void labelbgcolor(Fl_Color val) {
218  _labelbgcolor = val;
219  }
221  inline Fl_Color connectorcolor() const {
222  return(_connectorcolor);
223  }
225  inline void connectorcolor(Fl_Color val) {
226  _connectorcolor = val;
227  }
230  return(_connectorstyle);
231  }
234  _connectorstyle = val;
235  }
237  inline void connectorstyle(int val) {
238  _connectorstyle = Fl_Tree_Connector(val);
239  }
241  inline int connectorwidth() const {
242  return(_connectorwidth);
243  }
245  inline void connectorwidth(int val) {
246  _connectorwidth = val;
247  }
248 
250  // Icons
255  inline Fl_Image *openicon() const {
256  return(_openimage);
257  }
258  void openicon(Fl_Image *val);
262  inline Fl_Image *closeicon() const {
263  return(_closeimage);
264  }
265  void closeicon(Fl_Image *val);
267  inline Fl_Image *usericon() const {
268  return(_userimage);
269  }
273  inline void usericon(Fl_Image *val) {
274  _userimage = val;
275  }
276 
278  // Options
281  inline char showcollapse() const {
282  return(_showcollapse);
283  }
292  inline void showcollapse(int val) {
293  _showcollapse = val;
294  }
296  inline Fl_Tree_Sort sortorder() const {
297  return(_sortorder);
298  }
303  inline void sortorder(Fl_Tree_Sort val) {
304  _sortorder = val;
305  }
307  inline Fl_Boxtype selectbox() const {
308  return(_selectbox);
309  }
311  inline void selectbox(Fl_Boxtype val) {
312  _selectbox = val;
313  }
315  inline int showroot() const {
316  return(int(_showroot));
317  }
322  inline void showroot(int val) {
323  _showroot = char(val);
324  }
326  inline Fl_Tree_Select selectmode() const {
327  return(_selectmode);
328  }
334  inline void selectmode(Fl_Tree_Select val) {
335  _selectmode = val;
336  }
337 };
338 
339 #endif /*FL_TREE_PREFS_H*/
340 
341 //
342 // End of "$Id: Fl_Tree_Prefs.H 8340 2011-01-30 20:22:06Z greg.ercolano $".
343 //
Fl_Image * openicon() const
Get the current default 'open' icon.
Definition: Fl_Tree_Prefs.H:255
Fl_Image * usericon() const
Gets the default 'user icon' (default is 0)
Definition: Fl_Tree_Prefs.H:267
Add items in ascending sort order.
Definition: Fl_Tree_Prefs.H:54
Fl_Color labelfgcolor() const
Get the default label foreground color.
Definition: Fl_Tree_Prefs.H:205
int openchild_marginbottom() const
Get the margin below an open child in pixels.
Definition: Fl_Tree_Prefs.H:153
Fl_Tree_Sort
Sort order options for items added to the tree.
Definition: Fl_Tree_Prefs.H:52
Fl_Boxtype selectbox() const
Get the default selection box's box drawing style as an Fl_Boxtype.
Definition: Fl_Tree_Prefs.H:307
Fl_Tree_Select selectmode() const
Get the selection mode used for the tree.
Definition: Fl_Tree_Prefs.H:326
Fl_Tree_Select
Tree selection style.
Definition: Fl_Tree_Prefs.H:70
void showroot(int val)
Set if the root item should be shown or not.
Definition: Fl_Tree_Prefs.H:322
int marginleft() const
Get the left margin's value in pixels.
Definition: Fl_Tree_Prefs.H:137
void selectmode(Fl_Tree_Select val)
Set the selection mode used for the tree to val.
Definition: Fl_Tree_Prefs.H:334
void labelbgcolor(Fl_Color val)
Set the default label background color.
Definition: Fl_Tree_Prefs.H:217
Use solid lines connecting items.
Definition: Fl_Tree_Prefs.H:64
int margintop() const
Get the top margin's value in pixels.
Definition: Fl_Tree_Prefs.H:145
void usericonmarginleft(int val)
Set the user icon's left margin value in pixels.
Definition: Fl_Tree_Prefs.H:181
Use no lines connecting items.
Definition: Fl_Tree_Prefs.H:62
Fl_Image is the base class used for caching and drawing all kinds of images in FLTK.
Definition: Fl_Image.H:51
void labelfont(Fl_Font val)
Set the label's font to val.
Definition: Fl_Tree_Prefs.H:121
void connectorcolor(Fl_Color val)
Set the connector color used for tree connection lines.
Definition: Fl_Tree_Prefs.H:225
void showcollapse(int val)
Set if we should show the collapse icon or not.
Definition: Fl_Tree_Prefs.H:292
void labelfgcolor(Fl_Color val)
Set the default label foreground color.
Definition: Fl_Tree_Prefs.H:209
Fl_Boxtype
Definition: Enumerations.H:464
Multiple items can be selected by clicking with.
Definition: Fl_Tree_Prefs.H:73
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:262
void connectorwidth(int val)
Set the tree connection line's width.
Definition: Fl_Tree_Prefs.H:245
void sortorder(Fl_Tree_Sort val)
Set the default sort order value.
Definition: Fl_Tree_Prefs.H:303
void connectorstyle(Fl_Tree_Connector val)
Set the connector style.
Definition: Fl_Tree_Prefs.H:233
void connectorstyle(int val)
Set the connector style [integer].
Definition: Fl_Tree_Prefs.H:237
Fl_Fontsize labelsize() const
Return the label's size in pixels.
Definition: Fl_Tree_Prefs.H:125
Fl_Tree_Connector
Defines the style of connection lines between items.
Definition: Fl_Tree_Prefs.H:61
void labelsize(Fl_Fontsize val)
Set the label's size in pixels to val.
Definition: Fl_Tree_Prefs.H:129
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:741
void marginleft(int val)
Set the left margin's value in pixels.
Definition: Fl_Tree_Prefs.H:141
int linespacing() const
Get the line spacing value in pixels.
Definition: Fl_Tree_Prefs.H:193
Nothing selected when items are clicked.
Definition: Fl_Tree_Prefs.H:71
Fl_Tree_Connector connectorstyle() const
Get the connector style.
Definition: Fl_Tree_Prefs.H:229
Fl_Color labelbgcolor() const
Get the default label background color.
Definition: Fl_Tree_Prefs.H:213
Fl_Tree_Sort sortorder() const
Get the default sort order value.
Definition: Fl_Tree_Prefs.H:296
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:769
void labelmarginleft(int val)
Set the label's left margin value in pixels.
Definition: Fl_Tree_Prefs.H:189
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:712
Add items in descending sort order.
Definition: Fl_Tree_Prefs.H:55
Fl_Font labelfont() const
Return the label's font.
Definition: Fl_Tree_Prefs.H:117
void linespacing(int val)
Set the line spacing value in pixels.
Definition: Fl_Tree_Prefs.H:197
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:273
Use dotted lines connecting items (default)
Definition: Fl_Tree_Prefs.H:63
char showcollapse() const
Returns 1 if the collapse icon is enabled, 0 if not.
Definition: Fl_Tree_Prefs.H:281
int usericonmarginleft() const
Get the user icon's left margin value in pixels.
Definition: Fl_Tree_Prefs.H:177
Tree widget's preferences.
Definition: Fl_Tree_Prefs.H:85
int connectorwidth() const
Get the tree connection line's width.
Definition: Fl_Tree_Prefs.H:241
void margintop(int val)
Set the top margin's value in pixels.
Definition: Fl_Tree_Prefs.H:149
void selectbox(Fl_Boxtype val)
Set the default selection box's box drawing style to val.
Definition: Fl_Tree_Prefs.H:311
void openchild_marginbottom(int val)
Set the margin below an open child in pixels.
Definition: Fl_Tree_Prefs.H:157
Fl_Color connectorcolor() const
Get the connector color used for tree connection lines.
Definition: Fl_Tree_Prefs.H:221
Single item selected when item is clicked (default)
Definition: Fl_Tree_Prefs.H:72
No sorting; items are added in the order defined (default).
Definition: Fl_Tree_Prefs.H:53
int showroot() const
Returns 1 if the root item is to be shown, or 0 if not.
Definition: Fl_Tree_Prefs.H:315
int labelmarginleft() const
Get the label's left margin value in pixels.
Definition: Fl_Tree_Prefs.H:185