Add option for radiobox

This commit is contained in:
ArthurSonzogni
2021-07-10 10:50:25 +02:00
committed by Arthur Sonzogni
parent 33b3d1c7ab
commit ae6473363d
4 changed files with 34 additions and 24 deletions

View File

@@ -22,20 +22,13 @@ class RadioboxBase : public ComponentBase {
static RadioboxBase* From(Component component);
// Constructor.
RadioboxBase(const std::vector<std::wstring>* entries, int* selected);
RadioboxBase(const std::vector<std::wstring>* entries,
int* selected,
ConstRef<RadioboxOption> option);
~RadioboxBase() override = default;
int focused = 0;
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;
@@ -47,6 +40,7 @@ class RadioboxBase : public ComponentBase {
bool OnMouseEvent(Event event);
int cursor_position = 0;
std::vector<Box> boxes_;
ConstRef<RadioboxOption> option_;
};
} // namespace ftxui