FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Fl_Tree_Prefs.H
Go to the documentation of this file.

    00001 //
    00002 // "$Id: Fl_Tree_Prefs.H 9706 2012-11-06 20:46:14Z matt $"
    00003 //
    00004
    00005 #ifndef FL_TREE_PREFS_H
    00006 #define FL_TREE_PREFS_H
    00007
    00008 #include <FL/Fl.H>      // needed for ABI version features (via Enumerations.H)
    00009
    00011 // FL/Fl_Tree_Prefs.H
    00013 //
    00014 // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
    00015 // Copyright (C) 2009-2010 by Greg Ercolano.
    00016 //
    00017 // This library is free software. Distribution and use rights are outlined in
    00018 // the file "COPYING" which should have been included with this file.  If this
    00019 // file is missing or damaged, see the license at:
    00020 //
    00021 //     http://www.fltk.org/COPYING.php
    00022 //
    00023 // Please report all bugs and problems on the following page:
    00024 //
    00025 //     http://www.fltk.org/str.php
    00026 //
    00027
    00042
    00045
    00049 enum Fl_Tree_Sort {
    00050   FL_TREE_SORT_NONE=0,
    00051   FL_TREE_SORT_ASCENDING=1,
    00052   FL_TREE_SORT_DESCENDING=2
    00053 };
    00054
    00058 enum Fl_Tree_Connector {
    00059   FL_TREE_CONNECTOR_NONE=0,
    00060   FL_TREE_CONNECTOR_DOTTED=1,
    00061   FL_TREE_CONNECTOR_SOLID=2
    00062 };
    00063
    00067 enum Fl_Tree_Select {
    00068   FL_TREE_SELECT_NONE=0,
    00069   FL_TREE_SELECT_SINGLE=1,
    00070   FL_TREE_SELECT_MULTI=2
    00071
    00072 };
    00073
    00074 #if FLTK_ABI_VERSION >= 10301
    00075
    00076
    00077
    00078
    00079 enum Fl_Tree_Item_Reselect_Mode {
    00080   FL_TREE_SELECTABLE_ONCE=0,
    00081   FL_TREE_SELECTABLE_ALWAYS,
    00082 };
    00083
    00088 enum Fl_Tree_Item_Draw_Mode {
    00089   FL_TREE_ITEM_DRAW_DEFAULT=0,
    00090
    00091   FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET=1,
    00092   FL_TREE_ITEM_HEIGHT_FROM_WIDGET=2
    00093 };
    00094 #endif /*FLTK_ABI_VERSION*/
    00095
    00104 class FL_EXPORT Fl_Tree_Prefs {
    00105   Fl_Font _labelfont;                   // label's font face
    00106   Fl_Fontsize _labelsize;               // label's font size
    00107   int _margintop;                       // --
    00108   int _marginleft;                      //   |- tree's controllable margins
    00109 #if FLTK_ABI_VERSION >= 10301
    00110   int _marginbottom;                    // --
    00111 #endif
    00112   int _openchild_marginbottom;          // extra space below an open child tree
    00113   int _usericonmarginleft;              // space to left of user icon (if any)
    00114   int _labelmarginleft;                 // space to left of label
    00115 #if FLTK_ABI_VERSION >= 10301
    00116   int _widgetmarginleft;                // space to left of widget
    00117 #endif
    00118   int _connectorwidth;                  // connector width (right of open/close icon)
    00119   int _linespacing;                     // vertical space between lines
    00120   // Colors
    00121   Fl_Color _labelfgcolor;               // label's foreground color
    00122   Fl_Color _labelbgcolor;               // label's background color
    00123   Fl_Color _connectorcolor;             // connector dotted line color
    00124   Fl_Tree_Connector _connectorstyle;    // connector line style
    00125   Fl_Image *_openimage;                 // the 'open' icon [+]
    00126   Fl_Image *_closeimage;                // the 'close' icon [-]
    00127   Fl_Image *_userimage;                 // user's own icon
    00128   char _showcollapse;                   // 1=show collapse icons, 0=don't
    00129   char _showroot;                       // show the root item as part of the tree
    00130   Fl_Tree_Sort   _sortorder;            // none, ascening, descending, etc.
    00131   Fl_Boxtype     _selectbox;            // selection box type
    00132   Fl_Tree_Select _selectmode;           // selection mode
    00133 #if FLTK_ABI_VERSION >= 10301
    00134   Fl_Tree_Item_Reselect_Mode _itemreselectmode; // controls item selection callback() behavior
    00135   Fl_Tree_Item_Draw_Mode     _itemdrawmode;     // controls how items draw label + widget()
    00136 #endif /*FLTK_ABI_VERSION*/
    00137 public:
    00138   Fl_Tree_Prefs();
    00139
    00141   // Labels
    00144   inline Fl_Font item_labelfont() const { return(_labelfont); }
    00146   inline void item_labelfont(Fl_Font val) { _labelfont = val; }
    00148   inline Fl_Fontsize item_labelsize() const { return(_labelsize); }
    00150   inline void item_labelsize(Fl_Fontsize val) { _labelsize = val; }
    00152   inline Fl_Color item_labelfgcolor() const { return(_labelfgcolor); }
    00154   inline void item_labelfgcolor(Fl_Color val) { _labelfgcolor = val; }
    00155 #if FLTK_ABI_VERSION >= 10301
    00156
    00157
    00158
    00159
    00160   inline Fl_Color item_labelbgcolor() const {
    00161     return _labelbgcolor;
    00162   }
    00166   inline void item_labelbgcolor(Fl_Color val) {
    00167     _labelbgcolor = val;
    00168   }
    00169 #else /*FLTK_ABI_VERSION*/
    00170
    00171   inline Fl_Color item_labelbgcolor() const {
    00172     return(_labelbgcolor);
    00173   }
    00175   inline void item_labelbgcolor(Fl_Color val) {
    00176     _labelbgcolor = val;
    00177   }
    00178 #endif /*FLTK_ABI_VERSION*/
    00179
    00181   // Obsolete names - for 1.3.0 backwards compat
    00184   inline Fl_Font labelfont() const { return(_labelfont); }
    00186   inline void labelfont(Fl_Font val) { _labelfont = val; }
    00188   inline Fl_Fontsize labelsize() const { return(_labelsize); }
    00190   inline void labelsize(Fl_Fontsize val) { _labelsize = val; }
    00192   inline Fl_Color labelfgcolor() const { return(_labelfgcolor); }
    00194   inline void labelfgcolor(Fl_Color val) { _labelfgcolor = val; }
    00196   inline Fl_Color labelbgcolor() const { return(item_labelbgcolor()); }
    00198   inline void labelbgcolor(Fl_Color val) { item_labelbgcolor(val); }
    00199
    00201   // Margins
    00204   inline int marginleft() const {
    00205     return(_marginleft);
    00206   }
    00208   inline void marginleft(int val) {
    00209     _marginleft = val;
    00210   }
    00212   inline int margintop() const {
    00213     return(_margintop);
    00214   }
    00216   inline void margintop(int val) {
    00217     _margintop = val;
    00218   }
    00219 #if FLTK_ABI_VERSION >= 10301
    00220
    00221
    00222   inline int marginbottom() const {
    00223     return(_marginbottom);
    00224   }
    00227   inline void marginbottom(int val) {
    00228     _marginbottom = val;
    00229   }
    00230 #endif /*FLTK_ABI_VERSION*/
    00231
    00232   inline int openchild_marginbottom() const {
    00233     return(_openchild_marginbottom);
    00234   }
    00236   inline void openchild_marginbottom(int val) {
    00237     _openchild_marginbottom = val;
    00238   }
    00240   inline int usericonmarginleft() const {
    00241     return(_usericonmarginleft);
    00242   }
    00244   inline void usericonmarginleft(int val) {
    00245     _usericonmarginleft = val;
    00246   }
    00248   inline int labelmarginleft() const {
    00249     return(_labelmarginleft);
    00250   }
    00252   inline void labelmarginleft(int val) {
    00253     _labelmarginleft = val;
    00254   }
    00255 #if FLTK_ABI_VERSION >= 10301
    00256
    00257   inline int widgetmarginleft() const {
    00258     return(_widgetmarginleft);
    00259   }
    00261   inline void widgetmarginleft(int val) {
    00262     _widgetmarginleft = val;
    00263   }
    00264 #endif /*FLTK_ABI_VERSION*/
    00265
    00266   inline int linespacing() const {
    00267     return(_linespacing);
    00268   }
    00270   inline void linespacing(int val) {
    00271     _linespacing = val;
    00272   }
    00273
    00275   // Colors and Styles
    00278   inline Fl_Color connectorcolor() const {
    00279     return(_connectorcolor);
    00280   }
    00282   inline void connectorcolor(Fl_Color val) {
    00283     _connectorcolor = val;
    00284   }
    00286   inline Fl_Tree_Connector connectorstyle() const {
    00287     return(_connectorstyle);
    00288   }
    00290   inline void connectorstyle(Fl_Tree_Connector val) {
    00291     _connectorstyle = val;
    00292   }
    00294   inline void connectorstyle(int val) {
    00295     _connectorstyle = Fl_Tree_Connector(val);
    00296   }
    00298   inline int connectorwidth() const {
    00299     return(_connectorwidth);
    00300   }
    00302   inline void connectorwidth(int val) {
    00303     _connectorwidth = val;
    00304   }
    00305
    00307   // Icons
    00312   inline Fl_Image *openicon() const {
    00313     return(_openimage);
    00314   }
    00315   void openicon(Fl_Image *val);
    00319   inline Fl_Image *closeicon() const {
    00320     return(_closeimage);
    00321   }
    00322   void closeicon(Fl_Image *val);
    00324   inline Fl_Image *usericon() const {
    00325     return(_userimage);
    00326   }
    00330   inline void usericon(Fl_Image *val) {
    00331     _userimage = val;
    00332   }
    00333
    00335   // Options
    00338   inline char showcollapse() const {
    00339     return(_showcollapse);
    00340   }
    00349   inline void showcollapse(int val) {
    00350     _showcollapse = val;
    00351   }
    00353   inline Fl_Tree_Sort sortorder() const {
    00354     return(_sortorder);
    00355   }
    00360   inline void sortorder(Fl_Tree_Sort val) {
    00361     _sortorder = val;
    00362   }
    00364   inline Fl_Boxtype selectbox() const {
    00365     return(_selectbox);
    00366   }
    00368   inline void selectbox(Fl_Boxtype val) {
    00369     _selectbox = val;
    00370   }
    00372   inline int showroot() const {
    00373     return(int(_showroot));
    00374   }
    00379   inline void showroot(int val) {
    00380     _showroot = char(val);
    00381   }
    00383   inline Fl_Tree_Select selectmode() const {
    00384     return(_selectmode);
    00385   }
    00391   inline void selectmode(Fl_Tree_Select val) {
    00392     _selectmode = val;
    00393   }
    00394 #if FLTK_ABI_VERSION >= 10301
    00395
    00396   Fl_Tree_Item_Reselect_Mode item_reselect_mode() const {
    00397     return _itemreselectmode;
    00398   }
    00400   void item_reselect_mode(Fl_Tree_Item_Reselect_Mode mode) {
    00401     _itemreselectmode = mode;
    00402   }
    00404   inline Fl_Tree_Item_Draw_Mode item_draw_mode() const {
    00405     return(_itemdrawmode);
    00406   }
    00412   inline void item_draw_mode(Fl_Tree_Item_Draw_Mode val) {
    00413     _itemdrawmode = val;
    00414   }
    00415 #endif /*FLTK_ABI_VERSION*/
    00416 };
    00417
    00418 #endif /*FL_TREE_PREFS_H*/
    00419
    00420 //
    00421 // End of "$Id: Fl_Tree_Prefs.H 9706 2012-11-06 20:46:14Z matt $".
    00422 //