diff options
author | Olli Werwolff <qt-info@nokia.com> | 2011-07-07 09:07:19 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@nokia.com> | 2011-07-07 14:20:07 +0200 |
commit | f9f04ea63d2489bd2ecb91c5a6bee4c4a869ac20 (patch) | |
tree | 5914b51c5bbe09f7e191d3a4d6ae52092225697f /src/widgets/dialogs/qwizard_win.cpp | |
parent | d677aac93443a8e57955e4a0b9f09368090f6848 (diff) | |
download | qtbase-f9f04ea63d2489bd2ecb91c5a6bee4c4a869ac20.tar.gz |
Use PlatformNativeInterface to obtain handles
Change-Id: I8cdf3d5477e72e89bcde46ccb6670320bf4dd797
Reviewed-on: http://codereview.qt.nokia.com/1270
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets/dialogs/qwizard_win.cpp')
-rw-r--r-- | src/widgets/dialogs/qwizard_win.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 32fc3dfe46..ab59e0109a 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -44,6 +44,8 @@ #include "qwizard_win_p.h" #include <private/qsystemlibrary_p.h> +#include <private/qapplication_p.h> +#include "qplatformnativeinterface_qpa.h" #include "qwizard.h" #include "qpaintengine.h" #include "qapplication.h" @@ -286,7 +288,8 @@ QVistaHelper::VistaState QVistaHelper::vistaState() QColor QVistaHelper::basicWindowFrameColor() { DWORD rgb; - HANDLE hTheme = pOpenThemeData(QApplication::desktop()->winId(), L"WINDOW"); + HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop()); + HANDLE hTheme = pOpenThemeData(handle, L"WINDOW"); pGetThemeColor( hTheme, WIZ_WP_CAPTION, WIZ_CS_ACTIVE, wizard->isActiveWindow() ? WIZ_TMT_FILLCOLORHINT : WIZ_TMT_BORDERCOLORHINT, @@ -306,7 +309,8 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type) mar.cyTopHeight = 0; else mar.cyTopHeight = titleBarSize() + topOffset(); - HRESULT hr = pDwmExtendFrameIntoClientArea(wizard->winId(), &mar); + HWND wizardHandle = QApplicationPrivate::getHWNDForWidget(wizard); + HRESULT hr = pDwmExtendFrameIntoClientArea(wizardHandle, &mar); value = SUCCEEDED(hr); } return value; @@ -314,7 +318,7 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type) void QVistaHelper::drawTitleBar(QPainter *painter) { - HDC hdc = painter->paintEngine()->getDC(); + HDC hdc = static_cast<QRasterPaintEngine *>(painter->paintEngine())->getDC(); if (vistaState() == VistaAero) drawBlackRect(QRect(0, 0, wizard->width(), @@ -360,7 +364,8 @@ void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible) opt.dwMask = 0; else opt.dwMask = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION; - pSetWindowThemeAttribute(wizard->winId(), WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS)); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS)); } } @@ -437,7 +442,8 @@ void QVistaHelper::setWindowPosHack() const int y = wizard->geometry().y(); // ignored by SWP_NOMOVE const int w = wizard->width(); const int h = wizard->height(); - SetWindowPos(wizard->winId(), 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + SetWindowPos(handle, 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); } // The following hack allows any QWidget subclass to access @@ -575,7 +581,8 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event) msg.message = WM_NCHITTEST; msg.wParam = 0; msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY()); - msg.hwnd = wizard->winId(); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + msg.hwnd = handle; winEvent(&msg, &result); msg.wParam = result; msg.message = WM_NCMOUSEMOVE; @@ -587,7 +594,8 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event) msg.message = WM_NCHITTEST; msg.wParam = 0; msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY()); - msg.hwnd = wizard->winId(); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + msg.hwnd = handle; winEvent(&msg, &result); msg.wParam = result; msg.message = WM_NCLBUTTONDOWN; @@ -599,7 +607,8 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event) msg.message = WM_NCHITTEST; msg.wParam = 0; msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY()); - msg.hwnd = wizard->winId(); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + msg.hwnd = handle; winEvent(&msg, &result); msg.wParam = result; msg.message = WM_NCLBUTTONUP; @@ -628,7 +637,8 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q { bool value = false; if (vistaState() == VistaAero) { - HANDLE hTheme = pOpenThemeData(QApplication::desktop()->winId(), L"WINDOW"); + HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop()); + HANDLE hTheme = pOpenThemeData(handle, L"WINDOW"); if (!hTheme) return false; // Set up a memory DC and bitmap that we'll draw into HDC dcMem; |