mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-01 02:58:12 +08:00 
			
		
		
		
	Feature: Dropdown options with callback (#826)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
		| @@ -75,6 +75,8 @@ Component Radiobox(ConstStringListRef entries, | ||||
|                    RadioboxOption options = {}); | ||||
|  | ||||
| Component Dropdown(ConstStringListRef entries, int* selected); | ||||
| Component Dropdown(DropdownOption options); | ||||
|  | ||||
| Component Toggle(ConstStringListRef entries, int* selected); | ||||
|  | ||||
| // General slider constructor: | ||||
|   | ||||
| @@ -263,6 +263,21 @@ 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 { | ||||
|   /// Whether the dropdown is open or closed: | ||||
|   Ref<bool> open = false; | ||||
|   // The options for the checkbox: | ||||
|   CheckboxOption checkbox; | ||||
|   // The options for the radiobox: | ||||
|   RadioboxOption radiobox; | ||||
|   // The transformation function: | ||||
|   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
	 James
					James