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.cursor;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.point;
17 import qt.core.typeinfo;
18 import qt.gui.screen;
19 import qt.helpers;
20 version(QT_NO_CURSOR){}else
21 {
22     import qt.core.namespace;
23     import qt.core.variant;
24     import qt.gui.bitmap;
25     import qt.gui.pixmap;
26 }
27 
28 
29 /*
30   ### The fake cursor has to go first with old qdoc.
31 */
32 version(QT_NO_CURSOR)
33 {
34 
35 /// Binding for C++ class [QCursor](https://doc.qt.io/qt-6/qcursor.html).
36 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_GUI_EXPORT +/ QCursor
37 {
38 public:
39     static QPoint pos();
40     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
41     static QPoint pos(const(QScreen) screen);
42     }));
43     static void setPos(int x, int y);
44     static void setPos(QScreen screen, int x, int y);
45     pragma(inline, true) static void setPos(ref const(QPoint) p) { setPos(p.x(), p.y()); }
46 private:
47     @disable this();
48     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
49     ref typeof(this) rawConstructor();
50     static typeof(this) create()
51     {
52         typeof(this) r = typeof(this).init;
53         r.rawConstructor();
54         return r;
55     }
56 
57     mixin(CREATE_CONVENIENCE_WRAPPERS);
58 }
59 
60 }
61 
62 version(QT_NO_CURSOR){}else
63 {
64 
65 extern(C++, class) struct QCursorData;
66 
67 
68 /// Binding for C++ class [QCursor](https://doc.qt.io/qt-6/qcursor.html).
69 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_GUI_EXPORT +/ QCursor
70 {
71 public:
72     @disable this();
73     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
74     ref typeof(this) rawConstructor();
75     static typeof(this) create()
76     {
77         typeof(this) r = typeof(this).init;
78         r.rawConstructor();
79         return r;
80     }
81 
82     this(/+ Qt:: +/qt.core.namespace.CursorShape shape);
83     this(ref const(QBitmap) bitmap, ref const(QBitmap) mask, int hotX=-1, int hotY=-1);
84     /+ explicit +/this(ref const(QPixmap) pixmap, int hotX=-1, int hotY=-1);
85     @disable this(this);
86     this(ref const(QCursor) cursor);
87     ~this();
88     /+ref QCursor operator =(ref const(QCursor) cursor);+/
89     /+ QCursor(QCursor &&other) noexcept : d(qExchange(other.d, nullptr)) {} +/
90     /+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCursor) +/
91 
92     /+ void swap(QCursor &other) noexcept { qSwap(d, other.d); } +/
93 
94     /+auto opCast(T : QVariant)() const;+/
95 
96     /+ Qt:: +/qt.core.namespace.CursorShape shape() const;
97     void setShape(/+ Qt:: +/qt.core.namespace.CursorShape newShape);
98 
99 /+ #if QT_DEPRECATED_SINCE(6, 0) +/
100     QBitmap bitmap(/+ Qt:: +/qt.core.namespace.ReturnByValueConstant) const { return bitmap(); }
101     QBitmap mask(/+ Qt:: +/qt.core.namespace.ReturnByValueConstant) const { return mask(); }
102 /+ #endif +/ // QT_DEPRECATED_SINCE(6, 0)
103     QBitmap bitmap() const;
104     QBitmap mask() const;
105 
106     QPixmap pixmap() const;
107     QPoint hotSpot() const;
108 
109     static QPoint pos();
110     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
111     static QPoint pos(const(QScreen) screen);
112     }));
113     static void setPos(int x, int y);
114     static void setPos(QScreen screen, int x, int y);
115     pragma(inline, true) static void setPos(ref const(QPoint) p) { setPos(p.x(), p.y()); }
116     pragma(inline, true) static void setPos(QScreen screen, ref const(QPoint) p) { setPos(screen, p.x(), p.y()); }
117 
118 private:
119     /+ friend Q_GUI_EXPORT bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept; +/
120     /+ friend inline bool operator!=(const QCursor &lhs, const QCursor &rhs) noexcept { return !(lhs == rhs); } +/
121     QCursorData* d;
122     mixin(CREATE_CONVENIENCE_WRAPPERS);
123 }
124 /+ Q_DECLARE_SHARED(QCursor)
125 
126 /*****************************************************************************
127   QCursor stream functions
128  *****************************************************************************/
129 #ifndef QT_NO_DATASTREAM
130 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor);
131 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &inS, QCursor &cursor);
132 #endif
133 
134 #ifndef QT_NO_DEBUG_STREAM
135 Q_GUI_EXPORT QDebug operator<<(QDebug, const QCursor &);
136 #endif +/
137 
138 }
139