mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-27 05:38:29 +08:00
456ede70fd
For example: ============ element | size(WIDTH, EQUAL 10); element | size(HEIGHT, GREATER_THAN, 10); element | size(WIDTH, EQUAL, 10) | size(HEIGHT, EQUAL, 10)
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#include "ftxui/component/checkbox.hpp"
|
|
#include "ftxui/component/container.hpp"
|
|
#include "ftxui/component/input.hpp"
|
|
#include "ftxui/component/menu.hpp"
|
|
#include "ftxui/component/checkbox.hpp"
|
|
#include "ftxui/component/screen_interactive.hpp"
|
|
#include "ftxui/component/toggle.hpp"
|
|
#include "ftxui/screen/string.hpp"
|
|
|
|
using namespace ftxui;
|
|
|
|
class MyComponent : public Component {
|
|
public:
|
|
MyComponent() {
|
|
Add(&container);
|
|
checkbox.resize(30);
|
|
for(int i = 0; i<checkbox.size(); ++i) {
|
|
checkbox[i].label = (L"CheckBox " + to_wstring(i));
|
|
container.Add(&checkbox[i]);
|
|
}
|
|
}
|
|
|
|
Element Render() override {
|
|
Elements content;
|
|
for(auto& it : checkbox) {
|
|
content.push_back(it.Render());
|
|
}
|
|
return vbox(std::move(content))
|
|
| frame
|
|
| size(HEIGHT, LESS_THAN, 10)
|
|
| border;
|
|
}
|
|
|
|
private:
|
|
std::vector<CheckBox> checkbox;
|
|
Container container = Container::Vertical();
|
|
};
|
|
|
|
int main(int argc, const char* argv[]) {
|
|
auto screen = ScreenInteractive::FitComponent();
|
|
MyComponent component;
|
|
screen.Loop(&component);
|
|
|
|
return 0;
|
|
}
|