/src/qtbase/src/gui/kernel/qplatformcursor.h
Line | Count | Source |
1 | | // Copyright (C) 2016 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | // Qt-Security score:significant reason:default |
4 | | #ifndef QPLATFORMCURSOR_H |
5 | | #define QPLATFORMCURSOR_H |
6 | | |
7 | | // |
8 | | // W A R N I N G |
9 | | // ------------- |
10 | | // |
11 | | // This file is part of the QPA API and is not meant to be used |
12 | | // in applications. Usage of this API may make your code |
13 | | // source and binary incompatible with future versions of Qt. |
14 | | // |
15 | | |
16 | | #include <QtGui/qtguiglobal.h> |
17 | | #include <QtCore/QList> |
18 | | #include <QtGui/QImage> |
19 | | #include <QtGui/QMouseEvent> |
20 | | #include <QtCore/QObject> |
21 | | #include <qpa/qplatformscreen.h> |
22 | | #include <QtGui/QCursor> |
23 | | |
24 | | QT_BEGIN_NAMESPACE |
25 | | |
26 | | |
27 | | // Cursor graphics management |
28 | | class Q_GUI_EXPORT QPlatformCursorImage { |
29 | | public: |
30 | | QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) |
31 | 0 | { set(data, mask, width, height, hotX, hotY); } |
32 | 0 | QImage * image() { return &cursorImage; } |
33 | 0 | QPoint hotspot() const { return hot; } |
34 | | void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); |
35 | | void set(const QImage &image, int hx, int hy); |
36 | | void set(Qt::CursorShape); |
37 | | private: |
38 | | static void createSystemCursor(int id); |
39 | | QImage cursorImage; |
40 | | QPoint hot; |
41 | | }; |
42 | | |
43 | | class Q_GUI_EXPORT QPlatformCursor : public QObject { |
44 | | public: |
45 | | Q_DISABLE_COPY_MOVE(QPlatformCursor) |
46 | | |
47 | | enum Capability { |
48 | | OverrideCursor = 0x1 |
49 | | }; |
50 | | Q_DECLARE_FLAGS(Capabilities, Capability) |
51 | | |
52 | | QPlatformCursor(); |
53 | | |
54 | | // input methods |
55 | 0 | virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } |
56 | | #ifndef QT_NO_CURSOR |
57 | | virtual void changeCursor(QCursor * windowCursor, QWindow * window) = 0; |
58 | | virtual void setOverrideCursor(const QCursor &); |
59 | | virtual void clearOverrideCursor(); |
60 | | #endif // QT_NO_CURSOR |
61 | | virtual QPoint pos() const; |
62 | | virtual void setPos(const QPoint &pos); |
63 | | virtual QSize size() const; |
64 | | |
65 | 0 | static Capabilities capabilities() { return m_capabilities; } |
66 | 0 | static void setCapabilities(Capabilities c) { m_capabilities = c; } |
67 | 0 | static void setCapability(Capability c) { m_capabilities.setFlag(c); } |
68 | | |
69 | | private: |
70 | | friend void qt_qpa_set_cursor(QWidget * w, bool force); |
71 | | friend class QApplicationPrivate; |
72 | | |
73 | | static Capabilities m_capabilities; |
74 | | }; |
75 | | |
76 | | Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformCursor::Capabilities) Unexecuted instantiation: operator|(QPlatformCursor::Capability, QPlatformCursor::Capability) Unexecuted instantiation: operator|(QPlatformCursor::Capability, QFlags<QPlatformCursor::Capability>) Unexecuted instantiation: operator&(QPlatformCursor::Capability, QPlatformCursor::Capability) Unexecuted instantiation: operator&(QPlatformCursor::Capability, QFlags<QPlatformCursor::Capability>) Unexecuted instantiation: operator^(QPlatformCursor::Capability, QPlatformCursor::Capability) Unexecuted instantiation: operator^(QPlatformCursor::Capability, QFlags<QPlatformCursor::Capability>) Unexecuted instantiation: operator|(QPlatformCursor::Capability, int) |
77 | | |
78 | | QT_END_NAMESPACE |
79 | | |
80 | | #endif // QPLATFORMCURSOR_H |