1
#ifndef FL_TREE_PREFS_H
2
#define FL_TREE_PREFS_H
8
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
9
// Copyright (C) 2009 by Greg Ercolano.
11
// This library is free software; you can redistribute it and/or
12
// modify it under the terms of the GNU Library General Public
13
// License as published by the Free Software Foundation; either
14
// version 2 of the License, or (at your option) any later version.
16
// This library is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
// Library General Public License for more details.
21
// You should have received a copy of the GNU Library General Public
22
// License along with this library; if not, write to the Free Software
23
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29
/// \brief This file contains the definitions for Fl_Tree's preferences.
37
/// |_____ Fl_Tree_Item
42
/// \class Fl_Tree_Prefs
43
/// \brief Tree widget's preferences.
45
/// \enum Fl_Tree_Sort
46
/// Sort order options for items added to the tree
49
FL_TREE_SORT_NONE=0, ///< No sorting; items are added in the order defined (default).
50
FL_TREE_SORT_ASCENDING=1, ///< Add items in ascending sort order.
51
FL_TREE_SORT_DESCENDING=2 ///< Add items in descending sort order.
54
/// \enum Fl_Tree_Connector
55
/// Defines the style of connection lines between items.
57
enum Fl_Tree_Connector {
58
FL_TREE_CONNECTOR_NONE=0, ///< Use no lines connecting items
59
FL_TREE_CONNECTOR_DOTTED=1, ///< Use dotted lines connecting items (default)
60
FL_TREE_CONNECTOR_SOLID=2 ///< Use solid lines connecting items
63
/// \enum Fl_Tree_Select
64
/// Tree selection style.
67
FL_TREE_SELECT_NONE=0, ///< Nothing selected when items are clicked
68
FL_TREE_SELECT_SINGLE, ///< Single item selected when item is clicked (default)
69
FL_TREE_SELECT_MULTI ///< Multiple items can be selected by clicking with
70
///< SHIFT or CTRL or mouse drags.
73
/// \class Fl_Tree_Prefs
75
/// \brief Fl_Tree's Preferences class.
77
/// This class manages the Fl_Tree's defaults.
78
/// You should probably be using the methods in Fl_Tree
79
/// instead of trying to accessing tree's preferences settings directly.
82
int _labelfont; // label's font face
83
int _labelsize; // label's font size
85
int _marginleft; // |- tree's margins
86
//int _marginright; // |
87
//int _marginbottom; // --
88
int _usericonmarginleft; // space to left of user icon (if any)
89
int _labelmarginleft; // space to left of label
90
int _connectorwidth; // connector width (right of open/close icon)
91
int _linespacing; // vertical space between lines
93
Fl_Color _fgcolor; // label's foreground color
94
Fl_Color _bgcolor; // background color
95
Fl_Color _selectcolor; // selection color
96
Fl_Color _inactivecolor; // inactive color
97
Fl_Color _connectorcolor; // connector dotted line color
98
Fl_Tree_Connector _connectorstyle; // connector line style
99
Fl_Pixmap *_openpixmap; // the 'open' icon [+]
100
Fl_Pixmap *_closepixmap; // the 'close' icon [-]
101
Fl_Pixmap *_userpixmap; // user's own icon
102
char _showcollapse; // 1=show collapse icons, 0=don't
103
char _showroot; // show the root item as part of the tree
104
Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
105
Fl_Boxtype _selectbox; // selection box type
106
Fl_Tree_Select _selectmode; // selection mode
110
////////////////////////////
112
////////////////////////////
113
/// Return the label's font.
114
inline int labelfont() const {
117
/// Set the label's font to \p val.
118
inline void labelfont(int val) {
121
/// Return the label's size in pixels.
122
inline int labelsize() const {
125
/// Set the label's size in pixels to \p val.
126
inline void labelsize(int val) {
130
////////////////////////////
132
////////////////////////////
133
/// Get the left margin's value in pixels
134
inline int marginleft() const {
137
/// Set the left margin's value in pixels
138
inline void marginleft(int val) {
141
/// Get the top margin's value in pixels
142
inline int margintop() const {
145
/// Set the top margin's value in pixels
146
inline void margintop(int val) {
150
/****** NOT IMPLEMENTED
151
inline int marginright() const {
152
return(_marginright);
154
inline void marginright(int val) {
157
inline int marginbottom() const {
158
return(_marginbottom);
160
inline void marginbottom(int val) {
165
/// Get the user icon's left margin value in pixels
166
inline int usericonmarginleft() const {
167
return(_usericonmarginleft);
169
/// Set the user icon's left margin value in pixels
170
inline void usericonmarginleft(int val) {
171
_usericonmarginleft = val;
173
/// Get the label's left margin value in pixels
174
inline int labelmarginleft() const {
175
return(_labelmarginleft);
177
/// Set the label's left margin value in pixels
178
inline void labelmarginleft(int val) {
179
_labelmarginleft = val;
181
/// Get the line spacing value in pixels
182
inline int linespacing() const {
183
return(_linespacing);
185
/// Set the line spacing value in pixels
186
inline void linespacing(int val) {
190
////////////////////////////
192
////////////////////////////
193
/// Get the default label foreground color
194
inline Fl_Color fgcolor() const {
197
/// Set the default label foreground color
198
inline void fgcolor(Fl_Color val) {
201
/// Get the default label background color
202
inline Fl_Color bgcolor() const {
205
/// Set the default label background color
206
inline void bgcolor(Fl_Color val) {
209
/// Get the default selection color
210
inline Fl_Color selectcolor() const {
211
return(_selectcolor);
213
/// Set the default selection color
214
inline void selectcolor(Fl_Color val) {
217
/// Get the default inactive color
218
inline Fl_Color inactivecolor() const {
219
return(_inactivecolor);
221
/// Set the default inactive color
222
inline void inactivecolor(Fl_Color val) {
223
_inactivecolor = val;
225
/// Get the connector color; the color used for tree connection lines
226
inline Fl_Color connectorcolor() const {
227
return(_connectorcolor);
229
/// Set the connector color; the color used for tree connection lines
230
inline void connectorcolor(Fl_Color val) {
231
_connectorcolor = val;
233
/// Get the connector style
234
inline Fl_Tree_Connector connectorstyle() const {
235
return(_connectorstyle);
237
/// Set the connector style
238
inline void connectorstyle(Fl_Tree_Connector val) {
239
_connectorstyle = val;
241
/// Get the tree connection line's width
242
inline int connectorwidth() const {
243
return(_connectorwidth);
245
/// Set the tree connection line's width
246
inline void connectorwidth(int val) {
247
_connectorwidth = val;
250
////////////////////////////
252
////////////////////////////
253
/// Get the current default 'open' icon.
254
/// Returns the Fl_Pixmap* of the icon, or 0 if none.
256
inline Fl_Pixmap *openicon() const {
259
void openicon(Fl_Pixmap *val);
260
/// Gets the default 'close' icon
261
/// Returns the Fl_Pixmap* of the icon, or 0 if none.
263
inline Fl_Pixmap *closeicon() const {
264
return(_closepixmap);
266
void closeicon(Fl_Pixmap *val);
267
/// Gets the default 'user icon' (default is 0)
268
inline Fl_Pixmap *usericon() const {
271
/// Sets the default 'user icon'
272
/// Returns the Fl_Pixmap* of the icon, or 0 if none (default).
274
inline void usericon(Fl_Pixmap *val) {
278
////////////////////////////
280
////////////////////////////
281
/// Returns 1 if the collapse icon is enabled, 0 if not.
282
inline char showcollapse() const {
283
return(_showcollapse);
285
/// Set if we should show the collapse icon or not.
286
/// If collapse icons are disabled, the user will not be able
287
/// to interactively collapse items in the tree, unless the application
288
/// provides some other means via open() and close().
290
/// \param[in] val 1: shows collapse icons (default),\n
291
/// 0: hides collapse icons.
293
inline void showcollapse(int val) {
296
/// Get the default sort order value
297
inline Fl_Tree_Sort sortorder() const {
300
/// Set the default sort order value.
301
/// Defines the order new items appear when add()ed to the tree.
302
/// See Fl_Tree_Sort for possible values.
304
inline void sortorder(Fl_Tree_Sort val) {
307
/// Get the default selection box's box drawing style as an Fl_Boxtype.
308
inline Fl_Boxtype selectbox() const {
311
/// Set the default selection box's box drawing style to \p val.
312
inline void selectbox(Fl_Boxtype val) {
315
/// Returns 1 if the root item is to be shown, or 0 if not.
316
inline int showroot() const {
317
return(int(_showroot));
319
/// Set if the root item should be shown or not.
320
/// \param[in] val 1 -- show the root item (default)\n
321
/// 0 -- hide the root item.
323
inline void showroot(int val) {
324
_showroot = char(val);
326
/// Get the selection mode used for the tree
327
inline Fl_Tree_Select selectmode() const {
330
/// Set the selection mode used for the tree to \p val.
331
/// This affects how items in the tree are selected
332
/// when clicked on and dragged over by the mouse.
333
/// See Fl_Tree_Select for possible values.
335
inline void selectmode(Fl_Tree_Select val) {
340
#endif /*FL_TREE_PREFS_H*/