1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QCURSOR_H
|
---|
43 | #define QCURSOR_H
|
---|
44 |
|
---|
45 | #include <QtCore/qpoint.h>
|
---|
46 | #include <QtGui/qwindowdefs.h>
|
---|
47 |
|
---|
48 | QT_BEGIN_HEADER
|
---|
49 |
|
---|
50 | QT_BEGIN_NAMESPACE
|
---|
51 |
|
---|
52 | QT_MODULE(Gui)
|
---|
53 |
|
---|
54 | class QVariant;
|
---|
55 |
|
---|
56 | /*
|
---|
57 | ### The fake cursor has to go first with old qdoc.
|
---|
58 | */
|
---|
59 | #ifdef QT_NO_CURSOR
|
---|
60 |
|
---|
61 | class Q_GUI_EXPORT QCursor
|
---|
62 | {
|
---|
63 | public:
|
---|
64 | static QPoint pos();
|
---|
65 | static void setPos(int x, int y);
|
---|
66 | inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); }
|
---|
67 | private:
|
---|
68 | QCursor();
|
---|
69 | };
|
---|
70 |
|
---|
71 | #endif // QT_NO_CURSOR
|
---|
72 |
|
---|
73 | #ifndef QT_NO_CURSOR
|
---|
74 |
|
---|
75 | struct QCursorData;
|
---|
76 | class QBitmap;
|
---|
77 | class QPixmap;
|
---|
78 |
|
---|
79 | #if defined(Q_WS_MAC)
|
---|
80 | void qt_mac_set_cursor(const QCursor *c, const QPoint &p);
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | class Q_GUI_EXPORT QCursor
|
---|
84 | {
|
---|
85 | public:
|
---|
86 | QCursor();
|
---|
87 | QCursor(Qt::CursorShape shape);
|
---|
88 | QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX=-1, int hotY=-1);
|
---|
89 | QCursor(const QPixmap &pixmap, int hotX=-1, int hotY=-1);
|
---|
90 | QCursor(const QCursor &cursor);
|
---|
91 | ~QCursor();
|
---|
92 | QCursor &operator=(const QCursor &cursor);
|
---|
93 | operator QVariant() const;
|
---|
94 |
|
---|
95 | Qt::CursorShape shape() const;
|
---|
96 | void setShape(Qt::CursorShape newShape);
|
---|
97 |
|
---|
98 | const QBitmap *bitmap() const;
|
---|
99 | const QBitmap *mask() const;
|
---|
100 | QPixmap pixmap() const;
|
---|
101 | QPoint hotSpot() const;
|
---|
102 |
|
---|
103 | static QPoint pos();
|
---|
104 | static void setPos(int x, int y);
|
---|
105 | inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); }
|
---|
106 |
|
---|
107 | #ifdef qdoc
|
---|
108 | HCURSOR_or_HANDLE handle() const;
|
---|
109 | QCursor(HCURSOR cursor);
|
---|
110 | QCursor(Qt::HANDLE cursor);
|
---|
111 | #endif
|
---|
112 |
|
---|
113 | #ifndef qdoc
|
---|
114 | #if defined(Q_WS_WIN)
|
---|
115 | HCURSOR handle() const;
|
---|
116 | QCursor(HCURSOR cursor);
|
---|
117 | #elif defined(Q_WS_PM)
|
---|
118 | HPOINTER handle() const;
|
---|
119 | QCursor(HPOINTER handle);
|
---|
120 | #elif defined(Q_WS_X11)
|
---|
121 | Qt::HANDLE handle() const;
|
---|
122 | QCursor(Qt::HANDLE cursor);
|
---|
123 | static int x11Screen();
|
---|
124 | #elif defined(Q_WS_MAC)
|
---|
125 | Qt::HANDLE handle() const;
|
---|
126 | #elif defined(Q_WS_QWS)
|
---|
127 | int handle() const;
|
---|
128 | #endif
|
---|
129 | #endif
|
---|
130 |
|
---|
131 | private:
|
---|
132 | QCursorData *d;
|
---|
133 | #if defined(Q_WS_MAC)
|
---|
134 | friend void qt_mac_set_cursor(const QCursor *c, const QPoint &p);
|
---|
135 | #endif
|
---|
136 | };
|
---|
137 |
|
---|
138 | #ifdef QT3_SUPPORT
|
---|
139 | // CursorShape is defined in X11/X.h
|
---|
140 | #ifdef CursorShape
|
---|
141 | #define X_CursorShape CursorShape
|
---|
142 | #undef CursorShape
|
---|
143 | #endif
|
---|
144 | typedef Qt::CursorShape QCursorShape;
|
---|
145 | #ifdef X_CursorShape
|
---|
146 | #define CursorShape X_CursorShape
|
---|
147 | #endif
|
---|
148 | #endif
|
---|
149 |
|
---|
150 | /*****************************************************************************
|
---|
151 | QCursor stream functions
|
---|
152 | *****************************************************************************/
|
---|
153 | #ifndef QT_NO_DATASTREAM
|
---|
154 | Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor);
|
---|
155 | Q_GUI_EXPORT QDataStream &operator>>(QDataStream &inS, QCursor &cursor);
|
---|
156 | #endif
|
---|
157 | #endif // QT_NO_CURSOR
|
---|
158 |
|
---|
159 | QT_END_NAMESPACE
|
---|
160 |
|
---|
161 | QT_END_HEADER
|
---|
162 |
|
---|
163 | #endif // QCURSOR_H
|
---|