X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/facd6764872eede45605ba7c9dfa0e1d0c708fa2..db36543353d37c2357e8e30aab53ff37337b1127:/src/mac/carbon/radiobut.cpp diff --git a/src/mac/carbon/radiobut.cpp b/src/mac/carbon/radiobut.cpp index c7101f60ad..1a31f44a25 100644 --- a/src/mac/carbon/radiobut.cpp +++ b/src/mac/carbon/radiobut.cpp @@ -38,10 +38,12 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, m_label = label ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; - - m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , 1, - kControlRadioButtonProc , (long) this ) ; + m_peer = new wxMacControl() ; + verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , + 0 , false /* no autotoggle */ , m_peer->GetControlRefAddr() ) ); + + MacPostControlCreate(pos,size) ; m_cycle = this ; @@ -54,7 +56,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, { /* search backward for last group start */ wxRadioButton *chief = (wxRadioButton*) NULL; - wxWindowList::Node *node = parent->GetChildren().GetLast(); + wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast(); while (node) { wxWindow *child = node->GetData(); @@ -73,10 +75,10 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, void wxRadioButton::SetValue(bool val) { wxRadioButton *cycle; - if ( GetControl32BitValue( (ControlRef) m_macControl ) == val ) + if ( m_peer->GetValue() == val ) return ; - ::SetControl32BitValue( (ControlRef) m_macControl , val ) ; + m_peer->SetValue( val ) ; if (val) { cycle=this->NextInCycle(); @@ -92,7 +94,7 @@ void wxRadioButton::SetValue(bool val) bool wxRadioButton::GetValue() const { - return ::GetControl32BitValue( (ControlRef) m_macControl ) ; + return m_peer->GetValue() ; } void wxRadioButton::Command (wxCommandEvent & event) @@ -101,10 +103,11 @@ void wxRadioButton::Command (wxCommandEvent & event) ProcessCommand (event); } -void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown)) +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(); @@ -130,6 +133,7 @@ void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpar event2.SetEventObject(this); event2.SetInt( true ); ProcessCommand(event2); + return noErr ; } wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)