Qt 4.8
qwizard_win_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
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 
67 
69 {
70 public:
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();
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(
107  }
108  static int topOffset();
109 
110 private:
111  static HFONT getCaptionFont(HANDLE hTheme);
112  bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
113  static bool drawBlackRect(const QRect &rect, HDC hdc);
114 
115  static int frameSize();
116  static int captionSize();
117 
118  static int backButtonSize() { return int(QStyleHelper::dpiScaled(30)); }
119  static int iconSize() { return 16; } // Standard Aero
120  static int glowSize() { return 10; }
121  int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; }
122 
123  int titleOffset();
124  bool resolveSymbols();
125  void drawTitleBar(QPainter *painter);
126  void setMouseCursor(QPoint pos);
127  void collapseTopFrameStrut();
128  bool winEvent(MSG *message, long *result);
129  void mouseMoveEvent(QMouseEvent *event);
130  void mousePressEvent(QMouseEvent *event);
131  void mouseReleaseEvent(QMouseEvent *event);
132  bool eventFilter(QObject *obj, QEvent *event);
133 
134  static int instanceCount;
135  static bool is_vista;
137  static bool isCompositionEnabled();
138  static bool isThemeActive();
139  enum Changes { resizeTop, movePosition, noChange } change;
141  bool pressed;
146 
147  int titleBarOffset; // Extra spacing above the text
148  int iconSpacing; // Space between button and icon
149  int textSpacing; // Space between icon and text
150 };
151 
152 
154 
155 #endif // QT_NO_STYLE_WINDOWSVISTA
156 #endif // QT_NO_WIZARD
157 #endif // QWIZARD_WIN_P_H
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
QPoint pos() const
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QSize sizeHint() const
int type
Definition: qmetatype.cpp:239
QSize minimumSizeHint() const
Definition: qwizard_win_p.h:74
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QString text() const
QPointer< QWidget > widget
QVistaBackButton * backButton_
static VistaState cachedVistaState
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
virtual void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition: qwidget.cpp:9587
static const WinVersion WindowsVersion
the version of the Windows operating system on which the application is run (Windows only) ...
Definition: qglobal.h:1613
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
static int topPadding()
bool event(QEvent *e)
Reimplemented Function
void mouseMoveEvent(QMouseEvent *e)
Reimplemented Function
QSize frameSize() const
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
bool visible
whether the widget is visible
Definition: qwidget.h:191
static int titleBarSize()
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
static int iconSize()
static bool is_vista
void * HANDLE
Definition: qnamespace.h:1671
QRect rect() const
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qobject.cpp:1375
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
qreal dpiScaled(qreal value)
struct tagMSG MSG
void mouseReleaseEvent(QMouseEvent *e)
Reimplemented Function
QVistaBackButton * backButton() const
Definition: qwizard_win_p.h:96
virtual bool winEvent(MSG *message, long *result)
This special event handler can be reimplemented in a subclass to receive native Windows events which ...
Definition: qwidget.cpp:9941
void paintEvent(QPaintEvent *event)
Reimplemented Function
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QPoint pressedPos
QVistaBackButton(QWidget *widget)
void hideBackButton()
Definition: qwizard_win_p.h:98
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void enterEvent(QEvent *event)
This event handler can be reimplemented in a subclass to receive widget enter events which are passed...
void leaveEvent(QEvent *event)
This event handler can be reimplemented in a subclass to receive widget leave events which are passed...
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
Definition: qtestmouse.h:71
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static int instanceCount
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
static int backButtonSize()
QWizard * wizard
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
static int glowSize()
void mousePressEvent(QMouseEvent *e)
Reimplemented Function
The QWizard class provides a framework for wizards.
Definition: qwizard.h:59