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:
Andreas Kling 2020-12-28 20:14:17 +01:00
parent 207ecf454a
commit f7116bba43
Notes: sideshowbarker 2024-07-19 00:29:13 +09:00
8 changed files with 31 additions and 25 deletions

View file

@ -97,7 +97,6 @@ MultiView::MultiView()
build_actions();
set_view_mode(ViewMode::Icon);
apply_multi_select();
}
MultiView::~MultiView()
@ -176,19 +175,16 @@ void MultiView::build_actions()
m_view_type_action_group->add_action(*m_view_as_columns_action);
}
void MultiView::apply_multi_select()
AbstractView::SelectionMode MultiView::selection_mode() const
{
m_table_view->set_multi_select(m_multi_select);
m_icon_view->set_multi_select(m_multi_select);
m_columns_view->set_multi_select(m_multi_select);
return m_table_view->selection_mode();
}
void MultiView::set_multi_select(bool multi_select)
void MultiView::set_selection_mode(AbstractView::SelectionMode selection_mode)
{
if (m_multi_select == multi_select)
return;
m_multi_select = multi_select;
apply_multi_select();
m_table_view->set_selection_mode(selection_mode);
m_icon_view->set_selection_mode(selection_mode);
m_columns_view->set_selection_mode(selection_mode);
}
void MultiView::set_key_column_and_sort_order(int column, SortOrder sort_order)