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