Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
cursor_manager.h
1// SPDX-FileCopyrightText: © 2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <QCursor>
7#include <QtQmlIntegration>
8
12class CursorManager : public QObject
13{
14 Q_OBJECT
15 QML_ELEMENT
16 QML_SINGLETON
17
18public:
19 Q_INVOKABLE void
20 setCursorWithSize (const QString &imagePath, int hotX, int hotY, int size);
21 Q_INVOKABLE void setCursor (const QString &imagePath, int hotX, int hotY);
22
23 Q_INVOKABLE void setPointerCursor ();
24 Q_INVOKABLE void setPencilCursor ();
25 Q_INVOKABLE void setBrushCursor ();
26 Q_INVOKABLE void setCutCursor ();
27 Q_INVOKABLE void setEraserCursor ();
28 Q_INVOKABLE void setRampCursor ();
29 Q_INVOKABLE void setAuditionCursor ();
30 Q_INVOKABLE void setOpenHandCursor ();
31 Q_INVOKABLE void setClosedHandCursor ();
32 Q_INVOKABLE void setCopyCursor ();
33 Q_INVOKABLE void setLinkCursor ();
34 Q_INVOKABLE void setResizeStartCursor ();
35 Q_INVOKABLE void setStretchStartCursor ();
36 Q_INVOKABLE void setResizeLoopStartCursor ();
37 Q_INVOKABLE void setResizeEndCursor ();
38 Q_INVOKABLE void setStretchEndCursor ();
39 Q_INVOKABLE void setResizeLoopEndCursor ();
40 Q_INVOKABLE void setFadeInCursor ();
41 Q_INVOKABLE void setFadeOutCursor ();
42
43 Q_INVOKABLE void unsetCursor ();
44
45 Q_INVOKABLE static QPoint cursorPosition ();
46 Q_INVOKABLE static void warpCursor (QPoint point);
47
48private:
49 void set_cursor (const QString &cache_key, const QCursor &cursor);
50
51private:
52 int popped_cursor_count_ = 0;
53 QHash<QString, QCursor> cursor_cache_;
54 QString last_cursor_cache_key_;
55};
Cursor manager for arrangers.