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:
Andreas Kling 2020-03-30 19:57:44 +02:00
parent add93bf593
commit b4fde72013
Notes: sideshowbarker 2024-07-19 08:02:45 +09:00
6 changed files with 40 additions and 11 deletions

View file

@ -193,7 +193,16 @@ void AbstractView::mousedown_event(MouseEvent& event)
void AbstractView::mousemove_event(MouseEvent& event)
{
if (!model() || !m_might_drag)
if (!model())
return ScrollableWidget::mousemove_event(event);
auto hovered_index = index_at_event_position(event.position());
if (m_hovered_index != hovered_index) {
m_hovered_index = hovered_index;
update();
}
if (!m_might_drag)
return ScrollableWidget::mousemove_event(event);
if (!(event.buttons() & MouseButton::Left) || m_selection.is_empty()) {