1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 05:44:59 +00:00
serenity/Libraries/LibGUI/GMessageBox.h
Andreas Kling 31b38ed88f LibGUI: Don't create GMessageBox and GInputBox on the stack
We need to get rid of all instances of widgets-on-the-stack since that
will no longer work in the ref-counting world.
2019-09-21 20:32:31 +02:00

34 lines
875 B
C++

#pragma once
#include <LibGUI/GDialog.h>
class GMessageBox : public GDialog {
C_OBJECT(GMessageBox)
public:
enum class Type {
None,
Information,
Warning,
Error,
};
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 int show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
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 };
};