libplasma
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 ANIMATOR_H
00022 #define 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
00040 class PLASMA_EXPORT Animator : public QObject
00041 {
00042 Q_OBJECT
00043 Q_ENUMS( Animation )
00044 Q_ENUMS( CurveShape )
00045 Q_ENUMS( Movement )
00046
00047 public:
00048
00049 enum Animation
00050 {
00051 AppearAnimation = 0 ,
00052 DisappearAnimation ,
00053 ActivateAnimation
00054 };
00055
00056 enum CurveShape
00057 {
00058 EaseInCurve = 0,
00059 EaseOutCurve,
00060 EaseInOutCurve,
00061 LinearCurve
00062 };
00063
00064 enum Movement
00065 {
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