OSDN Git Service

import 0.9.3
[handbrake-jp/handbrake-jp.git] / qt4 / faderwidget.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2006 Trolltech AS. All rights reserved.
4 **
5 ** This file is part of the documentation of Qt. It was originally
6 ** published as part of Qt Quarterly.
7 **
8 ** This file may be used under the terms of the GNU General Public License
9 ** version 2.0 as published by the Free Software Foundation or under the
10 ** terms of the Qt Commercial License Agreement. The respective license
11 ** texts for these are provided with the open source and commercial
12 ** editions of Qt.
13 **
14 ** If you are unsure which license is appropriate for your use, please
15 ** review the following information:
16 ** http://www.trolltech.com/products/qt/licensing.html or contact the
17 ** sales department at sales@trolltech.com.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ****************************************************************************/
23
24 #ifndef FADERWIDGET_H
25 #define FADERWIDGET_H
26
27 #include <QWidget>
28
29 class QTimer;
30
31 class FaderWidget : public QWidget
32 {
33     Q_OBJECT
34     Q_PROPERTY(QColor fadeColor READ fadeColor WRITE setFadeColor)
35     Q_PROPERTY(int fadeDuration READ fadeDuration WRITE setFadeDuration)
36
37 public:
38     FaderWidget(QWidget *parent);
39
40     QColor fadeColor() const { return startColor; }
41     void setFadeColor(const QColor &newColor) { startColor = newColor; }
42
43     int fadeDuration() const { return duration; }
44     void setFadeDuration(int milliseconds) { duration = milliseconds; }
45
46     void start();
47     void startFadeOut();
48
49 signals:
50     void done(QWidget *w);
51
52 protected:
53     void paintEvent(QPaintEvent *event);
54
55 private:
56     QTimer *timer;
57     QColor startColor, endColor;
58     bool fadeOut;
59     int currentAlpha;
60     int duration;
61 };
62
63 #endif