kchart

KDFrameProfileSection.h

00001 /* -*- Mode: C++ -*-
00002    KDChart - a multi-platform charting engine
00003    */
00004 
00005 /****************************************************************************
00006  ** Copyright (C) 2001-2003 Klarälvdalens Datakonsult AB.  All rights reserved.
00007  **
00008  ** This file is part of the KDChart library.
00009  **
00010  ** This file may be distributed and/or modified under the terms of the
00011  ** GNU General Public License version 2 as published by the Free Software
00012  ** Foundation and appearing in the file LICENSE.GPL included in the
00013  ** packaging of this file.
00014  **
00015  ** Licensees holding valid commercial KDChart licenses may use this file in
00016  ** accordance with the KDChart Commercial License Agreement provided with
00017  ** the Software.
00018  **
00019  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021  **
00022  ** See http://www.klaralvdalens-datakonsult.se/?page=products for
00023  **   information about KDChart Commercial License Agreements.
00024  **
00025  ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
00026  ** licensing are not clear to you.
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: // should not happen
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 // default, should not happen
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: // should not happen
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 // default, should not happen
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
KDE Home | KDE Accessibility Home | Description of Access Keys