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

LibGUI: Remove left margin on MessageBox text when icon is unset

It looks better when text is properly centered.
This commit is contained in:
LuK1337 2021-07-09 22:19:24 +02:00 committed by Gunnar Beutner
parent a44de7a55f
commit 5e1e67277b

View file

@ -92,14 +92,16 @@ void MessageBox::build()
auto& message_container = widget.add<Widget>();
message_container.set_layout<HorizontalBoxLayout>();
message_container.layout()->set_margins({ 8, 0, 0, 0 });
message_container.layout()->set_spacing(8);
if (m_type != Type::None) {
auto& icon_image = message_container.add<ImageWidget>();
icon_image.set_bitmap(icon());
if (icon())
if (icon()) {
icon_width = icon()->width();
if (icon_width > 0)
message_container.layout()->set_margins({ 8, 0, 0, 0 });
}
}
auto& label = message_container.add<Label>(m_text);