FTXUI/examples/component/checkbox.cpp

35 lines
794 B
C++
Raw Normal View History

2019-01-13 05:25:49 +08:00
#include "ftxui/component/checkbox.hpp"
2020-03-23 05:32:44 +08:00
2019-01-13 05:25:49 +08:00
#include "ftxui/component/component.hpp"
#include "ftxui/component/container.hpp"
#include "ftxui/component/screen_interactive.hpp"
using namespace ftxui;
class MyComponent : public Component {
2020-03-23 05:32:44 +08:00
private:
CheckBox box_1_;
CheckBox box_2_;
CheckBox box_3_;
Container container_ = Container::Vertical();
public:
MyComponent() {
Add(&container_);
container_.Add(&box_1_);
container_.Add(&box_2_);
container_.Add(&box_3_);
box_1_.label = L"Build examples";
box_2_.label = L"Build tests";
box_3_.label = L"Use WebAssembly";
box_3_.state = true;
}
2019-01-13 05:25:49 +08:00
};
2020-03-23 05:32:44 +08:00
int main(int argc, const char* argv[]) {
2019-01-20 05:06:05 +08:00
auto screen = ScreenInteractive::TerminalOutput();
2019-01-13 05:25:49 +08:00
MyComponent component;
screen.Loop(&component);
return 0;
}