]> git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/slider.cpp
Suppress harmless warning about unhandled wxSHOW_EFFECT_NONE.
[wxWidgets.git] / src / osx / carbon / slider.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: slider.cpp
3 // Purpose: wxSlider
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_SLIDER
15
16 #include "wx/slider.h"
17 #include "wx/osx/private.h"
18
19 wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
20 wxWindowMac* parent,
21 wxWindowID WXUNUSED(id),
22 wxInt32 value,
23 wxInt32 minimum,
24 wxInt32 maximum,
25 const wxPoint& pos,
26 const wxSize& size,
27 long style,
28 long WXUNUSED(extraStyle))
29 {
30 Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
31 int tickMarks = 0;
32 if ( style & wxSL_AUTOTICKS )
33 tickMarks = (maximum - minimum) + 1; // +1 for the 0 value
34
35 // keep the number of tickmarks from becoming unwieldly, therefore below it is ok to cast
36 // it to a UInt16
37 while (tickMarks > 20)
38 tickMarks /= 5;
39
40
41 wxMacControl* peer = new wxMacControl( wxpeer );
42 OSStatus err = CreateSliderControl(
43 MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
44 value, minimum, maximum,
45 kControlSliderPointsDownOrRight,
46 (UInt16) tickMarks, true /* liveTracking */,
47 GetwxMacLiveScrollbarActionProc(),
48 peer->GetControlRefAddr() );
49 verify_noerr( err );
50
51 return peer;
52 }
53
54 #endif // wxUSE_SLIDER