libplasma
phase.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 PHASE_H
00022 #define PHASE_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
00038 class PLASMA_EXPORT Phase : public QObject
00039 {
00040 Q_OBJECT
00041 Q_ENUMS( Animation )
00042 Q_ENUMS( CurveShape )
00043 Q_ENUMS( Movement )
00044
00045 public:
00046 enum Animation
00047 {
00048 Appear = 0 ,
00049 Disappear ,
00050 Activate ,
00051 FrameAppear
00052 };
00053
00054 enum ElementAnimation
00055 {
00056 ElementAppear = 0 ,
00057 ElementDisappear
00058 };
00059
00060 enum CurveShape
00061 {
00062 EaseInCurve = 0,
00063 EaseOutCurve,
00064 EaseInOutCurve,
00065 LinearCurve
00066 };
00067
00068 enum Movement
00069 {
00070 SlideIn = 0,
00071 SlideOut
00072 };
00073
00074 typedef int AnimId;
00075
00079 static Phase* self();
00080
00081 explicit Phase(QObject * parent = 0);
00082 ~Phase();
00083
00084 Q_INVOKABLE void animateItem(QGraphicsItem* item, Animation anim);
00085 Q_INVOKABLE void moveItem(QGraphicsItem* item, Movement movement, const QPoint &destination);
00086
00101 Q_INVOKABLE AnimId customAnimation(int frames, int duration, Phase::CurveShape curve,
00102 QObject* receiver, const char* method);
00103
00111 Q_INVOKABLE void stopCustomAnimation(AnimId id);
00112
00113 Q_INVOKABLE AnimId animateElement(QGraphicsItem *obj, ElementAnimation);
00114 Q_INVOKABLE void stopElementAnimation(AnimId id);
00115 Q_INVOKABLE void setAnimationPixmap(AnimId id, const QPixmap &pixmap);
00116 Q_INVOKABLE QPixmap animationResult(AnimId id);
00117
00118 Q_SIGNALS:
00119 void animationComplete(QGraphicsItem *item, Plasma::Phase::Animation anim);
00120 void movementComplete(QGraphicsItem *item);
00121 void elementAnimationComplete(AnimId id);
00122 void customAnimationComplete(AnimId id);
00123
00124 protected:
00125 void timerEvent(QTimerEvent *event);
00126
00127 protected Q_SLOTS:
00128 void animatedItemDestroyed(QObject*);
00129 void movingItemDestroyed(QObject*);
00130 void animatedElementDestroyed(QObject*);
00131 void customAnimReceiverDestroyed(QObject*);
00132
00133 private:
00134 void init();
00135
00136 class Private;
00137 Private * const d;
00138 };
00139
00140 }
00141
00142 #endif
00143