* add element appear and disappear methods

* collapse all the frame rate methods into two (one for element anims and one for whole item anims) which take the Phase enumerations

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=677781
This commit is contained in:
Aaron J. Seigo 2007-06-19 21:53:19 +00:00
parent 4d6c186bac
commit f16c087846
2 changed files with 40 additions and 20 deletions

View File

@ -18,6 +18,8 @@
#include "animator.h"
#include <QPainter>
namespace Plasma
{
@ -31,11 +33,40 @@ Animator::~Animator()
{
}
int Animator::appearFrames()
int Animator::frameCount(Plasma::Phase::Animation animation)
{
Q_UNUSED(animation)
return 0;
}
int Animator::elementFrameCount(Plasma::Phase::ElementAnimation animation)
{
Q_UNUSED(animation)
return 0;
}
QPixmap Animator::elementAppear(qreal frame, const QPixmap& pixmap)
{
Q_UNUSED(frame)
Q_UNUSED(pixmap)
return pixmap;
}
QPixmap Animator::elementDisappear(qreal frame, const QPixmap& pixmap)
{
Q_UNUSED(frame)
Q_UNUSED(pixmap)
QPixmap alpha(pixmap.size());
{
QPainter painter(&alpha);
painter.fillRect(alpha.rect(), Qt::transparent);
}
QPixmap pix(pixmap.size());
pix.setAlphaChannel(alpha);
return pix;
}
void Animator::appear(qreal frame, QGraphicsItem* item)
{
Q_UNUSED(frame)
@ -47,11 +78,6 @@ void Animator::appearCompleted(QGraphicsItem* item)
Q_UNUSED(item)
}
int Animator::disappearFrames()
{
return 0;
}
void Animator::disappear(qreal frame, QGraphicsItem* item)
{
Q_UNUSED(frame)
@ -63,11 +89,6 @@ void Animator::disappearCompleted(QGraphicsItem* item)
Q_UNUSED(item)
}
int Animator::activateFrames()
{
return 0;
}
void Animator::activate(qreal frame, QGraphicsItem* item)
{
Q_UNUSED(frame)
@ -79,11 +100,6 @@ void Animator::activateCompleted(QGraphicsItem* item)
Q_UNUSED(item)
}
int Animator::frameAppearFrames()
{
return 0;
}
void Animator::frameAppear(qreal frame, QGraphicsItem* item, const QRegion& drawable)
{
Q_UNUSED(frame)

View File

@ -21,10 +21,12 @@
#include <QtCore/QObject>
#include <QtGui/QRegion>
#include <QtGui/QPixmap>
#include <kgenericfactory.h>
#include <plasma/plasma_export.h>
#include <plasma/phase.h>
class QGraphicsItem;
@ -39,19 +41,21 @@ public:
explicit Animator(QObject *parent = 0, const QStringList& list = QStringList());
~Animator();
virtual int appearFrames();
virtual int frameCount(Plasma::Phase::Animation);
virtual int elementFrameCount(Plasma::Phase::ElementAnimation);
virtual QPixmap elementAppear(qreal frame, const QPixmap& pixmap);
virtual QPixmap elementDisappear(qreal frame, const QPixmap& pixmap);
virtual void appear(qreal frame, QGraphicsItem* item);
virtual void appearCompleted(QGraphicsItem* item);
virtual int disappearFrames();
virtual void disappear(qreal frame, QGraphicsItem* item);
virtual void disappearCompleted(QGraphicsItem* item);
virtual int frameAppearFrames();
virtual void frameAppear(qreal frame, QGraphicsItem* item, const QRegion& drawable);
virtual void frameAppearCompleted(QGraphicsItem* item, const QRegion& drawable);
virtual int activateFrames();
virtual void activate(qreal frame, QGraphicsItem* item);
virtual void activateCompleted(QGraphicsItem* item);