1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:27:42 +00:00

LibGUI: Add GWidget::for_each_child_widget(callback).

This commit is contained in:
Andreas Kling 2019-05-27 03:52:33 +02:00
parent 906fde8f8c
commit 723ba91f74
6 changed files with 43 additions and 40 deletions

View file

@ -61,12 +61,10 @@ void GTabWidget::child_event(CChildEvent& event)
} else if (event.type() == GEvent::ChildRemoved) {
if (m_active_widget == &child) {
GWidget* new_active_widget = nullptr;
for (auto* new_child : children()) {
if (new_child->is_widget()) {
new_active_widget = static_cast<GWidget*>(new_child);
break;
}
}
for_each_child_widget([&] (auto& new_child) {
new_active_widget = &new_child;
return IterationDecision::Abort;
});
set_active_widget(new_active_widget);
}
}