OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / libs / qmleditorwidgets / easingpane / easinggraph.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef EASINGGRAPH_H
34 #define EASINGGRAPH_H
35
36 #include <QtGui/QWidget>
37 #include <QtCore/QEasingCurve>
38 #include <QtCore/QHash>
39
40 QT_BEGIN_HEADER
41
42 QT_BEGIN_NAMESPACE
43
44 QT_MODULE(Declarative)
45
46
47 class EasingGraph: public QWidget
48 {
49     Q_OBJECT
50
51     Q_PROPERTY (QString easingShape READ easingShape WRITE setEasingShape NOTIFY easingShapeChanged)
52     Q_PROPERTY (QString easingExtremes READ easingExtremes WRITE setEasingExtremes NOTIFY easingExtremesChanged)
53     Q_PROPERTY (QString easingName READ easingName WRITE setEasingName NOTIFY easingNameChanged)
54     Q_PROPERTY (qreal overshoot READ overshoot WRITE setOvershoot NOTIFY overshootChanged)
55     Q_PROPERTY (qreal amplitude READ amplitude WRITE setAmplitude NOTIFY amplitudeChanged)
56     Q_PROPERTY (qreal period READ period WRITE setPeriod NOTIFY periodChanged)
57     Q_PROPERTY (qreal duration READ duration WRITE setDuration NOTIFY durationChanged)
58     Q_PROPERTY (QColor color READ color WRITE setColor NOTIFY colorChanged)
59     Q_PROPERTY (QColor zeroColor READ zeroColor WRITE setZeroColor NOTIFY zeroColorChanged)
60
61 public:
62     EasingGraph(QWidget *parent=0);
63     ~EasingGraph();
64
65     QEasingCurve::Type easingType() const;
66     QEasingCurve easingCurve() const;
67
68     QString easingShape() const;
69     void setEasingShape(const QString &newShape);
70     QString easingExtremes() const;
71     void setEasingExtremes(const QString &newExtremes);
72     QString easingName() const;
73     void setEasingName(const QString &newName);
74     qreal overshoot() const;
75     void setOvershoot(qreal newOvershoot);
76     qreal amplitude() const;
77     void setAmplitude(qreal newAmplitude);
78     qreal period() const;
79     void setPeriod(qreal newPeriod);
80     qreal duration() const;
81     void setDuration(qreal newDuration);
82
83     QColor color() const;
84     void setColor(const QColor &newColor);
85     QColor zeroColor() const;
86     void setZeroColor(const QColor &newColor);
87
88     QRectF boundingRect() const;
89     //void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
90     void paintEvent(QPaintEvent *);
91
92 signals:
93     void easingShapeChanged();
94     void easingExtremesChanged();
95     void easingNameChanged();
96     void overshootChanged();
97     void amplitudeChanged();
98     void durationChanged();
99     void periodChanged();
100     void colorChanged();
101     void zeroColorChanged();
102
103 private:
104     Q_DISABLE_COPY(EasingGraph)
105
106     QColor m_color;
107     QColor m_zeroColor; // the color for the "zero" and "one" lines
108     qreal m_duration;
109
110     QString m_easingExtremes;
111
112     QEasingCurve m_curveFunction;
113     QHash <QString,QEasingCurve::Type> m_availableNames;
114 };
115
116 QT_END_NAMESPACE
117
118 //QML_DECLARE_TYPE(EasingGraph)
119
120 QT_END_HEADER
121
122 #endif // EASINGGRAPH_H