-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathMouseEvent.hpp
48 lines (35 loc) · 1.33 KB
/
MouseEvent.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
////////////////////////////////////////////////////////////////////////////////////////////////////
// This file is part of CosmoScout VR //
////////////////////////////////////////////////////////////////////////////////////////////////////
// SPDX-FileCopyrightText: German Aerospace Center (DLR) <[email protected]>
// SPDX-License-Identifier: MIT
#ifndef CS_GUI_MOUSE_EVENT_HPP
#define CS_GUI_MOUSE_EVENT_HPP
#include "cs_gui_export.hpp"
#include "types.hpp"
namespace cs::gui {
/// Contains all information, when the state of the mouse changes.
struct CS_GUI_EXPORT MouseEvent {
enum class Type {
eMove, ///< The mouse moved.
eScroll, ///< The scroll wheel moved.
ePress, ///< A mouse button was pressed.
eRelease, ///< A mouse button was released.
eLeave ///< The mouse left the window
};
MouseEvent() // NOLINT(cppcoreguidelines-pro-type-member-init): Can't init both union types.
: mX(0) {
}
/// Either eMove, eScroll, ePress or eRelease.
Type mType{Type::eMove};
union {
/// X-position for eMove, x-direction for eScroll.
int mX;
/// Only used for ePress and eRelease.
Button mButton;
};
/// Y-position for eMove, y-direction for eScroll.
int mY{0};
};
} // namespace cs::gui
#endif // CS_GUI_MOUSE_EVENT_HPP