2009-10-15 21:36:38 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2009 Mehmet Ali Akmanalp <makmanalp@wpi.edu>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file This file contains the definition for the Grow effect.
|
|
|
|
*/
|
|
|
|
|
2009-12-27 23:16:11 +01:00
|
|
|
#ifndef PLASMA_ANIMATIONS_GROW_P_H
|
|
|
|
#define PLASMA_ANIMATIONS_GROW_P_H
|
2009-10-15 21:36:38 +02:00
|
|
|
|
|
|
|
#include <plasma/animations/animation.h>
|
|
|
|
#include <plasma/plasma_export.h>
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
2009-12-09 19:40:02 +01:00
|
|
|
* @class GrowAnimation plasma/animations/grow.h
|
2009-10-15 21:36:38 +02:00
|
|
|
* @short Grow effect
|
2009-10-20 20:40:34 +02:00
|
|
|
*
|
2009-10-15 21:36:38 +02:00
|
|
|
* Effect that grows any QGraphicsWidget by a multiple given in the
|
2009-12-09 19:40:02 +01:00
|
|
|
* constructor. The center of the object stays in place while the sides grow
|
|
|
|
* (it does the animation by changing the objects geometry). Also see
|
|
|
|
* \ref ZoomAnimation.
|
2009-10-15 21:36:38 +02:00
|
|
|
*/
|
2009-10-20 23:04:49 +02:00
|
|
|
class GrowAnimation : public Animation
|
2009-10-15 21:36:38 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2009-10-22 18:25:48 +02:00
|
|
|
Q_PROPERTY(qreal factor READ factor WRITE setFactor)
|
2009-10-15 21:36:38 +02:00
|
|
|
|
|
|
|
public:
|
2009-12-09 19:40:02 +01:00
|
|
|
/** Default Constructor
|
|
|
|
* @param parent Animation object parent.
|
|
|
|
* @param factor Expand factor (default is twice the size of
|
|
|
|
* animated widget).
|
|
|
|
*/
|
2010-01-12 23:27:23 +01:00
|
|
|
explicit GrowAnimation(QObject *parent = 0, qreal factor = 2);
|
|
|
|
|
2009-12-09 19:40:02 +01:00
|
|
|
/** Destructor */
|
2009-10-15 21:36:38 +02:00
|
|
|
virtual ~GrowAnimation(){};
|
|
|
|
|
2009-12-09 19:40:02 +01:00
|
|
|
/**
|
|
|
|
* Access expansion factor of the shadow pulsable copy.
|
|
|
|
*
|
|
|
|
* If not set, the default is twice (2x) the size of animated widget.
|
|
|
|
* See \ref setFactor.
|
|
|
|
* @return Expansion factor.
|
|
|
|
*/
|
2009-10-22 18:25:48 +02:00
|
|
|
qreal factor() const;
|
2009-12-09 19:40:02 +01:00
|
|
|
/**
|
|
|
|
* Set expansion factor of target widget.
|
|
|
|
*
|
|
|
|
* If not set, the default is twice (2x) the size of animated widget.
|
|
|
|
* @param factor A expansion factor
|
|
|
|
*/
|
2009-10-27 14:59:40 +01:00
|
|
|
void setFactor(const qreal factor);
|
2009-10-22 18:25:48 +02:00
|
|
|
|
2009-10-15 21:36:38 +02:00
|
|
|
protected:
|
2009-12-05 14:53:25 +01:00
|
|
|
void updateCurrentTime(int currentTime);
|
|
|
|
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
|
2009-10-15 21:36:38 +02:00
|
|
|
|
2009-10-20 23:04:49 +02:00
|
|
|
private:
|
2009-12-09 19:40:02 +01:00
|
|
|
/** Animation grow factor */
|
2009-10-20 23:04:49 +02:00
|
|
|
qreal m_animFactor;
|
2009-12-09 19:40:02 +01:00
|
|
|
/** Widget start geometry */
|
2009-12-05 14:53:25 +01:00
|
|
|
QRectF m_startGeometry;
|
2009-12-09 19:40:02 +01:00
|
|
|
/** Widget final geometry */
|
2009-12-05 14:53:25 +01:00
|
|
|
QRectF m_targetGeometry;
|
2009-10-15 21:36:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-12-27 23:16:11 +01:00
|
|
|
#endif // PLASMA_ANIMATIONS_GROW_P_H
|