134 #define SPI_GETCLIENTAREAANIMATION 0x1042 |
134 #define SPI_GETCLIENTAREAANIMATION 0x1042 |
135 #define TDLG_PRIMARYPANEL 1 |
135 #define TDLG_PRIMARYPANEL 1 |
136 #define TDLG_SECONDARYPANEL 8 |
136 #define TDLG_SECONDARYPANEL 8 |
137 #endif |
137 #endif |
138 |
138 |
139 class Animation |
139 class QWindowsVistaAnimation |
140 { |
140 { |
141 public : |
141 public : |
142 Animation() : _running(true) { } |
142 QWindowsVistaAnimation() : _running(true) { } |
143 virtual ~Animation() { } |
143 virtual ~QWindowsVistaAnimation() { } |
144 QWidget * widget() const { return _widget; } |
144 QWidget * widget() const { return _widget; } |
145 bool running() const { return _running; } |
145 bool running() const { return _running; } |
146 const QTime &startTime() const { return _startTime; } |
146 const QTime &startTime() const { return _startTime; } |
147 void setRunning(bool val) { _running = val; } |
147 void setRunning(bool val) { _running = val; } |
148 void setWidget(QWidget *widget) { _widget = widget; } |
148 void setWidget(QWidget *widget) { _widget = widget; } |
159 bool _running; |
159 bool _running; |
160 }; |
160 }; |
161 |
161 |
162 |
162 |
163 // Handles state transition animations |
163 // Handles state transition animations |
164 class Transition : public Animation |
164 class QWindowsVistaTransition : public QWindowsVistaAnimation |
165 { |
165 { |
166 public : |
166 public : |
167 Transition() : Animation() {} |
167 QWindowsVistaTransition() : QWindowsVistaAnimation() {} |
168 virtual ~Transition() { } |
168 virtual ~QWindowsVistaTransition() { } |
169 void setDuration(int duration) { _duration = duration; } |
169 void setDuration(int duration) { _duration = duration; } |
170 void setStartImage(const QImage &image) { _primaryImage = image; } |
170 void setStartImage(const QImage &image) { _primaryImage = image; } |
171 void setEndImage(const QImage &image) { _secondaryImage = image; } |
171 void setEndImage(const QImage &image) { _secondaryImage = image; } |
172 virtual void paint(QPainter *painter, const QStyleOption *option); |
172 virtual void paint(QPainter *painter, const QStyleOption *option); |
173 int duration() const { return _duration; } |
173 int duration() const { return _duration; } |
174 int _duration; //set time in ms to complete a state transition |
174 int _duration; //set time in ms to complete a state transition |
175 }; |
175 }; |
176 |
176 |
177 |
177 |
178 // Handles pulse animations (default buttons) |
178 // Handles pulse animations (default buttons) |
179 class Pulse: public Animation |
179 class QWindowsVistaPulse: public QWindowsVistaAnimation |
180 { |
180 { |
181 public : |
181 public : |
182 Pulse() : Animation() {} |
182 QWindowsVistaPulse() : QWindowsVistaAnimation() {} |
183 virtual ~Pulse() { } |
183 virtual ~QWindowsVistaPulse() { } |
184 void setDuration(int duration) { _duration = duration; } |
184 void setDuration(int duration) { _duration = duration; } |
185 void setPrimaryImage(const QImage &image) { _primaryImage = image; } |
185 void setPrimaryImage(const QImage &image) { _primaryImage = image; } |
186 void setAlternateImage(const QImage &image) { _secondaryImage = image; } |
186 void setAlternateImage(const QImage &image) { _secondaryImage = image; } |
187 virtual void paint(QPainter *painter, const QStyleOption *option); |
187 virtual void paint(QPainter *painter, const QStyleOption *option); |
188 int duration() const { return _duration; } |
188 int duration() const { return _duration; } |
197 public: |
197 public: |
198 QWindowsVistaStylePrivate(); |
198 QWindowsVistaStylePrivate(); |
199 ~QWindowsVistaStylePrivate(); |
199 ~QWindowsVistaStylePrivate(); |
200 static bool resolveSymbols(); |
200 static bool resolveSymbols(); |
201 static inline bool useVista(); |
201 static inline bool useVista(); |
202 void startAnimation(Animation *); |
202 void startAnimation(QWindowsVistaAnimation *); |
203 void stopAnimation(const QWidget *); |
203 void stopAnimation(const QWidget *); |
204 Animation* widgetAnimation(const QWidget *) const; |
204 QWindowsVistaAnimation* widgetAnimation(const QWidget *) const; |
205 void timerEvent(); |
205 void timerEvent(); |
206 bool transitionsEnabled() const; |
206 bool transitionsEnabled() const; |
207 QWidget *treeViewHelper(); |
207 QWidget *treeViewHelper(); |
208 |
208 |
209 private: |
209 private: |
210 QList <Animation*> animations; |
210 QList <QWindowsVistaAnimation*> animations; |
211 QBasicTimer animationTimer; |
211 QBasicTimer animationTimer; |
212 QWidget *m_treeViewHelper; |
212 QWidget *m_treeViewHelper; |
213 }; |
213 }; |
214 |
214 |
215 QT_END_NAMESPACE |
215 QT_END_NAMESPACE |