kchart
KDChartEnums.hGo to the documentation of this file.00001
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 __KDCHARTENUMS_H__
00030 #define __KDCHARTENUMS_H__
00031
00032 #include <qrect.h>
00033 #include <qpointarray.h>
00034
00035 #include "KDChartGlobal.h"
00036 #include <qobject.h>
00037
00046 class KDCHART_EXPORT KDChartEnums :public QObject
00047 {
00048 Q_OBJECT
00049 Q_ENUMS( TextLayoutPolicy )
00050 Q_ENUMS( AreaName )
00051 Q_ENUMS( PositionFlag )
00052
00053 public:
00066 enum TextLayoutPolicy { LayoutJustOverwrite,
00067 LayoutPolicyRotate,
00068 LayoutPolicyShiftVertically,
00069 LayoutPolicyShiftHorizontally,
00070 LayoutPolicyShrinkFontSize };
00071
00079 static QString layoutPolicyToString( TextLayoutPolicy type ) {
00080 switch( type ) {
00081 case LayoutJustOverwrite:
00082 return "JustOverwrite";
00083 case LayoutPolicyRotate:
00084 return "Rotate";
00085 case LayoutPolicyShiftVertically:
00086 return "ShiftVertically";
00087 case LayoutPolicyShiftHorizontally:
00088 return "ShiftHorizontally";
00089 case LayoutPolicyShrinkFontSize:
00090 return "ShrinkFontSize";
00091 default:
00092 qDebug( "Unknown text layout policy" );
00093 return "JustOverwrite";
00094 }
00095 }
00096
00097
00107 enum NumberNotation { NumberNotationDecimal,
00108 NumberNotationScientific,
00109 NumberNotationScientificBig };
00110
00118 static QString numberNotationToString( NumberNotation notation ) {
00119 switch( notation ) {
00120 case NumberNotationDecimal:
00121 return "NumberNotationDecimal";
00122 case NumberNotationScientific:
00123 return "NumberNotationScientific";
00124 case NumberNotationScientificBig:
00125 return "NumberNotationScientificBig";
00126 default:
00127 qDebug( "Unknown text number notation" );
00128 return "NumberNotationDecimal";
00129 }
00130 }
00131
00132
00139 static NumberNotation stringToNumberNotation( const QString& notation ) {
00140 if( notation == "NumberNotationDecimal" )
00141 return NumberNotationDecimal;
00142 else if( notation == "NumberNotationScientific" )
00143 return NumberNotationScientific;
00144 else if( notation == "NumberNotationScientificBig" )
00145 return NumberNotationScientificBig;
00146 else
00147 return NumberNotationDecimal;
00148 }
00149
00150
00157 static TextLayoutPolicy stringToLayoutPolicy( const QString& string ) {
00158 if( string == "JustOverwrite" )
00159 return LayoutJustOverwrite;
00160 else if( string == "Rotate" )
00161 return LayoutPolicyRotate;
00162 else if( string == "ShiftVertically" )
00163 return LayoutPolicyShiftVertically;
00164 else if( string == "ShiftHorizontally" )
00165 return LayoutPolicyShiftHorizontally;
00166 else if( string == "ShrinkFontSize" )
00167 return LayoutPolicyShrinkFontSize;
00168 else
00169 return LayoutJustOverwrite;
00170 }
00171
00213 enum AreaName { AreaUNKNOWN = 0x0000,
00214 AreaData = 0x0001,
00215 AreaAxes = 0x0002,
00216 AreaDataAxes = 0x0003,
00217 AreaLegend = 0x0004,
00218 AreaDataAxesLegend = 0x0005,
00219 AreaHeaders = 0x0006,
00220 AreaFooters = 0x0007,
00221 AreaDataAxesLegendHeadersFooters = 0x0008,
00222 AreaInnermost = 0x0009,
00223 AreaOutermost = 0x000a,
00224 AreaChartDataRegion = 0x000b,
00225 AreasCustomBoxes = 0x000d,
00226 AreaAxisBASE = 0x1000,
00227 AreaHdFtBASE = 0x2000,
00228 AreaCustomBoxesBASE = 0x4000,
00229 AreaBASEMask = 0xF000 };
00230
00231
00258 enum PositionFlag { PosTopLeft =0, PosTopCenter =1, PosTopRight =2,
00259 PosCenterLeft=3, PosCenter =4, PosCenterRight=5,
00260 PosBottomLeft=6, PosBottomCenter=7, PosBottomRight=8 };
00261
00262
00266 static QPoint positionFlagToPoint( const QRect& rect,
00267 PositionFlag pos );
00268
00275 static QPoint positionFlagToPoint( const QPointArray& points,
00276 PositionFlag pos )
00277 {
00278 QPoint pt;
00279 if( 9 <= points.size() )
00280 pt = points[ pos ];
00281 return pt;
00282 }
00283
00284
00292 static QString positionFlagToString( PositionFlag type );
00293
00294
00301 static PositionFlag stringToPositionFlag( const QString& string );
00302 };
00303
00304
00305 #endif
|