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_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; }
bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) { DontCreatePeer(); if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; m_labelOrig = m_label = label; SetPeer(wxWidgetImpl::CreateRadioButton( this, parent, id, label, pos, size, style, GetExtraStyle() )); 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; }
bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { if( !CreateControl( parent, id, pos, size, style, validator, name ) ) return false; Widget parentWidget = (Widget) parent->GetClientWidget(); Display* dpy = XtDisplay(parentWidget); wxString label1(wxStripMenuCodes(label)); wxXmString text( label1 ); Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle", #if wxUSE_GADGETS xmToggleButtonGadgetClass, parentWidget, #else xmToggleButtonWidgetClass, parentWidget, #endif wxFont::GetFontTag(), m_font.GetFontTypeC(dpy), XmNlabelString, text(), XmNfillOnSelect, True, XmNindicatorType, XmONE_OF_MANY, // diamond-shape NULL); XtAddCallback (radioButtonWidget, XmNvalueChangedCallback, (XtCallbackProc)wxRadioButtonCallback, (XtPointer)this); m_mainWidget = (WXWidget) radioButtonWidget; XtManageChild (radioButtonWidget); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); ChangeBackgroundColour(); //copied from mac/radiobut.cpp (from here till "return true;") m_cycle = this ; if (HasFlag(wxRB_GROUP)) { AddInCycle( NULL ) ; } else { /* search backward for last group start */ wxRadioButton *chief = (wxRadioButton*) 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; }