Add full customization.

This commit is contained in:
ArthurSonzogni
2024-03-18 23:00:21 +01:00
parent 00fbdd98d4
commit 60ba15ac07
5 changed files with 150 additions and 77 deletions

View File

@@ -74,9 +74,8 @@ Component Radiobox(ConstStringListRef entries,
int* selected_,
RadioboxOption options = {});
Component Dropdown(ConstStringListRef entries,
int* selected,
DropdownOption options = {});
Component Dropdown(ConstStringListRef entries, int* selected);
Component Dropdown(DropdownOption options);
Component Toggle(ConstStringListRef entries, int* selected);

View File

@@ -148,15 +148,6 @@ struct CheckboxOption {
std::function<void()> on_change = [] {};
};
/// @brief Option for the Dropdown component.
/// @ingroup component
struct DropdownOption {
bool border = true;
// Observer:
/// Called when the user change the state.
std::function<void()> on_change = [] {};
};
/// @brief Used to define style for the Input component.
struct InputState {
@@ -273,6 +264,17 @@ struct WindowOptions {
std::function<Element(const WindowRenderState&)> render;
};
/// @brief Option for the Dropdown component.
/// @ingroup component
/// A dropdown menu is a checkbox opening/closing a radiobox.
struct DropdownOption {
Ref<bool> open = false;
CheckboxOption checkbox;
RadioboxOption radiobox;
std::function<Element(bool open, Element checkbox, Element radiobox)>
transform;
};
} // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP */