19#include <QtWidgets/private/qtwidgetsglobal_p.h>
21#if QT_CONFIG(style_windowsvista)
25#include <qabstractbutton.h>
26#include <QtWidgets/private/qwidget_p.h>
27#include <QtWidgets/private/qstylehelper_p.h>
28#include <qt_windows.h>
30QT_REQUIRE_CONFIG(wizard);
34class QVistaBackButton :
public QAbstractButton
37 QVistaBackButton(QWidget *widget);
39 QSize sizeHint()
const override;
40 inline QSize minimumSizeHint()
const override
41 {
return sizeHint(); }
43 void enterEvent(QEnterEvent *event) override;
44 void leaveEvent(QEvent *event) override;
45 void paintEvent(QPaintEvent *event) override;
50class QVistaHelper :
public QObject
52 Q_DISABLE_COPY_MOVE(QVistaHelper)
54 QVistaHelper(QWizard *wizard);
55 ~QVistaHelper() override;
56 enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
57 void updateCustomMargins(
bool vistaMargins);
58 bool setDWMTitleBar(TitleBarChangeType type);
59 void setTitleBarIconAndCaptionVisible(
bool visible);
60 void mouseEvent(QEvent *event);
61 bool handleWinEvent(MSG *message, qintptr *result);
62 void resizeEvent(QResizeEvent *event);
63 void paintEvent(QPaintEvent *event);
64 QVistaBackButton *backButton()
const {
return backButton_; }
65 void disconnectBackButton();
66 void hideBackButton() {
if (backButton_) backButton_->hide(); }
67 QColor basicWindowFrameColor();
68 static int titleBarSize() {
return QVistaHelper::titleBarSizeDp() / QVistaHelper::m_devicePixelRatio; }
69 static int titleBarSizeDp() {
return QVistaHelper::frameSizeDp() + QVistaHelper::captionSizeDp(); }
70 static int topPadding(
const QPaintDevice *device) {
71 return int(QStyleHelper::dpiScaled(4, device));
73 static int topOffset(
const QPaintDevice *device);
75 static HDC backingStoreDC(
const QWidget *wizard, QPoint *offset);
78 HWND wizardHWND()
const;
79 void drawTitleText(QPainter *painter,
const QString &text,
const QRect &rect, HDC hdc);
80 static void drawBlackRect(
const QRect &rect, HDC hdc);
82 static int frameSize() {
return QVistaHelper::frameSizeDp() / QVistaHelper::m_devicePixelRatio; }
83 static int frameSizeDp();
84 static int captionSize() {
return QVistaHelper::captionSizeDp() / QVistaHelper::m_devicePixelRatio; }
85 static int captionSizeDp();
87 static int backButtonSize(
const QPaintDevice *device)
88 {
return int(QStyleHelper::dpiScaled(30, device)); }
89 static int iconSize(
const QPaintDevice *device);
90 static int glowSize(
const QPaintDevice *device);
91 int leftMargin(
const QPaintDevice *device)
92 {
return backButton_->isVisible() ? backButtonSize(device) + iconSpacing : 0; }
95 void drawTitleBar(QPainter *painter);
96 void setMouseCursor(QPoint pos);
97 void collapseTopFrameStrut();
98 bool winEvent(MSG *message, qintptr *result);
99 void mouseMoveEvent(QMouseEvent *event);
100 void mousePressEvent(QMouseEvent *event);
101 void mouseReleaseEvent(QMouseEvent *event);
102 bool eventFilter(QObject *obj, QEvent *event) override;
104 enum Changes { resizeTop, movePosition, noChange } change;
110 QVistaBackButton *backButton_;
114 static qreal m_devicePixelRatio;