X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b45ed7a273799b1b360482496a706a211eca6435..56d061c578db49bb2dc98ccf34559d3027982a3b:/src/mac/carbon/spinbutt.cpp?ds=sidebyside diff --git a/src/mac/carbon/spinbutt.cpp b/src/mac/carbon/spinbutt.cpp index f8dcca8bd9..30d3076417 100644 --- a/src/mac/carbon/spinbutt.cpp +++ b/src/mac/carbon/spinbutt.cpp @@ -38,6 +38,8 @@ wxSpinButton::wxSpinButton() bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { + m_macIsUserPane = FALSE ; + if ( !wxSpinButtonBase::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; @@ -48,17 +50,12 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c if (!parent) return FALSE; - Rect bounds ; - Str255 title ; - - MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ; - - m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 100, - kControlLittleArrowsProc , (long) this ) ; + Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; + + verify_noerr ( CreateLittleArrowsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 0 , m_min , m_max , 1 , + (ControlRef*) &m_macControl ) ) ; - wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ; - - MacPostControlCreate() ; + MacPostControlCreate(pos,size) ; return TRUE; } @@ -94,8 +91,8 @@ void wxSpinButton::SetRange(int minVal, int maxVal) { m_min = minVal; m_max = maxVal; - SetControl32BitMaximum( (ControlHandle) m_macControl , maxVal ) ; - SetControl32BitMinimum((ControlHandle) m_macControl , minVal ) ; + SetControl32BitMaximum( (ControlRef) m_macControl , maxVal ) ; + SetControl32BitMinimum((ControlRef) m_macControl , minVal ) ; } void wxSpinButton::MacHandleValueChanged( int inc ) @@ -138,7 +135,7 @@ void wxSpinButton::MacHandleValueChanged( int inc ) { m_value = oldValue ; } - SetControl32BitValue( (ControlHandle) m_macControl , m_value ) ; + SetControl32BitValue( (ControlRef) m_macControl , m_value ) ; /* always send a thumbtrack event */ if (scrollEvent != wxEVT_SCROLL_THUMBTRACK) @@ -151,14 +148,12 @@ void wxSpinButton::MacHandleValueChanged( int inc ) } } -void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown)) +wxInt32 wxSpinButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF event ) { - if ( (ControlHandle) m_macControl == NULL ) - return ; - int nScrollInc = 0; + wxMacCarbonEvent cEvent( (EventRef) event ) ; - switch( controlpart ) + switch( cEvent.GetParameter(kEventParamControlPart,typeControlPartCode) ) { case kControlUpButtonPart : nScrollInc = 1; @@ -168,7 +163,7 @@ void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart break ; } MacHandleValueChanged( nScrollInc ) ; - + return noErr ; } // ----------------------------------------------------------------------------