kchart
KDFrameProfileSection.h00001
00002
00003
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
00029 #ifndef __KDFRAMEPROFILESECTION__
00030 #define __KDFRAMEPROFILESECTION__
00031
00032 #include <qregion.h>
00033 #include <qpen.h>
00034 #include <qdom.h>
00035 #include "KDChartGlobal.h"
00036
00037
00041 class KDCHART_EXPORT KDFrameProfileSection
00042 {
00043 public:
00065 enum Direction { DirPlain, DirRaising, DirSinking };
00066
00073 static QString directionToString( Direction dir ) {
00074 switch( dir ) {
00075 case DirPlain:
00076 return "Plain";
00077 case DirRaising:
00078 return "Raising";
00079 case DirSinking:
00080 return "Sinking";
00081 default:
00082 return "Plain";
00083 }
00084 }
00085
00086
00093 static Direction stringToDirection( const QString& string ) {
00094 if( string == "Plain" )
00095 return DirPlain;
00096 else if( string == "Raising" )
00097 return DirRaising;
00098 else if( string == "Sinking" )
00099 return DirSinking;
00100 else
00101 return DirPlain;
00102 }
00103
00104
00105
00114 enum Curvature { CvtPlain, CvtConvex, CvtConcave };
00115
00122 static QString curvatureToString( Curvature curv ) {
00123 switch( curv ) {
00124 case CvtPlain:
00125 return "Plain";
00126 case CvtConvex:
00127 return "Convex";
00128 case CvtConcave:
00129 return "Concave";
00130 default:
00131 return "Plain";
00132 }
00133 }
00134
00135
00142 static Curvature stringToCurvature( const QString& string ) {
00143 if( string == "Plain" )
00144 return CvtPlain;
00145 else if( string == "Convex" )
00146 return CvtConvex;
00147 else if( string == "Concave" )
00148 return CvtConcave;
00149 else
00150 return CvtPlain;
00151 }
00152
00153
00160 KDFrameProfileSection( Direction direction,
00161 Curvature curvature,
00162 int width,
00163 QPen pen )
00164 : _direction( direction ),
00165 _curvature( curvature ),
00166 _width( width ),
00167 _pen( pen ) {}
00168
00175 KDFrameProfileSection() {
00176 _direction = DirPlain;
00177 _curvature = CvtPlain;
00178 _width = 1;
00179 _pen = QPen( Qt::SolidLine );
00180 }
00181
00185 virtual ~KDFrameProfileSection();
00186
00196 static void createFrameProfileSectionNode( QDomDocument& document,
00197 QDomNode& parent,
00198 const QString& elementName,
00199 const KDFrameProfileSection* section );
00200
00210 static bool readFrameProfileSectionNode( const QDomElement& element,
00211 KDFrameProfileSection* section );
00212
00213 Direction direction() const { return _direction; }
00214 Curvature curvature() const { return _curvature; }
00215 int width() const { return _width; }
00216 QPen pen() const { return _pen; }
00217
00218 private:
00219 Direction _direction;
00220 Curvature _curvature;
00221 int _width;
00222 QPen _pen;
00223 };
00224
00230 typedef QPtrList < KDFrameProfileSection > KDFrameProfile;
00231
00232 #endif
|