| 
									
										
										
										
											2023-08-19 13:56:36 +02:00
										 |  |  | // Copyright 2020 Arthur Sonzogni. All rights reserved.
 | 
					
						
							|  |  |  | // Use of this source code is governed by the MIT license that can be found in
 | 
					
						
							|  |  |  | // the LICENSE file.
 | 
					
						
							| 
									
										
										
										
											2019-01-19 22:06:05 +01:00
										 |  |  | #ifndef FTXUI_SCREEN_BOX_HPP
 | 
					
						
							|  |  |  | #define FTXUI_SCREEN_BOX_HPP
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace ftxui { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-05 11:35:14 +02:00
										 |  |  | /// @brief Box is a structure that represents a rectangular area in a 2D space.
 | 
					
						
							|  |  |  | ///
 | 
					
						
							|  |  |  | /// It is defined by its minimum and maximum coordinates along the x and y axes.
 | 
					
						
							|  |  |  | /// Note that the coordinates are inclusive, meaning that the box includes both
 | 
					
						
							|  |  |  | /// the minimum and maximum values.
 | 
					
						
							| 
									
										
										
										
											2025-07-02 15:23:01 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2025-06-05 11:35:14 +02:00
										 |  |  | /// @ingroup screen
 | 
					
						
							| 
									
										
										
										
											2019-01-19 22:06:05 +01:00
										 |  |  | struct Box { | 
					
						
							| 
									
										
										
										
											2021-08-08 08:49:46 +02:00
										 |  |  |   int x_min = 0; | 
					
						
							|  |  |  |   int x_max = 0; | 
					
						
							|  |  |  |   int y_min = 0; | 
					
						
							|  |  |  |   int y_max = 0; | 
					
						
							| 
									
										
										
										
											2019-01-19 22:06:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-31 02:17:43 +02:00
										 |  |  |   static auto Intersection(Box a, Box b) -> Box; | 
					
						
							| 
									
										
										
										
											2022-05-22 21:41:29 +02:00
										 |  |  |   static auto Union(Box a, Box b) -> Box; | 
					
						
							| 
									
										
										
										
											2025-03-19 20:03:05 +05:30
										 |  |  |   void Shift(int x, int y); | 
					
						
							| 
									
										
										
										
											2022-03-31 02:17:43 +02:00
										 |  |  |   bool Contain(int x, int y) const; | 
					
						
							| 
									
										
										
										
											2024-04-28 10:39:30 +02:00
										 |  |  |   bool IsEmpty() const; | 
					
						
							| 
									
										
										
										
											2021-12-11 17:58:25 +01:00
										 |  |  |   bool operator==(const Box& other) const; | 
					
						
							|  |  |  |   bool operator!=(const Box& other) const; | 
					
						
							| 
									
										
										
										
											2019-01-19 22:06:05 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-11 21:44:55 +01:00
										 |  |  | }  // namespace ftxui
 | 
					
						
							| 
									
										
										
										
											2019-01-19 22:06:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-31 02:17:43 +02:00
										 |  |  | #endif  // FTXUI_SCREEN_BOX_HPP
 |