libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
mouseevent.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
13#include <promeki/event.h>
14#include <promeki/string.h>
15#include <promeki/point.h>
16
17PROMEKI_NAMESPACE_BEGIN
18
26class MouseEvent : public Event {
27 public:
29 static const Type Mouse;
30
32 enum Button : uint8_t {
33 NoButton = 0x00,
34 LeftButton = 0x01,
35 MiddleButton = 0x02,
36 RightButton = 0x04
37 };
38
40 enum Action : uint8_t {
41 Press,
42 Release,
43 Move,
44 DoubleClick,
45 ScrollUp,
46 ScrollDown
47 };
48
50 enum Modifier : uint8_t {
51 NoModifier = 0x00,
52 ShiftModifier = 0x01,
53 CtrlModifier = 0x02,
54 AltModifier = 0x04,
55 MetaModifier = 0x08
56 };
57
66 MouseEvent(const Point2Di32 &pos, Button button, Action action, uint8_t modifiers = NoModifier,
67 uint8_t buttons = 0)
68 : Event(Mouse), _pos(pos), _button(button), _action(action), _modifiers(modifiers),
69 _buttons(buttons) {}
70
72 const Point2Di32 &pos() const { return _pos; }
73
75 int x() const { return _pos.x(); }
76
78 int y() const { return _pos.y(); }
79
81 Button button() const { return _button; }
82
84 Action action() const { return _action; }
85
87 uint8_t modifiers() const { return _modifiers; }
88
90 uint8_t buttons() const { return _buttons; }
91
93 static String buttonName(Button button);
94
96 static String buttonsString(uint8_t buttons);
97
99 static String actionName(Action action);
100
101 private:
102 Point2Di32 _pos;
103 Button _button;
104 Action _action;
105 uint8_t _modifiers;
106 uint8_t _buttons = 0;
107};
108
109PROMEKI_NAMESPACE_END
110
111#endif // PROMEKI_ENABLE_CORE