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:
parent
906fde8f8c
commit
723ba91f74
6 changed files with 43 additions and 40 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue