Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwizard_win_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QWIZARD_WIN_P_H
6#define QWIZARD_WIN_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtWidgets/private/qtwidgetsglobal_p.h>
20
21#if QT_CONFIG(style_windowsvista)
22
23#include <qobject.h>
24#include <qwidget.h>
25#include <qabstractbutton.h>
26#include <QtWidgets/private/qwidget_p.h>
27#include <QtWidgets/private/qstylehelper_p.h>
28#include <qt_windows.h>
29
30QT_REQUIRE_CONFIG(wizard);
31
32QT_BEGIN_NAMESPACE
33
34class QVistaBackButton : public QAbstractButton
35{
36public:
37 QVistaBackButton(QWidget *widget);
38
39 QSize sizeHint() const override;
40 inline QSize minimumSizeHint() const override
41 { return sizeHint(); }
42
43 void enterEvent(QEnterEvent *event) override;
44 void leaveEvent(QEvent *event) override;
45 void paintEvent(QPaintEvent *event) override;
46};
47
48class QWizard;
49
50class QVistaHelper : public QObject
51{
52 Q_DISABLE_COPY_MOVE(QVistaHelper)
53public:
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) { // padding under text
71 return int(QStyleHelper::dpiScaled(4, device));
72 }
73 static int topOffset(const QPaintDevice *device);
74
75 static HDC backingStoreDC(const QWidget *wizard, QPoint *offset);
76
77private:
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);
81
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();
86
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; }
93
94 int titleOffset();
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;
103
104 enum Changes { resizeTop, movePosition, noChange } change;
105 QPoint pressedPos;
106 bool pressed;
107 QRect rtTop;
108 QRect rtTitle;
109 QWizard *wizard;
110 QVistaBackButton *backButton_;
111
112 int titleBarOffset; // Extra spacing above the text
113 int iconSpacing; // Space between button and icon
114 static qreal m_devicePixelRatio;
115};
116
117
118QT_END_NAMESPACE
119
120#endif // style_windowsvista
121#endif // QWIZARD_WIN_P_H