1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 23:28:12 +00:00

WindowServer: Raise menu item icons slightly when hovered :^)

Same effect as LibGUI toolbar buttons.
This commit is contained in:
Andreas Kling 2020-10-25 15:30:37 +01:00
parent 8b12d200ba
commit cfe1c132cb

View file

@ -246,6 +246,15 @@ void Menu::draw()
} else if (item.icon()) {
Gfx::IntRect icon_rect { item.rect().x() + 3, 0, s_item_icon_width, s_item_icon_width };
icon_rect.center_vertically_within(text_rect);
if (&item == hovered_item() && item.is_enabled()) {
auto shadow_color = palette.threed_shadow1();
shadow_color = palette.menu_selection().darkened();
painter.blit_filtered(icon_rect.location(), *item.icon(), item.icon()->rect(), [&shadow_color](auto) {
return shadow_color;
});
icon_rect.move_by(-1, -1);
}
painter.blit(icon_rect.location(), *item.icon(), item.icon()->rect());
}
auto& previous_font = painter.font();