fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Tree_Prefs.cxx

Go to the documentation of this file.
00001 //
00002 // "$Id: Fl_Tree_Prefs.cxx 7903 2010-11-28 21:06:39Z matt $"
00003 //
00004 
00005 #include <FL/Fl.H>
00006 #include <FL/Fl_Pixmap.H>
00007 #include <FL/Fl_Tree_Prefs.H>
00008 #include <string.h>
00009 
00011 // Fl_Tree_Prefs.cxx
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; you can redistribute it and/or
00018 // modify it under the terms of the GNU Library General Public
00019 // License as published by the Free Software Foundation; either
00020 // version 2 of the License, or (at your option) any later version.
00021 //
00022 // This library is distributed in the hope that it will be useful,
00023 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00025 // Library General Public License for more details.
00026 //
00027 // You should have received a copy of the GNU Library General Public
00028 // License along with this library; if not, write to the Free Software
00029 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00030 // USA.
00031 //
00032 
00033 // INTERNAL: BUILT IN OPEN/STOW XPMS
00034 //    These can be replaced via prefs.openicon()/closeicon()
00035 //
00036 static const char *L_open_xpm[] = {
00037 #ifdef __APPLE__
00038   "11 11 2 1",
00039   ".  c None",
00040   "@  c #000000",
00041   "...@.......",
00042   "...@@......",
00043   "...@@@.....",
00044   "...@@@@....",
00045   "...@@@@@...",
00046   "...@@@@@@..",
00047   "...@@@@@...",
00048   "...@@@@....",
00049   "...@@@.....",
00050   "...@@......",
00051   "...@......."
00052 #else
00053   "11 11 3 1",
00054   ".    c #fefefe",
00055   "#    c #444444",
00056   "@    c #000000",
00057   "###########",
00058   "#.........#",
00059   "#.........#",
00060   "#....@....#",
00061   "#....@....#",
00062   "#..@@@@@..#",
00063   "#....@....#",
00064   "#....@....#",
00065   "#.........#",
00066   "#.........#",
00067   "###########"
00068 #endif
00069 };
00070 static Fl_Pixmap L_openpixmap(L_open_xpm);
00071 
00072 static const char *L_close_xpm[] = {
00073 #ifdef __APPLE__
00074   "11 11 2 1",
00075   ".  c None",
00076   "@  c #000000",
00077   "...........",
00078   "...........",
00079   "...........",
00080   "...........",
00081   "...........",
00082   "@@@@@@@@@@@",
00083   ".@@@@@@@@@.",
00084   "..@@@@@@@..",
00085   "...@@@@@...",
00086   "....@@@....",
00087   ".....@....."
00088 #else
00089   "11 11 3 1",
00090   ".    c #fefefe",
00091   "#    c #444444",
00092   "@    c #000000",
00093   "###########",
00094   "#.........#",
00095   "#.........#",
00096   "#.........#",
00097   "#.........#",
00098   "#..@@@@@..#",
00099   "#.........#",
00100   "#.........#",
00101   "#.........#",
00102   "#.........#",
00103   "###########"
00104 #endif
00105 };
00106 static Fl_Pixmap L_closepixmap(L_close_xpm);
00107 
00114 void Fl_Tree_Prefs::openicon(Fl_Image *val) {
00115   _openimage = val ? val : &L_openpixmap;
00116 }
00117 
00123 void Fl_Tree_Prefs::closeicon(Fl_Image *val) {
00124   _closeimage = val ? val : &L_closepixmap;
00125 }
00126 
00128 Fl_Tree_Prefs::Fl_Tree_Prefs() {
00129   _labelfont              = FL_HELVETICA;
00130   _labelsize              = FL_NORMAL_SIZE;
00131   _marginleft             = 6;
00132   _margintop              = 3;
00133   //_marginright          = 3;
00134   //_marginbottom         = 3;
00135   _openchild_marginbottom = 0;
00136   _usericonmarginleft     = 3;
00137   _labelmarginleft        = 3;
00138   _linespacing            = 0;
00139   _fgcolor                = FL_BLACK;
00140   _bgcolor                = FL_WHITE;
00141   _selectcolor            = FL_DARK_BLUE;
00142   _inactivecolor          = FL_GRAY;
00143   _connectorcolor         = Fl_Color(43);
00144 #ifdef __APPLE__
00145   _connectorstyle         = FL_TREE_CONNECTOR_NONE;
00146 #else
00147   _connectorstyle         = FL_TREE_CONNECTOR_DOTTED;
00148 #endif
00149   _openimage              = &L_openpixmap;
00150   _closeimage             = &L_closepixmap;
00151   _userimage              = 0;
00152   _showcollapse           = 1;
00153   _showroot               = 1;
00154   _connectorwidth         = 17;
00155   _sortorder              = FL_TREE_SORT_NONE;
00156   _selectbox              = FL_FLAT_BOX;
00157   _selectmode             = FL_TREE_SELECT_SINGLE;
00158   // Let fltk's current 'scheme' affect defaults
00159   if ( Fl::scheme() ) {
00160     if ( strcmp(Fl::scheme(), "gtk+") == 0 ) {
00161       _selectbox = _FL_GTK_THIN_UP_BOX;
00162     } else if ( strcmp(Fl::scheme(), "plastic") == 0 ) {
00163       _selectbox = _FL_PLASTIC_THIN_UP_BOX;
00164     }
00165   }
00166 }
00167 
00168 //
00169 // End of "$Id: Fl_Tree_Prefs.cxx 7903 2010-11-28 21:06:39Z matt $".
00170 //