mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-16 16:08:08 +08:00
Fix event const correctness (#56)
This commit is contained in:
@@ -16,7 +16,6 @@ namespace ftxui {
|
||||
// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
|
||||
//
|
||||
struct Event {
|
||||
public:
|
||||
// --- Constructor section ---------------------------------------------------
|
||||
static Event Character(char);
|
||||
static Event Character(wchar_t);
|
||||
@@ -27,29 +26,29 @@ struct Event {
|
||||
static void Convert(Receiver<char>& in, Sender<Event>& out, char c);
|
||||
|
||||
// --- Arrow ---
|
||||
static Event ArrowLeft;
|
||||
static Event ArrowRight;
|
||||
static Event ArrowUp;
|
||||
static Event ArrowDown;
|
||||
static const Event ArrowLeft;
|
||||
static const Event ArrowRight;
|
||||
static const Event ArrowUp;
|
||||
static const Event ArrowDown;
|
||||
|
||||
// --- Other ---
|
||||
static Event Backspace;
|
||||
static Event Delete;
|
||||
static Event Return;
|
||||
static Event Escape;
|
||||
static Event Tab;
|
||||
static Event TabReverse;
|
||||
static Event F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12;
|
||||
static const Event Backspace;
|
||||
static const Event Delete;
|
||||
static const Event Return;
|
||||
static const Event Escape;
|
||||
static const Event Tab;
|
||||
static const Event TabReverse;
|
||||
static const Event F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12;
|
||||
|
||||
// --- Custom ---
|
||||
static Event Custom;
|
||||
|
||||
//--- Method section ---------------------------------------------------------
|
||||
bool is_character() { return is_character_; }
|
||||
wchar_t character() { return character_; }
|
||||
const std::string& input() { return input_; }
|
||||
bool is_character() const { return is_character_; }
|
||||
wchar_t character() const { return character_; }
|
||||
const std::string& input() const { return input_; }
|
||||
|
||||
bool operator==(const Event& other) { return input_ == other.input_; }
|
||||
bool operator==(const Event& other) const { return input_ == other.input_; }
|
||||
|
||||
//--- State section ----------------------------------------------------------
|
||||
private:
|
||||
@@ -58,6 +57,7 @@ struct Event {
|
||||
wchar_t character_ = U'?';
|
||||
};
|
||||
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
#endif /* end of include guard: FTXUI_COMPONENT_EVENT_HPP */
|
||||
|
Reference in New Issue
Block a user