// 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. #include #include "ftxui/dom/elements.hpp" #include "ftxui/dom/node.hpp" #include "ftxui/util/autoreset.hpp" namespace ftxui { // ----------------------------------------------------------------------------- class Select : public Node { public: Select(std::vector> children) : Node(std::move(children)) {} void ComputeRequirement() override { Node::ComputeRequirement(); requirement_ = children[0]->requirement(); auto& selected_box = requirement_.selected_box; selected_box.x_min = 0; selected_box.y_min = 0; selected_box.x_max = requirement_.min.x; selected_box.y_max = requirement_.min.y; requirement_.selection = Requirement::SELECTED; }; void SetBox(Box box) override { box_ = box; children[0]->SetBox(box); } }; Element select(Element child) { return std::make_shared