kchart

KDFrameProfileSection.h
1/*
2 KDChart - a multi-platform charting engine
3 */
4
5/****************************************************************************
6 ** Copyright (C) 2001-2003 Klarälvdalens Datakonsult AB. All rights reserved.
7 **
8 ** This file is part of the KDChart library.
9 **
10 ** This file may be distributed and/or modified under the terms of the
11 ** GNU General Public License version 2 as published by the Free Software
12 ** Foundation and appearing in the file LICENSE.GPL included in the
13 ** packaging of this file.
14 **
15 ** Licensees holding valid commercial KDChart licenses may use this file in
16 ** accordance with the KDChart Commercial License Agreement provided with
17 ** the Software.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.klaralvdalens-datakonsult.se/?page=products for
23 ** information about KDChart Commercial License Agreements.
24 **
25 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
26 ** licensing are not clear to you.
27 **
28 **********************************************************************/
29#ifndef __KDFRAMEPROFILESECTION__
30#define __KDFRAMEPROFILESECTION__
31
32#include <tqregion.h>
33#include <tqpen.h>
34#include <tqdom.h>
35#include "KDChartGlobal.h"
36
37
41class KDCHART_EXPORT KDFrameProfileSection
42{
43public:
65 enum Direction { DirPlain, DirRaising, DirSinking };
66
73 static TQString directionToString( Direction dir ) {
74 switch( dir ) {
75 case DirPlain:
76 return "Plain";
77 case DirRaising:
78 return "Raising";
79 case DirSinking:
80 return "Sinking";
81 default: // should not happen
82 return "Plain";
83 }
84 }
85
86
93 static Direction stringToDirection( const TQString& string ) {
94 if( string == "Plain" )
95 return DirPlain;
96 else if( string == "Raising" )
97 return DirRaising;
98 else if( string == "Sinking" )
99 return DirSinking;
100 else // default, should not happen
101 return DirPlain;
102 }
103
104
105
114 enum Curvature { CvtPlain, CvtConvex, CvtConcave };
115
122 static TQString curvatureToString( Curvature curv ) {
123 switch( curv ) {
124 case CvtPlain:
125 return "Plain";
126 case CvtConvex:
127 return "Convex";
128 case CvtConcave:
129 return "Concave";
130 default: // should not happen
131 return "Plain";
132 }
133 }
134
135
142 static Curvature stringToCurvature( const TQString& string ) {
143 if( string == "Plain" )
144 return CvtPlain;
145 else if( string == "Convex" )
146 return CvtConvex;
147 else if( string == "Concave" )
148 return CvtConcave;
149 else // default, should not happen
150 return CvtPlain;
151 }
152
153
161 Curvature curvature,
162 int width,
163 TQPen pen )
164 : _direction( direction ),
165 _curvature( curvature ),
166 _width( width ),
167 _pen( pen ) {}
168
176 _direction = DirPlain;
177 _curvature = CvtPlain;
178 _width = 1;
179 _pen = TQPen( TQt::SolidLine );
180 }
181
185 virtual ~KDFrameProfileSection();
186
196 static void createFrameProfileSectionNode( TQDomDocument& document,
197 TQDomNode& parent,
198 const TQString& elementName,
199 const KDFrameProfileSection* section );
200
210 static bool readFrameProfileSectionNode( const TQDomElement& element,
211 KDFrameProfileSection* section );
212
213 Direction direction() const { return _direction; }
214 Curvature curvature() const { return _curvature; }
215 int width() const { return _width; }
216 TQPen pen() const { return _pen; }
217
218private:
219 Direction _direction;
220 Curvature _curvature;
221 int _width;
222 TQPen _pen;
223};
224
230typedef TQPtrList < KDFrameProfileSection > KDFrameProfile;
231
232#endif
Settings for one profile section of one side of the frame.
static Curvature stringToCurvature(const TQString &string)
Converts the specified string to a curvature enum value.
Curvature
Profile Curvature Mode: specifying the shape of a frame profile section.
static Direction stringToDirection(const TQString &string)
Converts the specified string to a direction enum value.
static TQString curvatureToString(Curvature curv)
Converts the specified curvature enum to a string representation.
KDFrameProfileSection(Direction direction, Curvature curvature, int width, TQPen pen)
Ctor of KDFrameProfileSection.
KDFrameProfileSection()
Default ctor of FrameProfileSection.
static TQString directionToString(Direction dir)
Converts the specified direction enum to a string representation.
Direction
Profile Direction Mode: specifying whether a part of a profile looks embossed or engraved in comparis...