1 /**************************************************************************** 2 ** 3 ** DQt - D bindings for the Qt Toolkit 4 ** 5 ** GNU Lesser General Public License Usage 6 ** This file may be used under the terms of the GNU Lesser 7 ** General Public License version 3 as published by the Free Software 8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 9 ** packaging of this file. Please review the following information to 10 ** ensure the GNU Lesser General Public License version 3 requirements 11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 12 ** 13 ****************************************************************************/ 14 module qt.gui.cursor; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.metatype; 19 import qt.core.point; 20 import qt.gui.screen; 21 import qt.helpers; 22 version(QT_NO_CURSOR){}else 23 { 24 import qt.core.namespace; 25 import qt.core.variant; 26 import qt.gui.bitmap; 27 import qt.gui.pixmap; 28 } 29 30 /+ class QVariant; 31 class QScreen; +/ 32 33 /* 34 ### The fake cursor has to go first with old qdoc. 35 */ 36 version(QT_NO_CURSOR) 37 { 38 39 @(QMetaType.Type.QCursor) extern(C++, class) struct /+ Q_GUI_EXPORT +/ QCursor 40 { 41 public: 42 static QPoint pos(); 43 static QPoint pos(const(QScreen) screen); 44 static void setPos(int x, int y); 45 static void setPos(QScreen screen, int x, int y); 46 pragma(inline, true) static void setPos(ref const(QPoint) p) { setPos(p.x(), p.y()); } 47 private: 48 @disable this(); 49 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 50 ref typeof(this) rawConstructor(); 51 static typeof(this) create() 52 { 53 typeof(this) r = typeof(this).init; 54 r.rawConstructor(); 55 return r; 56 } 57 58 } 59 60 } 61 62 version(QT_NO_CURSOR){}else 63 { 64 65 extern(C++, class) struct QCursorData; 66 /+ class QBitmap; 67 class QPixmap; +/ 68 69 70 @(QMetaType.Type.QCursor) extern(C++, class) struct /+ Q_GUI_EXPORT +/ QCursor 71 { 72 public: 73 @disable this(); 74 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 75 ref typeof(this) rawConstructor(); 76 static typeof(this) create() 77 { 78 typeof(this) r = typeof(this).init; 79 r.rawConstructor(); 80 return r; 81 } 82 83 this(/+ Qt:: +/qt.core.namespace.CursorShape shape); 84 this(ref const(QBitmap) bitmap, ref const(QBitmap) mask, int hotX=-1, int hotY=-1); 85 this(ref const(QPixmap) pixmap, int hotX=-1, int hotY=-1); 86 @disable this(this); 87 this(ref const(QCursor) cursor); 88 ~this(); 89 /+ref QCursor operator =(ref const(QCursor) cursor);+/ 90 /+ QCursor(QCursor &&other) noexcept : d(other.d) { other.d = nullptr; } +/ 91 /+ inline QCursor &operator=(QCursor &&other) noexcept 92 { swap(other); return *this; } +/ 93 94 /+ void swap(QCursor &other) noexcept { qSwap(d, other.d); } +/ 95 96 /+auto opCast(T : QVariant)() const;+/ 97 98 /+ Qt:: +/qt.core.namespace.CursorShape shape() const; 99 void setShape(/+ Qt:: +/qt.core.namespace.CursorShape newShape); 100 101 /+ #if QT_DEPRECATED_SINCE(5, 15) +/ 102 /+ QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QBitmap by-value") +/ 103 const(QBitmap)* bitmap() const; // ### Qt 7: Remove function 104 105 /+ QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QBitmap by-value") +/ 106 const(QBitmap)* mask() const; // ### Qt 7: Remove function 107 108 QBitmap bitmap(/+ Qt:: +/qt.core.namespace.ReturnByValueConstant) const; 109 QBitmap mask(/+ Qt:: +/qt.core.namespace.ReturnByValueConstant) const; 110 /+ #else 111 QBitmap bitmap(Qt::ReturnByValueConstant = Qt::ReturnByValue) const; // ### Qt 7: Remove arg 112 QBitmap mask(Qt::ReturnByValueConstant = Qt::ReturnByValue) const; // ### Qt 7: Remove arg 113 #endif +/ // QT_DEPRECATED_SINCE(5, 15) 114 QPixmap pixmap() const; 115 QPoint hotSpot() const; 116 117 static QPoint pos(); 118 static QPoint pos(const(QScreen) screen); 119 static void setPos(int x, int y); 120 static void setPos(QScreen screen, int x, int y); 121 pragma(inline, true) static void setPos(ref const(QPoint) p) { setPos(p.x(), p.y()); } 122 pragma(inline, true) static void setPos(QScreen screen, ref const(QPoint) p) { setPos(screen, p.x(), p.y()); } 123 124 private: 125 /+ friend Q_GUI_EXPORT bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept; +/ 126 QCursorData* d; 127 } 128 /+ Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QCursor) +/ 129 130 /+/+ Q_GUI_EXPORT +/ bool operator ==(ref const(QCursor) lhs, ref const(QCursor) rhs)/+ noexcept+/;+/ 131 /+pragma(inline, true) bool operator !=(ref const(QCursor) lhs, ref const(QCursor) rhs)/+ noexcept+/ { return !(lhs == rhs); }+/ 132 133 /***************************************************************************** 134 QCursor stream functions 135 *****************************************************************************/ 136 /+ #ifndef QT_NO_DATASTREAM 137 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor); 138 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &inS, QCursor &cursor); 139 #endif 140 141 #ifndef QT_NO_DEBUG_STREAM 142 Q_GUI_EXPORT QDebug operator<<(QDebug, const QCursor &); 143 #endif +/ 144 145 } 146