7#include "keyboard_key.hpp"
8#include "../text/grapheme.hpp"
9#include "../required.hpp"
10#include "../assert.hpp"
11#include "../command.hpp"
12#include "../geometry/transform.hpp"
17enum class KeyboardState : uint8_t {
24[[nodiscard]]
constexpr KeyboardState operator|(KeyboardState lhs, KeyboardState rhs)
noexcept {
25 return static_cast<KeyboardState
>(
static_cast<uint8_t
>(lhs) |
static_cast<uint8_t
>(rhs));
28constexpr KeyboardState &operator|=(KeyboardState &lhs, KeyboardState rhs)
noexcept {
33[[nodiscard]]
constexpr bool operator>=(KeyboardState lhs, KeyboardState rhs)
noexcept {
34 ttlet lhs_ =
static_cast<uint8_t
>(lhs);
35 ttlet rhs_ =
static_cast<uint8_t
>(rhs);
36 return (lhs_ & rhs_) == rhs_;
41 enum class Type : uint8_t {
55 type(type), state(),
grapheme(), key() {}
59 keyboard_event(KeyboardState state, keyboard_modifiers modifiers, keyboard_virtual_key key) noexcept :
67 [[nodiscard]] friend
std::
string to_string(keyboard_event const &rhs) noexcept {
71 case Type::Idle: r +=
"Idle";
break;
75 default: tt_no_default();
79 r += to_string(rhs.grapheme);
81 r += to_string(rhs.key);
89 return lhs << to_string(rhs);
Definition keyboard_event.hpp:40
Type
Definition keyboard_event.hpp:41
@ Key
Key (+modifiers) was used to send a key.
@ Partialgrapheme
The user is combining a grapheme.
@ grapheme
The user has finished entering a grapheme.
keyboard_event(KeyboardState state, keyboard_modifiers modifiers, keyboard_virtual_key key) noexcept
Create a key-key keyboard event.
Definition keyboard_event.hpp:59
A key in combination with modifiers.
Definition keyboard_key.hpp:20
Definition grapheme.hpp:21