mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 10:38:09 +08:00 
			
		
		
		
	Add flex_grow and flex_shrink.
Two new elements: - flex_grow : Expand the element to occupy free space. - flex_shrink: Minimize the element leave away missing space. flex = flex_grow | flex_shrink. Other changes: - hbox and vbox are now non flexible by default. - the vtext element has been added to help writting tests. - Many new tests.
This commit is contained in:
		 ArthurSonzogni
					ArthurSonzogni
				
			
				
					committed by
					
						 Arthur Sonzogni
						Arthur Sonzogni
					
				
			
			
				
	
			
			
			 Arthur Sonzogni
						Arthur Sonzogni
					
				
			
						parent
						
							7f7775ba62
						
					
				
				
					commit
					08ee49f3e6
				
			| @@ -21,6 +21,7 @@ using GraphFunction = std::function<std::vector<int>(int, int)>; | ||||
|  | ||||
| // --- Widget --- | ||||
| Element text(std::wstring text); | ||||
| Element vtext(std::wstring text); | ||||
| Element separator(void); | ||||
| Element separator(Pixel); | ||||
| Element gauge(float ratio); | ||||
| @@ -52,9 +53,11 @@ Element hflow(Elements); | ||||
| // -- Flexibility --- | ||||
| // Define how to share the remaining space when not all of it is used inside a | ||||
| // container. | ||||
| Element filler(); | ||||
| Element flex(Element); | ||||
| Element notflex(Element); | ||||
| 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 notflex(Element);      // Reset the flex attribute. | ||||
| Element filler();              // A blank expandable element. | ||||
|  | ||||
| // -- Size override; | ||||
| enum Direction { WIDTH, HEIGHT }; | ||||
|   | ||||
| @@ -15,8 +15,10 @@ struct Requirement { | ||||
|   int min_y = 0; | ||||
|  | ||||
|   // How much flexibility is given to the component. | ||||
|   int flex_x = 0; | ||||
|   int flex_y = 0; | ||||
|   int flex_grow_x = 0; | ||||
|   int flex_grow_y = 0; | ||||
|   int flex_shrink_x = 0; | ||||
|   int flex_shrink_y = 0; | ||||
|  | ||||
|   // Focus management to support the frame/focus/select element. | ||||
|   enum Selection { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user