1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:37:34 +00:00

Minesweeper: Make a factory function for Field and propagate errors

This fixes a pleasant 8 FIXMEs. :^)
This commit is contained in:
Andreas Kling 2022-12-13 16:49:01 +01:00 committed by Linus Groh
parent cba9df1c53
commit 6ddc358a2b
3 changed files with 26 additions and 11 deletions

View file

@ -44,6 +44,7 @@ class Field final : public GUI::Frame {
friend class SquareLabel;
public:
static ErrorOr<NonnullRefPtr<Field>> create(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function<void(Gfx::IntSize)> on_size_changed);
virtual ~Field() override = default;
enum class Difficulty {
@ -110,6 +111,8 @@ public:
private:
Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function<void(Gfx::IntSize)> on_size_changed);
void initialize();
virtual void paint_event(GUI::PaintEvent&) override;
void on_square_clicked(Square&);