mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-01 02:58:12 +08:00 
			
		
		
		
	Deduplicate logic in ComponentBase members (#162)
- Invoke DetachAllChildren from ~ComponentBase - Define Focused using Active - Compact TakeFocus loop code - const-correctness for Parent, Active and Focused
This commit is contained in:
		 Tushar Maheshwari
					Tushar Maheshwari
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							09805e5e86
						
					
				
				
					commit
					7f95d59954
				
			| @@ -26,7 +26,7 @@ class ComponentBase { | ||||
|   virtual ~ComponentBase(); | ||||
|  | ||||
|   // Component hierarchy: | ||||
|   ComponentBase* Parent(); | ||||
|   ComponentBase* Parent() const; | ||||
|   Component& ChildAt(size_t i); | ||||
|   size_t ChildCount() const; | ||||
|   void Add(Component children); | ||||
| @@ -52,9 +52,9 @@ class ComponentBase { | ||||
|   virtual Component ActiveChild(); | ||||
|  | ||||
|   // Whether this is the active child of its parent. | ||||
|   bool Active(); | ||||
|   bool Active() const; | ||||
|   // Whether all the ancestors are active. | ||||
|   bool Focused(); | ||||
|   bool Focused() const; | ||||
|  | ||||
|   // Make the |child| to be the "active" one. | ||||
|   virtual void SetActiveChild(ComponentBase* child); | ||||
| @@ -66,7 +66,7 @@ class ComponentBase { | ||||
|  protected: | ||||
|   CapturedMouse CaptureMouse(const Event& event); | ||||
|  | ||||
|   std::vector<Component> children_; | ||||
|   Components children_; | ||||
|  | ||||
|  private: | ||||
|   ComponentBase* parent_ = nullptr; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user