3#include "di/container/string/string.h"
4#include "di/container/string/string_view.h"
5#include "di/reflect/enumerator.h"
6#include "di/reflect/field.h"
7#include "di/reflect/prelude.h"
18constexpr auto tag_invoke(di::Tag<di::reflect>, di::InPlaceType<KeyEventType>) {
20 return di::make_enumerators<
"KeyEventType">(di::enumerator<
"Press",
Press>, di::enumerator<
"Repeat",
Repeat>,
21 di::enumerator<
"Release",
Release>);
18constexpr auto tag_invoke(di::Tag<di::reflect>, di::InPlaceType<KeyEventType>) {
…}
38 , m_text(di::move(
text)) {}
42 constexpr auto key() const ->
Key {
return m_key; }
43 constexpr auto shifted_key() const -> c32 {
return m_shifted_key; }
45 constexpr auto text() const -> di::StringView {
return m_text; }
50 constexpr friend auto tag_invoke(di::Tag<di::reflect>, di::InPlaceType<KeyEvent>) {
51 return di::make_fields<
"KeyEvent">(
52 di::field<
"type", &KeyEvent::m_type>, di::field<
"modifers", &KeyEvent::m_modifiers>,
53 di::field<
"key", &KeyEvent::m_key>, di::field<
"shifted_key", &KeyEvent::m_shifted_key>,
54 di::field<
"base_layout_key", &KeyEvent::m_base_layout_key>, di::field<
"text", &KeyEvent::m_text>);
50 constexpr friend auto tag_invoke(di::Tag<di::reflect>, di::InPlaceType<KeyEvent>) {
…}
60 c32 m_shifted_key { 0 };
61 c32 m_base_layout_key { 0 };
Definition key_event.h:24
auto operator==(KeyEvent const &) const -> bool=default
constexpr auto modifiers() const -> Modifiers
Definition key_event.h:41
constexpr auto shifted_key() const -> c32
Definition key_event.h:43
constexpr auto key() const -> Key
Definition key_event.h:42
constexpr KeyEvent(KeyEventType type, Key key, di::String text={}, Modifiers modifiers=Modifiers::None, c32 shifted_key=0, c32 base_layout_key=0)
Definition key_event.h:31
constexpr auto text() const -> di::StringView
Definition key_event.h:45
constexpr friend auto tag_invoke(di::Tag< di::reflect >, di::InPlaceType< KeyEvent >)
Definition key_event.h:50
constexpr auto type() const -> KeyEventType
Definition key_event.h:40
constexpr auto base_layout_key() const -> c32
Definition key_event.h:44
static constexpr auto key_down(Key key, di::String text={}, Modifiers modifiers=Modifiers::None, c32 shifted_key=0, c32 base_layout_key=0) -> KeyEvent
Definition key_event.h:26
Definition cursor_style.h:5
Modifiers
Definition modifiers.h:9
@ None
Definition modifiers.h:10
KeyEventType
Definition key_event.h:12
@ Press
Definition key_event.h:13
@ Repeat
Definition key_event.h:14
@ Release
Definition key_event.h:15
constexpr auto tag_invoke(di::Tag< di::reflect >, di::InPlaceType< CursorStyle >)
Definition cursor_style.h:16