2019-01-07 00:10:35 +08:00
|
|
|
#ifndef FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
|
|
|
|
#define FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP
|
2018-10-10 01:06:03 +08:00
|
|
|
|
2019-01-07 00:10:35 +08:00
|
|
|
#include "ftxui/screen/screen.hpp"
|
2018-10-10 01:06:03 +08:00
|
|
|
#include <functional>
|
|
|
|
#include <memory>
|
|
|
|
|
2019-01-12 22:00:08 +08:00
|
|
|
namespace ftxui {
|
2019-01-13 01:24:46 +08:00
|
|
|
class Component;
|
2018-10-10 01:06:03 +08:00
|
|
|
|
2019-01-13 01:24:46 +08:00
|
|
|
class ScreenInteractive : public Screen {
|
2018-10-10 01:06:03 +08:00
|
|
|
public:
|
2019-01-05 09:03:49 +08:00
|
|
|
static ScreenInteractive FixedSize(size_t dimx, size_t dimy);
|
|
|
|
static ScreenInteractive Fullscreen();
|
|
|
|
static ScreenInteractive TerminalOutput();
|
|
|
|
|
2018-10-10 01:06:03 +08:00
|
|
|
~ScreenInteractive();
|
2019-01-13 01:24:46 +08:00
|
|
|
void Loop(Component*);
|
2019-01-07 00:10:35 +08:00
|
|
|
std::function<void()> ExitLoopClosure();
|
2018-10-10 01:06:03 +08:00
|
|
|
|
|
|
|
private:
|
2019-01-13 01:24:46 +08:00
|
|
|
void Draw(Component* component);
|
2019-01-07 00:10:35 +08:00
|
|
|
bool quit_ = false;
|
2019-01-05 09:03:49 +08:00
|
|
|
|
|
|
|
enum class Dimension {
|
|
|
|
Fixed,
|
|
|
|
TerminalOutput,
|
|
|
|
Fullscreen,
|
|
|
|
};
|
|
|
|
Dimension dimension_ = Dimension::Fixed;
|
|
|
|
ScreenInteractive(size_t dimx, size_t dimy, Dimension dimension);
|
2018-10-10 01:06:03 +08:00
|
|
|
};
|
|
|
|
|
2019-01-12 22:00:08 +08:00
|
|
|
} // namespace ftxui
|
2018-10-10 01:06:03 +08:00
|
|
|
|
2019-01-07 00:10:35 +08:00
|
|
|
#endif /* end of include guard: FTXUI_COMPONENT_SCREEN_INTERACTIVE_HPP */
|