mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-15 15:38:21 +08:00
Introduce WithRestoredIO (#307)
This function allow running a callback with the terminal hooks temporarily uninstalled. Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:

committed by
GitHub

parent
cd82fccde7
commit
b4a655ec65
@@ -20,20 +20,28 @@ using Component = std::shared_ptr<ComponentBase>;
|
||||
|
||||
class ScreenInteractive : public Screen {
|
||||
public:
|
||||
using Callback = std::function<void()>;
|
||||
|
||||
static ScreenInteractive FixedSize(int dimx, int dimy);
|
||||
static ScreenInteractive Fullscreen();
|
||||
static ScreenInteractive FitComponent();
|
||||
static ScreenInteractive TerminalOutput();
|
||||
|
||||
void Loop(Component);
|
||||
std::function<void()> ExitLoopClosure();
|
||||
Callback ExitLoopClosure();
|
||||
|
||||
void PostEvent(Event event);
|
||||
CapturedMouse CaptureMouse();
|
||||
|
||||
// Decorate a function. The outputted one will execute similarly to the
|
||||
// inputted one, but with the currently active screen terminal hooks
|
||||
// temporarily uninstalled.
|
||||
Callback WithRestoredIO(Callback);
|
||||
|
||||
private:
|
||||
void Install();
|
||||
void Uninstall();
|
||||
|
||||
void Main(Component component);
|
||||
ScreenInteractive* suspended_screen_ = nullptr;
|
||||
|
||||
|
Reference in New Issue
Block a user