1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 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 QWIZARD_WIN_P_H
|
---|
43 | #define QWIZARD_WIN_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 purely as an
|
---|
50 | // implementation detail. This header file may change from version to
|
---|
51 | // version without notice, or even be removed.
|
---|
52 | //
|
---|
53 | // We mean it.
|
---|
54 | //
|
---|
55 |
|
---|
56 | #ifndef QT_NO_WIZARD
|
---|
57 | #ifndef QT_NO_STYLE_WINDOWSVISTA
|
---|
58 |
|
---|
59 | #include <qt_windows.h>
|
---|
60 | #include <qobject.h>
|
---|
61 | #include <qwidget.h>
|
---|
62 | #include <qabstractbutton.h>
|
---|
63 | #include <QtGui/private/qwidget_p.h>
|
---|
64 | #include <QtGui/private/qstylehelper_p.h>
|
---|
65 |
|
---|
66 | QT_BEGIN_NAMESPACE
|
---|
67 |
|
---|
68 | class QVistaBackButton : public QAbstractButton
|
---|
69 | {
|
---|
70 | public:
|
---|
71 | QVistaBackButton(QWidget *widget);
|
---|
72 |
|
---|
73 | QSize sizeHint() const;
|
---|
74 | inline QSize minimumSizeHint() const
|
---|
75 | { return sizeHint(); }
|
---|
76 |
|
---|
77 | void enterEvent(QEvent *event);
|
---|
78 | void leaveEvent(QEvent *event);
|
---|
79 | void paintEvent(QPaintEvent *event);
|
---|
80 | };
|
---|
81 |
|
---|
82 | class QWizard;
|
---|
83 |
|
---|
84 | class QVistaHelper : public QObject
|
---|
85 | {
|
---|
86 | public:
|
---|
87 | QVistaHelper(QWizard *wizard);
|
---|
88 | ~QVistaHelper();
|
---|
89 | enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
|
---|
90 | bool setDWMTitleBar(TitleBarChangeType type);
|
---|
91 | void setTitleBarIconAndCaptionVisible(bool visible);
|
---|
92 | void mouseEvent(QEvent *event);
|
---|
93 | bool handleWinEvent(MSG *message, long *result);
|
---|
94 | void resizeEvent(QResizeEvent *event);
|
---|
95 | void paintEvent(QPaintEvent *event);
|
---|
96 | QVistaBackButton *backButton() const { return backButton_; }
|
---|
97 | void disconnectBackButton() { if (backButton_) backButton_->disconnect(); }
|
---|
98 | void hideBackButton() { if (backButton_) backButton_->hide(); }
|
---|
99 | void setWindowPosHack();
|
---|
100 | QColor basicWindowFrameColor();
|
---|
101 | enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
|
---|
102 | static VistaState vistaState();
|
---|
103 | static int titleBarSize() { return frameSize() + captionSize(); }
|
---|
104 | static int topPadding() { // padding under text
|
---|
105 | return int(QStyleHelper::dpiScaled(
|
---|
106 | QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6));
|
---|
107 | }
|
---|
108 | static int topOffset() {
|
---|
109 | static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
|
---|
110 | QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
|
---|
111 | return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); }
|
---|
112 | private:
|
---|
113 | static HFONT getCaptionFont(HANDLE hTheme);
|
---|
114 | bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
|
---|
115 | static bool drawBlackRect(const QRect &rect, HDC hdc);
|
---|
116 |
|
---|
117 | static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); }
|
---|
118 | static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); }
|
---|
119 |
|
---|
120 | static int backButtonSize() { return int(QStyleHelper::dpiScaled(30)); }
|
---|
121 | static int iconSize() { return 16; } // Standard Aero
|
---|
122 | static int glowSize() { return 10; }
|
---|
123 | int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; }
|
---|
124 |
|
---|
125 | int titleOffset();
|
---|
126 | bool resolveSymbols();
|
---|
127 | void drawTitleBar(QPainter *painter);
|
---|
128 | void setMouseCursor(QPoint pos);
|
---|
129 | void collapseTopFrameStrut();
|
---|
130 | bool winEvent(MSG *message, long *result);
|
---|
131 | void mouseMoveEvent(QMouseEvent *event);
|
---|
132 | void mousePressEvent(QMouseEvent *event);
|
---|
133 | void mouseReleaseEvent(QMouseEvent *event);
|
---|
134 | bool eventFilter(QObject *obj, QEvent *event);
|
---|
135 |
|
---|
136 | static bool is_vista;
|
---|
137 | static VistaState cachedVistaState;
|
---|
138 | static bool isCompositionEnabled();
|
---|
139 | static bool isThemeActive();
|
---|
140 | enum Changes { resizeTop, movePosition, noChange } change;
|
---|
141 | QPoint pressedPos;
|
---|
142 | bool pressed;
|
---|
143 | QRect rtTop;
|
---|
144 | QRect rtTitle;
|
---|
145 | QWizard *wizard;
|
---|
146 | QVistaBackButton *backButton_;
|
---|
147 |
|
---|
148 | int titleBarOffset; // Extra spacing above the text
|
---|
149 | int iconSpacing; // Space between button and icon
|
---|
150 | int textSpacing; // Space between icon and text
|
---|
151 | };
|
---|
152 |
|
---|
153 |
|
---|
154 | QT_END_NAMESPACE
|
---|
155 |
|
---|
156 | #endif // QT_NO_STYLE_WINDOWSVISTA
|
---|
157 | #endif // QT_NO_WIZARD
|
---|
158 | #endif // QWIZARD_WIN_P_H
|
---|