GMessageBox.h 876 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <LibGUI/GDialog.h>
  3. class GMessageBox : public GDialog {
  4. C_OBJECT(GMessageBox)
  5. public:
  6. enum class Type {
  7. None,
  8. Information,
  9. Warning,
  10. Error,
  11. };
  12. enum class InputType {
  13. OK,
  14. OKCancel,
  15. };
  16. explicit GMessageBox(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
  17. virtual ~GMessageBox() override;
  18. static void show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
  19. private:
  20. bool should_include_ok_button() const;
  21. bool should_include_cancel_button() const;
  22. void build();
  23. RefPtr<GraphicsBitmap> icon() const;
  24. String m_text;
  25. Type m_type { Type::None };
  26. InputType m_input_type { InputType::OK };
  27. };