FTXUI  0.10.0
C++ functional terminal UI.
Loading...
Searching...
No Matches
show.cpp
Go to the documentation of this file.
2
3Component Maybe(Component child, bool* show) {
4 class Impl : public ComponentBase {
5 public:
6 Impl(Component child, bool* show) : ComponentBase(child), show_(show) {}
7
8 private:
9 Element Render() override {
10 if (*show_)
11 return ComponentBase::Render();
12 else
13 return text("");
14 }
15 bool Focusable() const override {
16 return *show_ && ComponentBase::Focusable();
17 }
18 bool OnEvent(Event event) override {
19 if (*show_)
20 return false return ComponentBase::OnEvent(event);
21 }
22
23 bool* show_;
24 };
25 return Make<Impl>(std::move(child), show);
26}
Component Maybe(Component child, bool *show)
Definition show.cpp:3