-bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
- const wxString& label,
- const wxPoint& pos,
- const wxSize& size, long style,
- const wxValidator& validator,
- const wxString& name)
+bool wxRadioButton::Create( wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name )
+{
+ m_macIsUserPane = false;
+
+ if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
+ return false;
+
+ m_labelOrig = m_label = label;
+
+ Rect bounds = wxMacGetBoundsForControl( this, pos, size );
+
+ m_peer = new wxMacControl( this );
+ OSStatus err = CreateRadioButtonControl(
+ MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""),
+ 0, false /* no autotoggle */, m_peer->GetControlRefAddr() );
+ verify_noerr( err );
+
+ MacPostControlCreate( pos, size );
+
+ m_cycle = this;
+
+ if (HasFlag( wxRB_GROUP ))
+ {
+ AddInCycle( NULL );
+ }
+ else
+ {
+ // search backward for last group start
+ wxRadioButton *chief = NULL;
+ wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
+ while (node)
+ {
+ wxWindow *child = node->GetData();
+ if (child->IsKindOf( CLASSINFO( wxRadioButton ) ))
+ {
+ chief = (wxRadioButton*)child;
+ if (child->HasFlag( wxRB_GROUP ))
+ break;
+ }
+
+ node = node->GetPrevious();
+ }
+
+ AddInCycle( chief );
+ }
+
+ return true;
+}
+
+wxRadioButton::~wxRadioButton()