Example #1
0
void RadioButtonController::OnRadioClicked( Gwen::Controls::Base* pFromPanel )
{
	RadioButton* pCheckedRadioButton = pFromPanel->DynamicCastRadioButton();

	//Iterate through all other buttons and set them to false;
	for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
	{
		Base* pChild = *iter;
		LabeledRadioButton* pLRB = pChild->DynamicCastLabeledRadioButton();
		if ( pLRB )
		{
			RadioButton* pChildRadioButton = pLRB->GetRadioButton();
			if ( pChildRadioButton == pCheckedRadioButton )
			{
				m_Selected = pLRB;
			}
			else
			{
				pLRB->GetRadioButton()->SetChecked( false );
			}
		}
	}

	OnChange();
}