FLTK 1.3.0
Fl_Tree_Prefs.H
Go to the documentation of this file.
00001 //
00002 // "$Id$"
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   Fl_Font _labelfont;                   // label's font face
00087   Fl_Fontsize _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 _labelfgcolor;               // label's foreground color
00099   Fl_Color _labelbgcolor;               // background color
00100   Fl_Color _connectorcolor;             // connector dotted line color
00101   Fl_Tree_Connector _connectorstyle;    // connector line style
00102   Fl_Image *_openimage;                 // the 'open' icon [+]
00103   Fl_Image *_closeimage;                // the 'close' icon [-]
00104   Fl_Image *_userimage;                 // user's own icon
00105   char _showcollapse;                   // 1=show collapse icons, 0=don't
00106   char _showroot;                       // show the root item as part of the tree
00107   Fl_Tree_Sort   _sortorder;            // none, ascening, descending, etc.
00108   Fl_Boxtype     _selectbox;            // selection box type
00109   Fl_Tree_Select _selectmode;           // selection mode
00110 public:
00111   Fl_Tree_Prefs();
00112   
00114   // Labels
00117   inline Fl_Font labelfont() const {
00118     return(_labelfont);
00119   }
00121   inline void labelfont(Fl_Font val) {
00122     _labelfont = val;
00123   }
00125   inline Fl_Fontsize labelsize() const {
00126     return(_labelsize);
00127   }
00129   inline void labelsize(Fl_Fontsize val) {
00130     _labelsize = val;
00131   }
00132   
00134   // Margins
00137   inline int marginleft() const {
00138     return(_marginleft);
00139   }
00141   inline void marginleft(int val) {
00142     _marginleft = val;
00143   }
00145   inline int margintop() const {
00146     return(_margintop);
00147   }
00149   inline void margintop(int val) {
00150     _margintop = val;
00151   }
00153   inline int openchild_marginbottom() const {
00154     return(_openchild_marginbottom);
00155   }
00157   inline void openchild_marginbottom(int val) {
00158     _openchild_marginbottom = val;
00159   }
00160   
00161   /****** NOT IMPLEMENTED
00162    inline int marginright() const {
00163    return(_marginright);
00164    }
00165    inline void marginright(int val) {
00166    _marginright = val;
00167    }
00168    inline int marginbottom() const {
00169    return(_marginbottom);
00170    }
00171    inline void marginbottom(int val) {
00172    _marginbottom = val;
00173    }
00174    *******/
00175   
00177   inline int usericonmarginleft() const {
00178     return(_usericonmarginleft);
00179   }
00181   inline void usericonmarginleft(int val) {
00182     _usericonmarginleft = val;
00183   }
00185   inline int labelmarginleft() const {
00186     return(_labelmarginleft);
00187   }
00189   inline void labelmarginleft(int val) {
00190     _labelmarginleft = val;
00191   }
00193   inline int linespacing() const {
00194     return(_linespacing);
00195   }
00197   inline void linespacing(int val) {
00198     _linespacing = val;
00199   }
00200   
00202   // Colors and Styles
00205   inline Fl_Color labelfgcolor() const {
00206     return(_labelfgcolor);
00207   }
00209   inline void labelfgcolor(Fl_Color val) {
00210     _labelfgcolor = val;
00211   }
00213   inline Fl_Color labelbgcolor() const {
00214     return(_labelbgcolor);
00215   }
00217   inline void labelbgcolor(Fl_Color val) {
00218     _labelbgcolor = val;
00219   }
00221   inline Fl_Color connectorcolor() const {
00222     return(_connectorcolor);
00223   }
00225   inline void connectorcolor(Fl_Color val) {
00226     _connectorcolor = val;
00227   }
00229   inline Fl_Tree_Connector connectorstyle() const {
00230     return(_connectorstyle);
00231   }
00233   inline void connectorstyle(Fl_Tree_Connector val) {
00234     _connectorstyle = val;
00235   }
00237   inline void connectorstyle(int val) {
00238     _connectorstyle = Fl_Tree_Connector(val);
00239   }
00241   inline int connectorwidth() const {
00242     return(_connectorwidth);
00243   }
00245   inline void connectorwidth(int val) {
00246     _connectorwidth = val;
00247   }
00248   
00250   // Icons
00255   inline Fl_Image *openicon() const {
00256     return(_openimage);
00257   }
00258   void openicon(Fl_Image *val);
00262   inline Fl_Image *closeicon() const {
00263     return(_closeimage);
00264   }
00265   void closeicon(Fl_Image *val);
00267   inline Fl_Image *usericon() const {
00268     return(_userimage);
00269   }
00273   inline void usericon(Fl_Image *val) {
00274     _userimage = val;
00275   }
00276   
00278   // Options
00281   inline char showcollapse() const {
00282     return(_showcollapse);
00283   }
00292   inline void showcollapse(int val) {
00293     _showcollapse = val;
00294   }
00296   inline Fl_Tree_Sort sortorder() const {
00297     return(_sortorder);
00298   }
00303   inline void sortorder(Fl_Tree_Sort val) {
00304     _sortorder = val;
00305   }
00307   inline Fl_Boxtype selectbox() const {
00308     return(_selectbox);
00309   }
00311   inline void selectbox(Fl_Boxtype val) {
00312     _selectbox = val;
00313   }
00315   inline int showroot() const {
00316     return(int(_showroot));
00317   }
00322   inline void showroot(int val) {
00323     _showroot = char(val);
00324   }
00326   inline Fl_Tree_Select selectmode() const {
00327     return(_selectmode);
00328   }
00334   inline void selectmode(Fl_Tree_Select val) {
00335     _selectmode = val;
00336   }
00337 };
00338 
00339 #endif /*FL_TREE_PREFS_H*/
00340 
00341 //
00342 // End of "$Id$".
00343 //