]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/slider.cpp
fix some more improper widget casts
[wxWidgets.git] / src / osx / carbon / slider.cpp
index 38daf07216d5f5e6d5fb6251a18e88c7219025d6..30763766221c0324bb8762cfe2f3c3119d29188c 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        slider.cpp
+// Name:        src/osx/carbon/slider.cpp
 // Purpose:     wxSlider
 // Author:      Stefan Csomor
 // Modified by:
 #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;
@@ -38,7 +54,7 @@ wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
         tickMarks /= 5;
 
 
-    wxMacControl* peer = new wxMacControl( wxpeer );
+    wxMacControl* peer = new wxMacSliderCarbonControl( wxpeer );
     OSStatus err = CreateSliderControl(
         MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
         value, minimum, maximum,