| 
									
										
										
										
											2023-08-19 13:56:36 +02:00
										 |  |  | // Copyright 2021 Arthur Sonzogni. All rights reserved.
 | 
					
						
							|  |  |  | // Use of this source code is governed by the MIT license that can be found in
 | 
					
						
							|  |  |  | // the LICENSE file.
 | 
					
						
							| 
									
										
										
										
											2021-07-07 22:13:33 +02:00
										 |  |  | #ifndef FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
 | 
					
						
							|  |  |  | #define FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  | #include <chrono>                         // for milliseconds
 | 
					
						
							| 
									
										
										
										
											2022-05-08 08:44:38 +02:00
										 |  |  | #include <ftxui/component/animation.hpp>  // for Duration, QuadraticInOut, Function
 | 
					
						
							| 
									
										
										
										
											2023-03-09 20:21:23 +01:00
										 |  |  | #include <ftxui/dom/direction.hpp>  // for Direction, Direction::Left, Direction::Right, Direction::Down
 | 
					
						
							|  |  |  | #include <ftxui/dom/elements.hpp>  // for Element, separator
 | 
					
						
							| 
									
										
										
										
											2023-05-02 13:32:37 +02:00
										 |  |  | #include <ftxui/util/ref.hpp>      // for Ref, ConstRef, StringRef
 | 
					
						
							| 
									
										
										
										
											2025-08-17 11:18:25 +02:00
										 |  |  | #include <ftxui/util/warn_windows_macro.hpp>
 | 
					
						
							|  |  |  | #include <functional>  // for function
 | 
					
						
							|  |  |  | #include <string>      // for string
 | 
					
						
							| 
									
										
										
										
											2023-03-09 20:21:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "ftxui/component/component_base.hpp"  // for Component
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  | #include "ftxui/screen/color.hpp"  // for Color, Color::GrayDark, Color::White
 | 
					
						
							| 
									
										
										
										
											2021-07-07 22:37:50 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-07 22:13:33 +02:00
										 |  |  | namespace ftxui { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-20 14:35:17 +02:00
										 |  |  | /// @brief arguments for transform from |ButtonOption|, |CheckboxOption|,
 | 
					
						
							|  |  |  | /// |RadioboxOption|, |MenuEntryOption|, |MenuOption|.
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  | struct EntryState { | 
					
						
							| 
									
										
										
										
											2023-10-19 22:58:02 +02:00
										 |  |  |   std::string label;  ///< The label to display.
 | 
					
						
							|  |  |  |   bool state;         ///< The state of the button/checkbox/radiobox
 | 
					
						
							|  |  |  |   bool active;        ///< Whether the entry is the active one.
 | 
					
						
							|  |  |  |   bool focused;       ///< Whether the entry is one focused by the user.
 | 
					
						
							| 
									
										
										
										
											2024-09-30 23:18:59 +02:00
										 |  |  |   int index;          ///< Index of the entry when applicable or -1.
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2021-07-07 22:13:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-05 11:35:14 +02:00
										 |  |  | /// @brief Option for the underline effect.
 | 
					
						
							|  |  |  | /// @ingroup component
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  | struct UnderlineOption { | 
					
						
							|  |  |  |   bool enabled = false; | 
					
						
							| 
									
										
										
										
											2021-07-10 12:59:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   Color color_active = Color::White; | 
					
						
							|  |  |  |   Color color_inactive = Color::GrayDark; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   animation::easing::Function leader_function = | 
					
						
							|  |  |  |       animation::easing::QuadraticInOut; | 
					
						
							|  |  |  |   animation::easing::Function follower_function = | 
					
						
							|  |  |  |       animation::easing::QuadraticInOut; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   animation::Duration leader_duration = std::chrono::milliseconds(250); | 
					
						
							|  |  |  |   animation::Duration leader_delay = std::chrono::milliseconds(0); | 
					
						
							|  |  |  |   animation::Duration follower_duration = std::chrono::milliseconds(250); | 
					
						
							|  |  |  |   animation::Duration follower_delay = std::chrono::milliseconds(0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void SetAnimation(animation::Duration d, animation::easing::Function f); | 
					
						
							|  |  |  |   void SetAnimationDuration(animation::Duration d); | 
					
						
							|  |  |  |   void SetAnimationFunction(animation::easing::Function f); | 
					
						
							|  |  |  |   void SetAnimationFunction(animation::easing::Function f_leader, | 
					
						
							|  |  |  |                             animation::easing::Function f_follower); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /// @brief Option about a potentially animated color.
 | 
					
						
							|  |  |  | /// @ingroup component
 | 
					
						
							|  |  |  | struct AnimatedColorOption { | 
					
						
							|  |  |  |   void Set( | 
					
						
							|  |  |  |       Color inactive, | 
					
						
							|  |  |  |       Color active, | 
					
						
							|  |  |  |       animation::Duration duration = std::chrono::milliseconds(250), | 
					
						
							|  |  |  |       animation::easing::Function function = animation::easing::QuadraticInOut); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   bool enabled = false; | 
					
						
							|  |  |  |   Color inactive; | 
					
						
							|  |  |  |   Color active; | 
					
						
							|  |  |  |   animation::Duration duration = std::chrono::milliseconds(250); | 
					
						
							|  |  |  |   animation::easing::Function function = animation::easing::QuadraticInOut; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct AnimatedColorsOption { | 
					
						
							|  |  |  |   AnimatedColorOption background; | 
					
						
							|  |  |  |   AnimatedColorOption foreground; | 
					
						
							| 
									
										
										
										
											2021-07-07 22:13:33 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-04 18:43:56 +02:00
										 |  |  | /// @brief Option for the MenuEntry component.
 | 
					
						
							|  |  |  | /// @ingroup component
 | 
					
						
							|  |  |  | struct MenuEntryOption { | 
					
						
							| 
									
										
										
										
											2023-06-25 17:22:05 +02:00
										 |  |  |   ConstStringRef label = "MenuEntry"; | 
					
						
							| 
									
										
										
										
											2022-03-31 02:17:43 +02:00
										 |  |  |   std::function<Element(const EntryState& state)> transform; | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   AnimatedColorsOption animated_colors; | 
					
						
							| 
									
										
										
										
											2021-09-04 18:43:56 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  | /// @brief Option for the Menu component.
 | 
					
						
							|  |  |  | /// @ingroup component
 | 
					
						
							|  |  |  | struct MenuOption { | 
					
						
							|  |  |  |   // Standard constructors:
 | 
					
						
							|  |  |  |   static MenuOption Horizontal(); | 
					
						
							|  |  |  |   static MenuOption HorizontalAnimated(); | 
					
						
							|  |  |  |   static MenuOption Vertical(); | 
					
						
							|  |  |  |   static MenuOption VerticalAnimated(); | 
					
						
							|  |  |  |   static MenuOption Toggle(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 17:22:05 +02:00
										 |  |  |   ConstStringListRef entries;  ///> The list of entries.
 | 
					
						
							|  |  |  |   Ref<int> selected = 0;       ///> The index of the selected entry.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   // Style:
 | 
					
						
							|  |  |  |   UnderlineOption underline; | 
					
						
							| 
									
										
										
										
											2023-06-25 17:22:05 +02:00
										 |  |  |   MenuEntryOption entries_option; | 
					
						
							| 
									
										
										
										
											2023-03-09 20:21:23 +01:00
										 |  |  |   Direction direction = Direction::Down; | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   std::function<Element()> elements_prefix; | 
					
						
							|  |  |  |   std::function<Element()> elements_infix; | 
					
						
							|  |  |  |   std::function<Element()> elements_postfix; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Observers:
 | 
					
						
							| 
									
										
										
										
											2022-08-24 19:00:54 +09:00
										 |  |  |   std::function<void()> on_change;  ///> Called when the selected entry changes.
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   std::function<void()> on_enter;   ///> Called when the user presses enter.
 | 
					
						
							|  |  |  |   Ref<int> focused_entry = 0; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /// @brief Option for the AnimatedButton component.
 | 
					
						
							| 
									
										
										
										
											2021-07-10 14:23:46 +02:00
										 |  |  | /// @ingroup component
 | 
					
						
							| 
									
										
										
										
											2021-07-07 22:23:07 +02:00
										 |  |  | struct ButtonOption { | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   // Standard constructors:
 | 
					
						
							|  |  |  |   static ButtonOption Ascii(); | 
					
						
							|  |  |  |   static ButtonOption Simple(); | 
					
						
							|  |  |  |   static ButtonOption Border(); | 
					
						
							|  |  |  |   static ButtonOption Animated(); | 
					
						
							|  |  |  |   static ButtonOption Animated(Color color); | 
					
						
							|  |  |  |   static ButtonOption Animated(Color background, Color foreground); | 
					
						
							|  |  |  |   static ButtonOption Animated(Color background, | 
					
						
							|  |  |  |                                Color foreground, | 
					
						
							|  |  |  |                                Color background_active, | 
					
						
							|  |  |  |                                Color foreground_active); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 17:22:05 +02:00
										 |  |  |   ConstStringRef label = "Button"; | 
					
						
							|  |  |  |   std::function<void()> on_click = [] {}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   // Style:
 | 
					
						
							| 
									
										
										
										
											2022-03-31 02:17:43 +02:00
										 |  |  |   std::function<Element(const EntryState&)> transform; | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   AnimatedColorsOption animated_colors; | 
					
						
							| 
									
										
										
										
											2021-07-07 22:23:07 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-10 11:50:17 +02:00
										 |  |  | /// @brief Option for the Checkbox component.
 | 
					
						
							| 
									
										
										
										
											2021-07-10 14:23:46 +02:00
										 |  |  | /// @ingroup component
 | 
					
						
							| 
									
										
										
										
											2021-07-07 22:37:50 +02:00
										 |  |  | struct CheckboxOption { | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   // Standard constructors:
 | 
					
						
							|  |  |  |   static CheckboxOption Simple(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 17:22:05 +02:00
										 |  |  |   ConstStringRef label = "Checkbox"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Ref<bool> checked = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   // Style:
 | 
					
						
							| 
									
										
										
										
											2022-03-31 02:17:43 +02:00
										 |  |  |   std::function<Element(const EntryState&)> transform; | 
					
						
							| 
									
										
										
										
											2021-07-07 22:37:50 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   // Observer:
 | 
					
						
							| 
									
										
										
										
											2021-07-07 22:37:50 +02:00
										 |  |  |   /// Called when the user change the state.
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   std::function<void()> on_change = [] {}; | 
					
						
							| 
									
										
										
										
											2021-07-07 22:37:50 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-02 13:32:37 +02:00
										 |  |  | /// @brief Used to define style for the Input component.
 | 
					
						
							|  |  |  | struct InputState { | 
					
						
							|  |  |  |   Element element; | 
					
						
							| 
									
										
										
										
											2023-10-19 22:58:02 +02:00
										 |  |  |   bool hovered;         ///< Whether the input is hovered by the mouse.
 | 
					
						
							|  |  |  |   bool focused;         ///< Whether the input is focused by the user.
 | 
					
						
							|  |  |  |   bool is_placeholder;  ///< Whether the input is empty and displaying the
 | 
					
						
							|  |  |  |                         ///< placeholder.
 | 
					
						
							| 
									
										
										
										
											2023-05-02 13:32:37 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-10 11:50:17 +02:00
										 |  |  | /// @brief Option for the Input component.
 | 
					
						
							| 
									
										
										
										
											2021-07-10 14:23:46 +02:00
										 |  |  | /// @ingroup component
 | 
					
						
							| 
									
										
										
										
											2021-07-08 00:01:42 +02:00
										 |  |  | struct InputOption { | 
					
						
							| 
									
										
										
										
											2023-05-02 13:32:37 +02:00
										 |  |  |   // A set of predefined styles:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /// @brief Create the default input style:
 | 
					
						
							|  |  |  |   static InputOption Default(); | 
					
						
							|  |  |  |   /// @brief A white on black style with high margins:
 | 
					
						
							|  |  |  |   static InputOption Spacious(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 17:22:05 +02:00
										 |  |  |   /// The content of the input.
 | 
					
						
							|  |  |  |   StringRef content = ""; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-02 13:32:37 +02:00
										 |  |  |   /// The content of the input when it's empty.
 | 
					
						
							|  |  |  |   StringRef placeholder = ""; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Style:
 | 
					
						
							|  |  |  |   std::function<Element(InputState)> transform; | 
					
						
							| 
									
										
										
										
											2023-10-19 22:58:02 +02:00
										 |  |  |   Ref<bool> password = false;  ///< Obscure the input content using '*'.
 | 
					
						
							|  |  |  |   Ref<bool> multiline = true;  ///< Whether the input can be multiline.
 | 
					
						
							|  |  |  |   Ref<bool> insert = true;     ///< Insert or overtype character mode.
 | 
					
						
							| 
									
										
										
										
											2023-05-02 13:32:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-10 11:50:17 +02:00
										 |  |  |   /// Called when the content changes.
 | 
					
						
							| 
									
										
										
										
											2021-07-08 00:01:42 +02:00
										 |  |  |   std::function<void()> on_change = [] {}; | 
					
						
							| 
									
										
										
										
											2021-07-10 11:50:17 +02:00
										 |  |  |   /// Called when the user presses enter.
 | 
					
						
							| 
									
										
										
										
											2021-07-08 00:01:42 +02:00
										 |  |  |   std::function<void()> on_enter = [] {}; | 
					
						
							| 
									
										
										
										
											2021-07-10 12:29:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-02 13:32:37 +02:00
										 |  |  |   // The char position of the cursor:
 | 
					
						
							|  |  |  |   Ref<int> cursor_position = 0; | 
					
						
							| 
									
										
										
										
											2021-07-08 00:01:42 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-10 11:50:17 +02:00
										 |  |  | /// @brief Option for the Radiobox component.
 | 
					
						
							| 
									
										
										
										
											2021-07-10 14:23:46 +02:00
										 |  |  | /// @ingroup component
 | 
					
						
							| 
									
										
										
										
											2021-07-10 10:50:25 +02:00
										 |  |  | struct RadioboxOption { | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   // Standard constructors:
 | 
					
						
							|  |  |  |   static RadioboxOption Simple(); | 
					
						
							| 
									
										
										
										
											2021-07-10 10:50:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 17:22:05 +02:00
										 |  |  |   // Content:
 | 
					
						
							|  |  |  |   ConstStringListRef entries; | 
					
						
							|  |  |  |   Ref<int> selected = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   // Style:
 | 
					
						
							| 
									
										
										
										
											2022-03-31 02:17:43 +02:00
										 |  |  |   std::function<Element(const EntryState&)> transform; | 
					
						
							| 
									
										
										
										
											2021-07-10 11:03:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-13 18:51:46 +01:00
										 |  |  |   // Observers:
 | 
					
						
							| 
									
										
										
										
											2021-07-10 11:50:17 +02:00
										 |  |  |   /// Called when the selected entry changes.
 | 
					
						
							|  |  |  |   std::function<void()> on_change = [] {}; | 
					
						
							| 
									
										
										
										
											2021-07-10 13:15:28 +02:00
										 |  |  |   Ref<int> focused_entry = 0; | 
					
						
							| 
									
										
										
										
											2021-07-10 11:03:01 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-09 20:21:23 +01:00
										 |  |  | struct ResizableSplitOption { | 
					
						
							|  |  |  |   Component main; | 
					
						
							|  |  |  |   Component back; | 
					
						
							|  |  |  |   Ref<Direction> direction = Direction::Left; | 
					
						
							|  |  |  |   Ref<int> main_size = | 
					
						
							|  |  |  |       (direction() == Direction::Left || direction() == Direction::Right) ? 20 | 
					
						
							|  |  |  |                                                                           : 10; | 
					
						
							|  |  |  |   std::function<Element()> separator_func = [] { return ::ftxui::separator(); }; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-30 18:52:33 +02:00
										 |  |  | // @brief Option for the `Slider` component.
 | 
					
						
							|  |  |  | // @ingroup component
 | 
					
						
							|  |  |  | template <typename T> | 
					
						
							|  |  |  | struct SliderOption { | 
					
						
							|  |  |  |   Ref<T> value; | 
					
						
							|  |  |  |   ConstRef<T> min = T(0); | 
					
						
							|  |  |  |   ConstRef<T> max = T(100); | 
					
						
							|  |  |  |   ConstRef<T> increment = (max() - min()) / 20; | 
					
						
							| 
									
										
										
										
											2023-03-09 20:21:23 +01:00
										 |  |  |   Direction direction = Direction::Right; | 
					
						
							| 
									
										
										
										
											2022-08-30 18:52:33 +02:00
										 |  |  |   Color color_active = Color::White; | 
					
						
							|  |  |  |   Color color_inactive = Color::GrayDark; | 
					
						
							| 
									
										
										
										
											2024-10-29 08:03:59 +01:00
										 |  |  |   std::function<void()> on_change;  ///> Called when `value` is updated.
 | 
					
						
							| 
									
										
										
										
											2022-08-30 18:52:33 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-05 11:35:14 +02:00
										 |  |  | /// @brief State passed to the `Window` component's render function.
 | 
					
						
							|  |  |  | /// @ingroup component
 | 
					
						
							| 
									
										
										
										
											2023-07-15 16:29:48 +02:00
										 |  |  | struct WindowRenderState { | 
					
						
							| 
									
										
										
										
											2023-10-19 22:58:02 +02:00
										 |  |  |   Element inner;             ///< The element wrapped inside this window.
 | 
					
						
							|  |  |  |   const std::string& title;  ///< The title of the window.
 | 
					
						
							|  |  |  |   bool active = false;       ///< Whether the window is the active one.
 | 
					
						
							|  |  |  |   bool drag = false;         ///< Whether the window is being dragged.
 | 
					
						
							|  |  |  |   bool resize = false;       ///< Whether the window is being resized.
 | 
					
						
							|  |  |  |   bool hover_left = false;   ///< Whether the resizeable left side is hovered.
 | 
					
						
							|  |  |  |   bool hover_right = false;  ///< Whether the resizeable right side is hovered.
 | 
					
						
							|  |  |  |   bool hover_top = false;    ///< Whether the resizeable top side is hovered.
 | 
					
						
							|  |  |  |   bool hover_down = false;   ///< Whether the resizeable down side is hovered.
 | 
					
						
							| 
									
										
										
										
											2023-07-15 16:29:48 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // @brief Option for the `Window` component.
 | 
					
						
							|  |  |  | // @ingroup component
 | 
					
						
							|  |  |  | struct WindowOptions { | 
					
						
							| 
									
										
										
										
											2023-10-19 22:58:02 +02:00
										 |  |  |   Component inner;            ///< The component wrapped by this window.
 | 
					
						
							|  |  |  |   ConstStringRef title = "";  ///< The title displayed by this window.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Ref<int> left = 0;     ///< The left side position of the window.
 | 
					
						
							|  |  |  |   Ref<int> top = 0;      ///< The top side position of the window.
 | 
					
						
							|  |  |  |   Ref<int> width = 20;   ///< The width of the window.
 | 
					
						
							|  |  |  |   Ref<int> height = 10;  ///< The height of the window.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Ref<bool> resize_left = true;   ///< Can the left side be resized?
 | 
					
						
							|  |  |  |   Ref<bool> resize_right = true;  ///< Can the right side be resized?
 | 
					
						
							|  |  |  |   Ref<bool> resize_top = true;    ///< Can the top side be resized?
 | 
					
						
							|  |  |  |   Ref<bool> resize_down = true;   ///< Can the down side be resized?
 | 
					
						
							| 
									
										
										
										
											2023-07-15 16:29:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /// An optional function to customize how the window looks like:
 | 
					
						
							|  |  |  |   std::function<Element(const WindowRenderState&)> render; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-06 16:45:10 +01:00
										 |  |  | /// @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; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-10 14:23:46 +02:00
										 |  |  | }  // namespace ftxui
 | 
					
						
							| 
									
										
										
										
											2021-07-07 22:13:33 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif /* end of include guard: FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP */
 |