Class

NSSliderCell

An NSSliderCell object controls the appearance and behavior of an NSSlider object, or of a single slider in an NSMatrix object.

Overview

You can customize an NSSliderCell to a certain degree, using its properties. If this don’t give you sufficient flexibility, you can create a subclass. In that subclass, you can override any of the following methods: knobRect(flipped:), drawBar(inside:flipped:), drawKnob(_:), and prefersTrackingUntilMouseUp().

Symbols

Managing Cell Behavior

var altIncrementValue: Double

The amount by which the slider changes its value when the user Option-drags the knob.

class func prefersTrackingUntilMouseUp()

Returns a Boolean value indicating whether the NSSliderCell continues to track the pointer until the next mouse up.

var trackRect: NSRect

The rectangle within which the cell tracks the pointer while the mouse button is down.

Managing the Slider Type

var sliderType: NSSliderType

The slider type, either linear or circular.

Displaying the Cell

func barRect(flipped: Bool)

Returns the rectangle in which the bar is drawn.

func drawTickMarks()

Draws the slider’s tick marks.

func knobRect(flipped: Bool)

Returns the rectangle in which the slider knob is drawn.

func drawBar(inside: NSRect, flipped: Bool)

Draws the slider’s bar—but not its bezel or knob—inside the specified rectangle.

func drawKnob()

Calculates the rectangle in which the knob should be drawn, then calls drawKnob(_:) to actually draw the knob.

func drawKnob(NSRect)

Draws the slider knob in the given rectangle.

Managing Cell Appearance

var knobThickness: CGFloat

The thickness of the slider knob, in pixels.

var isVertical: Bool

An integer indicating the orientation (vertical or horizontal) of the slider.

Managing Value Limits

var maxValue: Double

The maximum value the slider can send to its target.

var minValue: Double

The minimum value the slider can send to its target.

Managing Tick Marks

var allowsTickMarkValuesOnly: Bool

A Boolean value indicating whether the receiver fixes its values to those values represented by its tick marks.

func closestTickMarkValue(toValue: Double)

Returns the value of the tick mark closest to the specified value.

func indexOfTickMark(at: NSPoint)

Returns the index of the tick mark closest to the location of the slider represented by the specified point.

var numberOfTickMarks: Int

The number of tick marks associated with the slider, including the tick marks assigned to the minimum and maximum values.

func rectOfTickMark(at: Int)

Returns the bounding rectangle of the tick mark at the specified index.

var tickMarkPosition: NSTickMarkPosition

The position of the tick marks relative to the receiver.

func tickMarkValue(at: Int)

Returns the receiver’s value represented by the tick mark at the specified index.

Constants

NSTickMarkPosition

Specifies where the tick marks of an NSSliderCell object appear.

NSSliderType

The types of sliders, used by sliderType.

Relationships

Inherits From