mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
Add full customization.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user