mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:08:11 +00:00
LibGUI: Add input types to GMessageBox.
Currently the two available input types are: - GMessageBox::InputType::OK (default) - GMessageBox::InputType::OKCancel Based on your choice, GMessageBox::exec() will return ExecOK or ExecCancel.
This commit is contained in:
parent
62335c5f0c
commit
a17fbd98e7
8 changed files with 63 additions and 26 deletions
|
@ -11,17 +11,25 @@ public:
|
|||
Error,
|
||||
};
|
||||
|
||||
explicit GMessageBox(const StringView& text, const StringView& title, Type type = Type::None, CObject* parent = nullptr);
|
||||
enum class InputType {
|
||||
OK,
|
||||
OKCancel,
|
||||
};
|
||||
|
||||
explicit GMessageBox(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
|
||||
virtual ~GMessageBox() override;
|
||||
|
||||
static void show(const StringView& text, const StringView& title, Type type = Type::None, CObject* parent = nullptr);
|
||||
static void show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
|
||||
|
||||
virtual const char* class_name() const override { return "GMessageBox"; }
|
||||
|
||||
private:
|
||||
bool should_include_ok_button() const;
|
||||
bool should_include_cancel_button() const;
|
||||
void build();
|
||||
RefPtr<GraphicsBitmap> icon() const;
|
||||
|
||||
String m_text;
|
||||
Type m_type { Type::None };
|
||||
InputType m_input_type { InputType::OK };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue