KD Chart 2  [rev.2.5]
KDChartGlobal.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2012 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 **********************************************************************/
00027 #ifndef __KDCHARTGLOBAL_H__
00028 #define __KDCHARTGLOBAL_H__
00029 
00030 #include <qglobal.h>
00031 
00032 #include "kdchart_export.h"
00033 
00034 #ifndef KDAB_SET_OBJECT_NAME
00035 template <typename T>
00036 inline T & __kdab__dereference_for_methodcall( T & o ) {
00037     return o;
00038 }
00039 
00040 template <typename T>
00041 inline T & __kdab__dereference_for_methodcall( T * o ) {
00042     return *o;
00043 }
00044 
00045 #define KDAB_SET_OBJECT_NAME( x ) __kdab__dereference_for_methodcall( x ).setObjectName( QLatin1String( #x ) )
00046 #endif
00047 
00048 #define KDCHART_DECLARE_PRIVATE_DERIVED( X )      \
00049 public:                                           \
00050     class Private;                                \
00051 protected:                                        \
00052     inline Private * d_func();                    \
00053     inline const Private * d_func() const;        \
00054     explicit inline X( Private * );               \
00055 private:                                          \
00056     void init();
00057 
00058 #define KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType )      \
00059 public:                                           \
00060     class Private;                                \
00061 protected:                                        \
00062     inline Private * d_func();                    \
00063     inline const Private * d_func() const;        \
00064     explicit inline X( Private *, ParentType );   \
00065 private:                                          \
00066     void init();
00067 
00068 #define KDCHART_DECLARE_PRIVATE_DERIVED_QWIDGET( X )         \
00069     KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, QWidget* )
00070 
00071 #define KDCHART_DECLARE_PRIVATE_BASE_VALUE( X )              \
00072 public:                                                      \
00073     inline void swap( X & other ) { qSwap( _d, other._d ); } \
00074 protected:                                                   \
00075     class Private;                                           \
00076     Private * d_func() { return _d; }                        \
00077     const Private * d_func() const { return _d; }            \
00078 private:                                                     \
00079     void init();                                             \
00080     Private * _d;
00081 
00082 #define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \
00083 public:                                           \
00084     class Private;                                    \
00085 protected:                                        \
00086     Private * d_func() { return _d; }                 \
00087     const Private * d_func() const { return _d; }     \
00088     explicit inline X( Private * );                   \
00089 private:                                              \
00090     void init();                                      \
00091     Private * _d;
00092 
00093 #define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \
00094 public:                                           \
00095     class Private;                                    \
00096 protected:                                        \
00097     Private * d_func() { return _d; }                 \
00098     const Private * d_func() const { return _d; }     \
00099     explicit inline X( Private *, QWidget* );                  \
00100 private:                                              \
00101     void init();                                      \
00102     Private * _d;
00103 
00104 #define KDCHART_DERIVED_PRIVATE_FOOTER( CLASS, PARENT )     \
00105 inline CLASS::CLASS( Private * p )                          \
00106   : PARENT( p ) { init(); }                                 \
00107 inline CLASS::Private * CLASS::d_func()                     \
00108 { return static_cast<Private*>( PARENT::d_func() ); }       \
00109 inline const CLASS::Private * CLASS::d_func() const         \
00110 { return static_cast<const Private*>( PARENT::d_func() ); }
00111 
00112 
00113 #define KDCHART_DECLARE_DERIVED_DIAGRAM( X, PLANE )     \
00114 public:                                                 \
00115     class Private;                                      \
00116 protected:                                              \
00117     inline Private * d_func();                          \
00118     inline const Private * d_func() const;              \
00119     explicit inline X( Private * );                     \
00120     explicit inline X( Private *, QWidget *, PLANE * ); \
00121 private:                                                \
00122     void init();
00123 
00124 #define KDCHART_IMPL_DERIVED_DIAGRAM( CLASS, PARENT, PLANE ) \
00125 inline CLASS::CLASS( Private * p )                           \
00126     : PARENT( p ) { init(); }                                \
00127 inline CLASS::CLASS(                            \
00128     Private * p, QWidget* parent, PLANE * plane )            \
00129     : PARENT( p, parent, plane ) { init(); }                 \
00130 inline CLASS::Private * CLASS::d_func()                      \
00131     { return static_cast<Private *>( PARENT::d_func() ); }   \
00132 inline const CLASS::Private * CLASS::d_func() const          \
00133     { return static_cast<const Private *>( PARENT::d_func() ); }
00134 
00135 
00136 #define KDCHART_IMPL_DERIVED_PLANE( CLASS, BASEPLANE )        \
00137 inline CLASS::CLASS( Private * p, Chart* parent )           \
00138     : BASEPLANE( p, parent ) { init(); }                      \
00139 inline CLASS::Private * CLASS::d_func()                       \
00140     { return static_cast<Private *>( BASEPLANE::d_func() ); } \
00141 inline const CLASS::Private * CLASS::d_func() const           \
00142     { return static_cast<const Private *>( BASEPLANE::d_func() ); }
00143 
00144 
00145 #include <QtAlgorithms> // qSwap
00146 #ifndef QT_NO_STL
00147 #include <algorithm>
00148 #define KDCHART_DECLARE_SWAP_SPECIALISATION( X )            \
00149 QT_BEGIN_NAMESPACE                                          \
00150     template <> inline void qSwap<X>( X & lhs, X & rhs )    \
00151     { lhs.swap( rhs ); }                                    \
00152 QT_END_NAMESPACE                                            \
00153     namespace std {                                         \
00154         template <> inline void swap<X>( X & lhs, X & rhs ) \
00155         { lhs.swap( rhs ); }                                \
00156     }
00157 #else
00158 #define KDCHART_DECLARE_SWAP_SPECIALISATION( X )            \
00159 QT_BEGIN_NAMESPACE                                          \
00160     template <> inline void qSwap<X>( X & lhs, X & rhs )    \
00161     { lhs.swap( rhs ); }                                    \
00162 QT_END_NAMESPACE
00163 #endif
00164 
00165 #define KDCHART_DECLARE_SWAP_SPECIALISATION_DERIVED( X )    \
00166     KDCHART_DECLARE_SWAP_SPECIALISATION( X )
00167 
00168 #define KDCHART_DECLARE_SWAP_BASE( X ) \
00169 protected: \
00170     void doSwap( X& other ) \
00171     { qSwap( _d, other._d); }
00172 
00173 #define KDCHART_DECLARE_SWAP_DERIVED( X ) \
00174     void swap( X& other ) { doSwap( other ); }
00175 
00176 #if defined(Q_OS_WIN) && defined(QT_DLL)
00177 #if defined(_MSC_VER) && _MSC_VER >= 1300
00178 // workaround http://support.microsoft.com/default.aspx?scid=kb;en-us;309801
00179 #include <QPointF>
00180 #include <QVector>
00181 template class Q_DECL_IMPORT QVector<QPointF>;
00182 #endif
00183 #endif
00184 
00185 #include <Qt>
00186 
00187 namespace KDChart {
00188 
00189 enum DisplayRoles {
00190   DatasetPenRole = 0x0A79EF95,
00191   DatasetBrushRole,
00192   DataValueLabelAttributesRole,
00193   ThreeDAttributesRole,
00194   LineAttributesRole,
00195   ThreeDLineAttributesRole,
00196   BarAttributesRole,
00197   StockBarAttributesRole,
00198   ThreeDBarAttributesRole,
00199   PieAttributesRole,
00200   ThreeDPieAttributesRole,
00201   DataHiddenRole,
00202   ValueTrackerAttributesRole,
00203   CommentRole
00204 };
00205 }
00206 
00207 #endif // __KDCHARTGLOBAL_H__
 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/