1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +00:00

LibCore: Add CObject::for_each_child_of_type<T>()

Use this to iterate over all the GRadioButtons in a group.
This commit is contained in:
Andreas Kling 2019-05-27 04:18:24 +02:00
parent 0c85d3dba9
commit 3873c51781
3 changed files with 21 additions and 5 deletions

View file

@ -55,9 +55,7 @@ void GRadioButton::for_each_in_group(Callback callback)
{
if (!parent())
return;
for_each_child_widget([&] (auto& child) {
if (!child.is_radio_button())
return IterationDecision::Continue;
parent()->for_each_child_of_type<GRadioButton>([&] (auto& child) {
return callback(static_cast<GRadioButton&>(child));
});
}