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

LibGUI: Add GUI::MessageBox::show_error() convenience function

This is just a wrapper around show() that puts up a standard-looking
error message.
This commit is contained in:
Andreas Kling 2020-05-13 21:11:49 +02:00
parent 7ca9259ffd
commit 14aa7f2d44
2 changed files with 6 additions and 0 deletions

View file

@ -43,6 +43,11 @@ int MessageBox::show(const StringView& text, const StringView& title, Type type,
return box->exec();
}
int MessageBox::show_error(const StringView& text, Window* parent_window)
{
return show(text, "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, parent_window);
}
MessageBox::MessageBox(const StringView& text, const StringView& title, Type type, InputType input_type, Window* parent_window)
: Dialog(parent_window)
, m_text(text)

View file

@ -50,6 +50,7 @@ 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);
private:
explicit MessageBox(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, Window* parent_window = nullptr);