2009-09-17 18:24:19 +02:00
|
|
|
/***********************************************************************/
|
|
|
|
/* kineticscroll.h */
|
|
|
|
/* */
|
|
|
|
/* Copyright(C) 2009 Igor Trindade Oliveira <igor.oliveira@indt.org.br>*/
|
|
|
|
/* Copyright(C) 2009 Adenilson Cavalcanti <adenilson.silva@idnt.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 */
|
|
|
|
/***********************************************************************/
|
|
|
|
#ifndef PLASMA_KINETICSCROLLING_H
|
|
|
|
#define PLASMA_KINETICSCROLLING_H
|
|
|
|
|
|
|
|
class QGraphicsSceneMouseEvent;
|
|
|
|
class QGraphicsWidget;
|
2009-10-13 14:36:48 +02:00
|
|
|
class QGraphicsSceneWheelEvent;
|
2009-09-17 18:24:19 +02:00
|
|
|
#include <QObject>
|
2009-10-13 14:29:55 +02:00
|
|
|
#include <QPointF>
|
2009-09-17 18:24:19 +02:00
|
|
|
|
2009-09-19 19:07:56 +02:00
|
|
|
|
2009-09-17 18:24:19 +02:00
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class KineticScrollingPrivate;
|
|
|
|
|
|
|
|
class KineticScrolling: public QObject
|
|
|
|
{
|
2009-10-13 12:47:41 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2009-10-20 00:10:25 +02:00
|
|
|
KineticScrolling(QGraphicsWidget *parent);
|
2009-10-13 12:47:41 +02:00
|
|
|
~KineticScrolling();
|
2009-10-15 21:11:34 +02:00
|
|
|
void setWidget(QGraphicsWidget *parent);
|
|
|
|
|
|
|
|
protected:
|
2009-10-13 12:47:41 +02:00
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
void wheelReleaseEvent(QGraphicsSceneWheelEvent *event);
|
2009-10-15 21:11:34 +02:00
|
|
|
|
2009-10-13 12:47:41 +02:00
|
|
|
private:
|
|
|
|
KineticScrollingPrivate *d;
|
|
|
|
void timerEvent(QTimerEvent *event);
|
|
|
|
void bounceTimer();
|
|
|
|
void duration();
|
|
|
|
QPointF kinMovement();
|
|
|
|
void startAnimationTimer(int interval);
|
|
|
|
void doneOvershoot(void);
|
2009-09-17 18:24:19 +02:00
|
|
|
|
2009-10-15 21:11:34 +02:00
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event);
|
|
|
|
|
2009-09-17 18:24:19 +02:00
|
|
|
public Q_SLOTS:
|
2009-10-01 22:44:40 +02:00
|
|
|
void setKineticScrollValue(QPointF value);
|
2009-09-17 18:24:19 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|