31 class Impl :
public ComponentBase {
33 Impl(ConstStringRef label, Component child, Ref<bool> show) : show_(show) {
35 opt.transform = [](EntryState s) {
36 auto prefix =
text(s.state ?
"▼ " :
"▶ ");
37 auto t =
text(s.label);
44 return hbox({prefix, t});
46 Add(Container::Vertical({
47 Checkbox(std::move(label), show_.operator->(), opt),
48 Maybe(std::move(child), show_.operator->()),
54 return Make<Impl>(std::move(label), std::move(child), show);
Component Checkbox(ConstStringRef label, bool *checked, Ref< CheckboxOption > option=CheckboxOption::Simple())
Draw checkable element.
Component Maybe(Component, const bool *show)
Decorate a component |child|. It is shown only when |show| is true. @params child the compoennt to de...
std::shared_ptr< T > Make(Args &&... args)
Element bold(Element)
Use a bold font, for elements with more emphasis.
Element hbox(Elements)
A container displaying elements horizontally one by one.
Element inverted(Element)
Add a filter that will invert the foreground and the background colors.
Element text(std::wstring text)
Display a piece of unicode text.
std::shared_ptr< ComponentBase > Component
Component Collapsible(ConstStringRef label, Component child, Ref< bool > show=false)