34 class Impl :
public ComponentBase {
36 Impl(ConstStringRef label, Component child, Ref<bool> show) : show_(show) {
38 opt.transform = [](EntryState s) {
39 auto prefix = text(s.state ?
"▼ " :
"▶ ");
40 auto t = text(s.label);
47 return hbox({prefix, t});
49 Add(Container::Vertical({
50 Checkbox(std::move(label), show_.operator->(), opt),
51 Maybe(std::move(child), show_.operator->()),
57 return Make<Impl>(std::move(label), std::move(child), show);
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
std::shared_ptr< T > Make(Args &&... args)
std::shared_ptr< ComponentBase > Component
Component Collapsible(ConstStringRef label, Component child, Ref< bool > show=false)