1// qscroller.sip generated by MetaSIP
2//
3// This file is part of the QtWidgets Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.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
23class QScroller : QObject
24{
25%TypeHeaderCode
26#include <qscroller.h>
27%End
28
29public:
30    enum State
31    {
32        Inactive,
33        Pressed,
34        Dragging,
35        Scrolling,
36    };
37
38    enum ScrollerGestureType
39    {
40        TouchGesture,
41        LeftMouseButtonGesture,
42        RightMouseButtonGesture,
43        MiddleMouseButtonGesture,
44    };
45
46    enum Input
47    {
48        InputPress,
49        InputMove,
50        InputRelease,
51    };
52
53    static bool hasScroller(QObject *target);
54    static QScroller *scroller(QObject *target);
55    static Qt::GestureType grabGesture(QObject *target, QScroller::ScrollerGestureType scrollGestureType = QScroller::TouchGesture);
56    static Qt::GestureType grabbedGesture(QObject *target);
57    static void ungrabGesture(QObject *target);
58    static QList<QScroller *> activeScrollers();
59    QObject *target() const;
60    QScroller::State state() const;
61    bool handleInput(QScroller::Input input, const QPointF &position, qint64 timestamp = 0);
62    void stop();
63    QPointF velocity() const;
64    QPointF finalPosition() const;
65    QPointF pixelPerMeter() const;
66    QScrollerProperties scrollerProperties() const;
67    void setSnapPositionsX(const QList<qreal> &positions);
68    void setSnapPositionsX(qreal first, qreal interval);
69    void setSnapPositionsY(const QList<qreal> &positions);
70    void setSnapPositionsY(qreal first, qreal interval);
71
72public slots:
73    void setScrollerProperties(const QScrollerProperties &prop);
74    void scrollTo(const QPointF &pos);
75    void scrollTo(const QPointF &pos, int scrollTime);
76    void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin);
77    void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin, int scrollTime);
78    void resendPrepareEvent();
79
80signals:
81    void stateChanged(QScroller::State newstate);
82    void scrollerPropertiesChanged(const QScrollerProperties &);
83
84private:
85    QScroller(QObject *target);
86    virtual ~QScroller();
87    QScroller(const QScroller &);
88};
89