FTXUI  5.0.0
C++ functional terminal UI.
Loading...
Searching...
No Matches
loop.hpp
Go to the documentation of this file.
1// Copyright 2022 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#ifndef FTXUI_COMPONENT_LOOP_HPP
5#define FTXUI_COMPONENT_LOOP_HPP
6
7#include <memory> // for shared_ptr
8
9#include "ftxui/component/component_base.hpp" // for ComponentBase
10
11namespace ftxui {
12class ComponentBase;
13
14using Component = std::shared_ptr<ComponentBase>;
15class ScreenInteractive;
16
17class Loop {
18 public:
20 ~Loop();
21
22 bool HasQuitted();
23 void RunOnce();
24 void RunOnceBlocking();
25 void Run();
26
27 // This class is non copyable/movable.
28 Loop(const Loop&) = default;
29 Loop(Loop&&) = delete;
30 Loop& operator=(Loop&&) = delete;
31 Loop(const ScreenInteractive&) = delete;
32 Loop& operator=(const Loop&) = delete;
33
34 private:
35 ScreenInteractive* screen_;
36 Component component_;
37};
38
39} // namespace ftxui
40
41#endif // FTXUI_COMPONENT_LOOP_HPP
bool HasQuitted()
Whether the loop has quitted.
Definition loop.cpp:32
Loop(const ScreenInteractive &)=delete
void Run()
Definition loop.cpp:51
Loop & operator=(const Loop &)=delete
void RunOnce()
Execute the loop. Make the component to process every pending tasks/events. A new frame might be draw...
Definition loop.cpp:39
Loop(const Loop &)=default
Loop & operator=(Loop &&)=delete
Loop(Loop &&)=delete
void RunOnceBlocking()
Wait for at least one event to be handled and execute Loop::RunOnce().
Definition loop.cpp:45
std::shared_ptr< T > Make(Args &&... args)
Definition component.hpp:26
std::shared_ptr< ComponentBase > Component