summaryrefslogtreecommitdiff
path: root/LibGUI/GMessageBox.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-19 00:01:02 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-19 00:01:02 +0100
commit57ff293a51d97742d50987950c86dfcde55e6ad1 (patch)
tree44cb31375a62808be2b743758bc6c42c574b4afa /LibGUI/GMessageBox.h
parent55aa8190773721f1dc0a3f49bedea6ed8524b318 (diff)
downloadserenity-57ff293a51d97742d50987950c86dfcde55e6ad1.zip
LibGUI: Implement nested event loops to support dialog boxes.
This patch adds a simple GMessageBox that can run in a nested event loop. Here's how you use it: GMessageBox box("Message text here", "Message window title"); int result = box.exec(); The next step is to make the WindowServer respect the modality flag of these windows and prevent interaction with other windows in the same process until the modal window has been closed.
Diffstat (limited to 'LibGUI/GMessageBox.h')
-rw-r--r--LibGUI/GMessageBox.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/LibGUI/GMessageBox.h b/LibGUI/GMessageBox.h
new file mode 100644
index 0000000000..fbbc371fba
--- /dev/null
+++ b/LibGUI/GMessageBox.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <LibGUI/GDialog.h>
+
+class GMessageBox : public GDialog {
+public:
+ explicit GMessageBox(const String& text, const String& title, GObject* parent = nullptr);
+ virtual ~GMessageBox() override;
+
+ String text() const { return m_text; }
+
+ void build();
+
+private:
+ String m_text;
+};