-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcursor.hpp
73 lines (56 loc) · 1.59 KB
/
cursor.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
This file is part of the Okteta Gui library, made within the KDE community.
SPDX-FileCopyrightText: 2003 Friedrich W. H. Kossebau <[email protected]>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#ifndef OKTETA_CURSOR_HPP
#define OKTETA_CURSOR_HPP
// lib
#include "pixelmetrics.hpp"
// Qt
#include <QPixmap>
namespace Okteta {
/**
* @author Friedrich W. H. Kossebau
*/
class Cursor
{
public:
Cursor();
Cursor(const Cursor&) = delete;
Cursor(Cursor&&) = delete;
~Cursor();
Cursor& operator=(const Cursor&) = delete;
Cursor& operator=(Cursor&&) = delete;
public:
/** sets size of the full cursor */
void setSize(PixelX Width, PixelY Height, qreal devicePixelRatio);
/** sets the shape of the cursor to be drawn */
void setShape(PixelX X, PixelX W, qreal devicePixelRatio);
public: // access
[[nodiscard]]
QPixmap& onPixmap();
[[nodiscard]]
QPixmap& offPixmap();
[[nodiscard]]
PixelX cursorX() const;
[[nodiscard]]
PixelX shapeX() const;
[[nodiscard]]
PixelX shapeW() const;
private:
QPixmap OnPixmap;
QPixmap OffPixmap;
PixelX CursorX = 0;
PixelX ShapeX = -1;
PixelX ShapeW = -1;
};
inline Cursor::Cursor() = default;
inline Cursor::~Cursor() = default;
inline QPixmap& Cursor::onPixmap() { return OnPixmap; }
inline QPixmap& Cursor::offPixmap() { return OffPixmap; }
inline PixelX Cursor::cursorX() const { return CursorX; }
inline PixelX Cursor::shapeX() const { return ShapeX; }
inline PixelX Cursor::shapeW() const { return ShapeW; }
}
#endif