TextStyle.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: TextStyle.cpp 1644 2009-01-27 19:26:14Z ckiesch $"
00002 
00004 
00005 //============================================================================
00006 //
00007 //  This file is part of GPSTk, the GPS Toolkit.
00008 //
00009 //  The GPSTk is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU Lesser General Public License as published
00011 //  by the Free Software Foundation; either version 2.1 of the License, or
00012 //  any later version.
00013 //
00014 //  The GPSTk is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 //  GNU Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with GPSTk; if not, write to the Free Software Foundation,
00021 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //  
00023 //  Copyright 2004, The University of Texas at Austin
00024 //
00025 //============================================================================
00026 
00027 
00028 #include "TextStyle.hpp"
00029 
00030 namespace vdraw
00031 {
00032   /*
00033    * Constructors/Destructors
00034    */
00035 
00036   TextStyle::TextStyle(void)
00037     :font(MONOSPACE), color(Color::BLACK), pointSize(12)
00038   {
00039     setStyle((short)0);
00040   }
00041 
00042 
00043   TextStyle::TextStyle(double ips, short istyle)
00044     :font(MONOSPACE), color(Color::BLACK), pointSize(ips)
00045   {
00046     setStyle(istyle);
00047   }
00048 
00049   TextStyle::TextStyle(double ips, short istyle, const Color& icolor, Font ifont)
00050     :font(ifont), color(icolor), pointSize(ips)
00051   {
00052     setStyle(istyle);
00053   }
00054 
00055   TextStyle::TextStyle(double ips, const Color& icolor, Font ifont)
00056     :font(ifont), color(icolor), pointSize(ips)
00057   {
00058   }
00059 
00060   /*
00061    * Methods
00062    */
00063 
00064   short TextStyle::style(const char* str)
00065   {
00066     using namespace std;
00067 
00068     int i;
00069     char tmp;
00070     short set = 0;
00071 
00072     for(i = 0; str[i] != '\0' ; i++)
00073     {
00074       tmp = str[i];
00075       switch(tmp)
00076       {
00077         case 'b':
00078         case 'B':
00079           set = set | BOLD;
00080           break;
00081         case 'i':
00082         case 'I':
00083           set = set | ITALIC;
00084           break;
00085         case 'u':
00086         case 'U':
00087           set = set | UNDERLINE;
00088           break;
00089         case 's':
00090         case 'S':
00091           set = set | STRIKE;
00092           break;
00093         default:
00094           cout << "Parse Error: " + tmp; 
00095       }
00096     }
00097     return set;
00098   }
00099 
00100   void TextStyle::setStyle(short istyle)
00101   {
00102     bold = istyle & BOLD;
00103     italic = istyle & ITALIC;
00104     underline = istyle & UNDERLINE;
00105     strike = istyle & STRIKE;
00106   }
00107 
00108 }
00109 

Generated on Wed Feb 8 03:31:03 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1