mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
LibGUI: Use Core::Object::add() a whole bunch
This commit is contained in:
parent
8efafdfc12
commit
45c25ffecd
Notes:
sideshowbarker
2024-07-19 09:08:55 +09:00
Author: https://github.com/awesomekling
Commit: 45c25ffecd
11 changed files with 52 additions and 52 deletions
|
@ -35,7 +35,7 @@ namespace GUI {
|
|||
|
||||
int MessageBox::show(const StringView& text, const StringView& title, Type type, InputType input_type, Core::Object* parent)
|
||||
{
|
||||
auto box = MessageBox::construct(text, title, type, input_type, parent);
|
||||
auto box = parent->add<MessageBox>(text, title, type, input_type);
|
||||
return box->exec();
|
||||
}
|
||||
|
||||
|
@ -103,29 +103,29 @@ void MessageBox::build()
|
|||
|
||||
RefPtr<Widget> message_container = widget;
|
||||
if (m_type != Type::None) {
|
||||
message_container = Widget::construct(widget.ptr());
|
||||
message_container = widget->add<Widget>();
|
||||
message_container->set_layout(make<HorizontalBoxLayout>());
|
||||
message_container->layout()->set_margins({ 8, 0, 8, 0 });
|
||||
message_container->layout()->set_spacing(8);
|
||||
|
||||
auto icon_label = Label::construct(message_container);
|
||||
auto icon_label = message_container->add<Label>();
|
||||
icon_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
icon_label->set_preferred_size(32, 32);
|
||||
icon_label->set_icon(icon());
|
||||
icon_width = icon_label->icon()->width();
|
||||
}
|
||||
|
||||
auto label = Label::construct(m_text, message_container);
|
||||
auto label = message_container->add<Label>(m_text);
|
||||
label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
label->set_preferred_size(text_width, 16);
|
||||
|
||||
auto button_container = Widget::construct(widget.ptr());
|
||||
auto button_container = widget->add<Widget>();
|
||||
button_container->set_layout(make<HorizontalBoxLayout>());
|
||||
button_container->layout()->set_spacing(5);
|
||||
button_container->layout()->set_margins({ 15, 0, 15, 0 });
|
||||
|
||||
auto add_button = [&](String label, Dialog::ExecResult result) {
|
||||
auto button = Button::construct(button_container);
|
||||
auto button = button_container->add<Button>();
|
||||
button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
button->set_preferred_size(0, 20);
|
||||
button->set_text(label);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue