Initial import from qtquick2.
[profile/ivi/qtdeclarative.git] / src / declarative / items / qsganimation_p.h
1 // Commit: e39a2e39451bf106a9845f8a60fc571faaa4dde5
2 /****************************************************************************
3 **
4 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 **
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 **
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** No Commercial Usage
12 ** This file contains pre-release code and may not be distributed.
13 ** You may use this file in accordance with the terms and conditions
14 ** contained in the Technology Preview License Agreement accompanying
15 ** this package.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **
33 **
34 **
35 **
36 **
37 **
38 **
39 ** $QT_END_LICENSE$
40 **
41 ****************************************************************************/
42
43 #ifndef QSGANIMATION_H
44 #define QSGANIMATION_H
45
46 #include "qsgitem.h"
47
48 #include <private/qdeclarativeanimation_p.h>
49
50 #include <QtCore/qabstractanimation.h>
51
52 QT_BEGIN_HEADER
53
54 QT_BEGIN_NAMESPACE
55
56 QT_MODULE(Declarative)
57
58 class QSGParentAnimationPrivate;
59 class QSGParentAnimation : public QDeclarativeAnimationGroup
60 {
61     Q_OBJECT
62     Q_DECLARE_PRIVATE(QSGParentAnimation)
63
64     Q_PROPERTY(QSGItem *target READ target WRITE setTarget NOTIFY targetChanged)
65     Q_PROPERTY(QSGItem *newParent READ newParent WRITE setNewParent NOTIFY newParentChanged)
66     Q_PROPERTY(QSGItem *via READ via WRITE setVia NOTIFY viaChanged)
67
68 public:
69     QSGParentAnimation(QObject *parent=0);
70     virtual ~QSGParentAnimation();
71
72     QSGItem *target() const;
73     void setTarget(QSGItem *);
74
75     QSGItem *newParent() const;
76     void setNewParent(QSGItem *);
77
78     QSGItem *via() const;
79     void setVia(QSGItem *);
80
81 Q_SIGNALS:
82     void targetChanged();
83     void newParentChanged();
84     void viaChanged();
85
86 protected:
87     virtual void transition(QDeclarativeStateActions &actions,
88                             QDeclarativeProperties &modified,
89                             TransitionDirection direction);
90     virtual QAbstractAnimation *qtAnimation();
91 };
92
93 class QSGAnchorAnimationPrivate;
94 class QSGAnchorAnimation : public QDeclarativeAbstractAnimation
95 {
96     Q_OBJECT
97     Q_DECLARE_PRIVATE(QSGAnchorAnimation)
98     Q_PROPERTY(QDeclarativeListProperty<QSGItem> targets READ targets)
99     Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
100     Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged)
101
102 public:
103     QSGAnchorAnimation(QObject *parent=0);
104     virtual ~QSGAnchorAnimation();
105
106     QDeclarativeListProperty<QSGItem> targets();
107
108     int duration() const;
109     void setDuration(int);
110
111     QEasingCurve easing() const;
112     void setEasing(const QEasingCurve &);
113
114 Q_SIGNALS:
115     void durationChanged(int);
116     void easingChanged(const QEasingCurve&);
117
118 protected:
119     virtual void transition(QDeclarativeStateActions &actions,
120                             QDeclarativeProperties &modified,
121                             TransitionDirection direction);
122     virtual QAbstractAnimation *qtAnimation();
123 };
124
125 QT_END_NAMESPACE
126
127 QML_DECLARE_TYPE(QSGParentAnimation)
128 QML_DECLARE_TYPE(QSGAnchorAnimation)
129
130 QT_END_HEADER
131
132 #endif // QSGANIMATION_H