2019-01-07 00:10:35 +08:00
|
|
|
#include "ftxui/component/event.hpp"
|
2018-10-19 04:58:38 +08:00
|
|
|
|
2019-01-12 22:00:08 +08:00
|
|
|
namespace ftxui {
|
2018-10-19 04:58:38 +08:00
|
|
|
|
2018-10-21 20:18:11 +08:00
|
|
|
constexpr int ESC = int(27);
|
2018-10-19 04:58:38 +08:00
|
|
|
|
|
|
|
// --- Character ---
|
2018-10-21 20:18:11 +08:00
|
|
|
Event Event::Character(int c) {
|
2018-10-19 04:58:38 +08:00
|
|
|
return Event{c};
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- Arrow ---
|
|
|
|
Event Event::ArrowLeft{ESC, '[', 'D'};
|
|
|
|
Event Event::ArrowRight{ESC, '[', 'C'};
|
|
|
|
Event Event::ArrowUp{ESC, '[', 'A'};
|
|
|
|
Event Event::ArrowDown{ESC, '[', 'B'};
|
|
|
|
|
|
|
|
// --- Other ---
|
2018-10-21 20:18:11 +08:00
|
|
|
Event Event::Backspace{127};
|
2018-10-19 04:58:38 +08:00
|
|
|
Event Event::Delete{ESC, '[', '3', '~'};
|
|
|
|
Event Event::Escape{ESC};
|
2018-10-21 20:18:11 +08:00
|
|
|
Event Event::Return{10};
|
2018-10-19 04:58:38 +08:00
|
|
|
|
|
|
|
Event Event::F1{ESC, '[', 'O', 'P'};
|
|
|
|
Event Event::F2{ESC, '[', 'O', 'Q'};
|
|
|
|
Event Event::F3{ESC, '[', 'O', 'R'};
|
|
|
|
Event Event::F4{ESC, '[', 'O', 'S'};
|
|
|
|
Event Event::F5{ESC, '[', '1', '5', '~'};
|
|
|
|
Event Event::F6{ESC, '[', '1', '7', '~'};
|
|
|
|
Event Event::F7{ESC, '[', '1', '8', '~'};
|
|
|
|
Event Event::F8{ESC, '[', '1', '9', '~'};
|
|
|
|
Event Event::F9{ESC, '[', '2', '0', '~'};
|
|
|
|
Event Event::F10{ESC, '[', '2', '1', '~'};
|
|
|
|
Event Event::F11{ESC, '[', '2', '1', '~'}; // Same as F10 ?
|
|
|
|
Event Event::F12{ESC, '[', '2', '4', '~'};
|
|
|
|
|
2019-01-27 09:33:06 +08:00
|
|
|
Event Event::Custom{0, 0, 0, 0, 0};
|
|
|
|
|
2019-01-12 22:00:08 +08:00
|
|
|
} // namespace ftxui
|