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

LibGUI: Make it possible to tweak icon spacing on a GUI::Button

This is the space between the icon and the text on buttons that have
both icon and text.
This commit is contained in:
Andreas Kling 2021-03-25 22:41:40 +01:00
parent 11e190b323
commit 32c6e31f4c
2 changed files with 6 additions and 2 deletions

View file

@ -94,8 +94,8 @@ void Button::paint_event(PaintEvent& event)
}
auto& font = is_checked() ? Gfx::FontDatabase::default_bold_font() : this->font();
if (m_icon && !text().is_empty()) {
content_rect.move_by(m_icon->width() + 4, 0);
content_rect.set_width(content_rect.width() - m_icon->width() - 4);
content_rect.move_by(m_icon->width() + icon_spacing(), 0);
content_rect.set_width(content_rect.width() - m_icon->width() - icon_spacing());
}
Gfx::IntRect text_rect { 0, 0, font.width(text()), font.glyph_height() };