mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 10:38:09 +08:00 
			
		
		
		
	Introduce WithRestoredIO (#307)
This function allow running a callback with the terminal hooks temporarily uninstalled. Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
		 Vladislav Nepogodin
					Vladislav Nepogodin
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							cd82fccde7
						
					
				
				
					commit
					b4a655ec65
				
			| @@ -20,20 +20,28 @@ using Component = std::shared_ptr<ComponentBase>; | ||||
|  | ||||
| class ScreenInteractive : public Screen { | ||||
|  public: | ||||
|   using Callback = std::function<void()>; | ||||
|  | ||||
|   static ScreenInteractive FixedSize(int dimx, int dimy); | ||||
|   static ScreenInteractive Fullscreen(); | ||||
|   static ScreenInteractive FitComponent(); | ||||
|   static ScreenInteractive TerminalOutput(); | ||||
|  | ||||
|   void Loop(Component); | ||||
|   std::function<void()> ExitLoopClosure(); | ||||
|   Callback ExitLoopClosure(); | ||||
|  | ||||
|   void PostEvent(Event event); | ||||
|   CapturedMouse CaptureMouse(); | ||||
|  | ||||
|   // Decorate a function. The outputted one will execute similarly to the | ||||
|   // inputted one, but with the currently active screen terminal hooks | ||||
|   // temporarily uninstalled. | ||||
|   Callback WithRestoredIO(Callback); | ||||
|  | ||||
|  private: | ||||
|   void Install(); | ||||
|   void Uninstall(); | ||||
|  | ||||
|   void Main(Component component); | ||||
|   ScreenInteractive* suspended_screen_ = nullptr; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user