2019-03-19 00:01:02 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibGUI/GDialog.h>
|
|
|
|
|
|
|
|
class GMessageBox : public GDialog {
|
2019-07-25 19:49:28 +02:00
|
|
|
C_OBJECT(GMessageBox)
|
2019-03-19 00:01:02 +01:00
|
|
|
public:
|
2019-06-07 17:13:23 +02:00
|
|
|
enum class Type {
|
2019-05-08 20:13:39 +02:00
|
|
|
None,
|
|
|
|
Information,
|
|
|
|
Warning,
|
|
|
|
Error,
|
|
|
|
};
|
|
|
|
|
2019-07-16 21:32:10 +02:00
|
|
|
enum class InputType {
|
|
|
|
OK,
|
|
|
|
OKCancel,
|
|
|
|
};
|
|
|
|
|
2019-03-19 00:01:02 +01:00
|
|
|
virtual ~GMessageBox() override;
|
|
|
|
|
2019-09-21 20:32:31 +02:00
|
|
|
static int show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
|
2019-05-08 20:13:39 +02:00
|
|
|
|
2019-03-19 01:41:00 +01:00
|
|
|
private:
|
2019-09-30 17:20:53 +02:00
|
|
|
explicit GMessageBox(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
|
|
|
|
|
2019-07-16 21:32:10 +02:00
|
|
|
bool should_include_ok_button() const;
|
|
|
|
bool should_include_cancel_button() const;
|
2019-03-19 00:01:02 +01:00
|
|
|
void build();
|
2019-06-21 18:37:47 +02:00
|
|
|
RefPtr<GraphicsBitmap> icon() const;
|
2019-03-19 00:01:02 +01:00
|
|
|
|
|
|
|
String m_text;
|
2019-05-08 20:13:39 +02:00
|
|
|
Type m_type { Type::None };
|
2019-07-16 21:32:10 +02:00
|
|
|
InputType m_input_type { InputType::OK };
|
2019-03-19 00:01:02 +01:00
|
|
|
};
|