17 explicit Impl(std::function<
bool()> show) : show_(std::move(show)) {}
21 return show_() ? ComponentBase::Render() : std::make_unique<Node>();
23 bool Focusable()
const override {
24 return show_() && ComponentBase::Focusable();
26 bool OnEvent(
Event event)
override {
27 return show_() && ComponentBase::OnEvent(event);
30 std::function<bool()> show_;
34 maybe->Add(std::move(child));
51 return [show = std::move(show)](
Component child)
mutable {
52 return Maybe(std::move(child), std::move(show));
68 return Maybe(std::move(child), [show] {
return *show; });
82 return [show](
Component child) {
return Maybe(std::move(child), show); };
It implement rendering itself as ftxui::Element. It implement keyboard navigation by responding to ft...
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)
std::shared_ptr< Node > Element
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
std::function< Component(Component)> ComponentDecorator
std::shared_ptr< ComponentBase > Component
Represent an event. It can be key press event, a terminal resize, or more ...