1 /****************************************************************************
2 **
3 ** Copyright (C) 2017 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL3$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or later as published by the Free
28 ** Software Foundation and appearing in the file LICENSE.GPL included in
29 ** the packaging of this file. Please review the following information to
30 ** ensure the GNU General Public License version 2.0 requirements will be
31 ** met: http://www.gnu.org/licenses/gpl-2.0.html.
32 **
33 ** $QT_END_LICENSE$
34 **
35 ****************************************************************************/
36 
37 #ifndef QQUICKSCROLLINDICATOR_P_H
38 #define QQUICKSCROLLINDICATOR_P_H
39 
40 //
41 //  W A R N I N G
42 //  -------------
43 //
44 // This file is not part of the Qt API.  It exists purely as an
45 // implementation detail.  This header file may change from version to
46 // version without notice, or even be removed.
47 //
48 // We mean it.
49 //
50 
51 #include <QtQuickTemplates2/private/qquickcontrol_p.h>
52 
53 QT_BEGIN_NAMESPACE
54 
55 class QQuickFlickable;
56 class QQuickScrollIndicatorAttached;
57 class QQuickScrollIndicatorPrivate;
58 
59 class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollIndicator : public QQuickControl
60 {
61     Q_OBJECT
62     Q_PROPERTY(qreal size READ size WRITE setSize NOTIFY sizeChanged FINAL)
63     Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
64     Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
65     Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
66     // 2.3 (Qt 5.10)
67     Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
68     Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
69     // 2.4 (Qt 5.11)
70     Q_PROPERTY(qreal minimumSize READ minimumSize WRITE setMinimumSize NOTIFY minimumSizeChanged FINAL REVISION 4)
71     Q_PROPERTY(qreal visualSize READ visualSize NOTIFY visualSizeChanged FINAL REVISION 4)
72     Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL REVISION 4)
73 
74 public:
75     explicit QQuickScrollIndicator(QQuickItem *parent = nullptr);
76 
77     static QQuickScrollIndicatorAttached *qmlAttachedProperties(QObject *object);
78 
79     qreal size() const;
80     qreal position() const;
81 
82     bool isActive() const;
83     void setActive(bool active);
84 
85     Qt::Orientation orientation() const;
86     void setOrientation(Qt::Orientation orientation);
87 
88     // 2.3 (Qt 5.10)
89     bool isHorizontal() const;
90     bool isVertical() const;
91 
92     // 2.4 (Qt 5.11)
93     qreal minimumSize() const;
94     void setMinimumSize(qreal minimumSize);
95 
96     qreal visualSize() const;
97     qreal visualPosition() const;
98 
99 public Q_SLOTS:
100     void setSize(qreal size);
101     void setPosition(qreal position);
102 
103 Q_SIGNALS:
104     void sizeChanged();
105     void positionChanged();
106     void activeChanged();
107     void orientationChanged();
108     // 2.4 (Qt 5.11)
109     Q_REVISION(4) void minimumSizeChanged();
110     Q_REVISION(4) void visualSizeChanged();
111     Q_REVISION(4) void visualPositionChanged();
112 
113 protected:
114 #if QT_CONFIG(quicktemplates2_multitouch)
115     void touchEvent(QTouchEvent *event) override;
116 #endif
117 
118 #if QT_CONFIG(accessibility)
119     QAccessible::Role accessibleRole() const override;
120 #endif
121 
122 private:
123     Q_DISABLE_COPY(QQuickScrollIndicator)
124     Q_DECLARE_PRIVATE(QQuickScrollIndicator)
125 };
126 
127 class QQuickScrollIndicatorAttachedPrivate;
128 
129 class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollIndicatorAttached : public QObject
130 {
131     Q_OBJECT
132     Q_PROPERTY(QQuickScrollIndicator *horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
133     Q_PROPERTY(QQuickScrollIndicator *vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
134 
135 public:
136     explicit QQuickScrollIndicatorAttached(QObject *parent = nullptr);
137     ~QQuickScrollIndicatorAttached();
138 
139     QQuickScrollIndicator *horizontal() const;
140     void setHorizontal(QQuickScrollIndicator *horizontal);
141 
142     QQuickScrollIndicator *vertical() const;
143     void setVertical(QQuickScrollIndicator *vertical);
144 
145 Q_SIGNALS:
146     void horizontalChanged();
147     void verticalChanged();
148 
149 private:
150     Q_DISABLE_COPY(QQuickScrollIndicatorAttached)
151     Q_DECLARE_PRIVATE(QQuickScrollIndicatorAttached)
152 };
153 
154 QT_END_NAMESPACE
155 
156 QML_DECLARE_TYPE(QQuickScrollIndicator)
157 QML_DECLARE_TYPEINFO(QQuickScrollIndicator, QML_HAS_ATTACHED_PROPERTIES)
158 
159 #endif // QQUICKSCROLLINDICATOR_P_H
160