4#ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
5#define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
26using Component = std::shared_ptr<ComponentBase>;
27class ScreenInteractivePrivate;
73 void RunOnceBlocking(
Component component);
77 void ResetCursorPosition();
79 void Signal(
int signal);
82 enum class Dimension {
88 Dimension dimension_ = Dimension::Fixed;
89 bool use_alternative_screen_ =
false;
93 bool use_alternative_screen);
95 bool track_mouse_ =
true;
100 std::string set_cursor_position;
101 std::string reset_cursor_position;
103 std::atomic<bool> quit_ =
false;
104 std::thread event_listener_;
105 std::thread animation_listener_;
106 bool animation_requested_ =
false;
112 bool mouse_captured =
false;
113 bool previous_frame_resized_ =
false;
115 bool frame_valid_ =
false;
118 int cursor_reset_shape_ = 1;
120 Mouse latest_mouse_event_;
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 FullscreenPrimaryScreen()
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.
static ScreenInteractive FullscreenAlternateScreen()
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
std::variant< Event, Closure, AnimationTask > Task
std::function< void()> Closure
Represent an event. It can be key press event, a terminal resize, or more ...
A mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift,...