7#include "keyboard_key.hpp"
8#include "../unicode/grapheme.hpp"
9#include "../geometry/transform.hpp"
11#include "../assert.hpp"
12#include "../command.hpp"
16namespace hi::inline v1 {
18enum class KeyboardState : uint8_t {
25[[nodiscard]]
constexpr KeyboardState
operator|(KeyboardState
const& lhs, KeyboardState
const& rhs)
noexcept
27 return static_cast<KeyboardState
>(to_underlying(lhs) | to_underlying(rhs));
30[[nodiscard]]
constexpr KeyboardState operator&(KeyboardState
const& lhs, KeyboardState
const& rhs)
noexcept
32 return static_cast<KeyboardState
>(to_underlying(lhs) & to_underlying(rhs));
35constexpr KeyboardState& operator|=(KeyboardState& lhs, KeyboardState
const& rhs)
noexcept
37 return lhs = lhs | rhs;
40bool operator>=(KeyboardState
const& lhs, KeyboardState
const& rhs) =
delete;
42[[nodiscard]]
constexpr bool any(KeyboardState
const& rhs)
noexcept
44 return static_cast<bool>(to_underlying(rhs));
48 enum class Type : uint8_t {
65 keyboard_event(KeyboardState state, keyboard_modifiers modifiers, keyboard_virtual_key key) noexcept :
66 type(Type::Key), state(state),
grapheme(), key(modifiers, key)
77 [[nodiscard]] friend
std::
string to_string(keyboard_event const& rhs) noexcept
82 case Type::Idle: r +=
"Idle";
break;
83 case Type::partial_grapheme: r +=
"partial_grapheme=";
break;
84 case Type::grapheme: r +=
"grapheme=";
break;
85 case Type::Key: r +=
"Key=";
break;
86 default: hi_no_default();
89 if (rhs.type == Type::partial_grapheme || rhs.type == Type::grapheme) {
91 }
else if (rhs.type == Type::Key) {
This file includes required definitions.
constexpr alignment operator|(horizontal_alignment lhs, vertical_alignment rhs) noexcept
Combine vertical and horizontal alignment.
Definition alignment.hpp:200
Definition keyboard_event.hpp:47
Type
Definition keyboard_event.hpp:48
keyboard_event(KeyboardState state, keyboard_modifiers modifiers, keyboard_virtual_key key) noexcept
Create a key-key keyboard event.
Definition keyboard_event.hpp:65
A key in combination with modifiers.
Definition keyboard_key.hpp:20
A grapheme, what a user thinks a character is.
Definition grapheme.hpp:34