kchart

KDChartEnums.h
Go to the documentation of this file.
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 __KDCHARTENUMS_H__
30#define __KDCHARTENUMS_H__
31
32#include <tqrect.h>
33#include <tqpointarray.h>
34
35#include "KDChartGlobal.h"
36#include <tqobject.h>
37
41
46class KDCHART_EXPORT KDChartEnums :public TQObject
47{
48 TQ_OBJECT
49
50 TQ_ENUMS( TextLayoutPolicy )
51 TQ_ENUMS( AreaName )
52 TQ_ENUMS( PositionFlag )
53
54public:
67 enum TextLayoutPolicy { LayoutJustOverwrite,
68 LayoutPolicyRotate,
69 LayoutPolicyShiftVertically,
70 LayoutPolicyShiftHorizontally,
71 LayoutPolicyShrinkFontSize };
72
80 static TQString layoutPolicyToString( TextLayoutPolicy type ) {
81 switch( type ) {
82 case LayoutJustOverwrite:
83 return "JustOverwrite";
84 case LayoutPolicyRotate:
85 return "Rotate";
86 case LayoutPolicyShiftVertically:
87 return "ShiftVertically";
88 case LayoutPolicyShiftHorizontally:
89 return "ShiftHorizontally";
90 case LayoutPolicyShrinkFontSize:
91 return "ShrinkFontSize";
92 default: // should not happen
93 tqDebug( "Unknown text layout policy" );
94 return "JustOverwrite";
95 }
96 }
97
98
108 enum NumberNotation { NumberNotationDecimal,
109 NumberNotationScientific,
110 NumberNotationScientificBig };
111
119 static TQString numberNotationToString( NumberNotation notation ) {
120 switch( notation ) {
121 case NumberNotationDecimal:
122 return "NumberNotationDecimal";
123 case NumberNotationScientific:
124 return "NumberNotationScientific";
125 case NumberNotationScientificBig:
126 return "NumberNotationScientificBig";
127 default: // should not happen
128 tqDebug( "Unknown text number notation" );
129 return "NumberNotationDecimal";
130 }
131 }
132
133
140 static NumberNotation stringToNumberNotation( const TQString& notation ) {
141 if( notation == "NumberNotationDecimal" )
142 return NumberNotationDecimal;
143 else if( notation == "NumberNotationScientific" )
144 return NumberNotationScientific;
145 else if( notation == "NumberNotationScientificBig" )
146 return NumberNotationScientificBig;
147 else // default, should not happen
148 return NumberNotationDecimal;
149 }
150
151
158 static TextLayoutPolicy stringToLayoutPolicy( const TQString& string ) {
159 if( string == "JustOverwrite" )
160 return LayoutJustOverwrite;
161 else if( string == "Rotate" )
162 return LayoutPolicyRotate;
163 else if( string == "ShiftVertically" )
164 return LayoutPolicyShiftVertically;
165 else if( string == "ShiftHorizontally" )
166 return LayoutPolicyShiftHorizontally;
167 else if( string == "ShrinkFontSize" )
168 return LayoutPolicyShrinkFontSize;
169 else // default, should not happen
170 return LayoutJustOverwrite;
171 }
172
214 enum AreaName { AreaUNKNOWN = 0x0000,
215 AreaData = 0x0001,
216 AreaAxes = 0x0002,
217 AreaDataAxes = 0x0003,
218 AreaLegend = 0x0004,
219 AreaDataAxesLegend = 0x0005,
220 AreaHeaders = 0x0006,
221 AreaFooters = 0x0007,
222 AreaDataAxesLegendHeadersFooters = 0x0008,
223 AreaInnermost = 0x0009,
224 AreaOutermost = 0x000a,
225 AreaChartDataRegion = 0x000b,
226 AreasCustomBoxes = 0x000d,
227 AreaAxisBASE = 0x1000,
228 AreaHdFtBASE = 0x2000,
229 AreaCustomBoxesBASE = 0x4000,
230 AreaBASEMask = 0xF000 };
231
232
259 enum PositionFlag { PosTopLeft =0, PosTopCenter =1, PosTopRight =2,
260 PosCenterLeft=3, PosCenter =4, PosCenterRight=5,
261 PosBottomLeft=6, PosBottomCenter=7, PosBottomRight=8 };
262
263
267 static TQPoint positionFlagToPoint( const TQRect& rect,
268 PositionFlag pos );
269
276 static TQPoint positionFlagToPoint( const TQPointArray& points,
277 PositionFlag pos )
278 {
279 TQPoint pt;
280 if( 9 <= points.size() )
281 pt = points[ pos ];
282 return pt;
283 }
284
285
293 static TQString positionFlagToString( PositionFlag type );
294
295
302 static PositionFlag stringToPositionFlag( const TQString& string );
303};
304
305
306#endif
Project global class providing some enums needed both by KDChartParams and by KDChartCustomBox.
NumberNotation
Number notation specifies the general way, how a number is to be shown.
static TQString layoutPolicyToString(TextLayoutPolicy type)
Converts the specified text layout policy enum to a string representation.
TextLayoutPolicy
Text layout policy: what to do if text that is to be drawn would cover neighboring text or neighborin...
AreaName
Areas of the chart that may have their own backgrounds and/or may be surrounded by a simple or comple...
static TextLayoutPolicy stringToLayoutPolicy(const TQString &string)
Converts the specified string to a text layout policy enum value.
static TQString numberNotationToString(NumberNotation notation)
Converts the specified number notation enum to a string representation.
PositionFlag
The general position flag to specify a point of an area, for example this could be the anchor point w...
static TQPoint positionFlagToPoint(const TQPointArray &points, PositionFlag pos)
Returns the point representing a position of a corresponding TQPointArray.
static NumberNotation stringToNumberNotation(const TQString &notation)
Converts the specified string to a number notation enum value.