source: trunk/src/gui/kernel/qcursor.h@ 67

Last change on this file since 67 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 4.5 KB
Line 
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
48QT_BEGIN_HEADER
49
50QT_BEGIN_NAMESPACE
51
52QT_MODULE(Gui)
53
54class QVariant;
55
56/*
57 ### The fake cursor has to go first with old qdoc.
58*/
59#ifdef QT_NO_CURSOR
60
61class Q_GUI_EXPORT QCursor
62{
63public:
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()); }
67private:
68 QCursor();
69};
70
71#endif // QT_NO_CURSOR
72
73#ifndef QT_NO_CURSOR
74
75struct QCursorData;
76class QBitmap;
77class QPixmap;
78
79#if defined(Q_WS_MAC)
80void qt_mac_set_cursor(const QCursor *c, const QPoint &p);
81#endif
82
83class Q_GUI_EXPORT QCursor
84{
85public:
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_X11)
118 Qt::HANDLE handle() const;
119 QCursor(Qt::HANDLE cursor);
120 static int x11Screen();
121#elif defined(Q_WS_MAC)
122 Qt::HANDLE handle() const;
123#elif defined(Q_WS_QWS)
124 int handle() const;
125#endif
126#endif
127
128private:
129 QCursorData *d;
130#if defined(Q_WS_MAC)
131 friend void qt_mac_set_cursor(const QCursor *c, const QPoint &p);
132#endif
133};
134
135#ifdef QT3_SUPPORT
136// CursorShape is defined in X11/X.h
137#ifdef CursorShape
138#define X_CursorShape CursorShape
139#undef CursorShape
140#endif
141typedef Qt::CursorShape QCursorShape;
142#ifdef X_CursorShape
143#define CursorShape X_CursorShape
144#endif
145#endif
146
147/*****************************************************************************
148 QCursor stream functions
149 *****************************************************************************/
150#ifndef QT_NO_DATASTREAM
151Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor);
152Q_GUI_EXPORT QDataStream &operator>>(QDataStream &inS, QCursor &cursor);
153#endif
154#endif // QT_NO_CURSOR
155
156QT_END_NAMESPACE
157
158QT_END_HEADER
159
160#endif // QCURSOR_H
Note: See TracBrowser for help on using the repository browser.