~patrick-hetu/+junk/evopedia-app

« back to all changes in this revision

Viewing changes to src/flickable.h

  • Committer: Patrick Hetu
  • Date: 2013-07-22 02:35:22 UTC
  • Revision ID: patrick.hetu@gmail.com-20130722023522-jrfmj5s6eb3mfdv8
initial test

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 
4
** Contact: Qt Software Information (qt-info@nokia.com)
 
5
**
 
6
** This file is part of the Graphics Dojo project on Qt Labs.
 
7
**
 
8
** This file may be used under the terms of the GNU General Public
 
9
** License version 2.0 or 3.0 as published by the Free Software Foundation
 
10
** and appearing in the file LICENSE.GPL included in the packaging of
 
11
** this file.  Please review the following information to ensure GNU
 
12
** General Public Licensing requirements will be met:
 
13
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
 
14
** http://www.gnu.org/copyleft/gpl.html.
 
15
**
 
16
** If you are unsure which license is appropriate for your use, please
 
17
** contact the sales department at qt-sales@nokia.com.
 
18
**
 
19
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
20
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
21
**
 
22
****************************************************************************/
 
23
 
 
24
#ifndef FLICKABLE_H
 
25
#define FLICKABLE_H
 
26
 
 
27
#include <QtWidgets/QWidget>
 
28
#include <QMouseEvent>
 
29
#include <QPoint>
 
30
 
 
31
class FlickableTicker;
 
32
class FlickablePrivate;
 
33
 
 
34
class Flickable
 
35
{
 
36
public:
 
37
 
 
38
    Flickable();
 
39
    virtual ~Flickable();
 
40
 
 
41
    void setThreshold(int threshold);
 
42
    int threshold() const;
 
43
 
 
44
    void setAcceptMouseClick(QWidget *target);
 
45
 
 
46
    void handleMousePress(QMouseEvent *event);
 
47
    void handleMouseMove(QMouseEvent *event);
 
48
    void handleMouseRelease(QMouseEvent *event);
 
49
 
 
50
protected:
 
51
    virtual QPoint scrollOffset() const = 0;
 
52
    virtual void setScrollOffset(const QPoint &offset) = 0;
 
53
    void externalScrollUpdate();
 
54
 
 
55
private:
 
56
    void tick();
 
57
 
 
58
private:
 
59
    FlickablePrivate *d;
 
60
    friend class FlickableTicker;
 
61
};
 
62
 
 
63
#endif // FLICKABLE_H