X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e40298d54ecd5b109222a7c60aa2ef084a304d69..bd24160658c0e3d8971c7f65391ad18fa631ed64:/src/mac/carbon/radiobut.cpp diff --git a/src/mac/carbon/radiobut.cpp b/src/mac/carbon/radiobut.cpp index 46014e4576..32ad08047e 100644 --- a/src/mac/carbon/radiobut.cpp +++ b/src/mac/carbon/radiobut.cpp @@ -30,15 +30,19 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - Rect bounds ; - Str255 title ; + m_macIsUserPane = FALSE ; - MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return false; + + m_label = label ; - m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, - kControlRadioButtonProc , (long) this ) ; + Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; - MacPostControlCreate() ; + verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , + 0 , false /* no autotoggle */ , (ControlRef*) &m_macControl ) ) ; + + MacPostControlCreate(pos,size) ; m_cycle = this ; @@ -69,10 +73,10 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, void wxRadioButton::SetValue(bool val) { wxRadioButton *cycle; - if ( GetControl32BitValue( (ControlHandle) m_macControl ) == val ) + if ( GetControl32BitValue( (ControlRef) m_macControl ) == val ) return ; - ::SetControl32BitValue( (ControlHandle) m_macControl , val ) ; + ::SetControl32BitValue( (ControlRef) m_macControl , val ) ; if (val) { cycle=this->NextInCycle(); @@ -88,7 +92,7 @@ void wxRadioButton::SetValue(bool val) bool wxRadioButton::GetValue() const { - return ::GetControl32BitValue( (ControlHandle) m_macControl ) ; + return ::GetControl32BitValue( (ControlRef) m_macControl ) ; } void wxRadioButton::Command (wxCommandEvent & event) @@ -97,10 +101,11 @@ void wxRadioButton::Command (wxCommandEvent & event) ProcessCommand (event); } -void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) +wxInt32 wxRadioButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) ) { + // if already set -> no action if ( GetValue() ) - return ; + return noErr; wxRadioButton *cycle, *old = NULL ; cycle=this->NextInCycle(); @@ -126,6 +131,7 @@ void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpar event2.SetEventObject(this); event2.SetInt( true ); ProcessCommand(event2); + return noErr ; } wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)