mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibGUI: Add ability to disable multiselect for views
This commit is contained in:
parent
f266f0e880
commit
d4c6ae8263
Notes:
sideshowbarker
2024-07-19 04:50:55 +09:00
Author: https://github.com/tomuta
Commit: d4c6ae8263
Pull-request: https://github.com/SerenityOS/serenity/pull/2761
Reviewed-by: https://github.com/Dexesttp
5 changed files with 45 additions and 3 deletions
|
@ -375,4 +375,16 @@ void AbstractView::drop_event(DropEvent& event)
|
|||
on_drop(index, event);
|
||||
}
|
||||
|
||||
void AbstractView::set_multi_select(bool multi_select)
|
||||
{
|
||||
if (m_multi_select == multi_select)
|
||||
return;
|
||||
m_multi_select = multi_select;
|
||||
if (!multi_select && m_selection.size() > 1) {
|
||||
auto first_selected = m_selection.first();
|
||||
m_selection.clear();
|
||||
m_selection.set(first_selected);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue