FTXUI/include/ftxui/component/mouse.hpp
Jørn Gustav Larsen d386df6f94
Enable raw keyboard input (#832)
In order for applications to receive all keyboard inputs, including the
Ctrl-C and Ctrl-Z, the raw input mode has been enabled. As result the
SIGINT will no longer be used, instead the keyboard Ctrl-C event is used
for exiting the framework, but only if no components has made use of it.

Co-authored-by: Jørn Gustav Larsen <jgl@fasttracksoftware.com>
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2024-04-28 15:17:54 +02:00

48 lines
1007 B
C++

// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#ifndef FTXUI_COMPONENT_MOUSE_HPP
#define FTXUI_COMPONENT_MOUSE_HPP
namespace ftxui {
/// @brief A mouse event. It contains the coordinate of the mouse, the button
/// pressed and the modifier (shift, ctrl, meta).
/// @ingroup component
struct Mouse {
enum Button {
Left = 0,
Middle = 1,
Right = 2,
None = 3,
WheelUp = 4,
WheelDown = 5,
WheelLeft = 6, /// Supported terminal only.
WheelRight = 7, /// Supported terminal only.
};
enum Motion {
Released = 0,
Pressed = 1,
Moved = 2,
};
// Button
Button button = Button::None;
// Motion
Motion motion = Motion::Pressed;
// Modifiers:
bool shift = false;
bool meta = false;
bool control = false;
// Coordinates:
int x = 0;
int y = 0;
};
} // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_MOUSE_HPP */