]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/slider.cpp
revert r59246; the window parameter was there by purpose (i.e. for consistency with...
[wxWidgets.git] / src / osx / carbon / slider.cpp
CommitLineData
489468fe
SC
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"
524c47aa
SC
17#include "wx/osx/private.h"
18
19wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
20 wxWindowMac* parent,
21 wxWindowID id,
22 wxInt32 value,
23 wxInt32 minimum,
24 wxInt32 maximum,
25 const wxPoint& pos,
26 const wxSize& size,
27 long style,
28 long extraStyle)
29{
30 Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
489468fe
SC
31 int tickMarks = 0;
32 if ( style & wxSL_AUTOTICKS )
524c47aa 33 tickMarks = (maximum - minimum) + 1; // +1 for the 0 value
489468fe
SC
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
524c47aa
SC
40
41 wxMacControl* peer = new wxMacControl( wxpeer );
489468fe
SC
42 OSStatus err = CreateSliderControl(
43 MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
524c47aa 44 value, minimum, maximum,
489468fe
SC
45 kControlSliderPointsDownOrRight,
46 (UInt16) tickMarks, true /* liveTracking */,
47 GetwxMacLiveScrollbarActionProc(),
524c47aa 48 peer->GetControlRefAddr() );
489468fe
SC
49 verify_noerr( err );
50
524c47aa 51 return peer;
489468fe
SC
52}
53
54#endif // wxUSE_SLIDER