4#ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
5#define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
26using Component = std::shared_ptr<ComponentBase>;
75 void ResetCursorPosition();
80 enum class Dimension {
86 Dimension dimension_ = Dimension::Fixed;
87 bool use_alternative_screen_ =
false;
93 bool track_mouse_ =
true;
98 std::string set_cursor_position;
99 std::string reset_cursor_position;
101 std::atomic<bool> quit_ =
false;
102 std::thread event_listener_;
103 std::thread animation_listener_;
104 bool animation_requested_ =
false;
110 bool mouse_captured =
false;
111 bool previous_frame_resized_ =
false;
113 bool frame_valid_ =
false;
static void Signal(ScreenInteractive &s, int signal)
static ScreenInteractive TerminalOutput()
void Exit()
Exit the main loop.
static ScreenInteractive FixedSize(int dimx, int dimy)
void PostEvent(Event event)
Add an event to the main loop. It will be executed later, after every other scheduled events.
void Post(Task task)
Add a task to the main loop. It will be executed later, after every other scheduled tasks.
static ScreenInteractive FitComponent()
static ScreenInteractive Fullscreen()
static ScreenInteractive * Active()
Return the currently active screen, or null if none.
CapturedMouse CaptureMouse()
Try to get the unique lock about behing able to capture the mouse.
void TrackMouse(bool enable=true)
Set whether mouse is tracked and events reported. called outside of the main loop....
void RequestAnimationFrame()
Add a task to draw the screen one more time, until all the animations are done.
Closure ExitLoopClosure()
Return a function to exit the main loop.
Closure WithRestoredIO(Closure)
Decorate a function. It executes the same way, but with the currently active screen terminal hooks te...
A rectangular grid of Pixel.
std::chrono::time_point< Clock > TimePoint
std::unique_ptr< CapturedMouseInterface > CapturedMouse
std::shared_ptr< ComponentBase > Component
std::unique_ptr< ReceiverImpl< T > > Receiver
std::unique_ptr< SenderImpl< T > > Sender
Component Slider(SliderOption< T > options)
A slider in any direction.
std::variant< Event, Closure, AnimationTask > Task
std::function< void()> Closure
Represent an event. It can be key press event, a terminal resize, or more ...