From 525f8df5b83c2fea262af4e382dd8eb0f7664d1e Mon Sep 17 00:00:00 2001 From: thatlittlegit Date: Sun, 23 Feb 2020 14:43:18 -0500 Subject: SystemMenu: Migrate PowerDialog to (widget)->add like in 3d20da9e This also fixes the build. --- Applications/SystemMenu/PowerDialog.cpp | 14 +++++++------- Applications/SystemMenu/PowerDialog.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'Applications') diff --git a/Applications/SystemMenu/PowerDialog.cpp b/Applications/SystemMenu/PowerDialog.cpp index 1d28de0d58..988431f3a9 100644 --- a/Applications/SystemMenu/PowerDialog.cpp +++ b/Applications/SystemMenu/PowerDialog.cpp @@ -59,8 +59,8 @@ Vector PowerDialog::show() return options[rc].cmd; } -PowerDialog::PowerDialog(Core::Object* parent) - : GUI::Dialog(parent) +PowerDialog::PowerDialog() + : GUI::Dialog(nullptr) { Gfx::Rect rect({ 0, 0, 180, 180 + ((options.size() - 3) * 16) }); rect.center_within(GUI::Desktop::the().rect()); @@ -76,7 +76,7 @@ PowerDialog::PowerDialog(Core::Object* parent) main->layout()->set_spacing(8); main->set_fill_with_background_color(true); - auto header = GUI::Label::construct(main.ptr()); + auto header = main->add(); header->set_text("What would you like to do?"); header->set_preferred_size(0, 16); header->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); @@ -85,7 +85,7 @@ PowerDialog::PowerDialog(Core::Object* parent) int selected = -1; for (int i = 0; i < options.size(); i++) { auto action = options[i]; - auto radio = GUI::RadioButton::construct(main); + auto radio = main->add(); radio->set_enabled(action.enabled); radio->set_text(action.title); @@ -99,17 +99,17 @@ PowerDialog::PowerDialog(Core::Object* parent) } } - auto button_box = GUI::Widget::construct(main.ptr()); + auto button_box = main->add(); button_box->set_layout(make()); button_box->layout()->set_spacing(8); - auto ok_button = GUI::Button::construct(button_box); + auto ok_button = button_box->add(); ok_button->on_click = [this, &selected](auto&) { done(selected); }; ok_button->set_text("OK"); - auto cancel_button = GUI::Button::construct(button_box); + auto cancel_button = button_box->add(); cancel_button->on_click = [this](auto&) { done(-1); }; diff --git a/Applications/SystemMenu/PowerDialog.h b/Applications/SystemMenu/PowerDialog.h index c36e033aa9..a001c7f42f 100644 --- a/Applications/SystemMenu/PowerDialog.h +++ b/Applications/SystemMenu/PowerDialog.h @@ -34,6 +34,6 @@ public: static Vector show(); private: - PowerDialog(Core::Object* parent = nullptr); + PowerDialog(); ~PowerDialog(); }; -- cgit v1.2.3