diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-04 09:46:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-04 14:26:16 +0100 |
commit | 0f3e57a6fb037f6a8133e8ec2be8f0889ff9bc19 (patch) | |
tree | 3fc1f6f91d7e00783792e98bd23f226e591d99a3 /Servers/NotificationServer | |
parent | 4697195645a4c66930761c85685f5752dc777bba (diff) | |
download | serenity-0f3e57a6fb037f6a8133e8ec2be8f0889ff9bc19.zip |
LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients
Diffstat (limited to 'Servers/NotificationServer')
-rw-r--r-- | Servers/NotificationServer/NotificationWindow.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Servers/NotificationServer/NotificationWindow.cpp b/Servers/NotificationServer/NotificationWindow.cpp index 2272ca6fd1..9d32487795 100644 --- a/Servers/NotificationServer/NotificationWindow.cpp +++ b/Servers/NotificationServer/NotificationWindow.cpp @@ -61,14 +61,14 @@ NotificationWindow::NotificationWindow(const String& text, const String& title) m_original_rect = rect; - auto widget = GUI::Widget::construct(); - widget->set_fill_with_background_color(true); + auto& widget = set_main_widget<GUI::Widget>(); + widget.set_fill_with_background_color(true); - widget->set_layout<GUI::HorizontalBoxLayout>(); - widget->layout()->set_margins({ 4, 4, 4, 4 }); - widget->layout()->set_spacing(4); + widget.set_layout<GUI::HorizontalBoxLayout>(); + widget.layout()->set_margins({ 4, 4, 4, 4 }); + widget.layout()->set_spacing(4); - auto left_container = widget->add<GUI::Widget>(); + auto left_container = widget.add<GUI::Widget>(); left_container->set_layout<GUI::VerticalBoxLayout>(); auto title_label = left_container->add<GUI::Label>(title); @@ -77,7 +77,7 @@ NotificationWindow::NotificationWindow(const String& text, const String& title) auto text_label = left_container->add<GUI::Label>(text); text_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); - auto right_container = widget->add<GUI::Widget>(); + 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<GUI::HorizontalBoxLayout>(); @@ -87,8 +87,6 @@ NotificationWindow::NotificationWindow(const String& text, const String& title) s_windows.remove(this); close(); }; - - set_main_widget(widget); } NotificationWindow::~NotificationWindow() |