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.pointingdevice; 13 extern(C++): 14 15 import qt.config; 16 import qt.core.flags; 17 import qt.core.global; 18 import qt.core.metamacros; 19 import qt.core.object; 20 import qt.core.string; 21 import qt.core.typeinfo; 22 import qt.gui.event; 23 import qt.gui.eventpoint; 24 import qt.gui.inputdevice; 25 import qt.helpers; 26 27 /+ class QDebug; +/ 28 extern(C++, class) struct QPointingDevicePrivate; 29 30 /// Binding for C++ class [QPointingDeviceUniqueId](https://doc.qt.io/qt-6/qpointingdeviceuniqueid.html). 31 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_GUI_EXPORT +/ QPointingDeviceUniqueId 32 { 33 mixin(Q_GADGET); 34 /+ Q_PROPERTY(qint64 numericId READ numericId CONSTANT) +/ 35 public: 36 /+/+ Q_ALWAYS_INLINE +/ 37 pragma(inline, true) this()/+ noexcept+/ 38 { 39 this.m_numericId = -1; 40 }+/ 41 // compiler-generated copy/move ctor/assignment operators are ok! 42 // compiler-generated dtor is ok! 43 44 static QPointingDeviceUniqueId fromNumericId(qint64 id); 45 46 /+ Q_ALWAYS_INLINE +/ pragma(inline, true) bool isValid() const/+ noexcept+/ { return m_numericId != -1; } 47 qint64 numericId() const/+ noexcept+/; 48 49 private: 50 /+ friend bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept 51 { return lhs.numericId() == rhs.numericId(); } +/ 52 /+ friend bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept 53 { return lhs.numericId() != rhs.numericId(); } +/ 54 55 // TODO: for TUIO 2, or any other type of complex token ID, an internal 56 // array (or hash) can be added to hold additional properties. 57 // In this case, m_numericId will then turn into an index into that array (or hash). 58 qint64 m_numericId = -1; 59 mixin(CREATE_CONVENIENCE_WRAPPERS); 60 } 61 /+ Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_RELOCATABLE_TYPE); 62 63 Q_GUI_EXPORT size_t qHash(QPointingDeviceUniqueId key, size_t seed = 0) noexcept; +/ 64 65 /// Binding for C++ class [QPointingDevice](https://doc.qt.io/qt-6/qpointingdevice.html). 66 class /+ Q_GUI_EXPORT +/ QPointingDevice : QInputDevice 67 { 68 mixin(Q_OBJECT); 69 /+ Q_DECLARE_PRIVATE(QPointingDevice) +/ 70 /+ Q_PROPERTY(PointerType pointerType READ pointerType CONSTANT) 71 Q_PROPERTY(int maximumPoints READ maximumPoints CONSTANT) 72 Q_PROPERTY(int buttonCount READ buttonCount CONSTANT) 73 Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT) +/ 74 75 public: 76 enum /+ class +/ PointerType { 77 Unknown = 0, 78 Generic = 0x0001, // mouse or similar 79 Finger = 0x0002, // touchscreen or pad 80 Pen = 0x0004, // stylus on a tablet 81 Eraser = 0x0008, // eraser end of a stylus 82 Cursor = 0x0010, // digitizer with crosshairs 83 AllPointerTypes = 0x7FFF 84 } 85 /+ Q_DECLARE_FLAGS(PointerTypes, PointerType) +/ 86 alias PointerTypes = QFlags!(PointerType); /+ Q_FLAG(PointerTypes) +/ 87 88 enum GrabTransition { 89 GrabPassive = 0x01, 90 UngrabPassive = 0x02, 91 CancelGrabPassive = 0x03, 92 OverrideGrabPassive = 0x04, 93 GrabExclusive = 0x10, 94 UngrabExclusive = 0x20, 95 CancelGrabExclusive = 0x30, 96 } 97 /+ Q_ENUM(GrabTransition) +/ 98 99 this(QObject parent = null); 100 ~this(); 101 this(ref const(QString) name, qint64 systemId, QInputDevice.DeviceType devType, 102 PointerType pType, Capabilities caps, int maxPoints, int buttonCount, 103 ref const(QString) seatName = globalInitVar!QString, 104 QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(), 105 QObject parent = null); 106 107 /+ #if QT_DEPRECATED_SINCE(6, 0) +/ 108 /+ QT_DEPRECATED_VERSION_X_6_0("Use the constructor") +/ 109 final void setType(DeviceType devType); 110 /+ QT_DEPRECATED_VERSION_X_6_0("Use the constructor") +/ 111 final void setCapabilities(QInputDevice.Capabilities caps); 112 /+ QT_DEPRECATED_VERSION_X_6_0("Use the constructor") +/ 113 final void setMaximumTouchPoints(int c); 114 /+ #endif +/ 115 116 final PointerType pointerType() const; 117 final int maximumPoints() const; 118 final int buttonCount() const; 119 final QPointingDeviceUniqueId uniqueId() const; 120 121 mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{ 122 static const(QPointingDevice) primaryPointingDevice(ref const(QString) seatName = globalInitVar!QString); 123 })); 124 125 /+final bool operator ==(ref const(ValueClass!(QPointingDevice)) other) const;+/ 126 127 /+ Q_SIGNALS +/public: 128 // Workaround for https://issues.dlang.org/show_bug.cgi?id=22620 129 private enum dummyNamespaceQEventPoint = __traits(getCppNamespaces, QEventPoint); 130 131 mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{ 132 @QSignal final void grabChanged(QObject grabber, GrabTransition transition, const(QPointerEvent) event, ref const(QEventPoint) point) const; 133 })); 134 135 protected: 136 this(ref QPointingDevicePrivate d, QObject parent); 137 138 /+ Q_DISABLE_COPY_MOVE(QPointingDevice) +/ 139 mixin(CREATE_CONVENIENCE_WRAPPERS); 140 } 141 /+pragma(inline, true) QFlags!(QPointingDevice.PointerTypes.enum_type) operator |(QPointingDevice.PointerTypes.enum_type f1, QPointingDevice.PointerTypes.enum_type f2)/+noexcept+/{return QFlags!(QPointingDevice.PointerTypes.enum_type)(f1)|f2;}+/ 142 /+pragma(inline, true) QFlags!(QPointingDevice.PointerTypes.enum_type) operator |(QPointingDevice.PointerTypes.enum_type f1, QFlags!(QPointingDevice.PointerTypes.enum_type) f2)/+noexcept+/{return f2|f1;}+/ 143 /+pragma(inline, true) QFlags!(QPointingDevice.PointerTypes.enum_type) operator &(QPointingDevice.PointerTypes.enum_type f1, QPointingDevice.PointerTypes.enum_type f2)/+noexcept+/{return QFlags!(QPointingDevice.PointerTypes.enum_type)(f1)&f2;}+/ 144 /+pragma(inline, true) QFlags!(QPointingDevice.PointerTypes.enum_type) operator &(QPointingDevice.PointerTypes.enum_type f1, QFlags!(QPointingDevice.PointerTypes.enum_type) f2)/+noexcept+/{return f2&f1;}+/ 145 /+pragma(inline, true) void operator +(QPointingDevice.PointerTypes.enum_type f1, QPointingDevice.PointerTypes.enum_type f2)/+noexcept+/;+/ 146 /+pragma(inline, true) void operator +(QPointingDevice.PointerTypes.enum_type f1, QFlags!(QPointingDevice.PointerTypes.enum_type) f2)/+noexcept+/;+/ 147 /+pragma(inline, true) void operator +(int f1, QFlags!(QPointingDevice.PointerTypes.enum_type) f2)/+noexcept+/;+/ 148 /+pragma(inline, true) void operator -(QPointingDevice.PointerTypes.enum_type f1, QPointingDevice.PointerTypes.enum_type f2)/+noexcept+/;+/ 149 /+pragma(inline, true) void operator -(QPointingDevice.PointerTypes.enum_type f1, QFlags!(QPointingDevice.PointerTypes.enum_type) f2)/+noexcept+/;+/ 150 /+pragma(inline, true) void operator -(int f1, QFlags!(QPointingDevice.PointerTypes.enum_type) f2)/+noexcept+/;+/ 151 /+pragma(inline, true) QIncompatibleFlag operator |(QPointingDevice.PointerTypes.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/ 152 /+pragma(inline, true) void operator +(int f1, QPointingDevice.PointerTypes.enum_type f2)/+noexcept+/;+/ 153 /+pragma(inline, true) void operator +(QPointingDevice.PointerTypes.enum_type f1, int f2)/+noexcept+/;+/ 154 /+pragma(inline, true) void operator -(int f1, QPointingDevice.PointerTypes.enum_type f2)/+noexcept+/;+/ 155 /+pragma(inline, true) void operator -(QPointingDevice.PointerTypes.enum_type f1, int f2)/+noexcept+/;+/ 156 157 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QPointingDevice::PointerTypes) 158 #ifndef QT_NO_DEBUG_STREAM 159 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPointingDevice *); 160 #endif +/ 161 162 //typedef QPointingDevice QTouchDevice; // Qt 5 source compatibility if we need it? or could be "using" 163