1/****************************************************************************
2** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. All rights reserved.
3**
4** This file is part of the KD Chart library.
5**
6** Licensees holding valid commercial KD Chart licenses may use this file in
7** accordance with the KD Chart Commercial License Agreement provided with
8** the Software.
9**
10**
11** This file may be distributed and/or modified under the terms of the
12** GNU General Public License version 2 and version 3 as published by the
13** Free Software Foundation and appearing in the file LICENSE.GPL included.
14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17**
18** Contact info@kdab.com if any conditions of this licensing are not
19** clear to you.
20**
21**********************************************************************/
22
23#ifndef __KDCHARTGLOBAL_H__
24#define __KDCHARTGLOBAL_H__
25
26#include <QtGlobal>
27
28#include "kdchart_export.h"
29
30#ifndef KDAB_SET_OBJECT_NAME
31template <typename T>
32inline T & __kdab__dereference_for_methodcall( T & o ) {
33 return o;
34}
35
36template <typename T>
37inline T & __kdab__dereference_for_methodcall( T * o ) {
38 return *o;
39}
40
41#define KDAB_SET_OBJECT_NAME( x ) __kdab__dereference_for_methodcall( x ).setObjectName( QLatin1String( #x ) )
42#endif
43
44/* vc.net2002 is 1300, vc.net2003 is 1310 */
45#if defined(_MSC_VER) && _MSC_VER <= 1300
46#define KDCHART_DECLARE_PRIVATE_DERIVED( X ) \
47public: \
48 class Private; \
49protected: \
50 inline Private * d_func(); \
51 inline const Private * d_func() const; \
52 explicit inline X( Private * ); \
53private: \
54 void init();
55#else
56#define KDCHART_DECLARE_PRIVATE_DERIVED( X ) \
57protected: \
58 class Private; \
59 inline Private * d_func(); \
60 inline const Private * d_func() const; \
61 explicit inline X( Private * ); \
62private: \
63 void init();
64#endif
65
66#if defined(_MSC_VER) && _MSC_VER <= 1300
67#define KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType ) \
68public: \
69 class Private; \
70protected: \
71 inline Private * d_func(); \
72 inline const Private * d_func() const; \
73 explicit inline X( Private *, ParentType ); \
74private: \
75 void init();
76#else
77#define KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType ) \
78protected: \
79 class Private; \
80 inline Private * d_func(); \
81 inline const Private * d_func() const; \
82 explicit inline X( Private *, ParentType ); \
83private: \
84 void init();
85#endif
86
87#define KDCHART_DECLARE_PRIVATE_DERIVED_QWIDGET( X ) \
88 KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( X, QWidget* )
89
90#define KDCHART_DECLARE_PRIVATE_BASE_VALUE( X ) \
91public: \
92 inline void swap( X & other ) { qSwap( _d, other._d ); } \
93protected: \
94 class Private; \
95 Private * d_func() { return _d; } \
96 const Private * d_func() const { return _d; } \
97private: \
98 void init(); \
99 Private * _d;
100
101#if defined(_MSC_VER) && _MSC_VER <= 1300
102#define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \
103public: \
104 class Private; \
105protected: \
106 Private * d_func() { return _d; } \
107 const Private * d_func() const { return _d; } \
108 explicit inline X( Private * ); \
109private: \
110 void init(); \
111 Private * _d;
112#else
113#define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \
114protected: \
115 class Private; \
116 Private * d_func() { return _d; } \
117 const Private * d_func() const { return _d; } \
118 explicit inline X( Private * ); \
119private: \
120 void init(); \
121 Private * _d;
122#endif
123
124#if defined(_MSC_VER) && _MSC_VER <= 1300
125#define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \
126public: \
127 class Private; \
128protected: \
129 Private * d_func() { return _d; } \
130 const Private * d_func() const { return _d; } \
131 explicit inline X( Private *, QWidget* ); \
132private: \
133 void init(); \
134 Private * _d;
135#else
136#define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \
137protected: \
138 class Private; \
139 Private * d_func() { return _d; } \
140 const Private * d_func() const { return _d; } \
141 explicit inline X( Private *, QWidget* ); \
142private: \
143 void init(); \
144 Private * _d;
145#endif
146
147
148#define KDCHART_DERIVED_PRIVATE_FOOTER( CLASS, PARENT ) \
149inline CLASS::CLASS( Private * p ) \
150 : PARENT( p ) { init(); } \
151inline CLASS::Private * CLASS::d_func() \
152{ return static_cast<Private*>( PARENT::d_func() ); } \
153inline const CLASS::Private * CLASS::d_func() const \
154{ return static_cast<const Private*>( PARENT::d_func() ); }
155
156
157#if defined(_MSC_VER) && _MSC_VER <= 1300
158#define KDCHART_DECLARE_DERIVED_DIAGRAM( X, PLANE ) \
159public: \
160 class Private; \
161protected: \
162 inline Private * d_func(); \
163 inline const Private * d_func() const; \
164 explicit inline X( Private * ); \
165 explicit inline X( Private *, QWidget *, PLANE * ); \
166private: \
167 void init();
168#else
169#define KDCHART_DECLARE_DERIVED_DIAGRAM( X, PLANE ) \
170protected: \
171 class Private; \
172 inline Private * d_func(); \
173 inline const Private * d_func() const; \
174 explicit inline X( Private * ); \
175 explicit inline X( Private *, QWidget *, PLANE * ); \
176private: \
177 void init();
178#endif
179
180#define KDCHART_IMPL_DERIVED_DIAGRAM( CLASS, PARENT, PLANE ) \
181inline CLASS::CLASS( Private * p ) \
182 : PARENT( p ) { init(); } \
183inline CLASS::CLASS( \
184 Private * p, QWidget* parent, PLANE * plane ) \
185 : PARENT( p, parent, plane ) { init(); } \
186inline CLASS::Private * CLASS::d_func() \
187 { return static_cast<Private *>( PARENT::d_func() ); } \
188inline const CLASS::Private * CLASS::d_func() const \
189 { return static_cast<const Private *>( PARENT::d_func() ); }
190
191
192#define KDCHART_IMPL_DERIVED_PLANE( CLASS, BASEPLANE ) \
193inline CLASS::CLASS( Private * p, Chart* parent ) \
194 : BASEPLANE( p, parent ) { init(); } \
195inline CLASS::Private * CLASS::d_func() \
196 { return static_cast<Private *>( BASEPLANE::d_func() ); } \
197inline const CLASS::Private * CLASS::d_func() const \
198 { return static_cast<const Private *>( BASEPLANE::d_func() ); }
199
200
201#include <QtAlgorithms> // qSwap
202#ifndef QT_NO_STL
203#include <algorithm>
204#define KDCHART_DECLARE_SWAP_SPECIALISATION( X ) \
205 template <> inline void qSwap<X>( X & lhs, X & rhs ) \
206 { lhs.swap( rhs ); } \
207 namespace std { \
208 template <> inline void swap<X>( X & lhs, X & rhs ) \
209 { lhs.swap( rhs ); } \
210 }
211#else
212#define KDCHART_DECLARE_SWAP_SPECIALISATION( X ) \
213 template <> inline void qSwap<X>( X & lhs, X & rhs ) \
214 { lhs.swap( rhs ); }
215#endif
216
217#define KDCHART_DECLARE_SWAP_SPECIALISATION_DERIVED( X ) \
218 KDCHART_DECLARE_SWAP_SPECIALISATION( X )
219
220#define KDCHART_DECLARE_SWAP_BASE( X ) \
221protected: \
222 void doSwap( X& other ) \
223 { qSwap( _d, other._d); }
224
225#define KDCHART_DECLARE_SWAP_DERIVED( X ) \
226 void swap( X& other ) { doSwap( other ); }
227
228#if defined(Q_OS_WIN) && defined(QT_DLL)
229#if defined(_MSC_VER) && _MSC_VER >= 1300
230// workaround http://support.microsoft.com/default.aspx?scid=kb;en-us;309801
231#include <QPointF>
232#include <QVector>
233template class Q_DECL_IMPORT QVector<QPointF>;
234#endif
235#endif
236
237#include <Qt>
238
239namespace KDChart {
240
241enum DisplayRoles {
242 DatasetPenRole = 0x0A79EF95,
243 DatasetBrushRole,
244 DataValueLabelAttributesRole,
245 ThreeDAttributesRole,
246 LineAttributesRole,
247 ThreeDLineAttributesRole,
248 BarAttributesRole,
249 StockBarAttributesRole,
250 ThreeDBarAttributesRole,
251 PieAttributesRole,
252 ThreeDPieAttributesRole,
253 DataHiddenRole,
254 ValueTrackerAttributesRole,
255 CommentRole,
256 ColumnDataRole
257};
258}
259
260#endif // __KDCHARTGLOBAL_H__
261