1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/slider.cpp
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/slider.h"
17 #include "wx/osx/private.h"
19 class wxMacSliderCarbonControl
: public wxMacControl
22 wxMacSliderCarbonControl( wxWindowMac
* peer
) : wxMacControl( peer
)
26 // work around an OSX bug : if the control is having the keyboard focus it cannot
27 // be set to the full max/min values by dragging
28 virtual bool CanFocus() const
35 wxWidgetImplType
* wxWidgetImpl::CreateSlider( wxWindowMac
* wxpeer
,
37 wxWindowID
WXUNUSED(id
),
44 long WXUNUSED(extraStyle
))
46 Rect bounds
= wxMacGetBoundsForControl( wxpeer
, pos
, size
);
48 if ( style
& wxSL_AUTOTICKS
)
49 tickMarks
= (maximum
- minimum
) + 1; // +1 for the 0 value
51 // keep the number of tickmarks from becoming unwieldy, therefore below it is ok to cast
53 while (tickMarks
> 20)
57 wxMacControl
* peer
= new wxMacSliderCarbonControl( wxpeer
);
58 OSStatus err
= CreateSliderControl(
59 MAC_WXHWND(parent
->MacGetTopLevelWindowRef()), &bounds
,
60 value
, minimum
, maximum
,
61 kControlSliderPointsDownOrRight
,
62 (UInt16
) tickMarks
, true /* liveTracking */,
63 GetwxMacLiveScrollbarActionProc(),
64 peer
->GetControlRefAddr() );
70 #endif // wxUSE_SLIDER