X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b45ed7a273799b1b360482496a706a211eca6435..da2101204027855793c4264388b95a208967ae15:/src/mac/carbon/radiobut.cpp?ds=inline diff --git a/src/mac/carbon/radiobut.cpp b/src/mac/carbon/radiobut.cpp index 991c8be68f..52cc12108a 100644 --- a/src/mac/carbon/radiobut.cpp +++ b/src/mac/carbon/radiobut.cpp @@ -30,18 +30,21 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + m_macIsUserPane = FALSE ; + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; - - Rect bounds ; - Str255 title ; - MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; + 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() ; + m_peer = new wxMacControl() ; + verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , + 0 , false /* no autotoggle */ , *m_peer ) ); + + + MacPostControlCreate(pos,size) ; m_cycle = this ; @@ -53,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(); @@ -72,10 +75,10 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, void wxRadioButton::SetValue(bool val) { wxRadioButton *cycle; - if ( GetControl32BitValue( (ControlHandle) m_macControl ) == val ) + if ( GetControl32BitValue( *m_peer ) == val ) return ; - ::SetControl32BitValue( (ControlHandle) m_macControl , val ) ; + ::SetControl32BitValue( *m_peer , val ) ; if (val) { cycle=this->NextInCycle(); @@ -91,7 +94,7 @@ void wxRadioButton::SetValue(bool val) bool wxRadioButton::GetValue() const { - return ::GetControl32BitValue( (ControlHandle) m_macControl ) ; + return ::GetControl32BitValue( *m_peer ) ; } void wxRadioButton::Command (wxCommandEvent & event) @@ -100,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(); @@ -129,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)