2009-12-09 16:24:06 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2009-10-23 04:45:55 +02:00
|
|
|
// rotationstacked.h //
|
2009-10-22 22:17:07 +02:00
|
|
|
// //
|
|
|
|
// Copyright(C) 2009 Igor Trindade Oliveira <igor.oliveira@indt.org.br>//
|
|
|
|
// //
|
|
|
|
// This library is free software; you can redistribute it and/or //
|
|
|
|
// modify it under the terms of the GNU Lesser General Public //
|
|
|
|
// License as published by the Free Software Foundation; either //
|
|
|
|
// version 2.1 of the License, or (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This library 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 //
|
|
|
|
// Lesser General Public License for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU Lesser General Public //
|
|
|
|
// License along with this library; if not, write to the Free Software //
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA //
|
|
|
|
// 02110-1301 USA //
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-12-09 19:40:02 +01:00
|
|
|
/**
|
|
|
|
* @file This file contains the definition for the StackedRotationAnimation.
|
|
|
|
*/
|
|
|
|
|
2009-12-09 16:24:06 +01:00
|
|
|
#ifndef PLASMA_ROTATIONSTACKED_H
|
|
|
|
#define PLASMA_ROTATIONSTACKED_H
|
2009-10-22 22:17:07 +02:00
|
|
|
|
|
|
|
#include <plasma/animations/animation.h>
|
|
|
|
#include <plasma/plasma_export.h>
|
|
|
|
|
2009-10-23 04:45:55 +02:00
|
|
|
#include <QGraphicsLayoutItem>
|
2009-12-08 00:22:47 +01:00
|
|
|
class QGraphicsRotation;
|
|
|
|
class StackedLayout;
|
2009-10-23 04:45:55 +02:00
|
|
|
|
2009-10-22 22:17:07 +02:00
|
|
|
namespace Plasma {
|
|
|
|
|
2009-10-23 04:45:55 +02:00
|
|
|
/* TODO:
|
|
|
|
* create a parent class for rotations
|
|
|
|
*/
|
2009-12-09 19:40:02 +01:00
|
|
|
/**
|
|
|
|
* @class RotationStackedAnimation plasma/animations/rotationstacked_p.h
|
|
|
|
* @short 3D like rotation animation
|
|
|
|
* Use this class when you want to rotate a widget along an axis (e.g. Y)
|
|
|
|
* and display a 'hidden' widget behind it. See also \ref RotationAnimation.
|
|
|
|
*/
|
2009-10-22 22:17:07 +02:00
|
|
|
class RotationStackedAnimation : public Animation
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2009-12-03 20:30:02 +01:00
|
|
|
Q_PROPERTY(qint8 movementDirection READ movementDirection WRITE setMovementDirection)
|
2009-10-23 04:45:55 +02:00
|
|
|
Q_PROPERTY(QGraphicsLayoutItem* layout READ layout)
|
2009-11-12 21:15:43 +01:00
|
|
|
Q_PROPERTY(qint8 reference READ reference WRITE setReference)
|
2009-10-23 04:45:55 +02:00
|
|
|
Q_PROPERTY(QGraphicsWidget* backWidget READ backWidget WRITE setBackWidget)
|
|
|
|
|
2009-12-08 00:22:47 +01:00
|
|
|
public:
|
|
|
|
RotationStackedAnimation(QObject *parent = 0);
|
|
|
|
|
|
|
|
~RotationStackedAnimation();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the animation direction
|
|
|
|
* @arg direction animation direction
|
|
|
|
*/
|
|
|
|
void setMovementDirection(const qint8 &direction);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the animation direction
|
|
|
|
*/
|
|
|
|
qint8 movementDirection() const;
|
|
|
|
|
2009-12-09 19:48:38 +01:00
|
|
|
/**
|
|
|
|
* Set rotation reference (e.g. Center, Up, Down, Left, Right) can
|
|
|
|
* be combined (i.e. Center|Up)
|
|
|
|
* @arg reference The reference
|
|
|
|
*/
|
2009-12-08 00:22:47 +01:00
|
|
|
void setReference(const qint8 &reference);
|
2009-12-09 19:48:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Rotation reference (e.g. Center, Up, Down, Left, Right) can
|
|
|
|
* be combined (i.e. Center|Up)
|
|
|
|
*/
|
2009-12-08 00:22:47 +01:00
|
|
|
qint8 reference() const;
|
|
|
|
|
2009-12-09 19:48:38 +01:00
|
|
|
/**
|
|
|
|
* Get the layout where the widgetToAnimate and backWidget are.
|
|
|
|
*/
|
2009-12-08 00:22:47 +01:00
|
|
|
QGraphicsLayoutItem *layout();
|
|
|
|
|
2009-12-09 19:48:38 +01:00
|
|
|
/**
|
|
|
|
* Get the back widget
|
|
|
|
*/
|
|
|
|
|
2009-12-08 00:22:47 +01:00
|
|
|
QGraphicsWidget *backWidget();
|
2009-12-09 19:48:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the back widget that is used after the animation to be finished
|
|
|
|
* @arg backWidget The back widget
|
|
|
|
*/
|
2009-12-08 00:22:47 +01:00
|
|
|
void setBackWidget(QGraphicsWidget *backWidget);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
|
|
|
|
void updateCurrentTime(int currentTime);
|
|
|
|
|
|
|
|
private:
|
2009-12-09 20:28:35 +01:00
|
|
|
/** Reference, the default is Up (see \ref Animation::Reference) */
|
2009-12-08 00:22:47 +01:00
|
|
|
qint8 m_reference;
|
|
|
|
/**
|
|
|
|
* Animation direction: where the animation will move.
|
|
|
|
*/
|
|
|
|
Plasma::AnimationDirection animDirection;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** Initial rotation angle from front widget */
|
2009-12-08 00:22:47 +01:00
|
|
|
int frontStartAngle;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** End value of the rotation angle of the front widget */
|
2009-12-08 00:22:47 +01:00
|
|
|
int frontEndAngle;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** Initial rotation angle from back widget */
|
2009-12-08 00:22:47 +01:00
|
|
|
int backStartAngle;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** End value of the rotation angle of the back widget */
|
2009-12-08 00:22:47 +01:00
|
|
|
int backEndAngle;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** Object the animation(s) should act upon. */
|
2009-12-08 00:22:47 +01:00
|
|
|
QWeakPointer<QGraphicsWidget> m_backWidget;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** Back Widget Rotation transform object */
|
2009-12-08 00:22:47 +01:00
|
|
|
QGraphicsRotation *backRotation;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** Front Widget Rotation transform object */
|
2009-12-08 00:22:47 +01:00
|
|
|
QGraphicsRotation *frontRotation;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** rotation stacked layout where the widget would be added */
|
2009-12-08 00:22:47 +01:00
|
|
|
StackedLayout *sLayout;
|
2009-10-22 22:17:07 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
} // Plasma
|
|
|
|
|
|
|
|
#endif
|