mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients
This commit is contained in:
parent
4697195645
commit
0f3e57a6fb
Notes:
sideshowbarker
2024-07-19 08:54:48 +09:00
Author: https://github.com/awesomekling
Commit: 0f3e57a6fb
37 changed files with 203 additions and 246 deletions
|
@ -91,21 +91,20 @@ bool MessageBox::should_include_no_button() const
|
|||
|
||||
void MessageBox::build()
|
||||
{
|
||||
auto widget = Widget::construct();
|
||||
set_main_widget(widget);
|
||||
auto& widget = set_main_widget<Widget>();
|
||||
|
||||
int text_width = widget->font().width(m_text);
|
||||
int text_width = widget.font().width(m_text);
|
||||
int icon_width = 0;
|
||||
|
||||
widget->set_layout<VerticalBoxLayout>();
|
||||
widget->set_fill_with_background_color(true);
|
||||
widget.set_layout<VerticalBoxLayout>();
|
||||
widget.set_fill_with_background_color(true);
|
||||
|
||||
widget->layout()->set_margins({ 0, 15, 0, 15 });
|
||||
widget->layout()->set_spacing(15);
|
||||
widget.layout()->set_margins({ 0, 15, 0, 15 });
|
||||
widget.layout()->set_spacing(15);
|
||||
|
||||
RefPtr<Widget> message_container = widget;
|
||||
if (m_type != Type::None) {
|
||||
message_container = widget->add<Widget>();
|
||||
message_container = widget.add<Widget>();
|
||||
message_container->set_layout<HorizontalBoxLayout>();
|
||||
message_container->layout()->set_margins({ 8, 0, 8, 0 });
|
||||
message_container->layout()->set_spacing(8);
|
||||
|
@ -121,7 +120,7 @@ void MessageBox::build()
|
|||
label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
label->set_preferred_size(text_width, 16);
|
||||
|
||||
auto button_container = widget->add<Widget>();
|
||||
auto button_container = widget.add<Widget>();
|
||||
button_container->set_layout<HorizontalBoxLayout>();
|
||||
button_container->layout()->set_spacing(5);
|
||||
button_container->layout()->set_margins({ 15, 0, 15, 0 });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue