X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/524c47aa3adf2af11a3069fd5da035a604f08f66..47e175a24f862aa8b7ca7dd4a2bb5957991e7f2d:/src/osx/carbon/slider.cpp diff --git a/src/osx/carbon/slider.cpp b/src/osx/carbon/slider.cpp index 38daf07216..ad2bc14334 100644 --- a/src/osx/carbon/slider.cpp +++ b/src/osx/carbon/slider.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: slider.cpp +// Name: src/osx/carbon/slider.cpp // Purpose: wxSlider // Author: Stefan Csomor // Modified by: @@ -16,29 +16,45 @@ #include "wx/slider.h" #include "wx/osx/private.h" -wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID id, +class wxMacSliderCarbonControl : public wxMacControl +{ +public : + wxMacSliderCarbonControl( wxWindowMac* peer ) : wxMacControl( peer ) + { + } + + // work around an OSX bug : if the control is having the keyboard focus it cannot + // be set to the full max/min values by dragging + virtual bool CanFocus() const + { + return false; + } +}; + + +wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID WXUNUSED(id), wxInt32 value, wxInt32 minimum, wxInt32 maximum, - const wxPoint& pos, + const wxPoint& pos, const wxSize& size, - long style, - long extraStyle) + long style, + long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); int tickMarks = 0; if ( style & wxSL_AUTOTICKS ) tickMarks = (maximum - minimum) + 1; // +1 for the 0 value - // keep the number of tickmarks from becoming unwieldly, therefore below it is ok to cast + // keep the number of tickmarks from becoming unwieldy, therefore below it is ok to cast // it to a UInt16 while (tickMarks > 20) tickMarks /= 5; - wxMacControl* peer = new wxMacControl( wxpeer ); + wxMacControl* peer = new wxMacSliderCarbonControl( wxpeer ); OSStatus err = CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, value, minimum, maximum,