1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 07:07:36 +00:00

Userspace: Use Core::Object::add() when building interfaces

This commit is contained in:
Andreas Kling 2020-02-23 10:57:42 +01:00
parent 7ec758773c
commit 3d20da9ee4
87 changed files with 403 additions and 438 deletions

View file

@ -68,21 +68,21 @@ NotificationWindow::NotificationWindow(const String& text, const String& title)
widget->layout()->set_margins({ 4, 4, 4, 4 });
widget->layout()->set_spacing(4);
auto left_container = GUI::Widget::construct(widget.ptr());
auto left_container = widget->add<GUI::Widget>();
left_container->set_layout(make<GUI::VerticalBoxLayout>());
auto title_label = GUI::Label::construct(title, left_container);
auto title_label = left_container->add<GUI::Label>(title);
title_label->set_font(Gfx::Font::default_bold_font());
title_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto text_label = GUI::Label::construct(text, left_container);
auto text_label = left_container->add<GUI::Label>(text);
text_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto right_container = GUI::Widget::construct(widget.ptr());
auto right_container = widget->add<GUI::Widget>();
right_container->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
right_container->set_preferred_size(40, 0);
right_container->set_layout(make<GUI::HorizontalBoxLayout>());
auto button = GUI::Button::construct("Okay", right_container);
auto button = right_container->add<GUI::Button>("Okay");
button->on_click = [this](auto&) {
s_windows.remove(this);
close();