KDChartEnums.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2011 Klaralvdalens Datakonsult AB.  All rights reserved.
00003 **
00004 ** This file is part of the KD Chart library.
00005 **
00006 ** Licensees holding valid commercial KD Chart licenses may use this file in
00007 ** accordance with the KD Chart Commercial License Agreement provided with
00008 ** the Software.
00009 **
00010 **
00011 ** This file may be distributed and/or modified under the terms of the
00012 ** GNU General Public License version 2 and version 3 as published by the
00013 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
00014 **
00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017 **
00018 ** Contact info@kdab.com if any conditions of this licensing are not
00019 ** clear to you.
00020 **
00021 **********************************************************************/
00022 
00023 #ifndef __KDCHARTENUMS_H__
00024 #define __KDCHARTENUMS_H__
00025 
00026 #include "KDChartGlobal.h"
00027 
00028 #include <QRectF>
00029 #include <QObject>
00030 #include <QVector>
00031 
00040 class KDCHART_EXPORT KDChartEnums :public QObject
00041 {
00042     Q_OBJECT
00043     Q_ENUMS( TextLayoutPolicy )
00044     Q_ENUMS( AreaName )
00045     Q_ENUMS( PositionFlag )
00046 
00047 public:
00095     enum GranularitySequence {
00096         GranularitySequence_10_20,
00097         GranularitySequence_10_50,
00098         GranularitySequence_25_50,
00099         GranularitySequence_125_25,
00100         GranularitySequenceIrregular };
00101 
00109     static QString granularitySequenceToString( GranularitySequence sequence ) {
00110         switch( sequence ) {
00111             case GranularitySequence_10_20:
00112                 return QString::fromLatin1("GranularitySequence_10_20");
00113             case GranularitySequence_10_50:
00114                 return QString::fromLatin1("GranularitySequence_10_50");
00115             case GranularitySequence_25_50:
00116                 return QString::fromLatin1("GranularitySequence_25_50");
00117             case GranularitySequence_125_25:
00118                 return QString::fromLatin1("GranularitySequence_125_25");
00119             case GranularitySequenceIrregular:
00120                 return QString::fromLatin1("GranularitySequenceIrregular");
00121             default: // should not happen
00122         qDebug( "Unknown granularity sequence" );
00123         return QString::fromLatin1("GranularitySequence_10_20");
00124         }
00125     }
00126 
00127 
00134     static GranularitySequence stringToGranularitySequence( const QString& string ) {
00135       if( string == QString::fromLatin1("GranularitySequence_10_20") )
00136           return GranularitySequence_10_20;
00137       if( string == QString::fromLatin1("GranularitySequence_10_50") )
00138           return GranularitySequence_10_50;
00139       if( string == QString::fromLatin1("GranularitySequence_25_50") )
00140           return GranularitySequence_25_50;
00141       if( string == QString::fromLatin1("GranularitySequence_125") )
00142           return GranularitySequence_125_25;
00143       if( string == QString::fromLatin1("GranularitySequenceIrregular") )
00144           return GranularitySequenceIrregular;
00145       // default, should not happen
00146       return GranularitySequence_10_20;
00147     }
00148 
00149 
00162     enum TextLayoutPolicy { LayoutJustOverwrite,
00163         LayoutPolicyRotate,
00164         LayoutPolicyShiftVertically,
00165         LayoutPolicyShiftHorizontally,
00166         LayoutPolicyShrinkFontSize };
00167 
00175     static QString layoutPolicyToString( TextLayoutPolicy type );
00176 
00177 
00184     static TextLayoutPolicy stringToLayoutPolicy( const QString& string );
00185 
00186 
00193     enum PositionValue {
00194         PositionUnknown   = 0,
00195         PositionCenter    = 1,
00196         PositionNorthWest = 2,
00197         PositionNorth     = 3,
00198         PositionNorthEast = 4,
00199         PositionEast      = 5,
00200         PositionSouthEast = 6,
00201         PositionSouth     = 7,
00202         PositionSouthWest = 8,
00203         PositionWest      = 9,
00204         PositionFloating  =10
00205     };
00206 
00207 
00223     enum MeasureCalculationMode { MeasureCalculationModeAbsolute,
00224         MeasureCalculationModeRelative,
00225         MeasureCalculationModeAuto,
00226         MeasureCalculationModeAutoArea,
00227         MeasureCalculationModeAutoOrientation };
00228 
00236     static QString measureCalculationModeToString( MeasureCalculationMode mode ) {
00237         switch( mode ) {
00238             case MeasureCalculationModeAbsolute:
00239                 return QString::fromLatin1("MeasureCalculationModeAbsolute");
00240             case MeasureCalculationModeAuto:
00241                 return QString::fromLatin1("MeasureCalculationModeAuto");
00242             case MeasureCalculationModeAutoArea:
00243                 return QString::fromLatin1("MeasureCalculationModeAutoArea");
00244             case MeasureCalculationModeAutoOrientation:
00245                 return QString::fromLatin1("MeasureCalculationModeAutoOrientation");
00246             case MeasureCalculationModeRelative:
00247                 return QString::fromLatin1("MeasureCalculationModeRelative");
00248             default: // should not happen
00249         qDebug( "Unknown measure calculation mode" );
00250         return QString::fromLatin1("MeasureCalculationModeAuto");
00251         }
00252     }
00253 
00254 
00261     static MeasureCalculationMode stringToMeasureCalculationMode( const QString& string ) {
00262       if( string == QString::fromLatin1("MeasureCalculationModeAbsolute") )
00263           return MeasureCalculationModeAbsolute;
00264       if( string == QString::fromLatin1("MeasureCalculationModeAuto") )
00265           return MeasureCalculationModeAuto;
00266       if( string == QString::fromLatin1("MeasureCalculationModeAutoArea") )
00267           return MeasureCalculationModeAutoArea;
00268       if( string == QString::fromLatin1("MeasureCalculationModeAutoOrientation") )
00269           return MeasureCalculationModeAutoOrientation;
00270       if( string == QString::fromLatin1("MeasureCalculationModeRelative") )
00271           return MeasureCalculationModeRelative;
00272       // default, should not happen
00273       return MeasureCalculationModeAuto;
00274     }
00275 
00292     enum MeasureOrientation { MeasureOrientationAuto,
00293         MeasureOrientationHorizontal,
00294         MeasureOrientationVertical,
00295         MeasureOrientationMinimum,
00296         MeasureOrientationMaximum };
00297 
00305     static QString measureOrientationToString( MeasureOrientation mode ) {
00306         switch( mode ) {
00307             case MeasureOrientationAuto:
00308                 return QString::fromLatin1("MeasureOrientationAuto");
00309             case MeasureOrientationHorizontal:
00310                 return QString::fromLatin1("MeasureOrientationHorizontal");
00311             case MeasureOrientationVertical:
00312                 return QString::fromLatin1("MeasureOrientationVertical");
00313             case MeasureOrientationMinimum:
00314                 return QString::fromLatin1("MeasureOrientationMinimum");
00315             case MeasureOrientationMaximum:
00316                 return QString::fromLatin1("MeasureOrientationMaximum");
00317             default: // should not happen
00318         qDebug( "Unknown measure orientation mode" );
00319         return QString::fromLatin1("MeasureOrientationAuto");
00320         }
00321     }
00322 
00323 
00330     static MeasureOrientation stringToMeasureOrientation( const QString& string ) {
00331       if( string == QString::fromLatin1("MeasureOrientationAuto") )
00332           return MeasureOrientationAuto;
00333       if( string == QString::fromLatin1("MeasureOrientationHorizontal") )
00334           return MeasureOrientationHorizontal;
00335       if( string == QString::fromLatin1("MeasureOrientationVertical") )
00336           return MeasureOrientationVertical;
00337       if( string == QString::fromLatin1("MeasureOrientationMinimum") )
00338           return MeasureOrientationMinimum;
00339       if( string == QString::fromLatin1("MeasureOrientationMaximum") )
00340           return MeasureOrientationMaximum;
00341       // default, should not happen
00342       return MeasureOrientationAuto;
00343     }
00344 
00345 
00346 };
00347 
00348 
00349 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/