Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Examples  

qsgattr.h

00001 /***************************************************************************
00002                                 qsgattr.h                              
00003                              -------------------                                         
00004     begin                : 01-January-2000
00005     copyright            : (C) 2000 by Kamil Dobkowski                         
00006     email                : kamildobk@poczta.onet.pl                                     
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   * 
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 
00019 #ifndef QSGATTRIBUTE_H
00020 #define QSGATTRIBUTE_H
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025 
00026 #include<qnamespace.h>
00027 #include<qstring.h>
00028 #include<qdom.h>
00029 
00034 class QSGAttr {};
00035 
00036 //-------------------------------------------------------------//
00037 
00042 class QSGColor : public QSGAttr {
00043          public:
00044              unsigned char r;
00045              unsigned char g;
00046              unsigned char b;
00047              unsigned char a;
00051              QSGColor();
00052              QSGColor( unsigned char red,
00053                        unsigned char green,
00054                        unsigned char blue,
00055                        unsigned char alpha = 255U );
00056              const QSGColor &set( unsigned char red,
00057                                   unsigned char green,
00058                                   unsigned char blue,
00059                                   unsigned char alpha = 255U );
00060              friend bool operator==( const QSGColor&, const QSGColor& );
00061              friend bool operator!=( const QSGColor&, const QSGColor& );
00062              friend QString  toQString( const QSGColor& a );
00063              friend QSGColor toQSGColor( const QString&  s );
00064             };
00065 
00066  //-------------------------------------------------------------//
00067 
00072 class QSGFont : public QSGAttr {
00073          public:
00074               QString  family;
00075               int      size;     // points
00076               bool     bold;
00077               bool     italic;
00078               QSGColor color;
00082               QSGFont();
00083               QSGFont( const QSGFont& f );
00084               void operator=( const QSGFont& f );
00085               friend bool operator==( const QSGFont&, const QSGFont& );
00086               friend bool operator!=( const QSGFont&, const QSGFont& );
00087               friend QString toQString( const QSGFont& font );
00088               friend QSGFont toQSGFont( const QString& string );
00089              };
00090 
00091 //-------------------------------------------------------------//
00092 
00097 class QSGLine : public QSGAttr {
00098 
00099         public:
00100        static const QSGLine invisibleLine;
00101 
00103             enum Style { Invisible  = Qt::NoPen,
00104              Solid      = Qt::SolidLine,
00105              Dash       = Qt::DashLine,
00106              DashDot    = Qt::DashDotLine,
00107              Dot        = Qt::DotLine,
00108              DashDotDot = Qt::DashDotDotLine };
00109             Style   style;
00110             int         width;
00111             QSGColor    color;
00112 
00116             QSGLine();
00117             QSGLine( Style style );
00118             friend bool operator==( const QSGLine&, const QSGLine& );
00119             friend bool operator!=( const QSGLine&, const QSGLine& );
00120             friend QString toQString( const QSGLine& line );
00121             friend QSGLine toQSGLine( const QString& string );
00122            };
00123 
00124 
00125 
00126 //-------------------------------------------------------------//
00127 
00132 class QSGFill : public QSGAttr {
00133 
00134         public:
00135     
00136          static const QSGFill transparentFill;
00137 
00139              enum Style { Transparent = Qt::NoBrush,
00140                               Solid       = Qt::SolidPattern,
00141                               Horiz       = Qt::HorPattern,
00142                               Vert        = Qt::VerPattern,
00143                               Cross       = Qt::CrossPattern,
00144                               BDiag       = Qt::BDiagPattern,
00145                               FDiag       = Qt::FDiagPattern,
00146                               DiagCross   = Qt::DiagCrossPattern,
00147                               Half        = Qt::Dense5Pattern };
00148 
00149              Style style;
00150              QSGColor  color;
00151 
00155              QSGFill();
00156              QSGFill( Style style );
00157              friend bool operator==( const QSGFill&, const QSGFill& );
00158              friend bool operator!=( const QSGFill&, const QSGFill& );
00159             friend QString toQString( const QSGFill& fill );
00160             friend QSGFill toQSGFill( const QString& string );
00161        };
00162 
00163 
00164 
00165 //-------------------------------------------------------------//
00166 
00171 class QSGPoint : public QSGAttr {
00172 
00173         public:
00174 
00175         enum Style { Invisible = 0,
00176                           Circle,
00177                           Rect,
00178                           Triangle,
00179                           Diamond,
00180                           Cross,
00181                           Plus,
00182                           HLine,
00183                           VLine
00184                           };
00185     enum Fill {
00186              Transparent = 0,
00187              Opaque,
00188              Filled
00189                };
00190         
00191         Style  style;
00192         Fill   fill;
00193         int         size;       // points
00194         QSGColor    color;
00195 
00199         QSGPoint();
00200         friend bool operator==( const QSGPoint&, const QSGPoint& );
00201         friend bool operator!=( const QSGPoint&, const QSGPoint& );
00202     friend QString toQString( const QSGPoint& point );
00203     friend QSGPoint toQSGPoint( const QString& string );
00204        };
00205 
00206 //-------------------------------------------------------------//
00207 
00212 class QSGArrow: public QSGAttr {
00213 
00214         public:
00215 
00219          enum Style {   None      = 0,
00220                 Arrow     = 1,
00221                 FArrow    = 2,
00222                 NArrow    = 3,
00223                 RArrow    = 4,
00224                 RFArrow   = 5,
00225                 RNArrow   = 6,
00226                 Rect      = 7,
00227                 Diamond   = 8,
00228                 Circle    = 9,  
00229                 Line      = 10,                                 
00230                 FDiagLine = 11,
00231                 BDiagLine = 12
00232                 };
00233          int style;
00234      int size;
00235 
00239          QSGArrow();
00240         
00241         friend bool operator==( const QSGArrow&, const QSGArrow& );
00242         friend bool operator!=( const QSGArrow&, const QSGArrow& );
00243     friend QString toQString( const QSGArrow& arrow );
00244     friend QSGArrow toQSGArrow( const QString& string );
00245     };
00246 
00247 //-------------------------------------------------------------//
00248 
00255 class QSGGradient : public QSGAttr {
00256 
00257     public:
00258      enum Type { GDefault, GGray, GStrange, GTwoColors, GFiveColors };
00259 
00260      QSGGradient( Type t = GDefault );
00261      QSGGradient( const QSGFill& f0,
00262                 const QSGFill& f4 );
00263          QSGGradient( const QSGFill& f0,
00264                 const QSGFill& f1,
00265                 const QSGFill& f2,
00266                 const QSGFill& f3,
00267                 const QSGFill& f4,
00268                 Type t = GFiveColors );
00269     virtual ~QSGGradient();
00274     virtual QSGFill& fill( double level, QSGFill& fill ) const;
00275     virtual bool isEqualTo( const QSGGradient& gradient ) const;
00276 
00277     QSGFill fill( int nr ) const { return f[nr]; }
00278     Type type() const { return t; }
00279         friend bool operator==( const QSGGradient&, const QSGGradient& );
00280         friend bool operator!=( const QSGGradient&, const QSGGradient& );
00281     friend QString toQString( const QSGGradient& arrow );
00282     friend QSGGradient toQSGGradient( const QString& string );
00283     protected:
00284 
00285         Type t;
00286     QSGFill f[5];
00287     bool m_all_colors;
00288     void set_default_colors();
00289     };
00290 
00291 
00292 //-------------------------------------------------------------//
00293 
00294 #endif
00295 
00296 
00297 
00298 
00299 

Generated on Mon Mar 18 19:16:32 2002 for KMatplot library by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002