#ifndef FTXUI_COMPONENT_BUTTON_HPP #define FTXUI_COMPONENT_BUTTON_HPP #include // for function #include // for wstring #include "ftxui/component/component.hpp" // for Component #include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/dom/elements.hpp" // for Element #include "ftxui/screen/box.hpp" // for Box namespace ftxui { struct Event; /// @brief A button. An action is associated to the click event. /// @ingroup dom class ButtonBase : public ComponentBase { public: // Access this interface from a Component static ButtonBase* From(Component); // Constructor. ButtonBase(const std::wstring* label, std::function on_click); ~ButtonBase() override = default; // Component implementation. Element Render() override; bool OnEvent(Event) override; private: const std::wstring* label_; std::function on_click_; Box box_; }; } // namespace ftxui #endif /* end of include guard: FTXUI_COMPONENT_BUTTON_HPP */ // 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.