QtGui/qplatformcursor_qpa.h Source File

qplatformcursor_qpa.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtOpenVG module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #ifndef QGRAPHICSSYSTEMCURSOR_H
42 #define QGRAPHICSSYSTEMCURSOR_H
43 
44 #include <QtCore/QList>
45 #include <QtGui/QImage>
46 #include <QtGui/QMouseEvent>
47 #include <QtCore/QWeakPointer>
48 #include <QtCore/QObject>
49 #include <QtGui/QPlatformScreen>
50 #include <QtGui/QCursor>
51 
53 
55 
56 QT_MODULE(Gui)
57 
58 // Cursor graphics management
59 class Q_GUI_EXPORT QPlatformCursorImage {
60 public:
61  QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
62  { set(data, mask, width, height, hotX, hotY); }
63  QImage * image() { return &cursorImage; }
64  QPoint hotspot() { return hot; }
65  void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
66  void set(const QImage &image, int hx, int hy);
67  void set(Qt::CursorShape);
68 private:
69  static void createSystemCursor(int id);
70  QImage cursorImage;
71  QPoint hot;
72 };
73 
74 class QPlatformCursor;
75 
77 public:
80 };
81 
82 class Q_GUI_EXPORT QPlatformCursor : public QObject {
83 public:
85 
86  // input methods
87  virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); }
88  virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0;
89  virtual QPoint pos() const;
90  virtual void setPos(const QPoint &pos);
91 
92 protected:
93  QPlatformScreen* screen; // Where to request an update
94 
95 private:
96  Q_DECLARE_PRIVATE(QPlatformCursor);
97  friend void qt_qpa_set_cursor(QWidget * w, bool force);
98  friend class QApplicationPrivate;
99 };
100 
102 
104 
105 #endif // QGRAPHICSSYSTEMCURSOR_H
virtual void pointerEvent(const QMouseEvent &event)
#define QT_END_NAMESPACE
Definition: qglobal.h:128
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
GLenum GLsizei width
Definition: GLee.h:873
QPlatformScreen * screen
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: GLee.h:882
static QList< QWeakPointer< QPlatformCursor > > instances
Definition: qpoint.h:53
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
GLenum GLsizei GLsizei height
Definition: GLee.h:883
Definition: qimage.h:87
CursorShape
Definition: qnamespace.h:1262
GLubyte GLubyte GLubyte GLubyte w
Definition: GLee.h:1775
QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
GLenum GLint GLuint mask
Definition: GLee.h:1701
#define QT_END_HEADER
Definition: qglobal.h:142
static QList< QWeakPointer< QPlatformCursor > > getInstances()