My Project
MirMousePointerInterface.h
1 /*
2  * Copyright (C) 2015-2016 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 
45 public:
49  MirMousePointerInterface(QQuickItem *parent = nullptr) : QQuickItem(parent) {}
50 
52  virtual void setCursorName(const QString &cursorName) = 0;
53  virtual QString cursorName() const = 0;
54 
55  virtual void setThemeName(const QString &themeName) = 0;
56  virtual QString themeName() const = 0;
58 
66  virtual void setCustomCursor(const QCursor &) = 0;
67 
68 Q_SIGNALS:
70  void cursorNameChanged(QString name);
71  void themeNameChanged(QString name);
73 
74 public Q_SLOTS:
87  virtual void handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButtons buttons,
88  Qt::KeyboardModifiers modifiers) = 0;
89 
94  virtual void handleWheelEvent(ulong timestamp, QPoint angleDelta, Qt::KeyboardModifiers modifiers) = 0;
95 
96 };
97 
98 #endif // MIR_MOUSE_POINTER_INTERFACE_H
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...
virtual void handleWheelEvent(ulong timestamp, QPoint angleDelta, Qt::KeyboardModifiers modifiers)=0
Handler for Mir mouse wheel events This is called by Mir's platform cursor.
MirMousePointerInterface(QQuickItem *parent=nullptr)
The constructor.
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.