1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:08:11 +00:00

LibWeb: Require parent window argument for MessageBox

Since the vast majority of message boxes should be modal, require
the parent window to be passed in, which can be nullptr for the
rare case that they don't. By it being the first argument, the
default arguments also don't need to be explicitly stated in most
cases, and it encourages passing in a parent window handle.

Fix up several message boxes that should have been modal.
This commit is contained in:
Tom 2020-07-15 20:45:11 -06:00 committed by Andreas Kling
parent 6568765e8f
commit 27bd2eab22
30 changed files with 109 additions and 135 deletions

View file

@ -50,11 +50,11 @@ public:
virtual ~MessageBox() override;
static int show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, Window* parent_window = nullptr);
static int show_error(const StringView& text, Window* parent_window = nullptr);
static int show(Window* parent_window, const StringView& text, const StringView& title, Type type = Type::None, InputType input_type = InputType::OK);
static int show_error(Window* parent_window, const StringView& text);
private:
explicit MessageBox(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, Window* parent_window = nullptr);
explicit MessageBox(Window* parent_window, const StringView& text, const StringView& title, Type type = Type::None, InputType input_type = InputType::OK);
bool should_include_ok_button() const;
bool should_include_cancel_button() const;