15#pragma clang diagnostic ignored "-Wshadow"
17#pragma GCC diagnostic ignored "-Wshadow"
18#elif defined(_MSC_VER)
19#pragma warning(disable : 6244)
20#pragma warning(disable : 6246)
29Event Event::Character(std::string input) {
31 event.input_ = std::move(
input);
32 event.type_ = Type::Character;
41 return Event::Character(std::string{
c});
48Event Event::Character(
wchar_t c) {
49 return Event::Character(
to_string(std::wstring{
c}));
57Event Event::Mouse(std::string input,
struct Mouse mouse) {
59 event.input_ = std::move(
input);
60 event.type_ = Type::Mouse;
61 event.data_.mouse =
mouse;
67Event Event::CursorShape(std::string input,
int shape) {
69 event.input_ = std::move(
input);
70 event.type_ = Type::CursorShape;
71 event.data_.cursor_shape = shape;
81 event.input_ = std::move(
input);
87Event Event::CursorPosition(std::string input,
int x,
int y) {
89 event.input_ = std::move(
input);
90 event.type_ = Type::CursorPosition;
91 event.data_.cursor = {
x,
y};
245 case Type::Character: {
246 return "Event::Character(\"" + input_ +
"\")";
249 std::string
out =
"Event::Mouse(\"...\", Mouse{";
254 if (data_.mouse.shift) {
255 out +=
".shift = true, ";
257 if (data_.mouse.meta) {
258 out +=
".meta = true, ";
260 if (data_.mouse.control) {
261 out +=
".control = true, ";
263 out +=
".x = " + std::to_string(data_.mouse.x);
265 out +=
".y = " + std::to_string(data_.mouse.y);
269 case Type::CursorShape:
270 return "Event::CursorShape(" + input_ +
", " +
271 std::to_string(data_.cursor_shape) +
")";
272 case Type::CursorPosition:
273 return "Event::CursorPosition(" + input_ +
", " +
274 std::to_string(data_.cursor.x) +
", " +
275 std::to_string(data_.cursor.y) +
")";
329const Event
Event::a = Event::Character(
"a");
330const Event
Event::b = Event::Character(
"b");
331const Event
Event::c = Event::Character(
"c");
332const Event
Event::d = Event::Character(
"d");
333const Event
Event::e = Event::Character(
"e");
334const Event
Event::f = Event::Character(
"f");
335const Event
Event::g = Event::Character(
"g");
336const Event
Event::h = Event::Character(
"h");
337const Event
Event::i = Event::Character(
"i");
338const Event
Event::j = Event::Character(
"j");
339const Event
Event::k = Event::Character(
"k");
340const Event
Event::l = Event::Character(
"l");
341const Event
Event::m = Event::Character(
"m");
342const Event
Event::n = Event::Character(
"n");
343const Event
Event::o = Event::Character(
"o");
344const Event
Event::p = Event::Character(
"p");
345const Event
Event::q = Event::Character(
"q");
346const Event
Event::r = Event::Character(
"r");
347const Event
Event::s = Event::Character(
"s");
348const Event
Event::t = Event::Character(
"t");
349const Event
Event::u = Event::Character(
"u");
350const Event
Event::v = Event::Character(
"v");
351const Event
Event::w = Event::Character(
"w");
352const Event
Event::x = Event::Character(
"x");
353const Event
Event::y = Event::Character(
"y");
354const Event
Event::z = Event::Character(
"z");
356const Event
Event::A = Event::Character(
"A");
357const Event
Event::B = Event::Character(
"B");
358const Event
Event::C = Event::Character(
"C");
359const Event
Event::D = Event::Character(
"D");
360const Event
Event::E = Event::Character(
"E");
361const Event
Event::F = Event::Character(
"F");
362const Event
Event::G = Event::Character(
"G");
363const Event
Event::H = Event::Character(
"H");
364const Event
Event::I = Event::Character(
"I");
365const Event
Event::J = Event::Character(
"J");
366const Event
Event::K = Event::Character(
"K");
367const Event
Event::L = Event::Character(
"L");
368const Event
Event::M = Event::Character(
"M");
369const Event
Event::N = Event::Character(
"N");
370const Event
Event::O = Event::Character(
"O");
371const Event
Event::P = Event::Character(
"P");
372const Event
Event::Q = Event::Character(
"Q");
373const Event
Event::R = Event::Character(
"R");
374const Event
Event::S = Event::Character(
"S");
375const Event
Event::T = Event::Character(
"T");
376const Event
Event::U = Event::Character(
"U");
377const Event
Event::V = Event::Character(
"V");
378const Event
Event::W = Event::Character(
"W");
379const Event
Event::X = Event::Character(
"X");
380const Event
Event::Y = Event::Character(
"Y");
381const Event
Event::Z = Event::Character(
"Z");
std::shared_ptr< T > Make(Args &&... args)
std::string to_string(const std::wstring &s)
Convert a UTF8 std::string into a std::wstring.
Represent an event. It can be key press event, a terminal resize, or more ...
static const Event TabReverse
static const Event ArrowLeftCtrl
static const Event CtrlAltX
static const Event CtrlAltN
static const Event CtrlAltC
static const Event PageUp
static const Event CtrlAltF
static const Event Escape
static const Event CtrlAltI
static const Event CtrlAltP
static const Event CtrlAltE
static const Event CtrlAltJ
static const Event CtrlAltH
static const Event CtrlAltW
static const Event CtrlAltO
static const Event Custom
std::string DebugString() const
Return a string representation of the event.
static const Event CtrlAltM
static const Event Backspace
static const Event CtrlAltR
static const Event ArrowUp
const std::string & input() const
static const Event CtrlAltZ
static const Event ArrowDown
static const Event CtrlAltY
static const Event CtrlAltL
static const Event ArrowUpCtrl
static const Event CtrlAltS
static const Event PageDown
static const Event CtrlAltK
static const Event CtrlAltG
static const Event Return
static const Event CtrlAltU
static const Event CtrlAltT
static const Event CtrlAltA
static const Event ArrowLeft
static const Event CtrlAltB
static const Event Delete
static const Event CtrlAltV
static const Event ArrowDownCtrl
static const Event CtrlAltD
static const Event Insert
static const Event ArrowRightCtrl
static const Event CtrlAltQ
static Event Special(std::string)
An custom event whose meaning is defined by the user of the library.
static const Event ArrowRight
A mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift,...
@ WheelRight
Supported terminal only.