#include #include #include #include "ftxui/dom/elements.hpp" #include "ftxui/dom/node.hpp" #include "ftxui/dom/requirement.hpp" #include "ftxui/screen/box.hpp" namespace ftxui { // Helper class. class Reflect : public Node { public: Reflect(Element child, Box& box) : Node(unpack(std::move(child))), box_(box) {} ~Reflect() override {} void ComputeRequirement() final { Node::ComputeRequirement(); requirement_ = children[0]->requirement(); } void SetBox(Box box) final { box_ = box; Node::SetBox(box_); children[0]->SetBox(box_); } private: Box& box_; }; Decorator reflect(Box& box) { return [&](Element child) -> Element { return std::make_shared(std::move(child), box); }; } } // namespace ftxui // Copyright 2020 Arthur Sonzogni. All rights reserved. // Use of this source code is governed by the MIT license that can be found in // the LICENSE file.