+ DisassociateNSSlider(GetNSSlider());
+}
+
+void wxSlider::ProcessEventType(wxEventType commandType)
+{
+ wxScrollEvent event(commandType, GetId(), GetValue(), HasFlag(wxSL_VERTICAL)?wxVERTICAL:wxHORIZONTAL);
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event);
+}
+
+void wxSlider::CocoaNotification_startTracking(WX_NSNotification notification)
+{
+ CocoaNotification_continueTracking(notification);
+}
+
+void wxSlider::CocoaNotification_continueTracking(WX_NSNotification notification)
+{
+ const double realValue = [GetNSSlider() doubleValue];
+
+ if (realValue != [GetNSSlider() intValue])
+ {
+ SetValue(rint(realValue));
+ }
+
+ ProcessEventType(wxEVT_SCROLL_THUMBTRACK);
+}
+
+void wxSlider::CocoaNotification_stopTracking(WX_NSNotification notification)
+{
+ ProcessEventType(wxEVT_SCROLL_THUMBRELEASE);
+}
+
+int wxSlider::GetValue() const
+{
+ return [GetNSSlider() intValue];
+}
+
+void wxSlider::SetValue(int value)
+{
+ [GetNSSlider() setIntValue:value];
+}
+
+void wxSlider::SetRange(int minValue, int maxValue)
+{
+ [GetNSSlider() setMinValue:minValue];
+ [GetNSSlider() setMaxValue:maxValue];
+}
+
+int wxSlider::GetMin() const
+{
+ return [GetNSSlider() minValue];
+}
+
+int wxSlider::GetMax() const
+{
+ return [GetNSSlider() maxValue];
+}
+
+void wxSlider::SetTickFreq(int n, int pos)
+{
+ const int numTicks = (n > 0) ? ((GetMax() - GetMin()) / n) + 1 : 0;
+ [GetNSSlider() setNumberOfTickMarks:numTicks];
+}
+
+int wxSlider::GetTickFreq() const
+{
+ const int numTicks = [GetNSSlider() numberOfTickMarks];
+ return ((numTicks != 0) ? (GetMax() - GetMin()) / (numTicks - 1) : 0);
+}
+
+void wxSlider::SetTickPos(int pos)
+{
+ NSTickMarkPosition thePos = NSTickMarkBelow;
+ wxSize size = GetSize();
+
+ if (size.GetWidth() < size.GetHeight()) // NSSlider isVertical method can return -1 if it has not been displayed.
+ {
+ thePos = (pos != 1) ? NSTickMarkLeft : NSTickMarkRight;
+ }
+ else
+ {
+ thePos = (pos != 1) ? NSTickMarkBelow : NSTickMarkAbove;
+ }
+
+ [GetNSSlider() setTickMarkPosition:thePos];
+}
+
+void wxSlider::SetLineSize(int lineSize)
+{
+ // to do
+}
+
+void wxSlider::SetPageSize(int pageSize)
+{
+ // to do
+}
+
+int wxSlider::GetLineSize() const
+{
+ return 1;
+}
+
+int wxSlider::GetPageSize() const
+{
+ return 1;
+}
+
+int wxSlider::GetThumbLength() const
+{
+ return 1;
+}
+
+void wxSlider::SetThumbLength(int lenPixels)
+{
+ // to do