1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:28:11 +00:00

Applications+LibGUI: Convert all GML consumers to use the LibCore finder

Remove Widget::find_child_by_name and Widget::find_descendant_by_name,
and convert all users to using the type-safer version in Core::Object.
This commit is contained in:
Andrew Kaster 2021-01-01 00:57:48 -07:00 committed by Andreas Kling
parent 5b03a0867f
commit 347bf6459d
11 changed files with 58 additions and 88 deletions

View file

@ -1001,33 +1001,6 @@ bool Widget::load_from_json(const JsonObject& json)
return true;
}
Widget* Widget::find_child_by_name(const String& name)
{
Widget* found_widget = nullptr;
for_each_child_widget([&](auto& child) {
if (child.name() == name) {
found_widget = &child;
return IterationDecision::Break;
}
return IterationDecision::Continue;
});
return found_widget;
}
Widget* Widget::find_descendant_by_name(const String& name)
{
Widget* found_widget = nullptr;
if (this->name() == name)
return this;
for_each_child_widget([&](auto& child) {
found_widget = child.find_descendant_by_name(name);
if (found_widget)
return IterationDecision::Break;
return IterationDecision::Continue;
});
return found_widget;
}
bool Widget::has_focus_within() const
{
auto* window = this->window();