2007-06-08 07:24:19 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Aaron Seigo <aseigo@kde.org>
|
2007-07-06 18:26:48 +02:00
|
|
|
* 2007 Alexis Ménard <darktears31@gmail.com>
|
2007-06-08 07:24:19 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PHASE_H
|
|
|
|
#define PHASE_H
|
|
|
|
|
2007-07-15 00:40:00 +02:00
|
|
|
#include <QtGui/QImage>
|
|
|
|
#include <QtCore/QObject>
|
2007-06-08 07:24:19 +02:00
|
|
|
|
2007-06-10 08:02:38 +02:00
|
|
|
#include <plasma/plasma_export.h>
|
2007-06-08 07:24:19 +02:00
|
|
|
|
|
|
|
class QGraphicsItem;
|
2007-06-10 09:09:07 +02:00
|
|
|
class QTimeLine;
|
2007-06-08 07:24:19 +02:00
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @short A system for applying effects to Plasma elements
|
|
|
|
*/
|
|
|
|
class PLASMA_EXPORT Phase : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Animation
|
|
|
|
{
|
|
|
|
Appear = 0 /*<< When some appears in the Corona */,
|
|
|
|
Disappear /*<< When something is about to disappear */,
|
|
|
|
Activate /*<< When something is activated or launched, such as an app icon being clicked */,
|
|
|
|
FrameAppear /*<< Make a frame appear around an object */
|
|
|
|
};
|
|
|
|
|
2007-06-19 23:56:03 +02:00
|
|
|
enum ElementAnimation
|
|
|
|
{
|
2007-06-25 08:01:34 +02:00
|
|
|
ElementAppear = 0 /*<< Animate the appearance of an element */,
|
|
|
|
ElementDisappear /*<< Animate the disappearance of an element */
|
2007-06-19 23:56:03 +02:00
|
|
|
};
|
|
|
|
|
2007-06-08 07:24:19 +02:00
|
|
|
enum RenderOp
|
|
|
|
{
|
|
|
|
RenderBackground = 0 /*<< Render the background of an item */
|
|
|
|
};
|
|
|
|
|
2007-06-25 08:01:34 +02:00
|
|
|
enum CurveShape
|
|
|
|
{
|
|
|
|
EaseInCurve = 0,
|
|
|
|
EaseOutCurve,
|
|
|
|
EaseInOutCurve,
|
|
|
|
LinearCurve
|
|
|
|
};
|
|
|
|
|
2007-07-04 11:36:50 +02:00
|
|
|
enum Movement
|
|
|
|
{
|
|
|
|
SlideIn = 0,
|
|
|
|
SlideOut
|
|
|
|
};
|
|
|
|
|
2007-06-19 23:56:03 +02:00
|
|
|
typedef int AnimId;
|
|
|
|
|
2007-06-17 22:05:43 +02:00
|
|
|
/**
|
|
|
|
* Singleton accessor
|
|
|
|
**/
|
|
|
|
static Phase* self();
|
|
|
|
|
2007-06-08 07:24:19 +02:00
|
|
|
explicit Phase(QObject * parent = 0);
|
|
|
|
~Phase();
|
|
|
|
|
2007-06-25 08:01:34 +02:00
|
|
|
void animateItem(QGraphicsItem* item, Animation anim);
|
2007-07-04 11:36:50 +02:00
|
|
|
void moveItem(QGraphicsItem* item, Movement movement, QPoint destination);
|
2007-06-25 08:01:34 +02:00
|
|
|
void render(QGraphicsItem* item, QImage& image, RenderOp op);
|
|
|
|
|
|
|
|
AnimId animateElement(QGraphicsItem *obj, ElementAnimation);
|
2007-06-19 23:56:03 +02:00
|
|
|
void stopElementAnimation(AnimId id);
|
|
|
|
void setAnimationPixmap(AnimId id, const QPixmap &pixmap);
|
|
|
|
QPixmap animationResult(AnimId id);
|
|
|
|
|
2007-06-08 07:24:19 +02:00
|
|
|
Q_SIGNALS:
|
2007-06-19 23:56:03 +02:00
|
|
|
void animationComplete(QGraphicsItem *item, Animation anim);
|
2007-07-17 21:23:33 +02:00
|
|
|
void movementComplete(QGraphicsItem *item);
|
2007-06-08 07:24:19 +02:00
|
|
|
|
2007-06-25 08:01:34 +02:00
|
|
|
protected:
|
|
|
|
void timerEvent(QTimerEvent *event);
|
2007-06-08 07:24:19 +02:00
|
|
|
|
|
|
|
protected Q_SLOTS:
|
|
|
|
void appletDestroyed(QObject*);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void init();
|
|
|
|
|
|
|
|
class Private;
|
|
|
|
Private * const d;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Plasma
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|