KDChartGlobal.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-2007 Klaralvdalens Datakonsult AB.  All rights reserved.
00007  **
00008  ** This file is part of the KD Chart 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 KD Chart licenses may use this file in
00016  ** accordance with the KD Chart 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.kdab.net/kdchart for
00023  **   information about KD Chart Commercial License Agreements.
00024  **
00025  ** Contact info@kdab.net if any conditions of this
00026  ** licensing are not clear to you.
00027  **
00028  **********************************************************************/
00029 #ifndef __KDCHARTGLOBAL_H__
00030 #define __KDCHARTGLOBAL_H__
00031 
00032 #include <qglobal.h>
00033 
00034 #include "kdchart_export.h"
00035 
00036 #ifndef KDAB_SET_OBJECT_NAME
00037 template <typename T>
00038 inline T & __kdab__dereference_for_methodcall( T & o ) {
00039     return o;
00040 }
00041 
00042 template <typename T>
00043 inline T & __kdab__dereference_for_methodcall( T * o ) {
00044     return *o;
00045 }
00046 
00047 #define KDAB_SET_OBJECT_NAME( x ) __kdab__dereference_for_methodcall( x ).setObjectName( QLatin1String( #x ) )
00048 #endif
00049 
00050 /* vc.net2002 is 1300, vc.net2003 is 1310 */
00051 #if defined(_MSC_VER) && _MSC_VER <= 1300
00052 #define KDCHART_DECLARE_PRIVATE_DERIVED( X )      \
00053 public:                                           \
00054     class Private;                                \
00055 protected:                                        \
00056     inline Private * d_func();                    \
00057     inline const Private * d_func() const;        \
00058     explicit inline X( Private * );               \
00059 private:                                          \
00060     void init();
00061 #else
00062 #define KDCHART_DECLARE_PRIVATE_DERIVED( X )      \
00063 protected:                                        \
00064     class Private;                                \
00065     inline Private * d_func();                    \
00066     inline const Private * d_func() const;        \
00067     explicit inline X( Private * );               \
00068 private:                                          \
00069     void init();
00070 #endif
00071 
00072 #if defined(_MSC_VER) && _MSC_VER <= 1300
00073 #define KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType )      \
00074 public:                                           \
00075     class Private;                                \
00076 protected:                                        \
00077     inline Private * d_func();                    \
00078     inline const Private * d_func() const;        \
00079     explicit inline X( Private *, ParentType );   \
00080 private:                                          \
00081     void init();
00082 #else
00083 #define KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType )      \
00084 protected:                                        \
00085     class Private;                                \
00086     inline Private * d_func();                    \
00087     inline const Private * d_func() const;        \
00088     explicit inline X( Private *, ParentType );   \
00089 private:                                          \
00090     void init();
00091 #endif
00092 
00093 #define KDCHART_DECLARE_PRIVATE_DERIVED_QWIDGET( X )         \
00094     KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, QWidget* )
00095 
00096 #define KDCHART_DECLARE_PRIVATE_BASE_VALUE( X )              \
00097 public:                                                      \
00098     inline void swap( X & other ) { qSwap( _d, other._d ); } \
00099 protected:                                                   \
00100     class Private;                                           \
00101     Private * d_func() { return _d; }                        \
00102     const Private * d_func() const { return _d; }            \
00103 private:                                                     \
00104     void init();                                             \
00105     Private * _d;
00106 
00107 #if defined(_MSC_VER) && _MSC_VER <= 1300
00108 #define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \
00109 public:                                           \
00110     class Private;                                    \
00111 protected:                                        \
00112     Private * d_func() { return _d; }                 \
00113     const Private * d_func() const { return _d; }     \
00114     explicit inline X( Private * );                   \
00115 private:                                              \
00116     void init();                                      \
00117     Private * _d;
00118 #else
00119 #define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \
00120 protected:                                        \
00121     class Private;                                    \
00122     Private * d_func() { return _d; }                 \
00123     const Private * d_func() const { return _d; }     \
00124     explicit inline X( Private * );                   \
00125 private:                                              \
00126     void init();                                      \
00127     Private * _d;
00128 #endif
00129 
00130 #if defined(_MSC_VER) && _MSC_VER <= 1300
00131 #define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \
00132 public:                                           \
00133     class Private;                                    \
00134 protected:                                        \
00135     Private * d_func() { return _d; }                 \
00136     const Private * d_func() const { return _d; }     \
00137     explicit inline X( Private *, QWidget* );                  \
00138 private:                                              \
00139     void init();                                      \
00140     Private * _d;
00141 #else
00142 #define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \
00143 protected:                                        \
00144     class Private;                                    \
00145     Private * d_func() { return _d; }                 \
00146     const Private * d_func() const { return _d; }     \
00147     explicit inline X( Private *, QWidget* );                  \
00148 private:                                              \
00149     void init();                                      \
00150     Private * _d;
00151 #endif
00152 
00153 
00154 #define KDCHART_DERIVED_PRIVATE_FOOTER( CLASS, PARENT )     \
00155 inline CLASS::CLASS( Private * p )                          \
00156   : PARENT( p ) { init(); }                                 \
00157 inline CLASS::Private * CLASS::d_func()                     \
00158 { return static_cast<Private*>( PARENT::d_func() ); }       \
00159 inline const CLASS::Private * CLASS::d_func() const         \
00160 { return static_cast<const Private*>( PARENT::d_func() ); }
00161 
00162 
00163 #if defined(_MSC_VER) && _MSC_VER <= 1300
00164 #define KDCHART_DECLARE_DERIVED_DIAGRAM( X, PLANE )     \
00165 public:                                                 \
00166     class Private;                                      \
00167 protected:                                              \
00168     inline Private * d_func();                          \
00169     inline const Private * d_func() const;              \
00170     explicit inline X( Private * );                     \
00171     explicit inline X( Private *, QWidget *, PLANE * ); \
00172 private:                                                \
00173     void init();
00174 #else
00175 #define KDCHART_DECLARE_DERIVED_DIAGRAM( X, PLANE )     \
00176 protected:                                              \
00177     class Private;                                      \
00178     inline Private * d_func();                          \
00179     inline const Private * d_func() const;              \
00180     explicit inline X( Private * );                     \
00181     explicit inline X( Private *, QWidget *, PLANE * ); \
00182 private:                                                \
00183     void init();
00184 #endif
00185 
00186 #define KDCHART_IMPL_DERIVED_DIAGRAM( CLASS, PARENT, PLANE ) \
00187 inline CLASS::CLASS( Private * p )                           \
00188     : PARENT( p ) { init(); }                                \
00189 inline CLASS::CLASS(                                         \
00190     Private * p, QWidget* parent, PLANE * plane )            \
00191     : PARENT( p, parent, plane ) { init(); }                 \
00192 inline CLASS::Private * CLASS::d_func()                      \
00193     { return static_cast<Private *>( PARENT::d_func() ); }   \
00194 inline const CLASS::Private * CLASS::d_func() const          \
00195     { return static_cast<const Private *>( PARENT::d_func() ); }
00196 
00197 
00198 #define KDCHART_IMPL_DERIVED_PLANE( CLASS, BASEPLANE )        \
00199 inline CLASS::CLASS( Private * p, Chart* parent )           \
00200     : BASEPLANE( p, parent ) { init(); }                      \
00201 inline CLASS::Private * CLASS::d_func()                       \
00202     { return static_cast<Private *>( BASEPLANE::d_func() ); } \
00203 inline const CLASS::Private * CLASS::d_func() const           \
00204     { return static_cast<const Private *>( BASEPLANE::d_func() ); }
00205 
00206 
00207 #include <QtAlgorithms> // qSwap
00208 #ifndef QT_NO_STL
00209 #include <algorithm>
00210 #define KDCHART_DECLARE_SWAP_SPECIALISATION( X )            \
00211     template <> inline void qSwap<X>( X & lhs, X & rhs )    \
00212     { lhs.swap( rhs ); }                                    \
00213     namespace std {                                         \
00214         template <> inline void swap<X>( X & lhs, X & rhs ) \
00215         { lhs.swap( rhs ); }                                \
00216     }
00217 #else
00218 #define KDCHART_DECLARE_SWAP_SPECIALISATION( X )            \
00219     template <> inline void qSwap<X>( X & lhs, X & rhs )    \
00220     { lhs.swap( rhs ); }
00221 #endif
00222 
00223 #define KDCHART_DECLARE_SWAP_SPECIALISATION_DERIVED( X )    \
00224     KDCHART_DECLARE_SWAP_SPECIALISATION( X )
00225 
00226 #define KDCHART_DECLARE_SWAP_BASE( X ) \
00227 protected: \
00228     void doSwap( X& other ) \
00229     { qSwap( _d, other._d); }
00230 
00231 #define KDCHART_DECLARE_SWAP_DERIVED( X ) \
00232     void swap( X& other ) { doSwap( other ); }
00233 
00234 #if defined(Q_OS_WIN) && defined(QT_DLL)
00235 #if defined(_MSC_VER) && _MSC_VER >= 1300
00236 // workaround http://support.microsoft.com/default.aspx?scid=kb;en-us;309801
00237 #include <QPointF>
00238 #include <QVector>
00239 template class Q_DECL_IMPORT QVector<QPointF>;
00240 #endif
00241 #endif
00242 
00243 #include <Qt>
00244 
00245 namespace KDChart {
00246 
00247 enum DisplayRoles {
00248   DatasetPenRole = 0x0A79EF95,
00249   DatasetBrushRole,
00250   DataValueLabelAttributesRole,
00251   ThreeDAttributesRole,
00252   LineAttributesRole,
00253   ThreeDLineAttributesRole,
00254   BarAttributesRole,
00255   StockBarAttributesRole,
00256   ThreeDBarAttributesRole,
00257   PieAttributesRole,
00258   ThreeDPieAttributesRole,
00259   DataHiddenRole,
00260   ValueTrackerAttributesRole,
00261   CommentRole
00262 };
00263 }
00264 
00265 #endif // __KDCHARTGLOBAL_H__

Generated on Thu Mar 4 23:19:11 2010 for KD Chart 2 by  doxygen 1.5.4