summaryrefslogtreecommitdiff
path: root/Applications/SystemMenu
diff options
context:
space:
mode:
authorthatlittlegit <personal@thatlittlegit.tk>2020-02-23 14:43:18 -0500
committerAndreas Kling <kling@serenityos.org>2020-02-23 22:03:03 +0100
commit525f8df5b83c2fea262af4e382dd8eb0f7664d1e (patch)
tree891912e9a0e58e902f1a68ecbef822c5f55adeb8 /Applications/SystemMenu
parentab9e5755baeeea701661492d31744c2cd4fcf367 (diff)
downloadserenity-525f8df5b83c2fea262af4e382dd8eb0f7664d1e.zip
SystemMenu: Migrate PowerDialog to (widget)->add like in 3d20da9e
This also fixes the build.
Diffstat (limited to 'Applications/SystemMenu')
-rw-r--r--Applications/SystemMenu/PowerDialog.cpp14
-rw-r--r--Applications/SystemMenu/PowerDialog.h2
2 files changed, 8 insertions, 8 deletions
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<char const*> 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<GUI::Label>();
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<GUI::RadioButton>();
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<GUI::Widget>();
button_box->set_layout(make<GUI::HorizontalBoxLayout>());
button_box->layout()->set_spacing(8);
- auto ok_button = GUI::Button::construct(button_box);
+ auto ok_button = button_box->add<GUI::Button>();
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<GUI::Button>();
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<char const*> show();
private:
- PowerDialog(Core::Object* parent = nullptr);
+ PowerDialog();
~PowerDialog();
};