1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** 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 are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department 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 <windows.h>
|
---|
60 | #include <qobject.h>
|
---|
61 | #include <qwidget.h>
|
---|
62 | #include <qabstractbutton.h>
|
---|
63 | #include <QtGui/private/qwidget_p.h>
|
---|
64 |
|
---|
65 | QT_BEGIN_NAMESPACE
|
---|
66 |
|
---|
67 | class QVistaBackButton : public QAbstractButton
|
---|
68 | {
|
---|
69 | public:
|
---|
70 | QVistaBackButton(QWidget *widget);
|
---|
71 |
|
---|
72 | QSize sizeHint() const;
|
---|
73 | inline QSize minimumSizeHint() const
|
---|
74 | { return sizeHint(); }
|
---|
75 |
|
---|
76 | void enterEvent(QEvent *event);
|
---|
77 | void leaveEvent(QEvent *event);
|
---|
78 | void paintEvent(QPaintEvent *event);
|
---|
79 | };
|
---|
80 |
|
---|
81 | class QWizard;
|
---|
82 |
|
---|
83 | class QVistaHelper : public QObject
|
---|
84 | {
|
---|
85 | Q_OBJECT
|
---|
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 setWindowPosHack();
|
---|
98 | QColor basicWindowFrameColor();
|
---|
99 | enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
|
---|
100 | static VistaState vistaState();
|
---|
101 | static int titleBarSize() { return frameSize() + captionSize(); }
|
---|
102 | static int topPadding() { return 8; }
|
---|
103 | static int topOffset() { return titleBarSize() + (vistaState() == VistaAero ? 13 : 3); }
|
---|
104 |
|
---|
105 | private:
|
---|
106 | static HFONT getCaptionFont(HANDLE hTheme);
|
---|
107 | bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
|
---|
108 | static bool drawBlackRect(const QRect &rect, HDC hdc);
|
---|
109 |
|
---|
110 | static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); }
|
---|
111 | static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); }
|
---|
112 |
|
---|
113 | static int backButtonSize() { return 31; } // ### should be queried from back button itself
|
---|
114 | static int iconSize() { return 16; } // Standard Aero
|
---|
115 | static int padding() { return 7; } // Standard Aero
|
---|
116 | static int leftMargin() { return backButtonSize() + padding(); }
|
---|
117 | static int glowSize() { return 10; }
|
---|
118 |
|
---|
119 | int titleOffset();
|
---|
120 | bool resolveSymbols();
|
---|
121 | void drawTitleBar(QPainter *painter);
|
---|
122 | void setMouseCursor(QPoint pos);
|
---|
123 | void collapseTopFrameStrut();
|
---|
124 | bool winEvent(MSG *message, long *result);
|
---|
125 | void mouseMoveEvent(QMouseEvent *event);
|
---|
126 | void mousePressEvent(QMouseEvent *event);
|
---|
127 | void mouseReleaseEvent(QMouseEvent *event);
|
---|
128 | bool eventFilter(QObject *obj, QEvent *event);
|
---|
129 |
|
---|
130 | static bool is_vista;
|
---|
131 | static VistaState cachedVistaState;
|
---|
132 | static bool isCompositionEnabled();
|
---|
133 | static bool isThemeActive();
|
---|
134 | enum Changes { resizeTop, movePosition, noChange } change;
|
---|
135 | QPoint pressedPos;
|
---|
136 | bool pressed;
|
---|
137 | QRect rtTop;
|
---|
138 | QRect rtTitle;
|
---|
139 | QWizard *wizard;
|
---|
140 | QVistaBackButton *backButton_;
|
---|
141 | };
|
---|
142 |
|
---|
143 |
|
---|
144 | QT_END_NAMESPACE
|
---|
145 |
|
---|
146 | #endif // QT_NO_STYLE_WINDOWSVISTA
|
---|
147 | #endif // QT_NO_WIZARD
|
---|
148 | #endif // QWIZARD_WIN_P_H
|
---|