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
4#ifndef QFBCURSOR_P_H
5#define QFBCURSOR_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qpa/qplatformcursor.h>
19#include <QtGui/private/qinputdevicemanager_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QFbScreen;
24class QFbCursor;
25
26class QFbCursorDeviceListener : public QObject
27{
28 Q_OBJECT
29
30public:
31 QFbCursorDeviceListener(QFbCursor *cursor) : m_cursor(cursor) { }
32 bool hasMouse() const;
33
34public slots:
35 void onDeviceListChanged(QInputDeviceManager::DeviceType type);
36
37private:
38 QFbCursor *m_cursor;
39};
40
41class QFbCursor : public QPlatformCursor
42{
43 Q_OBJECT
44
45public:
46 QFbCursor(QFbScreen *screen);
47 ~QFbCursor();
48
49 // output methods
50 QRect dirtyRect();
51 virtual QRect drawCursor(QPainter &painter);
52
53 // input methods
54 void pointerEvent(const QMouseEvent &event) override;
55 QPoint pos() const override;
56 void setPos(const QPoint &pos) override;
57#ifndef QT_NO_CURSOR
58 void changeCursor(QCursor *widgetCursor, QWindow *window) override;
59#endif
60
61 virtual void setDirty();
62 virtual bool isDirty() const { return mDirty; }
63 virtual bool isOnScreen() const { return mOnScreen; }
64 virtual QRect lastPainted() const { return mPrevRect; }
65
66 void updateMouseStatus();
67
68private:
69 void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
70 void setCursor(Qt::CursorShape shape);
71 void setCursor(const QImage &image, int hotx, int hoty);
72 QRect getCurrentRect() const;
73
74 bool mVisible;
75 QFbScreen *mScreen;
76 QRect mCurrentRect; // next place to draw the cursor
77 QRect mPrevRect; // last place the cursor was drawn
78 bool mDirty;
79 bool mOnScreen;
80 QScopedPointer<QPlatformCursorImage> mCursorImage;
81 QFbCursorDeviceListener *mDeviceListener;
82 QPoint m_pos;
83};
84
85QT_END_NAMESPACE
86
87#endif // QFBCURSOR_P_H
88

source code of qtbase/src/platformsupport/fbconvenience/qfbcursor_p.h