kchart

KDChartEnums.h

Go to the documentation of this file.
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 __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: // should not happen
00092                         qDebug( "Unknown text layout policy" );
00093                         return "JustOverwrite";
00094                 }
00095             }
00096 
00097 
00104             static TextLayoutPolicy stringToLayoutPolicy( const QString& string ) {
00105                 if( string ==      "JustOverwrite" )
00106                     return LayoutJustOverwrite;
00107                 else if( string == "Rotate" )
00108                     return LayoutPolicyRotate;
00109                 else if( string == "ShiftVertically" )
00110                     return LayoutPolicyShiftVertically;
00111                 else if( string == "ShiftHorizontally" )
00112                     return LayoutPolicyShiftHorizontally;
00113                 else if( string == "ShrinkFontSize" )
00114                     return LayoutPolicyShrinkFontSize;
00115                 else // default, should not happen
00116                     return LayoutJustOverwrite;
00117             }
00118 
00119 
00161             enum AreaName { AreaUNKNOWN                      = 0x0000,
00162                 AreaData                         = 0x0001,
00163                 AreaAxes                         = 0x0002,
00164                 AreaDataAxes                     = 0x0003,
00165                 AreaLegend                       = 0x0004,
00166                 AreaDataAxesLegend               = 0x0005,
00167                 AreaHeaders                      = 0x0006,
00168                 AreaFooters                      = 0x0007,
00169                 AreaDataAxesLegendHeadersFooters = 0x0008,
00170                 AreaInnermost                    = 0x0009,
00171                 AreaOutermost                    = 0x000a,
00172                 AreaChartDataRegion              = 0x000b,
00173                 AreasCustomBoxes                 = 0x000d,
00174                 AreaAxisBASE                     = 0x1000,
00175                 AreaHdFtBASE                     = 0x2000,
00176                 AreaCustomBoxesBASE              = 0x4000,
00177                 AreaBASEMask                     = 0xF000 };
00178 
00179 
00206                 enum PositionFlag { PosTopLeft   =0, PosTopCenter   =1, PosTopRight   =2,
00207                     PosCenterLeft=3, PosCenter      =4, PosCenterRight=5,
00208                     PosBottomLeft=6, PosBottomCenter=7, PosBottomRight=8 };
00209 
00210 
00214                     static QPoint positionFlagToPoint( const QRect& rect,
00215                                                        PositionFlag pos );
00216 
00223                     static QPoint positionFlagToPoint( const QPointArray& points,
00224                             PositionFlag pos )
00225                     {
00226                         QPoint pt;
00227                         if( 9 <= points.size() )
00228                             pt = points[ pos ];
00229                         return pt;
00230                     }
00231 
00232 
00240                     static QString positionFlagToString( PositionFlag type );
00241 
00242 
00249                     static PositionFlag stringToPositionFlag( const QString& string );
00250 };
00251 
00252 
00253 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys