mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-10-31 08:19:34 +08:00
493e734680
1) Set clang-format macro indent. 2) Run clang-format on every files.
41 lines
857 B
C++
41 lines
857 B
C++
#ifndef FTXUI_COMPONENT_CHECKBOX_HPP
|
|
#define FTXUI_COMPONENT_CHECKBOX_HPP
|
|
|
|
#include <functional>
|
|
|
|
#include "ftxui/component/component.hpp"
|
|
|
|
namespace ftxui {
|
|
|
|
class CheckBox : public Component {
|
|
public:
|
|
// Constructor.
|
|
CheckBox() = default;
|
|
~CheckBox() override = default;
|
|
|
|
bool state = false;
|
|
std::wstring label = L"label";
|
|
|
|
// std::wstring checked = L"[X] ";
|
|
// std::wstring unchecked = L"[ ] ";
|
|
std::wstring checked = L"▣ ";
|
|
std::wstring unchecked = L"☐ ";
|
|
|
|
Decorator focused_style = inverted;
|
|
Decorator unfocused_style = nothing;
|
|
|
|
// State update callback.
|
|
std::function<void()> on_change = []() {};
|
|
|
|
// Component implementation.
|
|
Element Render() override;
|
|
bool OnEvent(Event) override;
|
|
|
|
private:
|
|
int cursor_position = 0;
|
|
};
|
|
|
|
} // namespace ftxui
|
|
|
|
#endif /* end of include guard: FTXUI_COMPONENT_CHECKBOX_HPP */
|