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