1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 17:45:08 +00:00

LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients

This commit is contained in:
Andreas Kling 2020-03-04 09:46:23 +01:00
parent 4697195645
commit 0f3e57a6fb
37 changed files with 203 additions and 246 deletions

View file

@ -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()