1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:57:34 +00:00

LibGUI: Add GUI::MessageBox::ask_about_unsaved_changes()

This is a static helper function for asking the user what they want to
do about unsaved changes. It behaves as a standard Yes/No/Cancel box
with text and buttons tailored to the typical unsaved changes use case.
This commit is contained in:
Andreas Kling 2022-01-04 17:08:45 +01:00
parent 3f597c70b4
commit 8e336d3404
2 changed files with 33 additions and 6 deletions

View file

@ -32,6 +32,7 @@ public:
static int show(Window* parent_window, StringView text, StringView title, Type type = Type::None, InputType input_type = InputType::OK);
static int show_error(Window* parent_window, StringView text);
static int ask_about_unsaved_changes(Window* parent_window, StringView path);
private:
explicit MessageBox(Window* parent_window, StringView text, StringView title, Type type = Type::None, InputType input_type = InputType::OK);
@ -46,6 +47,11 @@ private:
String m_text;
Type m_type { Type::None };
InputType m_input_type { InputType::OK };
RefPtr<GUI::Button> m_ok_button;
RefPtr<GUI::Button> m_yes_button;
RefPtr<GUI::Button> m_no_button;
RefPtr<GUI::Button> m_cancel_button;
};
}