ftxui::Event
cpp
#include <ftxui/component/event.hpp>Represent an event. It can be key press event, a terminal resize, or more ...
For example:
- Printable character can be created using Event::Character('a').
- Some special are predefined, like Event::ArrowLeft.
- One can find arbitrary code for special Events using: ./example/util/print_key_press For instance, CTLR+A maps to Event::Special({1});
Useful documentation about xterm specification: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
Examples: component/canvas_animated, component/custom_loop, component/homescreen, component/print_key_press
Summary
Static Attributes
ArrowLeft
ArrowRight
cpp
static const Event ArrowRight = Event::Special("\x1B[C");ArrowUp
ArrowDown
ArrowLeftCtrl
cpp
static const Event ArrowLeftCtrl = Event::Special("\x1B[1;5D");ArrowRightCtrl
cpp
static const Event ArrowRightCtrl = Event::Special("\x1B[1;5C");ArrowUpCtrl
cpp
static const Event ArrowUpCtrl = Event::Special("\x1B[1;5A");ArrowDownCtrl
cpp
static const Event ArrowDownCtrl = Event::Special("\x1B[1;5B");Backspace
Delete
Return
Escape
Tab
Examples: component/canvas_animated, component/homescreen, component/modal_dialog_custom, component/print_key_press, component/tab_horizontal, component/tab_vertical
TabReverse
cpp
static const Event TabReverse = Event::Special({27, 91, 90});F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
Home
End
PageUp
PageDown
Custom
Public Attributes
screen_
cpp
ScreenInteractive * screen_ = nullptr;mouse
cpp
struct Mouse mouse;Examples: component/canvas_animated, component/print_key_press
cursor
cpp
struct Cursor cursor;Static Functions
CursorReporting
cpp
static Event CursorReporting(std::string, int x, int y);Public Member Functions
is_character
cpp
bool is_character() const;Examples: component/print_key_press
character
cpp
std::string character() const;is_mouse
cpp
bool is_mouse() const;Examples: component/canvas_animated, component/print_key_press
mouse
cpp
struct Mouse & mouse();is_cursor_reporting
cpp
bool is_cursor_reporting() const;cursor_x
cpp
int cursor_x() const;cursor_y
cpp
int cursor_y() const;input
cpp
const std::string & input() const;Examples: component/print_key_press
operator==
cpp
bool operator==(const Event & other) const;operator!=
cpp
bool operator!=(const Event & other) const;