source: trunk/src/gui/styles/qwindowsvistastyle_p.h@ 1056

Last change on this file since 1056 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 7.4 KB
Line 
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 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 <qlistview.h>
80#include <qtreeview.h>
81#include <qtextedit.h>
82#include <qmessagebox.h>
83#include <qdialogbuttonbox.h>
84#include <qinputdialog.h>
85#include <qtreeview.h>
86#include <qlistview.h>
87#include <qtableview.h>
88#include <qbasictimer.h>
89#include <qdatetime.h>
90#include <qcommandlinkbutton.h>
91
92QT_BEGIN_NAMESPACE
93
94#if !defined(SCHEMA_VERIFY_VSSYM32)
95#define TMT_ANIMATIONDURATION 5006
96#define TMT_TRANSITIONDURATIONS 6000
97#define EP_EDITBORDER_NOSCROLL 6
98#define EP_EDITBORDER_HVSCROLL 9
99#define EP_BACKGROUND 3
100#define EBS_NORMAL 1
101#define EBS_HOT 2
102#define EBS_DISABLED 3
103#define EBS_READONLY 5
104#define PBS_DEFAULTED_ANIMATING 6
105#define MBI_NORMAL 1
106#define MBI_HOT 2
107#define MBI_PUSHED 3
108#define MBI_DISABLED 4
109#define MB_ACTIVE 1
110#define MB_INACTIVE 2
111#define PP_FILL 5
112#define PP_FILLVERT 6
113#define PP_MOVEOVERLAY 8
114#define PP_MOVEOVERLAYVERT 10
115#define MENU_BARBACKGROUND 7
116#define MENU_BARITEM 8
117#define MENU_POPUPCHECK 11
118#define MENU_POPUPCHECKBACKGROUND 12
119#define MENU_POPUPGUTTER 13
120#define MENU_POPUPITEM 14
121#define MENU_POPUPBORDERS 10
122#define MENU_POPUPSEPARATOR 15
123#define MC_CHECKMARKNORMAL 1
124#define MC_CHECKMARKDISABLED 2
125#define MC_BULLETNORMAL 3
126#define MC_BULLETDISABLED 4
127#define ABS_UPHOVER 17
128#define ABS_DOWNHOVER 18
129#define ABS_LEFTHOVER 19
130#define ABS_RIGHTHOVER 20
131#define CP_DROPDOWNBUTTONRIGHT 6
132#define CP_DROPDOWNBUTTONLEFT 7
133#define SCRBS_HOVER 5
134#define TVP_HOTGLYPH 4
135#define SPI_GETCLIENTAREAANIMATION 0x1042
136#define TDLG_PRIMARYPANEL 1
137#define TDLG_SECONDARYPANEL 8
138#endif
139
140class QWindowsVistaAnimation
141{
142public :
143 QWindowsVistaAnimation() : _running(true) { }
144 virtual ~QWindowsVistaAnimation() { }
145 QWidget * widget() const { return _widget; }
146 bool running() const { return _running; }
147 const QTime &startTime() const { return _startTime; }
148 void setRunning(bool val) { _running = val; }
149 void setWidget(QWidget *widget) { _widget = widget; }
150 void setStartTime(const QTime &startTime) { _startTime = startTime; }
151 virtual void paint(QPainter *painter, const QStyleOption *option);
152
153protected:
154 void drawBlendedImage(QPainter *painter, QRect rect, float value);
155 QTime _startTime;
156 QPointer<QWidget> _widget;
157 QImage _primaryImage;
158 QImage _secondaryImage;
159 QImage _tempImage;
160 bool _running;
161};
162
163
164// Handles state transition animations
165class QWindowsVistaTransition : public QWindowsVistaAnimation
166{
167public :
168 QWindowsVistaTransition() : QWindowsVistaAnimation() {}
169 virtual ~QWindowsVistaTransition() { }
170 void setDuration(int duration) { _duration = duration; }
171 void setStartImage(const QImage &image) { _primaryImage = image; }
172 void setEndImage(const QImage &image) { _secondaryImage = image; }
173 virtual void paint(QPainter *painter, const QStyleOption *option);
174 int duration() const { return _duration; }
175 int _duration; //set time in ms to complete a state transition
176};
177
178
179// Handles pulse animations (default buttons)
180class QWindowsVistaPulse: public QWindowsVistaAnimation
181{
182public :
183 QWindowsVistaPulse() : QWindowsVistaAnimation() {}
184 virtual ~QWindowsVistaPulse() { }
185 void setDuration(int duration) { _duration = duration; }
186 void setPrimaryImage(const QImage &image) { _primaryImage = image; }
187 void setAlternateImage(const QImage &image) { _secondaryImage = image; }
188 virtual void paint(QPainter *painter, const QStyleOption *option);
189 int duration() const { return _duration; }
190 int _duration; //time in ms to complete a pulse cycle
191};
192
193
194class QWindowsVistaStylePrivate : public QWindowsXPStylePrivate
195{
196 Q_DECLARE_PUBLIC(QWindowsVistaStyle)
197
198public:
199 QWindowsVistaStylePrivate();
200 ~QWindowsVistaStylePrivate();
201 static bool resolveSymbols();
202 static inline bool useVista();
203 void startAnimation(QWindowsVistaAnimation *);
204 void stopAnimation(const QWidget *);
205 QWindowsVistaAnimation* widgetAnimation(const QWidget *) const;
206 void timerEvent();
207 bool transitionsEnabled() const;
208 QWidget *treeViewHelper();
209
210private:
211 QList <QWindowsVistaAnimation*> animations;
212 QBasicTimer animationTimer;
213 QWidget *m_treeViewHelper;
214};
215
216QT_END_NAMESPACE
217
218#endif // QT_NO_STYLE_WINDOWSVISTA
219
220#endif // QWINDOWSVISTASTYLE_P_H
Note: See TracBrowser for help on using the repository browser.