2009-12-27 23:16:11 +01: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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2009-10-22 22:17:07 +02:00
|
|
|
|
2009-12-09 19:40:02 +01:00
|
|
|
/**
|
|
|
|
* @file This file contains the definition for the StackedRotationAnimation.
|
|
|
|
*/
|
|
|
|
|
2009-12-27 23:16:11 +01:00
|
|
|
#ifndef PLASMA_ROTATIONSTACKED_P_H
|
|
|
|
#define PLASMA_ROTATIONSTACKED_P_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>
|
updates, cleans up and finishes the remaining Plasma::RotationStackedAnimation transformations. Now every combination of animation origin ( Up, Up | Left, Up | Right, Down, Down | Left, Down | Right, Left, Right) works with the animation movement directions ( MoveUp, MoveUpLeft, MoveUpRight, MoveDown, MoveDownLeft, MoveDownRight, MoveLeft, MoveRight).
Patch by: Bruno Abinader <brunoabinader@gmail.com>
svn path=/trunk/KDE/kdelibs/; revision=1080054
2010-01-25 14:37:57 +01:00
|
|
|
|
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:
|
2010-01-12 23:24:58 +01:00
|
|
|
explicit RotationStackedAnimation(QObject *parent = 0);
|
2009-12-08 00:22:47 +01:00
|
|
|
|
|
|
|
~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:
|
2010-01-27 21:43:56 +01:00
|
|
|
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
|
2009-12-08 00:22:47 +01:00
|
|
|
void updateCurrentTime(int currentTime);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
updates, cleans up and finishes the remaining Plasma::RotationStackedAnimation transformations. Now every combination of animation origin ( Up, Up | Left, Up | Right, Down, Down | Left, Down | Right, Left, Right) works with the animation movement directions ( MoveUp, MoveUpLeft, MoveUpRight, MoveDown, MoveDownLeft, MoveDownRight, MoveLeft, MoveRight).
Patch by: Bruno Abinader <brunoabinader@gmail.com>
svn path=/trunk/KDE/kdelibs/; revision=1080054
2010-01-25 14:37:57 +01:00
|
|
|
* Updates the front and back widget rotation animation transformations,
|
|
|
|
* according to the given animation reference point and direction.
|
2009-12-08 00:22:47 +01:00
|
|
|
*/
|
updates, cleans up and finishes the remaining Plasma::RotationStackedAnimation transformations. Now every combination of animation origin ( Up, Up | Left, Up | Right, Down, Down | Left, Down | Right, Left, Right) works with the animation movement directions ( MoveUp, MoveUpLeft, MoveUpRight, MoveDown, MoveDownLeft, MoveDownRight, MoveLeft, MoveRight).
Patch by: Bruno Abinader <brunoabinader@gmail.com>
svn path=/trunk/KDE/kdelibs/; revision=1080054
2010-01-25 14:37:57 +01:00
|
|
|
void updateTransformations();
|
|
|
|
|
|
|
|
/** Reference, the default is Center (see \ref Animation::Reference) */
|
|
|
|
qint8 m_reference;
|
|
|
|
/** Animation direction, the default is MoveUp (see \ref Animation::MovementDirection) */
|
2010-01-12 23:24:58 +01:00
|
|
|
MovementDirection m_animDirection;
|
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;
|
2010-01-29 21:36:32 +01:00
|
|
|
/** Layout where widget would be added */
|
|
|
|
QWeakPointer<StackedLayout> m_wLayout;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** Back Widget Rotation transform object */
|
2010-01-12 23:24:58 +01:00
|
|
|
QGraphicsRotation *m_backRotation;
|
2009-12-09 20:28:35 +01:00
|
|
|
/** Front Widget Rotation transform object */
|
2010-01-12 23:24:58 +01:00
|
|
|
QGraphicsRotation *m_frontRotation;
|
2010-01-31 16:54:14 +01:00
|
|
|
|
|
|
|
static const int s_sideAngle;
|
2009-10-22 22:17:07 +02:00
|
|
|
};
|
|
|
|
} // Plasma
|
|
|
|
|
2009-12-27 23:16:11 +01:00
|
|
|
#endif // PLASMA_ROTATIONSTACKED_P_H
|