FLTK 1.3.x

Fl_Tree_Prefs.H

Go to the documentation of this file.
00001 //
00002 // "$Id: Fl_Tree_Prefs.H 7903 2010-11-28 21:06:39Z matt $"
00003 //
00004 
00005 #ifndef FL_TREE_PREFS_H
00006 #define FL_TREE_PREFS_H
00007 
00009 // FL/Fl_Tree_Prefs.H
00011 //
00012 // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
00013 // Copyright (C) 2009-2010 by Greg Ercolano.
00014 //
00015 // This library is free software; you can redistribute it and/or
00016 // modify it under the terms of the GNU Library General Public
00017 // License as published by the Free Software Foundation; either
00018 // version 2 of the License, or (at your option) any later version.
00019 //
00020 // This library is distributed in the hope that it will be useful,
00021 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00023 // Library General Public License for more details.
00024 //
00025 // You should have received a copy of the GNU Library General Public
00026 // License along with this library; if not, write to the Free Software
00027 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00028 // USA.
00029 //
00030 
00045 
00048 
00052 enum Fl_Tree_Sort {
00053   FL_TREE_SORT_NONE=0,  
00054   FL_TREE_SORT_ASCENDING=1,     
00055   FL_TREE_SORT_DESCENDING=2     
00056 };
00057 
00061 enum Fl_Tree_Connector {
00062   FL_TREE_CONNECTOR_NONE=0,     
00063   FL_TREE_CONNECTOR_DOTTED=1,   
00064   FL_TREE_CONNECTOR_SOLID=2     
00065 };
00066 
00070 enum Fl_Tree_Select {
00071   FL_TREE_SELECT_NONE=0,        
00072   FL_TREE_SELECT_SINGLE=1,      
00073   FL_TREE_SELECT_MULTI=2        
00074 
00075 };
00076 
00085 class FL_EXPORT Fl_Tree_Prefs {
00086   int _labelfont;                       // label's font face
00087   int _labelsize;                       // label's font size
00088   int _margintop;                       // -- 
00089   int _marginleft;                      //   |- tree's margins
00090   //int _marginright;                   //   |
00091   //int _marginbottom;                  // --
00092   int _openchild_marginbottom;          // extra space below an open child tree
00093   int _usericonmarginleft;              // space to left of user icon (if any)
00094   int _labelmarginleft;                 // space to left of label
00095   int _connectorwidth;                  // connector width (right of open/close icon)
00096   int _linespacing;                     // vertical space between lines
00097   // Colors
00098   Fl_Color _fgcolor;                    // label's foreground color
00099   Fl_Color _bgcolor;                    // background color
00100   Fl_Color _selectcolor;                // selection color
00101   Fl_Color _inactivecolor;              // inactive color
00102   Fl_Color _connectorcolor;             // connector dotted line color
00103   Fl_Tree_Connector _connectorstyle;    // connector line style
00104   Fl_Image *_openimage;                 // the 'open' icon [+]
00105   Fl_Image *_closeimage;                // the 'close' icon [-]
00106   Fl_Image *_userimage;                 // user's own icon
00107   char _showcollapse;                   // 1=show collapse icons, 0=don't
00108   char _showroot;                       // show the root item as part of the tree
00109   Fl_Tree_Sort   _sortorder;            // none, ascening, descending, etc.
00110   Fl_Boxtype     _selectbox;            // selection box type
00111   Fl_Tree_Select _selectmode;           // selection mode
00112 public:
00113   Fl_Tree_Prefs();
00114   
00116   // Labels
00119   inline int labelfont() const {
00120     return(_labelfont);
00121   }
00123   inline void labelfont(int val) {
00124     _labelfont = val;
00125   }
00127   inline int labelsize() const {
00128     return(_labelsize);
00129   }
00131   inline void labelsize(int val) {
00132     _labelsize = val;
00133   }
00134   
00136   // Margins
00139   inline int marginleft() const {
00140     return(_marginleft);
00141   }
00143   inline void marginleft(int val) {
00144     _marginleft = val;
00145   }
00147   inline int margintop() const {
00148     return(_margintop);
00149   }
00151   inline void margintop(int val) {
00152     _margintop = val;
00153   }
00155   inline int openchild_marginbottom() const {
00156     return(_openchild_marginbottom);
00157   }
00159   inline void openchild_marginbottom(int val) {
00160     _openchild_marginbottom = val;
00161   }
00162   
00163   /****** NOT IMPLEMENTED
00164    inline int marginright() const {
00165    return(_marginright);
00166    }
00167    inline void marginright(int val) {
00168    _marginright = val;
00169    }
00170    inline int marginbottom() const {
00171    return(_marginbottom);
00172    }
00173    inline void marginbottom(int val) {
00174    _marginbottom = val;
00175    }
00176    *******/
00177   
00179   inline int usericonmarginleft() const {
00180     return(_usericonmarginleft);
00181   }
00183   inline void usericonmarginleft(int val) {
00184     _usericonmarginleft = val;
00185   }
00187   inline int labelmarginleft() const {
00188     return(_labelmarginleft);
00189   }
00191   inline void labelmarginleft(int val) {
00192     _labelmarginleft = val;
00193   }
00195   inline int linespacing() const {
00196     return(_linespacing);
00197   }
00199   inline void linespacing(int val) {
00200     _linespacing = val;
00201   }
00202   
00204   // Colors and Styles
00207   inline Fl_Color fgcolor() const {
00208     return(_fgcolor);
00209   }
00211   inline void fgcolor(Fl_Color val) {
00212     _fgcolor = val;
00213   }
00215   inline Fl_Color bgcolor() const {
00216     return(_bgcolor);
00217   }
00219   inline void bgcolor(Fl_Color val) {
00220     _bgcolor = val;
00221   }
00223   inline Fl_Color selectcolor() const {
00224     return(_selectcolor);
00225   }
00227   inline void selectcolor(Fl_Color val) {
00228     _selectcolor = val;
00229   }
00231   inline Fl_Color inactivecolor() const {
00232     return(_inactivecolor);
00233   }
00235   inline void inactivecolor(Fl_Color val) {
00236     _inactivecolor = val;
00237   }
00239   inline Fl_Color connectorcolor() const {
00240     return(_connectorcolor);
00241   }
00243   inline void connectorcolor(Fl_Color val) {
00244     _connectorcolor = val;
00245   }
00247   inline Fl_Tree_Connector connectorstyle() const {
00248     return(_connectorstyle);
00249   }
00251   inline void connectorstyle(Fl_Tree_Connector val) {
00252     _connectorstyle = val;
00253   }
00255   inline void connectorstyle(int val) {
00256     _connectorstyle = Fl_Tree_Connector(val);
00257   }
00259   inline int connectorwidth() const {
00260     return(_connectorwidth);
00261   }
00263   inline void connectorwidth(int val) {
00264     _connectorwidth = val;
00265   }
00266   
00268   // Icons
00273   inline Fl_Image *openicon() const {
00274     return(_openimage);
00275   }
00276   void openicon(Fl_Image *val);
00280   inline Fl_Image *closeicon() const {
00281     return(_closeimage);
00282   }
00283   void closeicon(Fl_Image *val);
00285   inline Fl_Image *usericon() const {
00286     return(_userimage);
00287   }
00291   inline void usericon(Fl_Image *val) {
00292     _userimage = val;
00293   }
00294   
00296   // Options
00299   inline char showcollapse() const {
00300     return(_showcollapse);
00301   }
00310   inline void showcollapse(int val) {
00311     _showcollapse = val;
00312   }
00314   inline Fl_Tree_Sort sortorder() const {
00315     return(_sortorder);
00316   }
00321   inline void sortorder(Fl_Tree_Sort val) {
00322     _sortorder = val;
00323   }
00325   inline Fl_Boxtype selectbox() const {
00326     return(_selectbox);
00327   }
00329   inline void selectbox(Fl_Boxtype val) {
00330     _selectbox = val;
00331   }
00333   inline int showroot() const {
00334     return(int(_showroot));
00335   }
00340   inline void showroot(int val) {
00341     _showroot = char(val);
00342   }
00344   inline Fl_Tree_Select selectmode() const {
00345     return(_selectmode);
00346   }
00352   inline void selectmode(Fl_Tree_Select val) {
00353     _selectmode = val;
00354   }
00355 };
00356 
00357 #endif /*FL_TREE_PREFS_H*/
00358 
00359 //
00360 // End of "$Id: Fl_Tree_Prefs.H 7903 2010-11-28 21:06:39Z matt $".
00361 //