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

LibGUI: Keep the (1, 1) text offset on GButton after it becomes checked

This makes the text offset "stick" after you click to select a window
in the taskbar, for example.
This commit is contained in:
Andreas Kling 2019-11-29 15:46:38 +01:00
parent dd72608aed
commit ea52fe528a

View file

@ -32,11 +32,11 @@ void GButton::paint_event(GPaintEvent& event)
if (text().is_empty() && !m_icon)
return;
auto content_rect = rect().shrunken(10, 2);
auto content_rect = rect().shrunken(8, 2);
auto icon_location = m_icon ? content_rect.center().translated(-(m_icon->width() / 2), -(m_icon->height() / 2)) : Point();
if (m_icon && !text().is_empty())
icon_location.set_x(content_rect.x());
if (is_being_pressed())
if (is_being_pressed() || is_checked())
painter.translate(1, 1);
if (m_icon) {
if (is_enabled())