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