1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKSWIPEVIEW_P_H
5#define QQUICKSWIPEVIEW_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuickTemplates2/private/qquickcontainer_p.h>
19
20QT_BEGIN_NAMESPACE
21
22class QQuickSwipeViewAttached;
23class QQuickSwipeViewPrivate;
24
25class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeView : public QQuickContainer
26{
27 Q_OBJECT
28 // 2.1 (Qt 5.8)
29 Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged FINAL REVISION(2, 1))
30 // 2.2 (Qt 5.9)
31 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL REVISION(2, 2))
32 // 2.3 (Qt 5.10)
33 Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION(2, 3))
34 Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION(2, 3))
35 QML_NAMED_ELEMENT(SwipeView)
36 QML_ATTACHED(QQuickSwipeViewAttached)
37 QML_ADDED_IN_VERSION(2, 0)
38
39public:
40 explicit QQuickSwipeView(QQuickItem *parent = nullptr);
41
42 static QQuickSwipeViewAttached *qmlAttachedProperties(QObject *object);
43
44 // 2.1 (Qt 5.8)
45 bool isInteractive() const;
46 void setInteractive(bool interactive);
47
48 // 2.2 (Qt 5.9)
49 Qt::Orientation orientation() const;
50 void setOrientation(Qt::Orientation orientation);
51
52 // 2.3 (Qt 5.10)
53 bool isHorizontal() const;
54 bool isVertical() const;
55
56Q_SIGNALS:
57 // 2.1 (Qt 5.8)
58 Q_REVISION(2, 1) void interactiveChanged();
59 // 2.2 (Qt 5.9)
60 Q_REVISION(2, 2) void orientationChanged();
61
62protected:
63 void componentComplete() override;
64 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
65 void itemAdded(int index, QQuickItem *item) override;
66 void itemMoved(int index, QQuickItem *item) override;
67 void itemRemoved(int index, QQuickItem *item) override;
68
69#if QT_CONFIG(accessibility)
70 QAccessible::Role accessibleRole() const override;
71#endif
72
73private:
74 Q_DISABLE_COPY(QQuickSwipeView)
75 Q_DECLARE_PRIVATE(QQuickSwipeView)
76};
77
78class QQuickSwipeViewAttachedPrivate;
79
80class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeViewAttached : public QObject
81{
82 Q_OBJECT
83 Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
84 Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY isCurrentItemChanged FINAL)
85 Q_PROPERTY(QQuickSwipeView *view READ view NOTIFY viewChanged FINAL)
86 // 2.1 (Qt 5.8)
87 Q_PROPERTY(bool isNextItem READ isNextItem NOTIFY isNextItemChanged FINAL REVISION(2, 1))
88 Q_PROPERTY(bool isPreviousItem READ isPreviousItem NOTIFY isPreviousItemChanged FINAL REVISION(2, 1))
89
90public:
91 explicit QQuickSwipeViewAttached(QObject *parent = nullptr);
92
93 int index() const;
94 bool isCurrentItem() const;
95 QQuickSwipeView *view() const;
96
97 // 2.1 (Qt 5.8)
98 bool isNextItem() const;
99 bool isPreviousItem() const;
100
101Q_SIGNALS:
102 void indexChanged();
103 void isCurrentItemChanged();
104 void viewChanged();
105 // 2.1 (Qt 5.8)
106 /*Q_REVISION(2, 1)*/ void isNextItemChanged();
107 /*Q_REVISION(2, 1)*/ void isPreviousItemChanged();
108
109private:
110 Q_DISABLE_COPY(QQuickSwipeViewAttached)
111 Q_DECLARE_PRIVATE(QQuickSwipeViewAttached)
112};
113
114QT_END_NAMESPACE
115
116QML_DECLARE_TYPE(QQuickSwipeView)
117
118#endif // QQUICKSWIPEVIEW_P_H
119

source code of qtdeclarative/src/quicktemplates/qquickswipeview_p.h