KD Chart 2: KDChartGlobal.h Source File

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

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