mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-12 02:30:30 +09:00
LibGUI: Add GAbstractView::activate_selected()
This is a nice little utility to activate all the selected items, which is what you usually want to do.
This commit is contained in:
parent
caa08938e5
commit
0f18a16e2c
Notes:
sideshowbarker
2024-07-19 10:13:34 +09:00
Author: https://github.com/bugaevc
Commit: 0f18a16e2c
Pull-request: https://github.com/SerenityOS/serenity/pull/1050
5 changed files with 21 additions and 24 deletions
|
@ -113,6 +113,16 @@ void GAbstractView::activate(const GModelIndex& index)
|
|||
on_activation(index);
|
||||
}
|
||||
|
||||
void GAbstractView::activate_selected()
|
||||
{
|
||||
if (!on_activation)
|
||||
return;
|
||||
|
||||
selection().for_each_index([this](auto& index) {
|
||||
on_activation(index);
|
||||
});
|
||||
}
|
||||
|
||||
void GAbstractView::notify_selection_changed(Badge<GModelSelection>)
|
||||
{
|
||||
did_update_selection();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue