-
- MacPreControlCreate( parent, id, wxEmptyString, pos, size, style,
- validator, name, &bounds, title );
-
- procID = kControlSliderProc + kControlSliderLiveFeedback;
- if(style & wxSL_AUTOTICKS) {
- procID += kControlSliderHasTickMarks;
- }
-
-
- m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, title, false,
- value, minValue, maxValue, procID, (long) this);
-
- wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
-
- ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
-
- if(style & wxSL_LABELS)
- {
- m_macMinimumStatic = new wxStaticText( this, -1, wxEmptyString );
- m_macMaximumStatic = new wxStaticText( this, -1, wxEmptyString );
- m_macValueStatic = new wxStaticText( this, -1, wxEmptyString );
- SetRange(minValue, maxValue);
- SetValue(value);
- }
-
- else {
- m_macMinimumStatic = NULL ;
- m_macMaximumStatic = NULL ;
- m_macValueStatic = NULL ;
- }
-
+
+ Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+
+ //
+ // NB: (RN) Ticks here are sometimes off in the GUI if there
+ // is not as many ticks as there are values
+ //
+ UInt16 tickMarks = 0 ;
+ if ( style & wxSL_AUTOTICKS )
+ tickMarks = (maxValue - minValue) + 1; //+1 for the 0 value
+
+ while (tickMarks > 20)
+ tickMarks /= 5; //keep the number of tickmarks from becoming unwieldly
+
+ m_peer = new wxMacControl(this) ;
+ verify_noerr ( CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
+ value , minValue , maxValue , kControlSliderPointsDownOrRight , tickMarks , true /* liveTracking */ ,
+ GetwxMacLiveScrollbarActionProc() , m_peer->GetControlRefAddr() ) );
+