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

LibGUI: Brighten buttons when hovering over them :^)

This commit is contained in:
Andreas Kling 2020-03-30 19:40:44 +02:00
parent 7976ef7a79
commit add93bf593

View file

@ -64,10 +64,14 @@ void Button::paint_event(PaintEvent& event)
if (is_being_pressed() || is_checked()) if (is_being_pressed() || is_checked())
painter.translate(1, 1); painter.translate(1, 1);
if (m_icon) { if (m_icon) {
if (is_enabled()) if (is_enabled()) {
painter.blit(icon_location, *m_icon, m_icon->rect()); if (is_hovered())
else painter.blit_brightened(icon_location, *m_icon, m_icon->rect());
else
painter.blit(icon_location, *m_icon, m_icon->rect());
} else {
painter.blit_dimmed(icon_location, *m_icon, m_icon->rect()); painter.blit_dimmed(icon_location, *m_icon, m_icon->rect());
}
} }
auto& font = is_checked() ? Gfx::Font::default_bold_font() : this->font(); auto& font = is_checked() ? Gfx::Font::default_bold_font() : this->font();
if (m_icon && !text().is_empty()) { if (m_icon && !text().is_empty()) {