mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
LibGUI: Refactor AbstractView "multi select" mode into "selection mode"
There are three possible selection modes for a GUI::AbstractView. - NoSelection - SingleSelection - MultiSelection We don't enforce these modes fully yet, this patch mostly adds them in place of the old "multi select" flag.
This commit is contained in:
@@ -403,16 +403,21 @@ void AbstractView::drop_event(DropEvent& event)
|
||||
on_drop(index, event);
|
||||
}
|
||||
|
||||
void AbstractView::set_multi_select(bool multi_select)
|
||||
void AbstractView::set_selection_mode(SelectionMode selection_mode)
|
||||
{
|
||||
if (m_multi_select == multi_select)
|
||||
if (m_selection_mode == selection_mode)
|
||||
return;
|
||||
m_multi_select = multi_select;
|
||||
if (!multi_select && m_selection.size() > 1) {
|
||||
m_selection_mode = selection_mode;
|
||||
|
||||
if (m_selection_mode == SelectionMode::NoSelection)
|
||||
m_selection.clear();
|
||||
else if (m_selection_mode != SelectionMode::SingleSelection && m_selection.size() > 1) {
|
||||
auto first_selected = m_selection.first();
|
||||
m_selection.clear();
|
||||
m_selection.set(first_selected);
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void AbstractView::set_key_column_and_sort_order(int column, SortOrder sort_order)
|
||||
|
||||
Reference in New Issue
Block a user