+ if(m_radioMaster==this)
+ {
+ // First get rid of ourselves (we should ALWAYS be at the head)
+ wxRadioButtonList::compatibility_iterator slaveNode =
+ m_radioSlaves.GetFirst();
+ wxASSERT(slaveNode);
+ wxASSERT(slaveNode->GetData() == this);
+ m_radioSlaves.DeleteNode(slaveNode);
+
+ // Now find the new master
+ wxRadioButton *newMaster = NULL;
+ slaveNode = m_radioSlaves.GetFirst();
+ if(slaveNode)
+ newMaster = slaveNode->GetData();
+
+ // For each node (including the new master) set the master, remove
+ // it from this list, and add it to the new master's list
+ for(; slaveNode; slaveNode = m_radioSlaves.GetFirst())
+ {
+ wxRadioButton *radioButton = slaveNode->GetData();
+ wxASSERT(radioButton->m_radioMaster == this);
+ radioButton->m_radioMaster = newMaster;
+ newMaster->m_radioSlaves.Append(radioButton);
+ m_radioSlaves.DeleteNode(slaveNode);
+ }
+ }
+ else if(m_radioMaster)
+ {
+ m_radioMaster->m_radioSlaves.DeleteObject(this);
+ m_radioMaster = NULL;
+ }
+ // normal stuff
+ DisassociateNSButton(GetNSButton());