X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/93a2619d107796afbad422363698bae4d7f06b77..5c7b506103cfc078a821860766e31c47d595e07f:/src/mac/carbon/slider.cpp diff --git a/src/mac/carbon/slider.cpp b/src/mac/carbon/slider.cpp index e619ada6c7..ced51f397e 100644 --- a/src/mac/carbon/slider.cpp +++ b/src/mac/carbon/slider.cpp @@ -22,7 +22,6 @@ BEGIN_EVENT_TABLE(wxSlider, wxControl) END_EVENT_TABLE() // The dimensions of the different styles of sliders (from Aqua document) -#define wxSLIDER_DIMENSIONACROSS 15 #define wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS 24 #define wxSLIDER_DIMENSIONACROSS_ARROW 18 @@ -204,11 +203,20 @@ 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 -void wxSlider::SetTickFreq(int n, int pos) +void wxSlider::SetTickFreq(int n, int WXUNUSED(pos)) { // TODO m_tickFreq = n; @@ -244,7 +252,7 @@ void wxSlider::SetLineSize(int lineSize) int wxSlider::GetLineSize() const { // TODO - return 0; + return m_lineSize; } int wxSlider::GetSelEnd() const @@ -259,12 +267,12 @@ int wxSlider::GetSelStart() const return 0; } -void wxSlider::SetSelection(int minPos, int maxPos) +void wxSlider::SetSelection(int WXUNUSED(minPos), int WXUNUSED(maxPos)) { // TODO } -void wxSlider::SetThumbLength(int len) +void wxSlider::SetThumbLength(int WXUNUSED(len)) { // TODO } @@ -275,7 +283,7 @@ int wxSlider::GetThumbLength() const return 0; } -void wxSlider::SetTick(int tickPos) +void wxSlider::SetTick(int WXUNUSED(tickPos)) { // TODO } @@ -286,7 +294,9 @@ void wxSlider::Command(wxCommandEvent &event) ProcessCommand(event); } -void wxSlider::MacHandleControlClick( WXWidget control, wxInt16 controlpart, bool mouseStillDown ) +void wxSlider::MacHandleControlClick(WXWidget WXUNUSED(control), + wxInt16 WXUNUSED(controlpart), + bool WXUNUSED(mouseStillDown)) { // Whatever the native value is, we may need to invert it for calling // SetValue and putting the possibly inverted value in the event @@ -294,23 +304,19 @@ 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); + HandleWindowEvent( event ); wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId ); cevent.SetInt( value ); cevent.SetEventObject( this ); - - GetEventHandler()->ProcessEvent( cevent ); + HandleWindowEvent( cevent ); } -wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent ) +wxInt32 wxSlider::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler), + WXEVENTREF WXUNUSED(mevent)) { // Whatever the native value is, we may need to invert it for calling // SetValue and putting the possibly inverted value in the event @@ -318,20 +324,16 @@ 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); + HandleWindowEvent( event ); wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId ); cevent.SetInt( value ); cevent.SetEventObject( this ); - GetEventHandler()->ProcessEvent( cevent ); + HandleWindowEvent( cevent ); return noErr; } @@ -341,14 +343,20 @@ wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent ) // void wxSlider::DoSetSizeHints( int minW, int minH, int maxW, int maxH, - int incW, int incH ) + int WXUNUSED(incW), int WXUNUSED(incH) ) { wxSize size = GetBestSize(); if (GetWindowStyle() & wxSL_VERTICAL) - wxWindow::DoSetSizeHints(size.x, minH, size.x, maxH, incW, incH); + { + SetMinSize( wxSize(size.x,minH) ); + SetMaxSize( wxSize(size.x,maxH) ); + } else - wxWindow::DoSetSizeHints(minW, size.y, maxW, size.y, incW, incH); + { + SetMinSize( wxSize(minW,size.y) ); + SetMaxSize( wxSize(maxW,size.y) ); + } } wxSize wxSlider::DoGetBestSize() const @@ -416,13 +424,11 @@ wxSize wxSlider::DoGetBestSize() const void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags) { - int xborder, yborder; + int yborder = 0; int minValWidth, maxValWidth, textheight; int sliderBreadth; int width = w; - xborder = yborder = 0; - if (GetWindowStyle() & wxSL_LABELS) { wxString text;