| 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 QWINDOWSVISTASTYLE_P_H
|
|---|
| 43 | #define QWINDOWSVISTASTYLE_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 for the convenience
|
|---|
| 50 | // of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
|
|---|
| 51 | // file may change from version to version without notice, or even be removed.
|
|---|
| 52 | //
|
|---|
| 53 | // We mean it.
|
|---|
| 54 | //
|
|---|
| 55 |
|
|---|
| 56 | #include "qwindowsvistastyle.h"
|
|---|
| 57 |
|
|---|
| 58 | #if !defined(QT_NO_STYLE_WINDOWSVISTA)
|
|---|
| 59 | #include <private/qwindowsxpstyle_p.h>
|
|---|
| 60 | #include <private/qpaintengine_raster_p.h>
|
|---|
| 61 | #include <qlibrary.h>
|
|---|
| 62 | #include <qpaintengine.h>
|
|---|
| 63 | #include <qwidget.h>
|
|---|
| 64 | #include <qapplication.h>
|
|---|
| 65 | #include <qpixmapcache.h>
|
|---|
| 66 | #include <qstyleoption.h>
|
|---|
| 67 | #include <qpushbutton.h>
|
|---|
| 68 | #include <qradiobutton.h>
|
|---|
| 69 | #include <qcheckbox.h>
|
|---|
| 70 | #include <qlineedit.h>
|
|---|
| 71 | #include <qgroupbox.h>
|
|---|
| 72 | #include <qtoolbutton.h>
|
|---|
| 73 | #include <qspinbox.h>
|
|---|
| 74 | #include <qtoolbar.h>
|
|---|
| 75 | #include <qcombobox.h>
|
|---|
| 76 | #include <qscrollbar.h>
|
|---|
| 77 | #include <qprogressbar.h>
|
|---|
| 78 | #include <qdockwidget.h>
|
|---|
| 79 | #include <qtreeview.h>
|
|---|
| 80 | #include <qtextedit.h>
|
|---|
| 81 | #include <qmessagebox.h>
|
|---|
| 82 | #include <qdialogbuttonbox.h>
|
|---|
| 83 | #include <qinputdialog.h>
|
|---|
| 84 | #include <qtreeview.h>
|
|---|
| 85 | #include <qlistview.h>
|
|---|
| 86 | #include <qbasictimer.h>
|
|---|
| 87 | #include <qcommandlinkbutton.h>
|
|---|
| 88 |
|
|---|
| 89 | QT_BEGIN_NAMESPACE
|
|---|
| 90 |
|
|---|
| 91 | #if !defined(SCHEMA_VERIFY_VSSYM32)
|
|---|
| 92 | #define TMT_ANIMATIONDURATION 5006
|
|---|
| 93 | #define TMT_TRANSITIONDURATIONS 6000
|
|---|
| 94 | #define EP_EDITBORDER_NOSCROLL 6
|
|---|
| 95 | #define EP_EDITBORDER_HVSCROLL 9
|
|---|
| 96 | #define EP_BACKGROUND 3
|
|---|
| 97 | #define EBS_NORMAL 1
|
|---|
| 98 | #define EBS_HOT 2
|
|---|
| 99 | #define EBS_DISABLED 3
|
|---|
| 100 | #define EBS_READONLY 5
|
|---|
| 101 | #define PBS_DEFAULTED_ANIMATING 6
|
|---|
| 102 | #define MBI_NORMAL 1
|
|---|
| 103 | #define MBI_HOT 2
|
|---|
| 104 | #define MBI_PUSHED 3
|
|---|
| 105 | #define MBI_DISABLED 4
|
|---|
| 106 | #define MB_ACTIVE 1
|
|---|
| 107 | #define MB_INACTIVE 2
|
|---|
| 108 | #define PP_FILL 5
|
|---|
| 109 | #define PP_FILLVERT 6
|
|---|
| 110 | #define PP_MOVEOVERLAY 8
|
|---|
| 111 | #define PP_MOVEOVERLAYVERT 10
|
|---|
| 112 | #define MENU_BARBACKGROUND 7
|
|---|
| 113 | #define MENU_BARITEM 8
|
|---|
| 114 | #define MENU_POPUPCHECK 11
|
|---|
| 115 | #define MENU_POPUPCHECKBACKGROUND 12
|
|---|
| 116 | #define MENU_POPUPGUTTER 13
|
|---|
| 117 | #define MENU_POPUPITEM 14
|
|---|
| 118 | #define MENU_POPUPBORDERS 10
|
|---|
| 119 | #define MENU_POPUPSEPARATOR 15
|
|---|
| 120 | #define MC_CHECKMARKNORMAL 1
|
|---|
| 121 | #define MC_CHECKMARKDISABLED 2
|
|---|
| 122 | #define MC_BULLETNORMAL 3
|
|---|
| 123 | #define MC_BULLETDISABLED 4
|
|---|
| 124 | #define ABS_UPHOVER 17
|
|---|
| 125 | #define ABS_DOWNHOVER 18
|
|---|
| 126 | #define ABS_LEFTHOVER 19
|
|---|
| 127 | #define ABS_RIGHTHOVER 20
|
|---|
| 128 | #define CP_DROPDOWNBUTTONRIGHT 6
|
|---|
| 129 | #define CP_DROPDOWNBUTTONLEFT 7
|
|---|
| 130 | #define SCRBS_HOVER 5
|
|---|
| 131 | #define TVP_HOTGLYPH 4
|
|---|
| 132 | #define SPI_GETCLIENTAREAANIMATION 0x1042
|
|---|
| 133 | #define TDLG_PRIMARYPANEL 1
|
|---|
| 134 | #define TDLG_SECONDARYPANEL 8
|
|---|
| 135 | #endif
|
|---|
| 136 |
|
|---|
| 137 | class Animation
|
|---|
| 138 | {
|
|---|
| 139 | public :
|
|---|
| 140 | Animation() : _running(true) { }
|
|---|
| 141 | virtual ~Animation() { }
|
|---|
| 142 | QWidget * widget() const { return _widget; }
|
|---|
| 143 | bool running() const { return _running; }
|
|---|
| 144 | const QTime &startTime() const { return _startTime; }
|
|---|
| 145 | void setRunning(bool val) { _running = val; }
|
|---|
| 146 | void setWidget(QWidget *widget) { _widget = widget; }
|
|---|
| 147 | void setStartTime(const QTime &startTime) { _startTime = startTime; }
|
|---|
| 148 | virtual void paint(QPainter *painter, const QStyleOption *option);
|
|---|
| 149 |
|
|---|
| 150 | protected:
|
|---|
| 151 | void drawBlendedImage(QPainter *painter, QRect rect, float value);
|
|---|
| 152 | QTime _startTime;
|
|---|
| 153 | QPointer<QWidget> _widget;
|
|---|
| 154 | QImage _primaryImage;
|
|---|
| 155 | QImage _secondaryImage;
|
|---|
| 156 | QImage _tempImage;
|
|---|
| 157 | bool _running;
|
|---|
| 158 | };
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 | // Handles state transition animations
|
|---|
| 162 | class Transition : public Animation
|
|---|
| 163 | {
|
|---|
| 164 | public :
|
|---|
| 165 | Transition() : Animation() {}
|
|---|
| 166 | virtual ~Transition() { }
|
|---|
| 167 | void setDuration(int duration) { _duration = duration; }
|
|---|
| 168 | void setStartImage(const QImage &image) { _primaryImage = image; }
|
|---|
| 169 | void setEndImage(const QImage &image) { _secondaryImage = image; }
|
|---|
| 170 | virtual void paint(QPainter *painter, const QStyleOption *option);
|
|---|
| 171 | int duration() const { return _duration; }
|
|---|
| 172 | int _duration; //set time in ms to complete a state transition
|
|---|
| 173 | };
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 | // Handles pulse animations (default buttons)
|
|---|
| 177 | class Pulse: public Animation
|
|---|
| 178 | {
|
|---|
| 179 | public :
|
|---|
| 180 | Pulse() : Animation() {}
|
|---|
| 181 | virtual ~Pulse() { }
|
|---|
| 182 | void setDuration(int duration) { _duration = duration; }
|
|---|
| 183 | void setPrimaryImage(const QImage &image) { _primaryImage = image; }
|
|---|
| 184 | void setAlternateImage(const QImage &image) { _secondaryImage = image; }
|
|---|
| 185 | virtual void paint(QPainter *painter, const QStyleOption *option);
|
|---|
| 186 | int duration() const { return _duration; }
|
|---|
| 187 | int _duration; //time in ms to complete a pulse cycle
|
|---|
| 188 | };
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 | class QWindowsVistaStylePrivate : public QWindowsXPStylePrivate
|
|---|
| 192 | {
|
|---|
| 193 | Q_DECLARE_PUBLIC(QWindowsVistaStyle)
|
|---|
| 194 |
|
|---|
| 195 | public:
|
|---|
| 196 | QWindowsVistaStylePrivate();
|
|---|
| 197 | ~QWindowsVistaStylePrivate();
|
|---|
| 198 | static bool resolveSymbols();
|
|---|
| 199 | static inline bool useVista();
|
|---|
| 200 | void startAnimation(Animation *);
|
|---|
| 201 | void stopAnimation(const QWidget *);
|
|---|
| 202 | Animation* widgetAnimation(const QWidget *) const;
|
|---|
| 203 | void timerEvent();
|
|---|
| 204 | bool transitionsEnabled() const;
|
|---|
| 205 | QWidget *treeViewHelper();
|
|---|
| 206 |
|
|---|
| 207 | private:
|
|---|
| 208 | QList <Animation*> animations;
|
|---|
| 209 | QBasicTimer animationTimer;
|
|---|
| 210 | QWidget *m_treeViewHelper;
|
|---|
| 211 | };
|
|---|
| 212 |
|
|---|
| 213 | QT_END_NAMESPACE
|
|---|
| 214 |
|
|---|
| 215 | #endif // QT_NO_STYLE_WINDOWSVISTA
|
|---|
| 216 |
|
|---|
| 217 | #endif // QWINDOWSVISTASTYLE_P_H
|
|---|