-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathKeyEvent.hpp
49 lines (34 loc) · 1.22 KB
/
KeyEvent.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
////////////////////////////////////////////////////////////////////////////////////////////////////
// This file is part of CosmoScout VR //
////////////////////////////////////////////////////////////////////////////////////////////////////
// SPDX-FileCopyrightText: German Aerospace Center (DLR) <[email protected]>
// SPDX-License-Identifier: MIT
#ifndef CS_GUI_KEY_EVENT_HPP
#define CS_GUI_KEY_EVENT_HPP
#include "cs_gui_export.hpp"
#include "types.hpp"
namespace cs::gui {
/// Contains the data contained in an interaction with the keyboard.
struct CS_GUI_EXPORT KeyEvent {
enum class Type {
ePress, ///< A non character key was pressed.
eRelease, ///< A non character key was released.
eCharacter, ///< A character key was pressed.
eInvalid
};
KeyEvent();
KeyEvent(int key, int mods);
void setMods(int mods);
/// PRESS, RELEASE, CHARACTER.
Type mType{Type::ePress};
/// Bitwise or of any Modifier defined in types.hpp.
uint32_t mModifiers{};
union {
/// Only used for PRESS and RELEASE.
Key mKey;
/// Only used for CHARACTER.
uint16_t mCharacter{};
};
};
} // namespace cs::gui
#endif // CS_GUI_KEY_EVENT_HPP