author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 02 Feb 2010 00:43:10 +0200 | |
changeset 3 | 41300fa6a67c |
parent 0 | 1918ee327afb |
child 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
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 QWIDGET_P_H |
|
43 |
#define QWIDGET_P_H |
|
44 |
||
45 |
// |
|
46 |
// W A R N I N G |
|
47 |
// ------------- |
|
48 |
// |
|
49 |
// This file is not part of the Qt API. It exists for the convenience |
|
50 |
// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header |
|
51 |
// file may change from version to version without notice, or even be removed. |
|
52 |
// |
|
53 |
// We mean it. |
|
54 |
// |
|
55 |
||
56 |
#include "QtGui/qwidget.h" |
|
57 |
#include "private/qobject_p.h" |
|
58 |
#include "QtCore/qrect.h" |
|
59 |
#include "QtCore/qlocale.h" |
|
60 |
#include "QtCore/qset.h" |
|
61 |
#include "QtGui/qregion.h" |
|
62 |
#include "QtGui/qsizepolicy.h" |
|
63 |
#include "QtGui/qstyle.h" |
|
64 |
#include "QtGui/qapplication.h" |
|
65 |
#include <private/qgraphicseffect_p.h> |
|
66 |
#include "QtGui/qgraphicsproxywidget.h" |
|
67 |
#include "QtGui/qgraphicsscene.h" |
|
68 |
#include "QtGui/qgraphicsview.h" |
|
69 |
#include <private/qgesture_p.h> |
|
70 |
||
71 |
#ifdef Q_WS_WIN |
|
72 |
#include "QtCore/qt_windows.h" |
|
73 |
#include <private/qdnd_p.h> |
|
74 |
#endif // Q_WS_WIN |
|
75 |
||
76 |
#ifdef Q_WS_X11 |
|
77 |
#include "QtGui/qx11info_x11.h" |
|
78 |
#endif |
|
79 |
||
80 |
#ifdef Q_WS_MAC |
|
81 |
#include <private/qt_mac_p.h> |
|
82 |
#endif |
|
83 |
||
84 |
#if defined(Q_WS_QWS) |
|
85 |
#include "QtGui/qinputcontext.h" |
|
86 |
#include "QtGui/qscreen_qws.h" |
|
87 |
#endif |
|
88 |
||
89 |
#if defined(Q_OS_SYMBIAN) |
|
90 |
class RDrawableWindow; |
|
91 |
class CCoeControl; |
|
92 |
#endif |
|
93 |
||
94 |
QT_BEGIN_NAMESPACE |
|
95 |
||
96 |
// Extra QWidget data |
|
97 |
// - to minimize memory usage for members that are seldom used. |
|
98 |
// - top-level widgets have extra extra data to reduce cost further |
|
99 |
#if defined(Q_WS_QWS) |
|
100 |
class QWSManager; |
|
101 |
#endif |
|
102 |
#if defined(Q_WS_MAC) |
|
103 |
class QCoreGraphicsPaintEnginePrivate; |
|
104 |
#endif |
|
105 |
class QPaintEngine; |
|
106 |
class QPixmap; |
|
107 |
class QWidgetBackingStore; |
|
108 |
class QGraphicsProxyWidget; |
|
109 |
class QWidgetItemV2; |
|
110 |
||
111 |
class QStyle; |
|
112 |
||
113 |
struct QTLWExtra { |
|
114 |
// *************************** Cross-platform variables ***************************** |
|
115 |
||
116 |
// Regular pointers (keep them together to avoid gaps on 64 bits architectures). |
|
117 |
QIcon *icon; // widget icon |
|
118 |
QPixmap *iconPixmap; |
|
119 |
QWidgetBackingStore *backingStore; |
|
120 |
QWindowSurface *windowSurface; |
|
121 |
QPainter *sharedPainter; |
|
122 |
||
123 |
// Implicit pointers (shared_null). |
|
124 |
QString caption; // widget caption |
|
125 |
QString iconText; // widget icon text |
|
126 |
QString role; // widget role |
|
127 |
QString filePath; // widget file path |
|
128 |
||
129 |
// Other variables. |
|
130 |
short incw, inch; // size increments |
|
131 |
short basew, baseh; // base sizes |
|
132 |
// frame strut, don't use these directly, use QWidgetPrivate::frameStrut() instead. |
|
133 |
QRect frameStrut; |
|
134 |
QRect normalGeometry; // used by showMin/maximized/FullScreen |
|
135 |
Qt::WindowFlags savedFlags; // Save widget flags while showing fullscreen |
|
136 |
||
137 |
// *************************** Cross-platform bit fields **************************** |
|
138 |
uint opacity : 8; |
|
139 |
uint posFromMove : 1; |
|
140 |
uint sizeAdjusted : 1; |
|
141 |
uint inTopLevelResize : 1; |
|
142 |
uint inRepaint : 1; |
|
143 |
uint embedded : 1; |
|
144 |
||
145 |
// *************************** Platform specific values (bit fields first) ********** |
|
146 |
#if defined(Q_WS_X11) // <----------------------------------------------------------- X11 |
|
147 |
uint spont_unmapped: 1; // window was spontaneously unmapped |
|
148 |
uint dnd : 1; // DND properties installed |
|
149 |
uint validWMState : 1; // is WM_STATE valid? |
|
150 |
uint waitingForMapNotify : 1; // show() has been called, haven't got the MapNotify yet |
|
151 |
WId parentWinId; // parent window Id (valid after reparenting) |
|
152 |
WId userTimeWindow; // window id that contains user-time timestamp when WM supports a _NET_WM_USER_TIME_WINDOW atom |
|
153 |
QPoint fullScreenOffset; |
|
154 |
#ifndef QT_NO_XSYNC |
|
155 |
WId syncUpdateCounter; |
|
156 |
ulong syncRequestTimestamp; |
|
157 |
qint32 newCounterValueHi; |
|
158 |
quint32 newCounterValueLo; |
|
159 |
#endif |
|
160 |
#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN |
|
161 |
HICON winIconBig; // internal big Windows icon |
|
162 |
HICON winIconSmall; // internal small Windows icon |
|
163 |
#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC |
|
164 |
uint resizer : 4; |
|
165 |
uint isSetGeometry : 1; |
|
166 |
uint isMove : 1; |
|
167 |
quint32 wattr; |
|
168 |
quint32 wclass; |
|
169 |
WindowGroupRef group; |
|
170 |
IconRef windowIcon; // the current window icon, if set with setWindowIcon_sys. |
|
171 |
quint32 savedWindowAttributesFromMaximized; // Saved attributes from when the calling updateMaximizeButton_sys() |
|
172 |
#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS |
|
173 |
#ifndef QT_NO_QWS_MANAGER |
|
174 |
QWSManager *qwsManager; |
|
175 |
#endif |
|
176 |
#endif |
|
177 |
}; |
|
178 |
||
179 |
struct QWExtra { |
|
180 |
// *************************** Cross-platform variables ***************************** |
|
181 |
||
182 |
// Regular pointers (keep them together to avoid gaps on 64 bits architectures). |
|
183 |
void *glContext; // if the widget is hijacked by QGLWindowSurface |
|
184 |
QTLWExtra *topextra; // only useful for TLWs |
|
185 |
#ifndef QT_NO_GRAPHICSVIEW |
|
186 |
QGraphicsProxyWidget *proxyWidget; // if the widget is embedded |
|
187 |
#endif |
|
188 |
#ifndef QT_NO_CURSOR |
|
189 |
QCursor *curs; |
|
190 |
#endif |
|
191 |
QPointer<QStyle> style; |
|
192 |
QPointer<QWidget> focus_proxy; |
|
193 |
||
194 |
// Implicit pointers (shared_empty/shared_null). |
|
195 |
QRegion mask; // widget mask |
|
196 |
QString styleSheet; |
|
197 |
||
198 |
// Other variables. |
|
199 |
qint32 minw; |
|
200 |
qint32 minh; // minimum size |
|
201 |
qint32 maxw; |
|
202 |
qint32 maxh; // maximum size |
|
203 |
quint16 customDpiX; |
|
204 |
quint16 customDpiY; |
|
205 |
QSize staticContentsSize; |
|
206 |
||
207 |
// *************************** Cross-platform bit fields **************************** |
|
208 |
uint explicitMinSize : 2; |
|
209 |
uint explicitMaxSize : 2; |
|
210 |
uint autoFillBackground : 1; |
|
211 |
uint nativeChildrenForced : 1; |
|
212 |
uint inRenderWithPainter : 1; |
|
213 |
uint hasMask : 1; |
|
214 |
||
215 |
// *************************** Platform specific values (bit fields first) ********** |
|
216 |
#if defined(Q_WS_WIN) // <----------------------------------------------------------- WIN |
|
217 |
#ifndef QT_NO_DRAGANDDROP |
|
218 |
QOleDropTarget *dropTarget; // drop target |
|
219 |
QList<QPointer<QWidget> > oleDropWidgets; |
|
220 |
#endif |
|
221 |
#elif defined(Q_WS_X11) // <--------------------------------------------------------- X11 |
|
222 |
uint compress_events : 1; |
|
223 |
WId xDndProxy; // XDND forwarding to embedded windows |
|
224 |
#elif defined(Q_WS_MAC) // <------------------------------------------------------ MAC |
|
225 |
#ifdef QT_MAC_USE_COCOA |
|
226 |
// Cocoa Mask stuff |
|
227 |
QImage maskBits; |
|
228 |
CGImageRef imageMask; |
|
229 |
#endif |
|
230 |
#elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian |
|
231 |
uint activated : 1; // RWindowBase::Activated has been called |
|
232 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
233 |
/** |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
234 |
* Defines the behaviour of QSymbianControl::Draw. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
235 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
236 |
enum NativePaintMode { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
237 |
/** |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
238 |
* Normal drawing mode: blits the required region of the backing store |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
239 |
* via WSERV. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
240 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
241 |
Blit, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
242 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
243 |
/** |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
244 |
* Disable drawing for this widget. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
245 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
246 |
Disable, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
247 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
248 |
/** |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
249 |
* Paint zeros into the WSERV framebuffer, using BitGDI APIs. For windows |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
250 |
* with an EColor16MU display mode, zero is written only into the R, G and B |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
251 |
* channels of the pixel. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
252 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
253 |
ZeroFill, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
254 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
255 |
Default = Blit |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
256 |
}; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
257 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
258 |
NativePaintMode nativePaintMode : 2; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
259 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
260 |
/** |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
261 |
* If this bit is set, each native widget receives the signals from the |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
262 |
* Symbian control immediately before and immediately after draw ops are |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
263 |
* sent to the window server for this control: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
264 |
* void beginNativePaintEvent(const QRect &paintRect); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
265 |
* void endNativePaintEvent(const QRect &paintRect); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
266 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
267 |
uint receiveNativePaintEvents : 1; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
268 |
|
0 | 269 |
#endif |
270 |
}; |
|
271 |
||
272 |
/*! |
|
273 |
\internal |
|
274 |
||
275 |
Returns true if \a p or any of its parents enable the |
|
276 |
Qt::BypassGraphicsProxyWidget window flag. Used in QWidget::show() and |
|
277 |
QWidget::setParent() to determine whether it's necessary to embed the |
|
278 |
widget into a QGraphicsProxyWidget or not. |
|
279 |
*/ |
|
280 |
static inline bool bypassGraphicsProxyWidget(const QWidget *p) |
|
281 |
{ |
|
282 |
while (p) { |
|
283 |
if (p->windowFlags() & Qt::BypassGraphicsProxyWidget) |
|
284 |
return true; |
|
285 |
p = p->parentWidget(); |
|
286 |
} |
|
287 |
return false; |
|
288 |
} |
|
289 |
||
290 |
class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate |
|
291 |
{ |
|
292 |
Q_DECLARE_PUBLIC(QWidget) |
|
293 |
||
294 |
public: |
|
295 |
// *************************** Cross-platform *************************************** |
|
296 |
enum DrawWidgetFlags { |
|
297 |
DrawAsRoot = 0x01, |
|
298 |
DrawPaintOnScreen = 0x02, |
|
299 |
DrawRecursive = 0x04, |
|
300 |
DrawInvisible = 0x08, |
|
301 |
DontSubtractOpaqueChildren = 0x10, |
|
302 |
DontSetCompositionMode = 0x20, |
|
303 |
DontDrawOpaqueChildren = 0x40 |
|
304 |
}; |
|
305 |
||
306 |
enum CloseMode { |
|
307 |
CloseNoEvent, |
|
308 |
CloseWithEvent, |
|
309 |
CloseWithSpontaneousEvent |
|
310 |
}; |
|
311 |
||
312 |
enum Direction { |
|
313 |
DirectionNorth = 0x01, |
|
314 |
DirectionEast = 0x10, |
|
315 |
DirectionSouth = 0x02, |
|
316 |
DirectionWest = 0x20 |
|
317 |
}; |
|
318 |
||
319 |
// Functions. |
|
320 |
explicit QWidgetPrivate(int version = QObjectPrivateVersion); |
|
321 |
~QWidgetPrivate(); |
|
322 |
||
323 |
QWExtra *extraData() const; |
|
324 |
QTLWExtra *topData() const; |
|
325 |
QTLWExtra *maybeTopData() const; |
|
326 |
QPainter *sharedPainter() const; |
|
327 |
void setSharedPainter(QPainter *painter); |
|
328 |
QWidgetBackingStore *maybeBackingStore() const; |
|
329 |
void init(QWidget *desktopWidget, Qt::WindowFlags f); |
|
330 |
void create_sys(WId window, bool initializeWindow, bool destroyOldWindow); |
|
331 |
void createRecursively(); |
|
332 |
void createWinId(WId id = 0); |
|
333 |
||
334 |
void createTLExtra(); |
|
335 |
void createExtra(); |
|
336 |
void deleteExtra(); |
|
337 |
void createSysExtra(); |
|
338 |
void deleteSysExtra(); |
|
339 |
void createTLSysExtra(); |
|
340 |
void deleteTLSysExtra(); |
|
341 |
void updateSystemBackground(); |
|
342 |
void propagatePaletteChange(); |
|
343 |
||
344 |
void setPalette_helper(const QPalette &); |
|
345 |
void resolvePalette(); |
|
346 |
QPalette naturalWidgetPalette(uint inheritedMask) const; |
|
347 |
||
348 |
void setMask_sys(const QRegion &); |
|
349 |
#ifdef Q_OS_SYMBIAN |
|
350 |
void setSoftKeys_sys(const QList<QAction*> &softkeys); |
|
351 |
void activateSymbianWindow(WId wid = 0); |
|
352 |
void _q_delayedDestroy(WId winId); |
|
353 |
#endif |
|
354 |
||
355 |
void raise_sys(); |
|
356 |
void lower_sys(); |
|
357 |
void stackUnder_sys(QWidget *); |
|
358 |
||
359 |
void setFocus_sys(); |
|
360 |
||
361 |
void updateFont(const QFont &); |
|
362 |
inline void setFont_helper(const QFont &font) { |
|
363 |
if (data.fnt == font && data.fnt.resolve() == font.resolve()) |
|
364 |
return; |
|
365 |
updateFont(font); |
|
366 |
} |
|
367 |
void resolveFont(); |
|
368 |
QFont naturalWidgetFont(uint inheritedMask) const; |
|
369 |
||
370 |
void setLayoutDirection_helper(Qt::LayoutDirection); |
|
371 |
void resolveLayoutDirection(); |
|
372 |
||
373 |
void setLocale_helper(const QLocale &l, bool forceUpdate = false); |
|
374 |
void resolveLocale(); |
|
375 |
||
376 |
void setStyle_helper(QStyle *newStyle, bool propagate, bool metalHack = false); |
|
377 |
void inheritStyle(); |
|
378 |
||
379 |
void setUpdatesEnabled_helper(bool ); |
|
380 |
||
381 |
void paintBackground(QPainter *, const QRegion &, int flags = DrawAsRoot) const; |
|
382 |
bool isAboutToShow() const; |
|
383 |
QRegion prepareToRender(const QRegion ®ion, QWidget::RenderFlags renderFlags); |
|
384 |
void render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, |
|
385 |
QWidget::RenderFlags renderFlags); |
|
386 |
void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, |
|
387 |
QPainter *sharedPainter = 0, QWidgetBackingStore *backingStore = 0); |
|
388 |
||
389 |
||
390 |
void paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& children, int index, |
|
391 |
const QRegion &rgn, const QPoint &offset, int flags |
|
392 |
#ifdef Q_BACKINGSTORE_SUBSURFACES |
|
393 |
, const QWindowSurface *currentSurface |
|
394 |
#endif |
|
395 |
, QPainter *sharedPainter, QWidgetBackingStore *backingStore); |
|
396 |
||
397 |
||
398 |
QPainter *beginSharedPainter(); |
|
399 |
bool endSharedPainter(); |
|
400 |
#ifndef QT_NO_GRAPHICSVIEW |
|
401 |
static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin); |
|
402 |
#endif |
|
403 |
QWindowSurface *createDefaultWindowSurface(); |
|
404 |
QWindowSurface *createDefaultWindowSurface_sys(); |
|
405 |
void repaint_sys(const QRegion &rgn); |
|
406 |
||
407 |
QRect clipRect() const; |
|
408 |
QRegion clipRegion() const; |
|
409 |
void subtractOpaqueChildren(QRegion &rgn, const QRect &clipRect) const; |
|
410 |
void subtractOpaqueSiblings(QRegion &source, bool *hasDirtySiblingsAbove = 0, |
|
411 |
bool alsoNonOpaque = false) const; |
|
412 |
void clipToEffectiveMask(QRegion ®ion) const; |
|
413 |
void updateIsOpaque(); |
|
414 |
void setOpaque(bool opaque); |
|
415 |
void updateIsTranslucent(); |
|
416 |
bool paintOnScreen() const; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
417 |
#ifndef QT_NO_GRAPHICSEFFECT |
0 | 418 |
void invalidateGraphicsEffectsRecursively(); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
419 |
#endif //QT_NO_GRAPHICSEFFECT |
0 | 420 |
|
421 |
const QRegion &getOpaqueChildren() const; |
|
422 |
void setDirtyOpaqueRegion(); |
|
423 |
||
424 |
bool close_helper(CloseMode mode); |
|
425 |
||
426 |
void setWindowIcon_helper(); |
|
427 |
void setWindowIcon_sys(bool forceReset = false); |
|
428 |
void setWindowOpacity_sys(qreal opacity); |
|
429 |
void adjustQuitOnCloseAttribute(); |
|
430 |
||
431 |
void scrollChildren(int dx, int dy); |
|
432 |
void moveRect(const QRect &, int dx, int dy); |
|
433 |
void scrollRect(const QRect &, int dx, int dy); |
|
434 |
void invalidateBuffer_resizeHelper(const QPoint &oldPos, const QSize &oldSize); |
|
435 |
// ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). |
|
436 |
void invalidateBuffer(const QRegion &); |
|
437 |
void invalidateBuffer(const QRect &); |
|
438 |
bool isOverlapped(const QRect&) const; |
|
439 |
void syncBackingStore(); |
|
440 |
void syncBackingStore(const QRegion ®ion); |
|
441 |
||
442 |
void reparentFocusWidgets(QWidget *oldtlw); |
|
443 |
||
444 |
static int pointToRect(const QPoint &p, const QRect &r); |
|
445 |
||
446 |
void setWinId(WId); |
|
447 |
void showChildren(bool spontaneous); |
|
448 |
void hideChildren(bool spontaneous); |
|
449 |
void setParent_sys(QWidget *parent, Qt::WindowFlags); |
|
450 |
void scroll_sys(int dx, int dy); |
|
451 |
void scroll_sys(int dx, int dy, const QRect &r); |
|
452 |
void deactivateWidgetCleanup(); |
|
453 |
void setGeometry_sys(int, int, int, int, bool); |
|
454 |
void sendPendingMoveAndResizeEvents(bool recursive = false, bool disableUpdates = false); |
|
455 |
void activateChildLayoutsRecursively(); |
|
456 |
void show_recursive(); |
|
457 |
void show_helper(); |
|
458 |
void show_sys(); |
|
459 |
void hide_sys(); |
|
460 |
void hide_helper(); |
|
461 |
void _q_showIfNotHidden(); |
|
462 |
||
463 |
void setEnabled_helper(bool); |
|
464 |
void registerDropSite(bool); |
|
465 |
static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = 0); |
|
466 |
||
467 |
void updateFrameStrut(); |
|
468 |
QRect frameStrut() const; |
|
469 |
||
470 |
#ifdef QT_KEYPAD_NAVIGATION |
|
471 |
static bool navigateToDirection(Direction direction); |
|
472 |
static QWidget *widgetInNavigationDirection(Direction direction); |
|
473 |
#endif |
|
474 |
||
475 |
void setWindowIconText_sys(const QString &cap); |
|
476 |
void setWindowIconText_helper(const QString &cap); |
|
477 |
void setWindowTitle_sys(const QString &cap); |
|
478 |
||
479 |
#ifndef QT_NO_CURSOR |
|
480 |
void setCursor_sys(const QCursor &cursor); |
|
481 |
void unsetCursor_sys(); |
|
482 |
#endif |
|
483 |
||
484 |
void setWindowTitle_helper(const QString &cap); |
|
485 |
void setWindowFilePath_helper(const QString &filePath); |
|
486 |
||
487 |
bool setMinimumSize_helper(int &minw, int &minh); |
|
488 |
bool setMaximumSize_helper(int &maxw, int &maxh); |
|
489 |
void setConstraints_sys(); |
|
490 |
QWidget *childAt_helper(const QPoint &, bool) const; |
|
491 |
void updateGeometry_helper(bool forceUpdate); |
|
492 |
||
493 |
void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const; |
|
494 |
void setLayoutItemMargins(int left, int top, int right, int bottom); |
|
495 |
void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0); |
|
496 |
||
497 |
QInputContext *inputContext() const; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
498 |
inline QWidget *effectiveFocusWidget() { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
499 |
QWidget *w = q_func(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
500 |
while (w->focusProxy()) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
501 |
w = w->focusProxy(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
502 |
return w; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
503 |
} |
0 | 504 |
|
505 |
void setModal_sys(); |
|
506 |
||
507 |
// This is an helper function that return the available geometry for |
|
508 |
// a widget and takes care is this one is in QGraphicsView. |
|
509 |
// If the widget is not embed in a scene then the geometry available is |
|
510 |
// null, we let QDesktopWidget decide for us. |
|
511 |
static QRect screenGeometry(const QWidget *widget) |
|
512 |
{ |
|
513 |
QRect screen; |
|
514 |
#ifndef QT_NO_GRAPHICSVIEW |
|
515 |
QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget); |
|
516 |
//It's embedded if it has an ancestor |
|
517 |
if (ancestorProxy) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
518 |
if (!bypassGraphicsProxyWidget(widget) && ancestorProxy->scene() != 0) { |
0 | 519 |
// One view, let be smart and return the viewport rect then the popup is aligned |
520 |
if (ancestorProxy->scene()->views().size() == 1) { |
|
521 |
QGraphicsView *view = ancestorProxy->scene()->views().at(0); |
|
522 |
screen = view->mapToScene(view->viewport()->rect()).boundingRect().toRect(); |
|
523 |
} else { |
|
524 |
screen = ancestorProxy->scene()->sceneRect().toRect(); |
|
525 |
} |
|
526 |
} |
|
527 |
} |
|
528 |
#endif |
|
529 |
return screen; |
|
530 |
} |
|
531 |
||
532 |
inline void setRedirected(QPaintDevice *replacement, const QPoint &offset) |
|
533 |
{ |
|
534 |
Q_ASSERT(q_func()->testAttribute(Qt::WA_WState_InPaintEvent)); |
|
535 |
redirectDev = replacement; |
|
536 |
redirectOffset = offset; |
|
537 |
} |
|
538 |
||
539 |
inline QPaintDevice *redirected(QPoint *offset) const |
|
540 |
{ |
|
541 |
if (offset) |
|
542 |
*offset = redirectDev ? redirectOffset : QPoint(); |
|
543 |
return redirectDev; |
|
544 |
} |
|
545 |
||
546 |
inline void restoreRedirected() |
|
547 |
{ redirectDev = 0; } |
|
548 |
||
549 |
inline void enforceNativeChildren() |
|
550 |
{ |
|
551 |
if (!extra) |
|
552 |
createExtra(); |
|
553 |
||
554 |
if (extra->nativeChildrenForced) |
|
555 |
return; |
|
556 |
extra->nativeChildrenForced = 1; |
|
557 |
||
558 |
for (int i = 0; i < children.size(); ++i) { |
|
559 |
if (QWidget *child = qobject_cast<QWidget *>(children.at(i))) |
|
560 |
child->setAttribute(Qt::WA_NativeWindow); |
|
561 |
} |
|
562 |
} |
|
563 |
||
564 |
inline bool nativeChildrenForced() const |
|
565 |
{ |
|
566 |
return extra ? extra->nativeChildrenForced : false; |
|
567 |
} |
|
568 |
||
569 |
inline QRect effectiveRectFor(const QRect &rect) const |
|
570 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
571 |
#ifndef QT_NO_GRAPHICSEFFECT |
0 | 572 |
if (graphicsEffect && graphicsEffect->isEnabled()) |
573 |
return graphicsEffect->boundingRectFor(rect).toAlignedRect(); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
574 |
#endif //QT_NO_GRAPHICSEFFECT |
0 | 575 |
return rect; |
576 |
} |
|
577 |
||
578 |
QSize adjustedSize() const; |
|
579 |
||
580 |
inline void handleSoftwareInputPanel(Qt::MouseButton button, bool clickCausedFocus) |
|
581 |
{ |
|
582 |
Q_Q(QWidget); |
|
583 |
if (button == Qt::LeftButton && qApp->autoSipEnabled()) { |
|
584 |
QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( |
|
585 |
q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); |
|
586 |
if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) { |
|
587 |
QEvent event(QEvent::RequestSoftwareInputPanel); |
|
588 |
QApplication::sendEvent(q, &event); |
|
589 |
} |
|
590 |
} |
|
591 |
} |
|
592 |
||
593 |
#ifndef Q_WS_QWS // Almost cross-platform :-) |
|
594 |
void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect()); |
|
595 |
||
596 |
inline QPoint mapToWS(const QPoint &p) const |
|
597 |
{ return p - data.wrect.topLeft(); } |
|
598 |
||
599 |
inline QPoint mapFromWS(const QPoint &p) const |
|
600 |
{ return p + data.wrect.topLeft(); } |
|
601 |
||
602 |
inline QRect mapToWS(const QRect &r) const |
|
603 |
{ QRect rr(r); rr.translate(-data.wrect.topLeft()); return rr; } |
|
604 |
||
605 |
inline QRect mapFromWS(const QRect &r) const |
|
606 |
{ QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; } |
|
607 |
#endif |
|
608 |
||
609 |
// Variables. |
|
610 |
// Regular pointers (keep them together to avoid gaps on 64 bit architectures). |
|
611 |
QWExtra *extra; |
|
612 |
QWidget *focus_next; |
|
613 |
QWidget *focus_prev; |
|
614 |
QWidget *focus_child; |
|
615 |
QLayout *layout; |
|
616 |
QRegion *needsFlush; |
|
617 |
QPaintDevice *redirectDev; |
|
618 |
QWidgetItemV2 *widgetItem; |
|
619 |
QPaintEngine *extraPaintEngine; |
|
620 |
mutable const QMetaObject *polished; |
|
621 |
QGraphicsEffect *graphicsEffect; |
|
622 |
// All widgets are added into the allWidgets set. Once |
|
623 |
// they receive a window id they are also added to the mapper. |
|
624 |
// This should just ensure that all widgets are deleted by QApplication |
|
625 |
static QWidgetMapper *mapper; |
|
626 |
static QWidgetSet *allWidgets; |
|
627 |
#if !defined(QT_NO_IM) |
|
628 |
QPointer<QInputContext> ic; |
|
629 |
Qt::InputMethodHints imHints; |
|
630 |
#endif |
|
631 |
#ifdef QT_KEYPAD_NAVIGATION |
|
632 |
static QPointer<QWidget> editingWidget; |
|
633 |
#endif |
|
634 |
||
635 |
// Implicit pointers (shared_null/shared_empty). |
|
636 |
QRegion opaqueChildren; |
|
637 |
QRegion dirty; |
|
638 |
#ifndef QT_NO_TOOLTIP |
|
639 |
QString toolTip; |
|
640 |
#endif |
|
641 |
#ifndef QT_NO_STATUSTIP |
|
642 |
QString statusTip; |
|
643 |
#endif |
|
644 |
#ifndef QT_NO_WHATSTHIS |
|
645 |
QString whatsThis; |
|
646 |
#endif |
|
647 |
#ifndef QT_NO_ACCESSIBILITY |
|
648 |
QString accessibleName; |
|
649 |
QString accessibleDescription; |
|
650 |
#endif |
|
651 |
||
652 |
// Other variables. |
|
653 |
uint inheritedFontResolveMask; |
|
654 |
uint inheritedPaletteResolveMask; |
|
655 |
short leftmargin; |
|
656 |
short topmargin; |
|
657 |
short rightmargin; |
|
658 |
short bottommargin; |
|
659 |
signed char leftLayoutItemMargin; |
|
660 |
signed char topLayoutItemMargin; |
|
661 |
signed char rightLayoutItemMargin; |
|
662 |
signed char bottomLayoutItemMargin; |
|
663 |
static int instanceCounter; // Current number of widget instances |
|
664 |
static int maxInstances; // Maximum number of widget instances |
|
665 |
Qt::HANDLE hd; |
|
666 |
QWidgetData data; |
|
667 |
QSizePolicy size_policy; |
|
668 |
QLocale locale; |
|
669 |
QPoint redirectOffset; |
|
670 |
#ifndef QT_NO_ACTION |
|
671 |
QList<QAction*> actions; |
|
672 |
#endif |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
673 |
QMap<Qt::GestureType, Qt::GestureFlags> gestureContext; |
0 | 674 |
|
675 |
// Bit fields. |
|
676 |
uint high_attributes[3]; // the low ones are in QWidget::widget_attributes |
|
677 |
QPalette::ColorRole fg_role : 8; |
|
678 |
QPalette::ColorRole bg_role : 8; |
|
679 |
uint dirtyOpaqueChildren : 1; |
|
680 |
uint isOpaque : 1; |
|
681 |
uint inDirtyList : 1; |
|
682 |
uint isScrolled : 1; |
|
683 |
uint isMoved : 1; |
|
684 |
uint usesDoubleBufferedGLContext : 1; |
|
685 |
||
686 |
// *************************** Platform specific ************************************ |
|
687 |
#if defined(Q_WS_X11) // <----------------------------------------------------------- X11 |
|
688 |
QX11Info xinfo; |
|
689 |
Qt::HANDLE picture; |
|
690 |
static QWidget *mouseGrabber; |
|
691 |
static QWidget *keyboardGrabber; |
|
692 |
||
693 |
void setWindowRole(); |
|
694 |
void sendStartupMessage(const char *message) const; |
|
695 |
void setNetWmWindowTypes(); |
|
696 |
void x11UpdateIsOpaque(); |
|
697 |
bool isBackgroundInherited() const; |
|
698 |
#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN |
|
699 |
uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine() |
|
700 |
uint nativeGesturePanEnabled : 1; |
|
701 |
||
702 |
bool shouldShowMaximizeButton(); |
|
703 |
void winUpdateIsOpaque(); |
|
704 |
void reparentChildren(); |
|
705 |
#ifndef QT_NO_DRAGANDDROP |
|
706 |
QOleDropTarget *registerOleDnd(QWidget *widget); |
|
707 |
void unregisterOleDnd(QWidget *widget, QOleDropTarget *target); |
|
708 |
#endif |
|
709 |
void grabMouseWhileInWindow(); |
|
710 |
void registerTouchWindow(); |
|
711 |
void winSetupGestures(); |
|
712 |
#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC |
|
713 |
// This is new stuff |
|
714 |
uint needWindowChange : 1; |
|
715 |
uint isGLWidget : 1; |
|
716 |
||
717 |
// Each wiget keeps a list of all its child and grandchild OpenGL widgets. |
|
718 |
// This list is used to update the gl context whenever a parent and a granparent |
|
719 |
// moves, and also to check for intersections with gl widgets within the window |
|
720 |
// when a widget moves. |
|
721 |
struct GlWidgetInfo |
|
722 |
{ |
|
723 |
GlWidgetInfo(QWidget *widget) : widget(widget), lastUpdateWidget(0) { } |
|
724 |
bool operator==(const GlWidgetInfo &other) const { return (widget == other.widget); } |
|
725 |
QWidget * widget; |
|
726 |
QWidget * lastUpdateWidget; |
|
727 |
}; |
|
728 |
||
729 |
// dirtyOnWidget contains the areas in the widget that needs to be repained, |
|
730 |
// in the same way as dirtyOnScreen does for the window. Areas are added in |
|
731 |
// dirtyWidget_sys and cleared in the paint event. In scroll_sys we then use |
|
732 |
// this information repaint invalid areas when widgets are scrolled. |
|
733 |
QRegion dirtyOnWidget; |
|
734 |
EventHandlerRef window_event; |
|
735 |
QList<GlWidgetInfo> glWidgets; |
|
736 |
||
737 |
//these are here just for code compat (HIViews) |
|
738 |
Qt::HANDLE qd_hd; |
|
739 |
||
740 |
void macUpdateSizeAttribute(); |
|
741 |
void macUpdateHideOnSuspend(); |
|
742 |
void macUpdateOpaqueSizeGrip(); |
|
743 |
void macUpdateIgnoreMouseEvents(); |
|
744 |
void macUpdateMetalAttribute(); |
|
745 |
void macUpdateIsOpaque(); |
|
746 |
void setEnabled_helper_sys(bool enable); |
|
747 |
bool isRealWindow() const; |
|
748 |
void adjustWithinMaxAndMinSize(int &w, int &h); |
|
749 |
void applyMaxAndMinSizeOnWindow(); |
|
750 |
void update_sys(const QRect &rect); |
|
751 |
void update_sys(const QRegion &rgn); |
|
752 |
void setGeometry_sys_helper(int, int, int, int, bool); |
|
753 |
void setWindowModified_sys(bool b); |
|
754 |
void updateMaximizeButton_sys(); |
|
755 |
void setWindowFilePath_sys(const QString &filePath); |
|
756 |
void createWindow_sys(); |
|
757 |
void recreateMacWindow(); |
|
758 |
#ifndef QT_MAC_USE_COCOA |
|
759 |
void initWindowPtr(); |
|
760 |
void finishCreateWindow_sys_Carbon(OSWindowRef windowRef); |
|
761 |
#else |
|
762 |
void finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ windowRef); |
|
763 |
void syncCocoaMask(); |
|
764 |
void finishCocoaMaskSetup(); |
|
765 |
#endif |
|
766 |
void determineWindowClass(); |
|
767 |
void transferChildren(); |
|
768 |
bool qt_mac_dnd_event(uint, DragRef); |
|
769 |
void toggleDrawers(bool); |
|
770 |
//mac event functions |
|
771 |
static bool qt_create_root_win(); |
|
772 |
static void qt_clean_root_win(); |
|
773 |
static bool qt_mac_update_sizer(QWidget *, int up = 0); |
|
774 |
static OSStatus qt_window_event(EventHandlerCallRef er, EventRef event, void *); |
|
775 |
static OSStatus qt_widget_event(EventHandlerCallRef er, EventRef event, void *); |
|
776 |
static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool); |
|
777 |
void registerTouchWindow(); |
|
778 |
#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS |
|
779 |
void setMaxWindowState_helper(); |
|
780 |
void setFullScreenSize_helper(); |
|
781 |
void moveSurface(QWindowSurface *surface, const QPoint &offset); |
|
782 |
QRegion localRequestedRegion() const; |
|
783 |
QRegion localAllocatedRegion() const; |
|
784 |
||
785 |
friend class QWSManager; |
|
786 |
friend class QWSManagerPrivate; |
|
787 |
friend class QDecoration; |
|
788 |
#ifndef QT_NO_CURSOR |
|
789 |
void updateCursor() const; |
|
790 |
#endif |
|
791 |
QScreen* getScreen() const; |
|
792 |
#elif defined(Q_OS_SYMBIAN) // <--------------------------------------------------------- SYMBIAN |
|
793 |
static QWidget *mouseGrabber; |
|
794 |
static QWidget *keyboardGrabber; |
|
795 |
void s60UpdateIsOpaque(); |
|
796 |
void reparentChildren(); |
|
797 |
void registerTouchWindow(); |
|
798 |
#endif |
|
799 |
||
800 |
}; |
|
801 |
||
802 |
struct QWidgetPaintContext |
|
803 |
{ |
|
804 |
inline QWidgetPaintContext(QPaintDevice *d, const QRegion &r, const QPoint &o, int f, |
|
805 |
QPainter *p, QWidgetBackingStore *b) |
|
806 |
: pdev(d), rgn(r), offset(o), flags(f), sharedPainter(p), backingStore(b), painter(0) {} |
|
807 |
||
808 |
QPaintDevice *pdev; |
|
809 |
QRegion rgn; |
|
810 |
QPoint offset; |
|
811 |
int flags; |
|
812 |
QPainter *sharedPainter; |
|
813 |
QWidgetBackingStore *backingStore; |
|
814 |
QPainter *painter; |
|
815 |
}; |
|
816 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
817 |
#ifndef QT_NO_GRAPHICSEFFECT |
0 | 818 |
class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate |
819 |
{ |
|
820 |
public: |
|
821 |
QWidgetEffectSourcePrivate(QWidget *widget) |
|
822 |
: QGraphicsEffectSourcePrivate(), m_widget(widget), context(0), updateDueToGraphicsEffect(false) |
|
823 |
{} |
|
824 |
||
825 |
inline void detach() |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
826 |
{ m_widget->d_func()->graphicsEffect = 0; } |
0 | 827 |
|
828 |
inline const QGraphicsItem *graphicsItem() const |
|
829 |
{ return 0; } |
|
830 |
||
831 |
inline const QWidget *widget() const |
|
832 |
{ return m_widget; } |
|
833 |
||
834 |
inline void update() |
|
835 |
{ |
|
836 |
updateDueToGraphicsEffect = true; |
|
837 |
m_widget->update(); |
|
838 |
updateDueToGraphicsEffect = false; |
|
839 |
} |
|
840 |
||
841 |
inline bool isPixmap() const |
|
842 |
{ return false; } |
|
843 |
||
844 |
inline void effectBoundingRectChanged() |
|
845 |
{ |
|
846 |
// ### This function should take a rect parameter; then we can avoid |
|
847 |
// updating too much on the parent widget. |
|
848 |
if (QWidget *parent = m_widget->parentWidget()) |
|
849 |
parent->update(); |
|
850 |
else |
|
851 |
update(); |
|
852 |
} |
|
853 |
||
854 |
inline const QStyleOption *styleOption() const |
|
855 |
{ return 0; } |
|
856 |
||
857 |
inline QRect deviceRect() const |
|
858 |
{ return m_widget->window()->rect(); } |
|
859 |
||
860 |
QRectF boundingRect(Qt::CoordinateSystem system) const; |
|
861 |
void draw(QPainter *p); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
862 |
QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
863 |
QGraphicsEffect::PixmapPadMode mode) const; |
0 | 864 |
|
865 |
QWidget *m_widget; |
|
866 |
QWidgetPaintContext *context; |
|
867 |
QTransform lastEffectTransform; |
|
868 |
bool updateDueToGraphicsEffect; |
|
869 |
}; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
870 |
#endif //QT_NO_GRAPHICSEFFECT |
0 | 871 |
|
872 |
inline QWExtra *QWidgetPrivate::extraData() const |
|
873 |
{ |
|
874 |
return extra; |
|
875 |
} |
|
876 |
||
877 |
inline QTLWExtra *QWidgetPrivate::topData() const |
|
878 |
{ |
|
879 |
const_cast<QWidgetPrivate *>(this)->createTLExtra(); |
|
880 |
return extra->topextra; |
|
881 |
} |
|
882 |
||
883 |
inline QTLWExtra *QWidgetPrivate::maybeTopData() const |
|
884 |
{ |
|
885 |
return extra ? extra->topextra : 0; |
|
886 |
} |
|
887 |
||
888 |
inline QPainter *QWidgetPrivate::sharedPainter() const |
|
889 |
{ |
|
890 |
Q_Q(const QWidget); |
|
891 |
QTLWExtra *x = q->window()->d_func()->maybeTopData(); |
|
892 |
return x ? x->sharedPainter : 0; |
|
893 |
} |
|
894 |
||
895 |
inline void QWidgetPrivate::setSharedPainter(QPainter *painter) |
|
896 |
{ |
|
897 |
Q_Q(QWidget); |
|
898 |
QTLWExtra *x = q->window()->d_func()->topData(); |
|
899 |
x->sharedPainter = painter; |
|
900 |
} |
|
901 |
||
902 |
inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const |
|
903 |
{ |
|
904 |
Q_Q(const QWidget); |
|
905 |
QTLWExtra *x = q->window()->d_func()->maybeTopData(); |
|
906 |
return x ? x->backingStore : 0; |
|
907 |
} |
|
908 |
||
909 |
QT_END_NAMESPACE |
|
910 |
||
911 |
#endif // QWIDGET_P_H |