GMessageBox.h 929 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <LibGUI/GDialog.h>
  3. class GMessageBox : public GDialog {
  4. public:
  5. enum class Type {
  6. None,
  7. Information,
  8. Warning,
  9. Error,
  10. };
  11. enum class InputType {
  12. OK,
  13. OKCancel,
  14. };
  15. explicit GMessageBox(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
  16. virtual ~GMessageBox() override;
  17. static void show(const StringView& text, const StringView& title, Type type = Type::None, InputType = InputType::OK, CObject* parent = nullptr);
  18. virtual const char* class_name() const override { return "GMessageBox"; }
  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. };