00001 #pragma ident "$Id: TextStyle.cpp 1644 2009-01-27 19:26:14Z ckiesch $"
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "TextStyle.hpp"
00029
00030 namespace vdraw
00031 {
00032
00033
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
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