mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:07:36 +00:00
Chess: Move ChessWidget
to the create pattern
This commit is contained in:
parent
f66098ab6f
commit
e7377c6d60
2 changed files with 9 additions and 4 deletions
|
@ -19,9 +19,12 @@
|
|||
#include <LibGfx/Path.h>
|
||||
#include <unistd.h>
|
||||
|
||||
ChessWidget::ChessWidget()
|
||||
ErrorOr<NonnullRefPtr<ChessWidget>> ChessWidget::try_create()
|
||||
{
|
||||
set_piece_set("stelar7"sv);
|
||||
auto widget = TRY(AK::adopt_nonnull_ref_or_enomem(new (nothrow) ChessWidget));
|
||||
widget->set_piece_set("stelar7"sv);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
void ChessWidget::paint_event(GUI::PaintEvent& event)
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
class ChessWidget final
|
||||
: public GUI::Frame
|
||||
, public Config::Listener {
|
||||
C_OBJECT(ChessWidget);
|
||||
C_OBJECT_ABSTRACT(ChessWidget);
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<ChessWidget>> try_create();
|
||||
|
||||
virtual ~ChessWidget() override = default;
|
||||
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
|
@ -109,7 +111,7 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
ChessWidget();
|
||||
ChessWidget() = default;
|
||||
|
||||
virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override;
|
||||
virtual void config_bool_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue