collapsible
#include <memory>
#include <utility>
#include <vector>
Component vlist = Container::Vertical(std::move(children));
return Renderer(vlist, [vlist] {
return hbox({
text(" "),
vlist->Render(),
});
});
}
return std::make_shared<ComponentBase>();
}
auto component =
})),
})),
})),
}));
ScreenInteractive::FitComponent().Loop(component);
}
Component Inner(std::vector< Component > children)
Component Collapsible(ConstStringRef label, Component child, Ref< bool > show=false)
A collapsible component. It display a checkbox with an arrow. Once activated, the children is display...
std::shared_ptr< ComponentBase > Component
#include <array>
#include <memory>
#include <string>
std::array<bool, 30> states;
auto container = Container::Vertical({});
for (int i = 0; i < 30; ++i) {
states[i] = false;
container->Add(Checkbox("Checkbox" + std::to_string(i), &states[i]));
}
auto renderer = Renderer(container, [&] {
return container->Render() | vscroll_indicator | frame |
size(HEIGHT, LESS_THAN, 10) | border;
});
auto screen = ScreenInteractive::FitComponent();
screen.Loop(renderer);
return 0;
}