]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/slider.cpp
avoid setting initial position if it was not specified, broken in r70734
[wxWidgets.git] / src / osx / carbon / slider.cpp
index 60beb5b99d9941a17793f8f77a742b5d2cbbb421..e5f6f3f4b564a8af692713d3df23923713083842 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
-// RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
 // Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 #include "wx/slider.h"
 #include "wx/osx/private.h"
 
+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),
@@ -32,13 +47,13 @@ wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
     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,