4 #ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
5 #define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
26 using Component = std::shared_ptr<ComponentBase>;
27 class ScreenInteractivePrivate;
82 void RunOnceBlocking(
Component component);
86 void ResetCursorPosition();
88 void Signal(
int signal);
91 enum class Dimension {
97 Dimension dimension_ = Dimension::Fixed;
98 bool use_alternative_screen_ =
false;
102 bool use_alternative_screen);
104 bool track_mouse_ =
true;
109 std::string set_cursor_position;
110 std::string reset_cursor_position;
112 std::atomic<bool> quit_{
false};
113 std::thread event_listener_;
114 std::thread animation_listener_;
115 bool animation_requested_ =
false;
121 bool mouse_captured =
false;
122 bool previous_frame_resized_ =
false;
124 bool frame_valid_ =
false;
126 bool force_handle_ctrl_c_ =
true;
127 bool force_handle_ctrl_z_ =
true;
130 int cursor_reset_shape_ = 1;
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.
void ForceHandleCtrlC(bool force)
Force FTXUI to handle or not handle Ctrl-C, even if the component catches the Event::CtrlC.
void ForceHandleCtrlZ(bool force)
Force FTXUI to handle or not handle Ctrl-Z, even if the component catches the Event::CtrlZ.
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 ...