mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-09 04:32:51 +00:00
LibGUI: Add GWidget::for_each_child_widget(callback).
This commit is contained in:
parent
906fde8f8c
commit
723ba91f74
Notes:
sideshowbarker
2024-07-19 13:55:26 +09:00
Author: https://github.com/awesomekling
Commit: 723ba91f74
6 changed files with 43 additions and 40 deletions
|
@ -526,16 +526,14 @@ Vector<GWidget*> GWindow::focusable_widgets() const
|
|||
Function<void(GWidget&)> collect_focusable_widgets = [&] (GWidget& widget) {
|
||||
if (widget.accepts_focus())
|
||||
collected_widgets.append(&widget);
|
||||
for (auto& child : widget.children()) {
|
||||
if (!child->is_widget())
|
||||
continue;
|
||||
auto& child_widget = *static_cast<GWidget*>(child);
|
||||
if (!child_widget.is_visible())
|
||||
continue;
|
||||
if (!child_widget.is_enabled())
|
||||
continue;
|
||||
collect_focusable_widgets(child_widget);
|
||||
}
|
||||
widget.for_each_child_widget([&] (auto& child) {
|
||||
if (!child.is_visible())
|
||||
return IterationDecision::Continue;
|
||||
if (!child.is_enabled())
|
||||
return IterationDecision::Continue;
|
||||
collect_focusable_widgets(child);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
};
|
||||
|
||||
collect_focusable_widgets(*m_main_widget);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue