LibGUI: Add hover highlighting and keyboard controls to ComboBox

Adds a new highlighting effect to the actively selected row in
ComboBox ListView. ComboBoxEditor can now be controlled with
page up, page down, and the up and down arrow keys. ESC and loss
of focus now cause comboboxes to close. Now activates on mouseup
as well as return.
This commit is contained in:
thankyouverycool 2020-07-14 17:18:12 -04:00 committed by Andreas Kling
parent b2783a234a
commit 6a78db07f1
Notes: sideshowbarker 2024-07-19 04:48:58 +09:00
7 changed files with 142 additions and 15 deletions

View file

@ -225,6 +225,16 @@ void AbstractView::set_hovered_index(const ModelIndex& index)
if (m_hovered_index == index)
return;
m_hovered_index = index;
if (m_hovered_index.is_valid())
m_last_valid_hovered_index = m_hovered_index;
update();
}
void AbstractView::set_last_valid_hovered_index(const ModelIndex& index)
{
if (m_last_valid_hovered_index == index)
return;
m_last_valid_hovered_index = index;
update();
}
@ -325,6 +335,9 @@ void AbstractView::mouseup_event(MouseEvent& event)
m_might_drag = false;
update();
}
if (activates_on_selection())
activate_selected();
}
void AbstractView::doubleclick_event(MouseEvent& event)