X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/93a2619d107796afbad422363698bae4d7f06b77..f8a139493553049e0b92db4bbee11deb33093ee3:/src/mac/carbon/slider.cpp diff --git a/src/mac/carbon/slider.cpp b/src/mac/carbon/slider.cpp index e619ada6c7..a46467044f 100644 --- a/src/mac/carbon/slider.cpp +++ b/src/mac/carbon/slider.cpp @@ -204,7 +204,16 @@ void wxSlider::SetRange(int minValue, int maxValue) m_macMaximumStatic->SetLabel( value ); } - SetValue( m_rangeMin ); + // If the range is out of bounds, set it to a + // value that is within bounds + // RN: Testing reveals OSX does its own + // bounding, perhaps this isn't needed? + int currentValue = GetValue(); + + if(currentValue < m_rangeMin) + SetValue(m_rangeMin); + else if(currentValue > m_rangeMax) + SetValue(m_rangeMax); } // For trackbars only @@ -294,19 +303,14 @@ void wxSlider::MacHandleControlClick( WXWidget control, wxInt16 controlpart, boo SetValue( value ); - wxEventType scrollEvent = wxEVT_NULL; - - scrollEvent = wxEVT_SCROLL_THUMBTRACK; - - wxScrollEvent event(scrollEvent, m_windowId); - event.SetPosition(value); + wxScrollEvent event( wxEVT_SCROLL_THUMBTRACK, m_windowId ); + event.SetPosition( value ); event.SetEventObject( this ); - GetEventHandler()->ProcessEvent(event); + GetEventHandler()->ProcessEvent( event ); wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId ); cevent.SetInt( value ); cevent.SetEventObject( this ); - GetEventHandler()->ProcessEvent( cevent ); } @@ -318,14 +322,10 @@ wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent ) SetValue( value ) ; - wxEventType scrollEvent = wxEVT_NULL ; - - scrollEvent = wxEVT_SCROLL_THUMBRELEASE; - - wxScrollEvent event(scrollEvent, m_windowId); - event.SetPosition(value); + wxScrollEvent event( wxEVT_SCROLL_THUMBRELEASE, m_windowId ); + event.SetPosition( value ); event.SetEventObject( this ); - GetEventHandler()->ProcessEvent(event); + GetEventHandler()->ProcessEvent( event ); wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId ); cevent.SetInt( value );