4#ifndef FTXUI_COMPONENT_APP_HPP
5#define FTXUI_COMPONENT_APP_HPP
35class FTXUI_EXPORT(COMPONENT) App :
public Screen {
42 static App FixedSize(
int dimx,
int dimy);
52 static App FullscreenPrimaryScreen();
56 static App FullscreenAlternateScreen();
69 App& operator=(App&&) noexcept;
70 App(const App&) = delete;
71 App& operator=(const App&) = delete;
80 void TrackMouse(
bool enable = true);
90 void HandlePipedInput(
bool enable = true);
117 void ForceHandleCtrlC(
bool force = true);
121 void ForceHandleCtrlZ(
bool force = true);
127 void Post(
Task task);
131 void PostEvent(Event event);
135 static
void PostEventOrExecute(
Closure closure);
139 void RequestAnimationFrame();
149 std::
string GetSelection();
152 void SelectionChange(std::function<
void()> callback);
157 const std::
string& TerminalName() const;
160 int TerminalVersion() const;
163 const std::
string& TerminalEmulatorName() const;
166 const std::
string& TerminalEmulatorVersion() const;
169 const std::vector<
int>& TerminalCapabilities() const;
172 std::vector<std::
string> TerminalCapabilityNames() const;
184 void RunOnce(const
Component& component);
185 void RunOnceBlocking(
Component component);
188 bool HandleSelection(
bool handled, Event event);
190 std::
string ResetCursorPosition();
192 void RequestCursorPosition(
bool force = false);
194 void TerminalSend(std::string_view);
195 void TerminalFlush();
197 void InstallPipedInputHandling();
198 void InstallTerminalInfo();
200 void Signal(
int signal);
202 size_t FetchTerminalEvents();
204 void PostAnimationTask();
207 explicit App(std::unique_ptr<Internal> internal,
int dimx,
int dimy);
209 std::unique_ptr<Internal> internal_;
216 static void Signal(App& s,
int signal) { s.Signal(signal); }
std::unique_ptr< CapturedMouseInterface > CapturedMouse
std::variant< Event, Closure, AnimationTask > Task
std::function< void()> Closure
std::shared_ptr< ComponentBase > Component