Plasma
animator.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PLASMA_ANIMATOR_H
00022 #define PLASMA_ANIMATOR_H
00023
00024 #include <QtGui/QImage>
00025 #include <QtCore/QObject>
00026
00027 #include <plasma/plasma_export.h>
00028
00029 class QGraphicsItem;
00030 class QTimeLine;
00031
00032 namespace Plasma
00033 {
00034
00035 class AnimatorPrivate;
00036
00042 class PLASMA_EXPORT Animator : public QObject
00043 {
00044 Q_OBJECT
00045 Q_ENUMS(Animation)
00046 Q_ENUMS(CurveShape)
00047 Q_ENUMS(Movement)
00048
00049 public:
00050
00051 enum Animation {
00052 AppearAnimation = 0,
00053 DisappearAnimation,
00054 ActivateAnimation
00055
00056 };
00057
00058 enum CurveShape {
00059 EaseInCurve = 0,
00060 EaseOutCurve,
00061 EaseInOutCurve,
00062 LinearCurve
00063 };
00064
00065 enum Movement {
00066 SlideInMovement = 0,
00067 SlideOutMovement,
00068 FastSlideInMovement,
00069 FastSlideOutMovement
00070 };
00071
00075 static Animator *self();
00076
00084 Q_INVOKABLE int animateItem(QGraphicsItem *item, Animation anim);
00085
00093 Q_INVOKABLE void stopItemAnimation(int id);
00094
00102 Q_INVOKABLE int moveItem(QGraphicsItem *item, Movement movement, const QPoint &destination);
00103
00111 Q_INVOKABLE void stopItemMovement(int id);
00112
00130 Q_INVOKABLE int customAnimation(int frames, int duration, Animator::CurveShape curve,
00131 QObject *receiver, const char *method);
00132
00140 Q_INVOKABLE void stopCustomAnimation(int id);
00141
00142 Q_INVOKABLE int animateElement(QGraphicsItem *obj, Animation);
00143 Q_INVOKABLE void stopElementAnimation(int id);
00144 Q_INVOKABLE void setInitialPixmap(int id, const QPixmap &pixmap);
00145 Q_INVOKABLE QPixmap currentPixmap(int id);
00146
00153 Q_INVOKABLE bool isAnimating() const;
00154
00155 Q_SIGNALS:
00156 void animationFinished(QGraphicsItem *item, Plasma::Animator::Animation anim);
00157 void movementFinished(QGraphicsItem *item);
00158 void elementAnimationFinished(int id);
00159 void customAnimationFinished(int id);
00160
00161 protected:
00162 void timerEvent(QTimerEvent *event);
00163
00164 private:
00165 friend class AnimatorSingleton;
00166 explicit Animator(QObject * parent = 0);
00167 ~Animator();
00168
00169 Q_PRIVATE_SLOT(d, void animatedItemDestroyed(QObject*))
00170 Q_PRIVATE_SLOT(d, void movingItemDestroyed(QObject*))
00171 Q_PRIVATE_SLOT(d, void animatedElementDestroyed(QObject*))
00172 Q_PRIVATE_SLOT(d, void customAnimReceiverDestroyed(QObject*))
00173
00174 AnimatorPrivate * const d;
00175 };
00176
00177 }
00178
00179 #endif
00180