1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added a method Component::getChildren() to allow them to be iterated with a range-based for loop, and used this in appropriate places around the codebase

This commit is contained in:
jules 2017-07-19 12:08:47 +01:00
parent 663af835f9
commit 4e5f005421
21 changed files with 182 additions and 223 deletions

View file

@ -242,19 +242,17 @@ void Button::setRadioGroupId (const int newGroupId, NotificationType notificatio
void Button::turnOffOtherButtonsInGroup (const NotificationType notification)
{
if (Component* const p = getParentComponent())
if (auto* p = getParentComponent())
{
if (radioGroupId != 0)
{
WeakReference<Component> deletionWatcher (this);
for (int i = p->getNumChildComponents(); --i >= 0;)
for (auto* c : p->getChildren())
{
Component* const c = p->getChildComponent (i);
if (c != this)
{
if (Button* const b = dynamic_cast<Button*> (c))
if (auto b = dynamic_cast<Button*> (c))
{
if (b->getRadioGroupId() == radioGroupId)
{