author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 11:15:19 +0300 | |
branch | RCL_3 |
changeset 11 | 25a739ee40f4 |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QGRAPHICSEFFECT_H |
|
43 |
#define QGRAPHICSEFFECT_H |
|
44 |
||
45 |
#include <QtCore/qobject.h> |
|
46 |
#include <QtCore/qpoint.h> |
|
47 |
#include <QtCore/qrect.h> |
|
48 |
#include <QtGui/qcolor.h> |
|
49 |
#include <QtGui/qbrush.h> |
|
50 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
51 |
#ifndef QT_NO_GRAPHICSEFFECT |
0 | 52 |
QT_BEGIN_HEADER |
53 |
||
54 |
QT_BEGIN_NAMESPACE |
|
55 |
||
56 |
QT_MODULE(Gui) |
|
57 |
||
58 |
class QGraphicsItem; |
|
59 |
class QStyleOption; |
|
60 |
class QPainter; |
|
61 |
class QPixmap; |
|
62 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
class QGraphicsEffectSource; |
0 | 64 |
|
65 |
class QGraphicsEffectPrivate; |
|
66 |
class Q_GUI_EXPORT QGraphicsEffect : public QObject |
|
67 |
{ |
|
68 |
Q_OBJECT |
|
69 |
Q_FLAGS(ChangeFlags) |
|
70 |
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) |
|
71 |
public: |
|
72 |
enum ChangeFlag { |
|
73 |
SourceAttached = 0x1, |
|
74 |
SourceDetached = 0x2, |
|
75 |
SourceBoundingRectChanged = 0x4, |
|
76 |
SourceInvalidated = 0x8 |
|
77 |
}; |
|
78 |
Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) |
|
79 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
enum PixmapPadMode { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
NoPad, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
82 |
PadToTransparentBorder, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
83 |
PadToEffectiveBoundingRect |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
}; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
|
0 | 86 |
QGraphicsEffect(QObject *parent = 0); |
87 |
virtual ~QGraphicsEffect(); |
|
88 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
virtual QRectF boundingRectFor(const QRectF &sourceRect) const; |
0 | 90 |
QRectF boundingRect() const; |
91 |
||
92 |
bool isEnabled() const; |
|
93 |
||
94 |
public Q_SLOTS: |
|
95 |
void setEnabled(bool enable); |
|
96 |
void update(); |
|
97 |
||
98 |
Q_SIGNALS: |
|
99 |
void enabledChanged(bool enabled); |
|
100 |
||
101 |
protected: |
|
102 |
QGraphicsEffect(QGraphicsEffectPrivate &d, QObject *parent = 0); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
103 |
virtual void draw(QPainter *painter) = 0; |
0 | 104 |
virtual void sourceChanged(ChangeFlags flags); |
105 |
void updateBoundingRect(); |
|
106 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
bool sourceIsPixmap() const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
QRectF sourceBoundingRect(Qt::CoordinateSystem system = Qt::LogicalCoordinates) const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
109 |
void drawSource(QPainter *painter); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
110 |
QPixmap sourcePixmap(Qt::CoordinateSystem system = Qt::LogicalCoordinates, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
111 |
QPoint *offset = 0, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
112 |
PixmapPadMode mode = PadToEffectiveBoundingRect) const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
113 |
|
0 | 114 |
private: |
115 |
Q_DECLARE_PRIVATE(QGraphicsEffect) |
|
116 |
Q_DISABLE_COPY(QGraphicsEffect) |
|
117 |
friend class QGraphicsItem; |
|
118 |
friend class QGraphicsItemPrivate; |
|
119 |
friend class QGraphicsScenePrivate; |
|
120 |
friend class QWidget; |
|
121 |
friend class QWidgetPrivate; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
123 |
public: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
124 |
QGraphicsEffectSource *source() const; // internal |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
125 |
|
0 | 126 |
}; |
127 |
Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsEffect::ChangeFlags) |
|
128 |
||
129 |
class QGraphicsColorizeEffectPrivate; |
|
130 |
class Q_GUI_EXPORT QGraphicsColorizeEffect: public QGraphicsEffect |
|
131 |
{ |
|
132 |
Q_OBJECT |
|
133 |
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
|
134 |
Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged) |
|
135 |
public: |
|
136 |
QGraphicsColorizeEffect(QObject *parent = 0); |
|
137 |
~QGraphicsColorizeEffect(); |
|
138 |
||
139 |
QColor color() const; |
|
140 |
qreal strength() const; |
|
141 |
||
142 |
public Q_SLOTS: |
|
143 |
void setColor(const QColor &c); |
|
144 |
void setStrength(qreal strength); |
|
145 |
||
146 |
Q_SIGNALS: |
|
147 |
void colorChanged(const QColor &color); |
|
148 |
void strengthChanged(qreal strength); |
|
149 |
||
150 |
protected: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
151 |
void draw(QPainter *painter); |
0 | 152 |
|
153 |
private: |
|
154 |
Q_DECLARE_PRIVATE(QGraphicsColorizeEffect) |
|
155 |
Q_DISABLE_COPY(QGraphicsColorizeEffect) |
|
156 |
}; |
|
157 |
||
158 |
class QGraphicsBlurEffectPrivate; |
|
159 |
class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect |
|
160 |
{ |
|
161 |
Q_OBJECT |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
162 |
Q_FLAGS(BlurHint BlurHints) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
163 |
Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
164 |
Q_PROPERTY(BlurHints blurHints READ blurHints WRITE setBlurHints NOTIFY blurHintsChanged) |
0 | 165 |
public: |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
166 |
enum BlurHint { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
167 |
PerformanceHint = 0x00, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
168 |
QualityHint = 0x01, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
169 |
AnimationHint = 0x02 |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
170 |
}; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
171 |
Q_DECLARE_FLAGS(BlurHints, BlurHint) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
172 |
|
0 | 173 |
QGraphicsBlurEffect(QObject *parent = 0); |
174 |
~QGraphicsBlurEffect(); |
|
175 |
||
176 |
QRectF boundingRectFor(const QRectF &rect) const; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
177 |
qreal blurRadius() const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
178 |
BlurHints blurHints() const; |
0 | 179 |
|
180 |
public Q_SLOTS: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
181 |
void setBlurRadius(qreal blurRadius); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
182 |
void setBlurHints(BlurHints hints); |
0 | 183 |
|
184 |
Q_SIGNALS: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
185 |
void blurRadiusChanged(qreal blurRadius); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
186 |
void blurHintsChanged(BlurHints hints); |
0 | 187 |
|
188 |
protected: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
189 |
void draw(QPainter *painter); |
0 | 190 |
|
191 |
private: |
|
192 |
Q_DECLARE_PRIVATE(QGraphicsBlurEffect) |
|
193 |
Q_DISABLE_COPY(QGraphicsBlurEffect) |
|
194 |
}; |
|
195 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
196 |
Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsBlurEffect::BlurHints) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
197 |
|
0 | 198 |
class QGraphicsDropShadowEffectPrivate; |
199 |
class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect |
|
200 |
{ |
|
201 |
Q_OBJECT |
|
202 |
Q_PROPERTY(QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged) |
|
203 |
Q_PROPERTY(qreal xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged) |
|
204 |
Q_PROPERTY(qreal yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
205 |
Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) |
0 | 206 |
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
207 |
public: |
|
208 |
QGraphicsDropShadowEffect(QObject *parent = 0); |
|
209 |
~QGraphicsDropShadowEffect(); |
|
210 |
||
211 |
QRectF boundingRectFor(const QRectF &rect) const; |
|
212 |
QPointF offset() const; |
|
213 |
||
214 |
inline qreal xOffset() const |
|
215 |
{ return offset().x(); } |
|
216 |
||
217 |
inline qreal yOffset() const |
|
218 |
{ return offset().y(); } |
|
219 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
220 |
qreal blurRadius() const; |
0 | 221 |
QColor color() const; |
222 |
||
223 |
public Q_SLOTS: |
|
224 |
void setOffset(const QPointF &ofs); |
|
225 |
||
226 |
inline void setOffset(qreal dx, qreal dy) |
|
227 |
{ setOffset(QPointF(dx, dy)); } |
|
228 |
||
229 |
inline void setOffset(qreal d) |
|
230 |
{ setOffset(QPointF(d, d)); } |
|
231 |
||
232 |
inline void setXOffset(qreal dx) |
|
233 |
{ setOffset(QPointF(dx, yOffset())); } |
|
234 |
||
235 |
inline void setYOffset(qreal dy) |
|
236 |
{ setOffset(QPointF(xOffset(), dy)); } |
|
237 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
238 |
void setBlurRadius(qreal blurRadius); |
0 | 239 |
void setColor(const QColor &color); |
240 |
||
241 |
Q_SIGNALS: |
|
242 |
void offsetChanged(const QPointF &offset); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
243 |
void blurRadiusChanged(qreal blurRadius); |
0 | 244 |
void colorChanged(const QColor &color); |
245 |
||
246 |
protected: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
247 |
void draw(QPainter *painter); |
0 | 248 |
|
249 |
private: |
|
250 |
Q_DECLARE_PRIVATE(QGraphicsDropShadowEffect) |
|
251 |
Q_DISABLE_COPY(QGraphicsDropShadowEffect) |
|
252 |
}; |
|
253 |
||
254 |
class QGraphicsOpacityEffectPrivate; |
|
255 |
class Q_GUI_EXPORT QGraphicsOpacityEffect: public QGraphicsEffect |
|
256 |
{ |
|
257 |
Q_OBJECT |
|
258 |
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) |
|
259 |
Q_PROPERTY(QBrush opacityMask READ opacityMask WRITE setOpacityMask NOTIFY opacityMaskChanged) |
|
260 |
public: |
|
261 |
QGraphicsOpacityEffect(QObject *parent = 0); |
|
262 |
~QGraphicsOpacityEffect(); |
|
263 |
||
264 |
qreal opacity() const; |
|
265 |
QBrush opacityMask() const; |
|
266 |
||
267 |
public Q_SLOTS: |
|
268 |
void setOpacity(qreal opacity); |
|
269 |
void setOpacityMask(const QBrush &mask); |
|
270 |
||
271 |
Q_SIGNALS: |
|
272 |
void opacityChanged(qreal opacity); |
|
273 |
void opacityMaskChanged(const QBrush &mask); |
|
274 |
||
275 |
protected: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
276 |
void draw(QPainter *painter); |
0 | 277 |
|
278 |
private: |
|
279 |
Q_DECLARE_PRIVATE(QGraphicsOpacityEffect) |
|
280 |
Q_DISABLE_COPY(QGraphicsOpacityEffect) |
|
281 |
}; |
|
282 |
||
283 |
QT_END_NAMESPACE |
|
284 |
||
285 |
QT_END_HEADER |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
286 |
#endif //QT_NO_GRAPHICSEFFECT |
0 | 287 |
|
288 |
#endif // QGRAPHICSEFFECT_H |
|
289 |