mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:52:44 +00:00 
			
		
		
		
	 d7ff2c5b86
			
		
	
	
		d7ff2c5b86
		
	
	
	
	
		
			
			Make GWindow::close() so we can override it in GDialog and quit from the internal event loop when the window manager tells us to close ourselves. The dialog will return GDialog::ExecCancel in these situations.
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			528 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			528 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <LibGUI/GEventLoop.h>
 | |
| #include <LibGUI/GWindow.h>
 | |
| 
 | |
| class GDialog : public GWindow {
 | |
|     C_OBJECT(GDialog)
 | |
| public:
 | |
|     enum ExecResult {
 | |
|         ExecOK = 0,
 | |
|         ExecCancel = 1,
 | |
|         ExecAborted = 2
 | |
|     };
 | |
| 
 | |
|     virtual ~GDialog() override;
 | |
| 
 | |
|     int exec();
 | |
| 
 | |
|     int result() const { return m_result; }
 | |
|     void done(int result);
 | |
| 
 | |
|     virtual void close() override;
 | |
| 
 | |
| protected:
 | |
|     explicit GDialog(CObject* parent);
 | |
| 
 | |
| private:
 | |
|     OwnPtr<GEventLoop> m_event_loop;
 | |
|     int m_result { ExecAborted };
 | |
| };
 |