| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the QtCore module of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifndef QABSTRACTANIMATION_H
|
|---|
| 43 | #define QABSTRACTANIMATION_H
|
|---|
| 44 |
|
|---|
| 45 | #include <QtCore/qobject.h>
|
|---|
| 46 |
|
|---|
| 47 | QT_BEGIN_HEADER
|
|---|
| 48 |
|
|---|
| 49 | QT_BEGIN_NAMESPACE
|
|---|
| 50 |
|
|---|
| 51 | QT_MODULE(Core)
|
|---|
| 52 |
|
|---|
| 53 | #ifndef QT_NO_ANIMATION
|
|---|
| 54 |
|
|---|
| 55 | class QAnimationGroup;
|
|---|
| 56 | class QSequentialAnimationGroup;
|
|---|
| 57 |
|
|---|
| 58 | class QAbstractAnimationPrivate;
|
|---|
| 59 | class Q_CORE_EXPORT QAbstractAnimation : public QObject
|
|---|
| 60 | {
|
|---|
| 61 | Q_OBJECT
|
|---|
| 62 | Q_ENUMS(State)
|
|---|
| 63 | Q_ENUMS(Direction)
|
|---|
| 64 | Q_PROPERTY(State state READ state NOTIFY stateChanged)
|
|---|
| 65 | Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount)
|
|---|
| 66 | Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime)
|
|---|
| 67 | Q_PROPERTY(int currentLoop READ currentLoop NOTIFY currentLoopChanged)
|
|---|
| 68 | Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged)
|
|---|
| 69 | Q_PROPERTY(int duration READ duration)
|
|---|
| 70 |
|
|---|
| 71 | public:
|
|---|
| 72 | enum Direction {
|
|---|
| 73 | Forward,
|
|---|
| 74 | Backward
|
|---|
| 75 | };
|
|---|
| 76 |
|
|---|
| 77 | enum State {
|
|---|
| 78 | Stopped,
|
|---|
| 79 | Paused,
|
|---|
| 80 | Running
|
|---|
| 81 | };
|
|---|
| 82 |
|
|---|
| 83 | enum DeletionPolicy {
|
|---|
| 84 | KeepWhenStopped = 0,
|
|---|
| 85 | DeleteWhenStopped
|
|---|
| 86 | };
|
|---|
| 87 |
|
|---|
| 88 | QAbstractAnimation(QObject *parent = 0);
|
|---|
| 89 | virtual ~QAbstractAnimation();
|
|---|
| 90 |
|
|---|
| 91 | State state() const;
|
|---|
| 92 |
|
|---|
| 93 | QAnimationGroup *group() const;
|
|---|
| 94 |
|
|---|
| 95 | Direction direction() const;
|
|---|
| 96 | void setDirection(Direction direction);
|
|---|
| 97 |
|
|---|
| 98 | int currentTime() const;
|
|---|
| 99 | int currentLoopTime() const;
|
|---|
| 100 |
|
|---|
| 101 | int loopCount() const;
|
|---|
| 102 | void setLoopCount(int loopCount);
|
|---|
| 103 | int currentLoop() const;
|
|---|
| 104 |
|
|---|
| 105 | virtual int duration() const = 0;
|
|---|
| 106 | int totalDuration() const;
|
|---|
| 107 |
|
|---|
| 108 | Q_SIGNALS:
|
|---|
| 109 | void finished();
|
|---|
| 110 | void stateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
|
|---|
| 111 | void currentLoopChanged(int currentLoop);
|
|---|
| 112 | void directionChanged(QAbstractAnimation::Direction);
|
|---|
| 113 |
|
|---|
| 114 | public Q_SLOTS:
|
|---|
| 115 | void start(QAbstractAnimation::DeletionPolicy policy = KeepWhenStopped);
|
|---|
| 116 | void pause();
|
|---|
| 117 | void resume();
|
|---|
| 118 | void setPaused(bool);
|
|---|
| 119 | void stop();
|
|---|
| 120 | void setCurrentTime(int msecs);
|
|---|
| 121 |
|
|---|
| 122 | protected:
|
|---|
| 123 | QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = 0);
|
|---|
| 124 | bool event(QEvent *event);
|
|---|
| 125 |
|
|---|
| 126 | virtual void updateCurrentTime(int currentTime) = 0;
|
|---|
| 127 | virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
|
|---|
| 128 | virtual void updateDirection(QAbstractAnimation::Direction direction);
|
|---|
| 129 |
|
|---|
| 130 | private:
|
|---|
| 131 | Q_DISABLE_COPY(QAbstractAnimation)
|
|---|
| 132 | Q_DECLARE_PRIVATE(QAbstractAnimation)
|
|---|
| 133 | };
|
|---|
| 134 |
|
|---|
| 135 | #endif //QT_NO_ANIMATION
|
|---|
| 136 |
|
|---|
| 137 | QT_END_NAMESPACE
|
|---|
| 138 |
|
|---|
| 139 | QT_END_HEADER
|
|---|
| 140 |
|
|---|
| 141 | #endif // QABSTRACTANIMATION_H
|
|---|