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

Last change on this file since 605 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

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