| 
									
										
										
										
											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.
 | 
					
						
							| 
									
										
										
										
											2021-05-01 20:40:35 +02:00
										 |  |  | #ifndef FTXUI_COMPONENT_MOUSE_HPP
 | 
					
						
							|  |  |  | #define FTXUI_COMPONENT_MOUSE_HPP
 | 
					
						
							| 
									
										
										
										
											2021-04-25 15:22:38 +02:00
										 |  |  | namespace ftxui { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /// @brief A mouse event. It contains the coordinate of the mouse, the button
 | 
					
						
							|  |  |  | /// pressed and the modifier (shift, ctrl, meta).
 | 
					
						
							|  |  |  | /// @ingroup component
 | 
					
						
							|  |  |  | struct Mouse { | 
					
						
							|  |  |  |   enum Button { | 
					
						
							|  |  |  |     Left = 0, | 
					
						
							|  |  |  |     Middle = 1, | 
					
						
							|  |  |  |     Right = 2, | 
					
						
							|  |  |  |     None = 3, | 
					
						
							|  |  |  |     WheelUp = 4, | 
					
						
							|  |  |  |     WheelDown = 5, | 
					
						
							| 
									
										
										
										
											2024-04-28 15:17:54 +02:00
										 |  |  |     WheelLeft = 6,   /// Supported terminal only.
 | 
					
						
							|  |  |  |     WheelRight = 7,  /// Supported terminal only.
 | 
					
						
							| 
									
										
										
										
											2021-04-25 15:22:38 +02:00
										 |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   enum Motion { | 
					
						
							|  |  |  |     Released = 0, | 
					
						
							|  |  |  |     Pressed = 1, | 
					
						
							| 
									
										
										
										
											2023-12-17 10:35:21 +01:00
										 |  |  |     Moved = 2, | 
					
						
							| 
									
										
										
										
											2021-04-25 15:22:38 +02:00
										 |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Button
 | 
					
						
							| 
									
										
										
										
											2023-03-26 20:20:02 +02:00
										 |  |  |   Button button = Button::None; | 
					
						
							| 
									
										
										
										
											2021-04-25 15:22:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Motion
 | 
					
						
							| 
									
										
										
										
											2023-03-26 20:20:02 +02:00
										 |  |  |   Motion motion = Motion::Pressed; | 
					
						
							| 
									
										
										
										
											2021-04-25 15:22:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Modifiers:
 | 
					
						
							| 
									
										
										
										
											2023-03-26 20:20:02 +02:00
										 |  |  |   bool shift = false; | 
					
						
							|  |  |  |   bool meta = false; | 
					
						
							|  |  |  |   bool control = false; | 
					
						
							| 
									
										
										
										
											2021-04-25 15:22:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Coordinates:
 | 
					
						
							| 
									
										
										
										
											2023-03-26 20:20:02 +02:00
										 |  |  |   int x = 0; | 
					
						
							|  |  |  |   int y = 0; | 
					
						
							| 
									
										
										
										
											2021-04-25 15:22:38 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }  // namespace ftxui
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-01 20:40:35 +02:00
										 |  |  | #endif /* end of include guard: FTXUI_COMPONENT_MOUSE_HPP */
 |