My Project
MirMousePointerInterface.h
1 /*
2  * Copyright (C) 2015 Canonical, Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 3, as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10  * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef MIR_MOUSE_POINTER_INTERFACE_H
18 #define MIR_MOUSE_POINTER_INTERFACE_H
19 
20 #include <QQuickItem>
21 
29 class MirMousePointerInterface : public QQuickItem {
30  Q_OBJECT
31 
36  Q_PROPERTY(QString cursorName READ cursorName NOTIFY cursorNameChanged)
37 
38 
43  Q_PROPERTY(QString themeName READ themeName NOTIFY themeNameChanged)
44 
49  Q_PROPERTY(qreal hotspotX READ hotspotX NOTIFY hotspotXChanged)
50 
55  Q_PROPERTY(qreal hotspotY READ hotspotY NOTIFY hotspotYChanged)
56 public:
60  MirMousePointerInterface(QQuickItem *parent = nullptr) : QQuickItem(parent) {}
61 
63  virtual void setCursorName(const QString &cursorName) = 0;
64  virtual QString cursorName() const = 0;
65 
66  virtual void setThemeName(const QString &themeName) = 0;
67  virtual QString themeName() const = 0;
68 
69  virtual qreal hotspotX() const = 0;
70  virtual qreal hotspotY() const = 0;
72 
80  virtual void setCustomCursor(const QCursor &) = 0;
81 
82 Q_SIGNALS:
84  void cursorNameChanged(QString name);
85  void themeNameChanged(QString name);
86  void hotspotXChanged(qreal value);
87  void hotspotYChanged(qreal value);
89 
90 public Q_SLOTS:
103  virtual void handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButtons buttons,
104  Qt::KeyboardModifiers modifiers) = 0;
105 
110  virtual void handleWheelEvent(ulong timestamp, QPoint angleDelta, Qt::KeyboardModifiers modifiers) = 0;
111 
112 };
113 
114 #endif // MIR_MOUSE_POINTER_INTERFACE_H
virtual void handleWheelEvent(ulong timestamp, QPoint angleDelta, Qt::KeyboardModifiers modifiers)=0
Handler for Mir mouse wheel events This is called by Mir&#39;s platform cursor.
qreal hotspotY
Y coordinate of the cursor hotspot Is value depends on the current cursor name and theme...
Definition: MirMousePointerInterface.h:55
The QML mouse pointer.
Definition: MirMousePointerInterface.h:29
virtual void handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)=0
Handler for Mir mouse events The implementation should respond to Mir mouse events by moving itself a...
qreal hotspotX
X coordinate of the cursor hotspot Is value depends on the current cursor name and theme...
Definition: MirMousePointerInterface.h:49
QString themeName
Name of the cursor theme Defines the look of the mouse pointer along with cursorName Its default valu...
Definition: MirMousePointerInterface.h:43
QString cursorName
Name of the cursor Defines the look of the mouse pointer along with themeName.
Definition: MirMousePointerInterface.h:36
virtual void setCustomCursor(const QCursor &)=0
Sets the custom cursor.