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 ANIMATOR_H
|
|
|
|
#define ANIMATOR_H
|
|
|
|
|
2007-06-17 11:28:55 +02:00
|
|
|
#include <QtCore/QObject>
|
|
|
|
#include <QtGui/QRegion>
|
2007-06-19 23:53:19 +02:00
|
|
|
#include <QtGui/QPixmap>
|
2007-06-08 07:24:19 +02:00
|
|
|
|
2007-06-17 11:28:55 +02:00
|
|
|
#include <kgenericfactory.h>
|
2007-06-10 08:02:38 +02:00
|
|
|
|
|
|
|
#include <plasma/plasma_export.h>
|
2007-06-19 23:53:19 +02:00
|
|
|
#include <plasma/phase.h>
|
2007-06-08 07:24:19 +02:00
|
|
|
|
|
|
|
class QGraphicsItem;
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class PLASMA_EXPORT Animator : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit Animator(QObject *parent = 0, const QStringList& list = QStringList());
|
|
|
|
~Animator();
|
|
|
|
|
2007-07-20 10:06:27 +02:00
|
|
|
// Parameter definitions
|
2007-06-24 23:36:00 +02:00
|
|
|
virtual int framesPerSecond(Plasma::Phase::Animation);
|
2007-07-04 11:36:50 +02:00
|
|
|
virtual int framesPerSecond(Plasma::Phase::Movement);
|
2007-06-24 23:36:00 +02:00
|
|
|
virtual int framesPerSecond(Plasma::Phase::ElementAnimation);
|
2007-06-25 07:57:47 +02:00
|
|
|
virtual Phase::CurveShape curve(Plasma::Phase::Animation);
|
2007-07-04 11:36:50 +02:00
|
|
|
virtual Phase::CurveShape curve(Plasma::Phase::Movement);
|
2007-06-25 07:57:47 +02:00
|
|
|
virtual Phase::CurveShape curve(Plasma::Phase::ElementAnimation);
|
2007-06-19 23:53:19 +02:00
|
|
|
|
2007-07-04 11:36:50 +02:00
|
|
|
// Element animations
|
2007-06-19 23:53:19 +02:00
|
|
|
virtual QPixmap elementAppear(qreal frame, const QPixmap& pixmap);
|
|
|
|
virtual QPixmap elementDisappear(qreal frame, const QPixmap& pixmap);
|
|
|
|
|
2007-07-04 11:36:50 +02:00
|
|
|
// Item animations
|
|
|
|
virtual void appear(qreal progress, QGraphicsItem* item);
|
|
|
|
virtual void disappear(qreal progress, QGraphicsItem* item);
|
|
|
|
virtual void frameAppear(qreal progress, QGraphicsItem* item, const QRegion& drawable);
|
|
|
|
virtual void activate(qreal progress, QGraphicsItem* item);
|
2007-06-08 07:24:19 +02:00
|
|
|
|
2007-07-04 11:36:50 +02:00
|
|
|
// Item movements
|
2007-07-20 10:06:27 +02:00
|
|
|
virtual void slideIn(qreal progress, QGraphicsItem* item, const QPoint &destination);
|
|
|
|
virtual void slideOut(qreal progress, QGraphicsItem* item, const QPoint &destination);
|
2007-07-04 11:36:50 +02:00
|
|
|
|
|
|
|
// Rendering
|
2007-06-08 07:24:19 +02:00
|
|
|
virtual void renderBackground(QImage& background);
|
2007-07-06 12:28:28 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
class Private;
|
|
|
|
Private * const d;
|
2007-06-08 07:24:19 +02:00
|
|
|
};
|
|
|
|
|
2007-06-08 09:23:09 +02:00
|
|
|
} // Plasma namespace
|
2007-06-08 07:24:19 +02:00
|
|
|
|
2007-06-10 08:02:38 +02:00
|
|
|
#define K_EXPORT_PLASMA_ANIMATOR(libname, classname) \
|
|
|
|
K_EXPORT_COMPONENT_FACTORY( \
|
|
|
|
plasma_animator_##libname, \
|
|
|
|
KGenericFactory<classname>("plasma_animator_" #libname))
|
|
|
|
|
2007-06-08 07:24:19 +02:00
|
|
|
#endif // multiple inclusion guard
|