FTXUI  4.0.0
C++ functional terminal UI.
Loading...
Searching...
No Matches
loop.cpp
Go to the documentation of this file.
2
3#include <utility> // for move
4
5#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive, Component
6
7namespace ftxui {
8
9// NOLINTNEXTLINE
11 : screen_(screen), component_(std::move(component)) {
12 screen_->PreMain();
13}
14
16 screen_->PostMain();
17}
18
20 return screen_->HasQuitted();
21}
22
23/// @brief Execute the loop. Make the `component` to process every pending
24/// tasks/events. A new frame might be drawn if the previous was invalidated.
25/// Return true until the loop hasn't completed.
27 screen_->RunOnce(component_);
28}
29
30/// @brief Wait for at least one event to be handled and execute
31/// `Loop::RunOnce()`.
33 screen_->RunOnceBlocking(component_);
34}
35
36/// Execute the loop, blocking the current thread, up until the loop has
37/// quitted.
38void Loop::Run() {
39 while (!HasQuitted()) {
41 }
42}
43
44} // namespace ftxui
45
46// Copyright 2022 Arthur Sonzogni. All rights reserved.
47// Use of this source code is governed by the MIT license that can be found in
48// the LICENSE file.
bool HasQuitted()
Definition loop.cpp:19
void Run()
Definition loop.cpp:38
Loop(ScreenInteractive *screen, Component component)
Definition loop.cpp:10
void RunOnce()
Execute the loop. Make the component to process every pending tasks/events. A new frame might be draw...
Definition loop.cpp:26
void RunOnceBlocking()
Wait for at least one event to be handled and execute Loop::RunOnce().
Definition loop.cpp:32
std::shared_ptr< ComponentBase > Component