b293b88cb2bf21c0053fc8e96d02001a3a55ca84
[profile/ivi/qtdeclarative.git] / src / quick / items / qquickanimation_p.h
1 // Commit: e39a2e39451bf106a9845f8a60fc571faaa4dde5
2 /****************************************************************************
3 **
4 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: http://www.qt-project.org/
7 **
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 **
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** GNU Lesser General Public License Usage
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
15 ** file. Please review the following information to ensure the GNU Lesser
16 ** General 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 ** GNU General Public License Usage
24 ** Alternatively, this file may be used under the terms of the GNU General
25 ** Public License version 3.0 as published by the Free Software Foundation
26 ** and appearing in the file LICENSE.GPL included in the packaging of this
27 ** file. Please review the following information to ensure the GNU General
28 ** Public License version 3.0 requirements will be met:
29 ** http://www.gnu.org/copyleft/gpl.html.
30 **
31 ** Other Usage
32 ** Alternatively, this file may be used in accordance with the terms and
33 ** conditions contained in a signed written agreement between you and Nokia.
34 **
35 **
36 **
37 **
38 **
39 ** $QT_END_LICENSE$
40 **
41 ****************************************************************************/
42
43 #ifndef QQUICKANIMATION_H
44 #define QQUICKANIMATION_H
45
46 #include "qquickitem.h"
47
48 #include <QtQuick/private/qdeclarativeanimation_p.h>
49
50 #include <QtCore/qabstractanimation.h>
51
52 QT_BEGIN_HEADER
53
54 QT_BEGIN_NAMESPACE
55
56 class QQuickParentAnimationPrivate;
57 class QQuickParentAnimation : public QDeclarativeAnimationGroup
58 {
59     Q_OBJECT
60     Q_DECLARE_PRIVATE(QQuickParentAnimation)
61
62     Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
63     Q_PROPERTY(QQuickItem *newParent READ newParent WRITE setNewParent NOTIFY newParentChanged)
64     Q_PROPERTY(QQuickItem *via READ via WRITE setVia NOTIFY viaChanged)
65
66 public:
67     QQuickParentAnimation(QObject *parent=0);
68     virtual ~QQuickParentAnimation();
69
70     QQuickItem *target() const;
71     void setTarget(QQuickItem *);
72
73     QQuickItem *newParent() const;
74     void setNewParent(QQuickItem *);
75
76     QQuickItem *via() const;
77     void setVia(QQuickItem *);
78
79 Q_SIGNALS:
80     void targetChanged();
81     void newParentChanged();
82     void viaChanged();
83
84 protected:
85     virtual void transition(QDeclarativeStateActions &actions,
86                             QDeclarativeProperties &modified,
87                             TransitionDirection direction);
88     virtual QAbstractAnimation *qtAnimation();
89 };
90
91 class QQuickAnchorAnimationPrivate;
92 class QQuickAnchorAnimation : public QDeclarativeAbstractAnimation
93 {
94     Q_OBJECT
95     Q_DECLARE_PRIVATE(QQuickAnchorAnimation)
96     Q_PROPERTY(QDeclarativeListProperty<QQuickItem> targets READ targets)
97     Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
98     Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged)
99
100 public:
101     QQuickAnchorAnimation(QObject *parent=0);
102     virtual ~QQuickAnchorAnimation();
103
104     QDeclarativeListProperty<QQuickItem> targets();
105
106     int duration() const;
107     void setDuration(int);
108
109     QEasingCurve easing() const;
110     void setEasing(const QEasingCurve &);
111
112 Q_SIGNALS:
113     void durationChanged(int);
114     void easingChanged(const QEasingCurve&);
115
116 protected:
117     virtual void transition(QDeclarativeStateActions &actions,
118                             QDeclarativeProperties &modified,
119                             TransitionDirection direction);
120     virtual QAbstractAnimation *qtAnimation();
121 };
122
123 class QQuickItem;
124 class QDeclarativePath;
125 class QQuickPathAnimationPrivate;
126 class Q_AUTOTEST_EXPORT QQuickPathAnimation : public QDeclarativeAbstractAnimation
127 {
128     Q_OBJECT
129     Q_DECLARE_PRIVATE(QQuickPathAnimation)
130
131     Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
132     Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged)
133     Q_PROPERTY(QDeclarativePath *path READ path WRITE setPath NOTIFY pathChanged)
134     Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
135     Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
136     Q_PROPERTY(QPointF anchorPoint READ anchorPoint WRITE setAnchorPoint NOTIFY anchorPointChanged)
137     Q_PROPERTY(int orientationEntryDuration READ orientationEntryDuration WRITE setOrientationEntryDuration NOTIFY orientationEntryDurationChanged)
138     Q_PROPERTY(int orientationExitDuration READ orientationExitDuration WRITE setOrientationExitDuration NOTIFY orientationExitDurationChanged)
139     Q_PROPERTY(qreal endRotation READ endRotation WRITE setEndRotation NOTIFY endRotationChanged)
140
141 public:
142     QQuickPathAnimation(QObject *parent=0);
143     virtual ~QQuickPathAnimation();
144
145     enum Orientation {
146         Fixed,
147         RightFirst,
148         LeftFirst,
149         BottomFirst,
150         TopFirst
151     };
152     Q_ENUMS(Orientation)
153
154     int duration() const;
155     void setDuration(int);
156
157     QEasingCurve easing() const;
158     void setEasing(const QEasingCurve &);
159
160     QDeclarativePath *path() const;
161     void setPath(QDeclarativePath *);
162
163     QQuickItem *target() const;
164     void setTarget(QQuickItem *);
165
166     Orientation orientation() const;
167     void setOrientation(Orientation orientation);
168
169     QPointF anchorPoint() const;
170     void setAnchorPoint(const QPointF &point);
171
172     int orientationEntryDuration() const;
173     void setOrientationEntryDuration(int);
174
175     int orientationExitDuration() const;
176     void setOrientationExitDuration(int);
177
178     qreal endRotation() const;
179     void setEndRotation(qreal);
180
181 protected:
182     virtual void transition(QDeclarativeStateActions &actions,
183                             QDeclarativeProperties &modified,
184                             TransitionDirection direction);
185     virtual QAbstractAnimation *qtAnimation();
186
187 Q_SIGNALS:
188     void durationChanged(int);
189     void easingChanged(const QEasingCurve &);
190     void pathChanged();
191     void targetChanged();
192     void orientationChanged(Orientation);
193     void anchorPointChanged(const QPointF &);
194     void orientationEntryDurationChanged(qreal);
195     void orientationExitDurationChanged(qreal);
196     void endRotationChanged(qreal);
197 };
198
199 QT_END_NAMESPACE
200
201 QML_DECLARE_TYPE(QQuickParentAnimation)
202 QML_DECLARE_TYPE(QQuickAnchorAnimation)
203 QML_DECLARE_TYPE(QQuickPathAnimation)
204
205 QT_END_HEADER
206
207 #endif // QQUICKANIMATION_H