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
|
|
|
|
2010-04-08 19:07:33 +02:00
|
|
|
#include <plasma/animations/easinganimation_p.h>
|
2009-10-22 22:17:07 +02:00
|
|
|
#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.
|
|
|
|
*/
|
2010-04-08 19:07:33 +02:00
|
|
|
class RotationStackedAnimation : public EasingAnimation
|
2009-10-22 22:17:07 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2010-02-02 14:36:23 +01:00
|
|
|
Q_PROPERTY(MovementDirection movementDirection READ movementDirection WRITE setMovementDirection)
|
|
|
|
Q_PROPERTY(Reference reference READ reference WRITE setReference)
|
2009-10-23 04:45:55 +02:00
|
|
|
Q_PROPERTY(QGraphicsLayoutItem* layout READ layout)
|
|
|
|
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();
|
|
|
|
|
|
|
|
/**
|
2010-02-01 19:01:40 +01:00
|
|
|
* Set the animation movement direction (e.g. MoveAny, MoveUp, MoveDown,
|
|
|
|
* MoveLeft, MoveRight) which can be combined (i.e. MoveUp|MoveLeft).
|
2011-06-13 14:47:29 +02:00
|
|
|
* @param direction animation direction
|
2009-12-08 00:22:47 +01:00
|
|
|
*/
|
2010-02-02 14:36:23 +01:00
|
|
|
void setMovementDirection(const Animation::MovementDirection &direction);
|
2009-12-08 00:22:47 +01:00
|
|
|
|
|
|
|
/**
|
2010-02-01 19:01:40 +01:00
|
|
|
* Get the animation movement direction.
|
2009-12-08 00:22:47 +01:00
|
|
|
*/
|
2010-02-02 14:36:23 +01:00
|
|
|
Animation::MovementDirection movementDirection() const;
|
2009-12-08 00:22:47 +01:00
|
|
|
|
2009-12-09 19:48:38 +01:00
|
|
|
/**
|
2010-02-01 19:01:40 +01:00
|
|
|
* Set the animation rotation reference (e.g. Center, Up, Down, Left,
|
|
|
|
* Right) which can be combined (i.e. Center|Up).
|
2011-06-13 14:47:29 +02:00
|
|
|
* @param reference animation reference
|
2009-12-09 19:48:38 +01:00
|
|
|
*/
|
2010-02-02 14:36:23 +01:00
|
|
|
void setReference(const Animation::Reference &reference);
|
2009-12-09 19:48:38 +01:00
|
|
|
|
|
|
|
/**
|
2010-02-01 19:01:40 +01:00
|
|
|
* Get the animation rotation reference.
|
2009-12-09 19:48:38 +01:00
|
|
|
*/
|
2010-02-02 14:36:23 +01:00
|
|
|
Animation::Reference reference() const;
|
2009-12-08 00:22:47 +01:00
|
|
|
|
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
|
2011-06-13 14:47:29 +02:00
|
|
|
* @param backWidget The back widget
|
2009-12-09 19:48:38 +01:00
|
|
|
*/
|
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);
|
2010-04-08 19:07:33 +02:00
|
|
|
void updateEffectiveTime(int currentTime);
|
2009-12-08 00:22:47 +01:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2010-02-01 19:01:40 +01:00
|
|
|
/** Animation reference (see \ref Animation::Reference) */
|
2010-02-02 14:36:23 +01:00
|
|
|
Animation::Reference m_animReference;
|
2010-02-01 19:01:40 +01:00
|
|
|
/** Animation movement direction (see \ref Animation::MovementDirection) */
|
2010-02-02 14:36:23 +01:00
|
|
|
Animation::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
|