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