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 <QHash>
8#include <QObject>
9#include <QtQmlIntegration/qqmlintegration.h>
10
14class CursorManager : public QObject
15{
16 Q_OBJECT
17 QML_ELEMENT
18 QML_SINGLETON
19
20public:
21 Q_INVOKABLE void
22 setCursorWithSize (const QString &imagePath, int hotX, int hotY, int size);
23 Q_INVOKABLE void setCursor (const QString &imagePath, int hotX, int hotY);
24
25 Q_INVOKABLE void setPointerCursor ();
26 Q_INVOKABLE void setPencilCursor ();
27 Q_INVOKABLE void setBrushCursor ();
28 Q_INVOKABLE void setCutCursor ();
29 Q_INVOKABLE void setEraserCursor ();
30 Q_INVOKABLE void setRampCursor ();
31 Q_INVOKABLE void setAuditionCursor ();
32 Q_INVOKABLE void setOpenHandCursor ();
33 Q_INVOKABLE void setClosedHandCursor ();
34 Q_INVOKABLE void setCopyCursor ();
35 Q_INVOKABLE void setLinkCursor ();
36 Q_INVOKABLE void setResizeStartCursor ();
37 Q_INVOKABLE void setStretchStartCursor ();
38 Q_INVOKABLE void setResizeLoopStartCursor ();
39 Q_INVOKABLE void setResizeEndCursor ();
40 Q_INVOKABLE void setStretchEndCursor ();
41 Q_INVOKABLE void setResizeLoopEndCursor ();
42 Q_INVOKABLE void setFadeInCursor ();
43 Q_INVOKABLE void setFadeOutCursor ();
44
45 Q_INVOKABLE void unsetCursor ();
46
47 Q_INVOKABLE static QPoint cursorPosition ();
48 Q_INVOKABLE static void warpCursor (QPoint point);
49
50private:
51 void set_cursor (const QString &cache_key, const QCursor &cursor);
52
53private:
54 int popped_cursor_count_ = 0;
55 QHash<QString, QCursor> cursor_cache_;
56 QString last_cursor_cache_key_;
57};
Cursor manager for arrangers.