1 /*
2  * DQt - D bindings for the Qt Toolkit
3  *
4  * GNU Lesser General Public License Usage
5  * This file may be used under the terms of the GNU Lesser
6  * General Public License version 3 as published by the Free Software
7  * Foundation and appearing in the file LICENSE.LGPL3 included in the
8  * packaging of this file. Please review the following information to
9  * ensure the GNU Lesser General Public License version 3 requirements
10  * will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
11  */
12 module qt.gui.eventpoint;
13 extern(C++):
14 
15 import core.stdc.config;
16 import qt.config;
17 import qt.core.flags;
18 import qt.core.global;
19 import qt.core.metamacros;
20 import qt.core.namespace;
21 import qt.core.point;
22 import qt.core.shareddata;
23 import qt.core.size;
24 import qt.core.typeinfo;
25 import qt.gui.pointingdevice;
26 import qt.gui.vector2d;
27 import qt.helpers;
28 
29 extern(C++, class) struct QEventPointPrivate;
30 /+ QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QEventPointPrivate, Q_GUI_EXPORT) +/
31 /// Binding for C++ class [QEventPoint](https://doc.qt.io/qt-6/qeventpoint.html).
32 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_GUI_EXPORT +/ QEventPoint
33 {
34     mixin(Q_GADGET);
35     /+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
36     QDOC_PROPERTY(QPointingDevice *device READ device CONSTANT) // qdoc doesn't know const
37     Q_PROPERTY(const QPointingDevice *device READ device CONSTANT)
38     Q_PROPERTY(int id READ id CONSTANT)
39     Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT)
40     Q_PROPERTY(State state READ state CONSTANT)
41     Q_PROPERTY(ulong timestamp READ timestamp CONSTANT)
42     Q_PROPERTY(ulong pressTimestamp READ pressTimestamp CONSTANT)
43     Q_PROPERTY(ulong lastTimestamp READ lastTimestamp CONSTANT)
44     Q_PROPERTY(qreal timeHeld READ timeHeld CONSTANT)
45     Q_PROPERTY(qreal pressure READ pressure CONSTANT)
46     Q_PROPERTY(qreal rotation READ rotation CONSTANT)
47     Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters CONSTANT)
48     Q_PROPERTY(QVector2D velocity READ velocity CONSTANT)
49     Q_PROPERTY(QPointF position READ position CONSTANT)
50     Q_PROPERTY(QPointF pressPosition READ pressPosition CONSTANT)
51     Q_PROPERTY(QPointF grabPosition READ grabPosition CONSTANT)
52     Q_PROPERTY(QPointF lastPosition READ lastPosition CONSTANT)
53     Q_PROPERTY(QPointF scenePosition READ scenePosition CONSTANT)
54     Q_PROPERTY(QPointF scenePressPosition READ scenePressPosition CONSTANT)
55     Q_PROPERTY(QPointF sceneGrabPosition READ sceneGrabPosition CONSTANT)
56     Q_PROPERTY(QPointF sceneLastPosition READ sceneLastPosition CONSTANT)
57     Q_PROPERTY(QPointF globalPosition READ globalPosition CONSTANT)
58     Q_PROPERTY(QPointF globalPressPosition READ globalPressPosition CONSTANT)
59     Q_PROPERTY(QPointF globalGrabPosition READ globalGrabPosition CONSTANT)
60     Q_PROPERTY(QPointF globalLastPosition READ globalLastPosition CONSTANT) +/
61 public:
62     enum State : quint8 {
63         Unknown     = /+ Qt:: +/qt.core.namespace.TouchPointState.TouchPointUnknownState,
64         Stationary  = /+ Qt:: +/qt.core.namespace.TouchPointState.TouchPointStationary,
65         Pressed     = /+ Qt:: +/qt.core.namespace.TouchPointState.TouchPointPressed,
66         Updated     = /+ Qt:: +/qt.core.namespace.TouchPointState.TouchPointMoved,
67         Released    = /+ Qt:: +/qt.core.namespace.TouchPointState.TouchPointReleased
68     }
69     /+ Q_DECLARE_FLAGS(States, State) +/
70 alias States = QFlags!(State);    /+ Q_FLAG(States) +/
71 
72     @disable this();
73     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
74     /+ explicit +/this(int id/+ = -1+/, const(QPointingDevice) device = null);
75     }));
76     this(int pointId, State state, ref const(QPointF) scenePosition, ref const(QPointF) globalPosition);
77     @disable this(this);
78     this(ref const(QEventPoint) other)/+ noexcept+/;
79     /+ref QEventPoint operator =(ref const(QEventPoint) other)/+ noexcept+/;+/
80     /+ QEventPoint(QEventPoint && other) noexcept = default; +/
81     /+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEventPoint) +/
82     /+bool operator ==(ref const(QEventPoint) other) const/+ noexcept+/;+/
83     /+bool operator !=(ref const(QEventPoint) other) const/+ noexcept+/ { return !operator==(other); }+/
84     ~this();
85     /+ inline void swap(QEventPoint &other) noexcept
86     { qSwap(d, other.d); } +/
87 
88     QPointF position() const;
89     QPointF pressPosition() const;
90     QPointF grabPosition() const;
91     QPointF lastPosition() const;
92     QPointF scenePosition() const;
93     QPointF scenePressPosition() const;
94     QPointF sceneGrabPosition() const;
95     QPointF sceneLastPosition() const;
96     QPointF globalPosition() const;
97     QPointF globalPressPosition() const;
98     QPointF globalGrabPosition() const;
99     QPointF globalLastPosition() const;
100     QPointF normalizedPosition() const;
101 
102 /+ #if QT_DEPRECATED_SINCE(6, 0) +/
103     // QEventPoint replaces QTouchEvent::TouchPoint, so we need all its old accessors, for now
104     /+ QT_DEPRECATED_VERSION_X_6_0("Use position()") +/
105         QPointF pos() const { return position(); }
106     /+ QT_DEPRECATED_VERSION_X_6_0("Use pressPosition()") +/
107         QPointF startPos() const { return pressPosition(); }
108     /+ QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()") +/
109         QPointF scenePos() const { return scenePosition(); }
110     /+ QT_DEPRECATED_VERSION_X_6_0("Use scenePressPosition()") +/
111         QPointF startScenePos() const { return scenePressPosition(); }
112     /+ QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") +/
113         QPointF screenPos() const { return globalPosition(); }
114     /+ QT_DEPRECATED_VERSION_X_6_0("Use globalPressPosition()") +/
115         QPointF startScreenPos() const { return globalPressPosition(); }
116     /+ QT_DEPRECATED_VERSION_X_6_0("Use globalPressPosition()") +/
117         QPointF startNormalizedPos() const;
118     /+ QT_DEPRECATED_VERSION_X_6_0("Use normalizedPosition()") +/
119         QPointF normalizedPos() const { return normalizedPosition(); }
120     /+ QT_DEPRECATED_VERSION_X_6_0("Use lastPosition()") +/
121         QPointF lastPos() const { return lastPosition(); }
122     /+ QT_DEPRECATED_VERSION_X_6_0("Use sceneLastPosition()") +/
123         QPointF lastScenePos() const { return sceneLastPosition(); }
124     /+ QT_DEPRECATED_VERSION_X_6_0("Use globalLastPosition()") +/
125         QPointF lastScreenPos() const { return globalLastPosition(); }
126     /+ QT_DEPRECATED_VERSION_X_6_0("Use globalLastPosition()") +/
127         QPointF lastNormalizedPos() const;
128 /+ #endif +/ // QT_DEPRECATED_SINCE(6, 0)
129     QVector2D velocity() const;
130     State state() const;
131     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
132     const(QPointingDevice) device() const;
133     }));
134     int id() const;
135     QPointingDeviceUniqueId uniqueId() const;
136     cpp_ulong timestamp() const;
137     cpp_ulong lastTimestamp() const;
138     cpp_ulong pressTimestamp() const;
139     qreal timeHeld() const;
140     qreal pressure() const;
141     qreal rotation() const;
142     QSizeF ellipseDiameters() const;
143 
144     bool isAccepted() const;
145     void setAccepted(bool accepted = true);
146 
147 private:
148     QExplicitlySharedDataPointer!(QEventPointPrivate) d;
149     /+ friend class QMutableEventPoint; +/
150     /+ friend class QPointerEvent; +/
151     mixin(CREATE_CONVENIENCE_WRAPPERS);
152 }
153 
154 /+ #ifndef QT_NO_DEBUG_STREAM
155 Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint *);
156 Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint &);
157 #endif
158 
159 Q_DECLARE_SHARED(QEventPoint) +/
160