4#ifndef FTXUI_COMPONENT_APP_HPP
5#define FTXUI_COMPONENT_APP_HPP
95 void RunOnceBlocking(
Component component);
98 bool HandleSelection(
bool handled,
Event event);
99 void RefreshSelection();
101 std::string ResetCursorPosition();
103 void TerminalSend(std::string_view);
104 void TerminalFlush();
106 void InstallPipedInputHandling();
108 void Signal(
int signal);
110 void FetchTerminalEvents();
112 void PostAnimationTask();
114 App* suspended_screen_ =
nullptr;
124 const bool use_alternative_screen_;
126 bool track_mouse_ =
true;
128 std::string set_cursor_position_;
129 std::string reset_cursor_position_;
131 std::atomic<bool> quit_{
false};
132 bool animation_requested_ =
false;
138 std::uint64_t frame_count_ = 0;
139 bool mouse_captured =
false;
140 bool previous_frame_resized_ =
false;
142 bool frame_valid_ =
false;
144 bool force_handle_ctrl_c_ =
true;
145 bool force_handle_ctrl_z_ =
true;
148 bool handle_piped_input_ =
true;
153 int cursor_reset_shape_ = 1;
157 struct SelectionData {
163 bool operator==(
const SelectionData& other)
const;
164 bool operator!=(
const SelectionData& other)
const;
166 SelectionData selection_data_;
167 SelectionData selection_data_previous_;
168 std::unique_ptr<Selection> selection_;
169 std::function<void()> selection_on_change_;
173 std::unique_ptr<Internal> internal_;
182 static void Signal(
App& s,
int signal) { s.Signal(signal); }
static void Signal(App &s, int signal)
void HandlePipedInput(bool enable=true)
Enable or disable automatic piped input handling. When enabled, FTXUI will detect piped input and red...
void Exit()
Exit the main loop.
void PostEvent(Event event)
Add an event to the main loop. It will be executed later, after every other scheduled events.
static App FitComponent()
static App * Active()
Return the currently active screen, or null if none.
void Post(Task task)
Add a task to the main loop. It will be executed later, after every other scheduled tasks.
static App FullscreenPrimaryScreen()
static App TerminalOutput()
static App FullscreenAlternateScreen()
CapturedMouse CaptureMouse()
Try to get the unique lock about behing able to capture the mouse.
static App FixedSize(int dimx, int dimy)
std::string GetSelection()
Returns the content of the current selection.
void TrackMouse(bool enable=true)
Set whether mouse is tracked and events reported. called outside of the main loop....
void SelectionChange(std::function< void()> callback)
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...
App is a Screen that can handle events, run a main loop, and manage components.
Loop is a class that manages the event loop for a component.
Represent an event. It can be key press event, a terminal resize, or more ...
A rectangular grid of Cell.
The FTXUI ftxui::Dimension:: namespace.
std::chrono::time_point< Clock > TimePoint
The FTXUI ftxui:: namespace.
std::unique_ptr< CapturedMouseInterface > CapturedMouse
std::variant< Event, Closure, AnimationTask > Task
std::function< void()> Closure
std::shared_ptr< ComponentBase > Component