mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 18:48:11 +08:00 
			
		
		
		
	Add more documentation.
This commit is contained in:
		 ArthurSonzogni
					ArthurSonzogni
				
			
				
					committed by
					
						 Arthur Sonzogni
						Arthur Sonzogni
					
				
			
			
				
	
			
			
			 Arthur Sonzogni
						Arthur Sonzogni
					
				
			
						parent
						
							f2dc080a35
						
					
				
				
					commit
					114ab4ae2a
				
			| @@ -7,27 +7,29 @@ | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| /// @brief A Checkbox. It can be checked or unchecked.Display an element on a ftxui::Screen. | ||||
| /// @ingroup dom | ||||
| class CheckBox : public Component { | ||||
|  public: | ||||
|   // Constructor. | ||||
|   CheckBox() = default; | ||||
|   ~CheckBox() override = default; | ||||
|  | ||||
|   bool state = false; | ||||
|   std::wstring label = L"label"; | ||||
|   bool state = false; // The current state. true=checked, false:unchecked. | ||||
|   std::wstring label = L"label"; // The CheckBox label. | ||||
|  | ||||
| #if defined(_WIN32) | ||||
|   std::wstring checked = L"[X] "; | ||||
|   std::wstring unchecked = L"[ ] "; | ||||
|   std::wstring checked = L"[X] "; /// Prefix for  a "checked" state. | ||||
|   std::wstring unchecked = L"[ ] "; /// Prefix for  an "unchecked" state. | ||||
| #else | ||||
|   std::wstring checked = L"▣ "; | ||||
|   std::wstring unchecked = L"☐ "; | ||||
|   std::wstring checked = L"▣ "; /// Prefix for  a "checked" state. | ||||
|   std::wstring unchecked = L"☐ "; /// Prefix for  a "unchecked" state. | ||||
| #endif | ||||
|  | ||||
|   Decorator focused_style = inverted; | ||||
|   Decorator unfocused_style = nothing; | ||||
|   Decorator focused_style = inverted; /// Decorator used when focused. | ||||
|   Decorator unfocused_style = nothing; /// Decorator used when unfocused. | ||||
|  | ||||
|   // State update callback. | ||||
|   /// Called when the user change the state of the CheckBox. | ||||
|   std::function<void()> on_change = []() {}; | ||||
|  | ||||
|   // Component implementation. | ||||
|   | ||||
| @@ -9,6 +9,9 @@ namespace ftxui { | ||||
| class Delegate; | ||||
| class Focus; | ||||
|  | ||||
| /// @brief It implement rendering itself as ftxui::Element. It implement | ||||
| /// keyboard navigation by responding to ftxui::Event. | ||||
| /// @ingroup component | ||||
| class Component { | ||||
|  public: | ||||
|   // Constructor/Destructor. | ||||
| @@ -16,7 +19,7 @@ class Component { | ||||
|   virtual ~Component(); | ||||
|  | ||||
|   // Component hierarchy. | ||||
|   Component* Parent() { return parent_; } | ||||
|   Component* Parent(); | ||||
|   void Add(Component* children); | ||||
|  | ||||
|   // Renders the component. | ||||
|   | ||||
| @@ -5,10 +5,7 @@ | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| // A component where focus and events are automatically handled for you. | ||||
| // List of container: | ||||
| // | ||||
| // Please use HorizontalContainer or VerticalContainer. | ||||
| /// @brief A component where focus and events are automatically handled for you. | ||||
| class Container : public Component { | ||||
|  public: | ||||
|   static Container Vertical(); | ||||
|   | ||||
| @@ -9,6 +9,9 @@ | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| /// @brief Represent an event. It can be key press event, a terminal resize, or | ||||
| /// more ... | ||||
| // | ||||
| // Documentation: | ||||
| // https://invisible-island.net/xterm/ctlseqs/ctlseqs.html | ||||
| // | ||||
|   | ||||
| @@ -7,6 +7,8 @@ | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| /// @brief An input box. The user can type text into it. | ||||
| /// @ingroup component. | ||||
| class Input : public Component { | ||||
|  public: | ||||
|   // Constructor. | ||||
|   | ||||
| @@ -8,6 +8,8 @@ | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| /// @brief A list of items. The user can navigate through them. | ||||
| /// @ingroup component | ||||
| class Menu : public Component { | ||||
|  public: | ||||
|   // Constructor. | ||||
|   | ||||
| @@ -7,6 +7,9 @@ | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| /// @brief A list of selectable element. One and only one can be selected at | ||||
| /// the same time. | ||||
| /// @ingroup component | ||||
| class RadioBox : public Component { | ||||
|  public: | ||||
|   // Constructor. | ||||
|   | ||||
| @@ -8,6 +8,8 @@ | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| /// @brief An horizontal list of elements. The user can navigate through them. | ||||
| /// @ingroup component | ||||
| class Toggle : public Component { | ||||
|  public: | ||||
|   // Constructor. | ||||
|   | ||||
| @@ -61,13 +61,13 @@ Element flex(Element);         // Expand/Minimize if possible/needed. | ||||
| Element flex_grow(Element);    // Expand element if possible. | ||||
| Element flex_shrink(Element);  // Minimize element if needed. | ||||
|  | ||||
| Element xflex(Element);         // Expand/Minimize if possible/needed. | ||||
| Element xflex_grow(Element);    // Expand element if possible. | ||||
| Element xflex_shrink(Element);  // Minimize element if needed. | ||||
| Element xflex(Element);         // Expand/Minimize if possible/needed on X axis. | ||||
| Element xflex_grow(Element);    // Expand element if possible on X axis. | ||||
| Element xflex_shrink(Element);  // Minimize element if needed on X axis. | ||||
|  | ||||
| Element yflex(Element);         // Expand/Minimize if possible/needed. | ||||
| Element yflex_grow(Element);    // Expand element if possible. | ||||
| Element yflex_shrink(Element);  // Minimize element if needed. | ||||
| Element yflex(Element);         // Expand/Minimize if possible/needed on Y axis. | ||||
| Element yflex_grow(Element);    // Expand element if possible on Y axis. | ||||
| Element yflex_shrink(Element);  // Minimize element if needed on Y axis. | ||||
|  | ||||
| Element notflex(Element);  // Reset the flex attribute. | ||||
| Element filler();          // A blank expandable element. | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
|  | ||||
| namespace ftxui { | ||||
|  | ||||
| /// Assign a value to a variable, reset its old value when going out of scope. | ||||
| template <typename T> | ||||
| class AutoReset { | ||||
|  public: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user