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 QQUICKSWIPE_P_H
38 #define QQUICKSWIPE_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 <QtCore/qobject.h>
52 #include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
53 #include <QtQuickTemplates2/private/qquickswipedelegate_p.h>
54 
55 QT_BEGIN_NAMESPACE
56 
57 class QQmlComponent;
58 class QQuickItem;
59 class QQuickTransition;
60 class QQuickSwipePrivate;
61 
62 class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipe : public QObject
63 {
64     Q_OBJECT
65     Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
66     Q_PROPERTY(bool complete READ isComplete NOTIFY completeChanged FINAL)
67     Q_PROPERTY(QQmlComponent *left READ left WRITE setLeft NOTIFY leftChanged FINAL)
68     Q_PROPERTY(QQmlComponent *behind READ behind WRITE setBehind NOTIFY behindChanged FINAL)
69     Q_PROPERTY(QQmlComponent *right READ right WRITE setRight NOTIFY rightChanged FINAL)
70     Q_PROPERTY(QQuickItem *leftItem READ leftItem NOTIFY leftItemChanged FINAL)
71     Q_PROPERTY(QQuickItem *behindItem READ behindItem NOTIFY behindItemChanged FINAL)
72     Q_PROPERTY(QQuickItem *rightItem READ rightItem NOTIFY rightItemChanged FINAL)
73     // 2.2 (Qt 5.9)
74     Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL) // REVISION 2
75     Q_PROPERTY(QQuickTransition *transition READ transition WRITE setTransition NOTIFY transitionChanged FINAL) // REVISION 2
76 
77 public:
78     explicit QQuickSwipe(QQuickSwipeDelegate *control);
79 
80     qreal position() const;
81     void setPosition(qreal position);
82 
83     bool isComplete() const;
84     void setComplete(bool complete);
85 
86     QQmlComponent *left() const;
87     void setLeft(QQmlComponent *left);
88 
89     QQmlComponent *behind() const;
90     void setBehind(QQmlComponent *behind);
91 
92     QQmlComponent *right() const;
93     void setRight(QQmlComponent *right);
94 
95     QQuickItem *leftItem() const;
96     void setLeftItem(QQuickItem *item);
97 
98     QQuickItem *behindItem() const;
99     void setBehindItem(QQuickItem *item);
100 
101     QQuickItem *rightItem() const;
102     void setRightItem(QQuickItem *item);
103 
104     // 2.1 (Qt 5.8)
105     Q_REVISION(1) Q_INVOKABLE void close();
106 
107     // 2.2 (Qt 5.9)
108     bool isEnabled() const;
109     void setEnabled(bool enabled);
110 
111     QQuickTransition *transition() const;
112     void setTransition(QQuickTransition *transition);
113 
114     Q_REVISION(2) Q_INVOKABLE void open(QQuickSwipeDelegate::Side side);
115 
116 Q_SIGNALS:
117     void positionChanged();
118     void completeChanged();
119     void leftChanged();
120     void behindChanged();
121     void rightChanged();
122     void leftItemChanged();
123     void behindItemChanged();
124     void rightItemChanged();
125     // 2.1 (Qt 5.8)
126     /*Q_REVISION(1)*/ void completed();
127     // 2.2 (Qt 5.9)
128     /*Q_REVISION(2)*/ void opened();
129     /*Q_REVISION(2)*/ void closed();
130     /*Q_REVISION(2)*/ void enabledChanged();
131     /*Q_REVISION(2)*/ void transitionChanged();
132 
133 private:
134     Q_DISABLE_COPY(QQuickSwipe)
135     Q_DECLARE_PRIVATE(QQuickSwipe)
136 };
137 
138 QT_END_NAMESPACE
139 
140 #endif // QQUICKSWIPE_P_H
141