25 explicit Impl(std::function<
bool()> show) : show_(std::move(show)) {}
31 bool Focusable()
const override {
34 bool OnEvent(
Event event)
override {
38 std::function<bool()> show_;
41 auto maybe = Make<Impl>(std::move(show));
42 maybe->Add(std::move(child));
59 return [show = std::move(show)](
Component child)
mutable {
60 return Maybe(std::move(child), std::move(show));
76 return Maybe(std::move(child), [show] {
return *show; });
90 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...
virtual bool Focusable() const
Return true when the component contains focusable elements. The non focusable Components will be skip...
virtual Element Render()
Draw the component. Build a ftxui::Element to be drawn on the ftxi::Screen representing this ftxui::C...
virtual bool OnEvent(Event)
Called in response to an event.
Component Maybe(Component, const bool *show)
Decorate a component |child|. It is shown only when |show| is true.
std::shared_ptr< Node > Element
std::shared_ptr< ComponentBase > Component
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
std::function< Component(Component)> ComponentDecorator
Represent an event. It can be key press event, a terminal resize, or more ...