mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 04:04:59 +00:00
LibGUI: Brighten icons when hovering items in item views
View classes now track their hovered item and paint them in a slightly brighter shade to liven up the user interface. :^)
This commit is contained in:
parent
add93bf593
commit
b4fde72013
6 changed files with 40 additions and 11 deletions
|
@ -299,8 +299,13 @@ void ItemView::paint_event(PaintEvent& event)
|
|||
get_item_rects(item_index, font, item_text, item_rect, icon_rect, text_rect);
|
||||
|
||||
if (icon.is_icon()) {
|
||||
if (auto bitmap = icon.as_icon().bitmap_for_size(icon_rect.width()))
|
||||
painter.draw_scaled_bitmap(icon_rect, *bitmap, bitmap->rect());
|
||||
if (auto bitmap = icon.as_icon().bitmap_for_size(icon_rect.width())) {
|
||||
if (m_hovered_index.is_valid() && m_hovered_index == model_index) {
|
||||
painter.blit_brightened(icon_rect.location(), *bitmap, bitmap->rect());
|
||||
} else {
|
||||
painter.blit(icon_rect.location(), *bitmap, bitmap->rect());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Color text_color;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue