Inherits from: NSActionCell : NSCell : NSObject
Conforms to: NSCoding
NSCopying (from NSCell)
NSObject (from NSObject)
Declared in: AppKit/NSSliderCell.h
An NSSliderCell controls the appearance and behavior of an NSSlider, or of a single slider in an NSMatrix. A slider can have tick marks to either side of it. The values represented by the tick marks are determined by the number of tick marks and the minimum and maximum values of the slider; a slider's values can be pegged to the values represented by the tick marks.
You can customize an NSSliderCell to a certain degree, using its set... methods. If these do not allow you sufficient flexibility, you can create a subclass. In that subclass, you can override any of the following methods: knobRectFlipped:, drawBarInside:flipped:, drawKnob, or prefersTrackingUntilMouseUp.
- Asking about the cell's behavior
- - altIncrementValue
- + prefersTrackingUntilMouseUp
- - trackRect
- Changing the cell's behavior
- - setAltIncrementValue:
- Displaying the cell
- - knobRectFlipped:
- - drawBarInside:flipped:
- - drawKnob
- - drawKnob:
- Asking about the cell's appearance
- - knobThickness
- - isVertical
- - title
- - titleCell
- - titleFont
- - titleColor
- Changing the cell's appearance
- - setKnobThickness:
- - setTitle:
- - setTitleCell:
- - setTitleColor:
- - setTitleFont:
- Asking about the value limits
- - maxValue
- - minValue
- Changing the value limits
- - setMaxValue:
- - setMinValue:
- Managing tick marks
- - allowsTickMarkValuesOnly
- - closestTickMarkValueToValue:
- - indexOfTickMarkAtPoint:
- - numberOfTickMarks
- - rectOfTickMarkAtIndex:
- - setAllowsTickMarkValuesOnly:
- - setNumberOfTickMarks:
- - setTickMarkPosition:
- - tickMarkPosition
- - tickMarkValueAtIndex:
+ (BOOL)prefersTrackingUntilMouseUp
YES
,
so an NSSliderCell continues to track the mouse even after the mouse
leaves the cell's tracking rectangle. This means
that, once you take hold of a slider's knob (by putting the mouse
inside the cell's frame rectangle and pressing the mouse button),
you retain control of the knob until you release the mouse button,
even if you drag the mouse clear to the other side of the screen.Never call this method explicitly. Override it if you create a subclass of NSSliderCell that you want to track the mouse differently.
- (BOOL)allowsTickMarkValuesOnly
See Also: - setAllowsTickMarkValuesOnly:
- (double)altIncrementValue
Unless you call setAltIncrementValue:, altIncrementValue returns -1.0, and the slider behaves no differently with the Alt key down than with it up.
See Also: - setAltIncrementValue:
- (double)closestTickMarkValueToValue:(double)aValue
See Also: - indexOfTickMarkAtPoint:
- (void)drawBarInside:(NSRect)aRect flipped:(BOOL)flipped
flipped indicates whether the cell's control view-that is, the NSSlider or NSMatrix associated with the NSSliderCell-has a flipped coordinate system.
You should never invoke this method explicitly. It's included so you can override it in a subclass.
See Also: - drawKnob:
- (void)drawKnob
You might invoke this method if you override one of the display methods belonging to NSControl or NSCell.
If you create a subclass of NSSliderCell, don't override this method. Override drawKnob: instead.
- (void)drawKnob:(NSRect)knobRect
You should never invoke this method explicitly. It's included so you can override it in a subclass.
- (int)indexOfTickMarkAtPoint:(NSPoint)point
NSArray.NotFound
.
This method invokes rectOfTickMarkAtIndex: for
each tick mark on the slider until it finds a tick mark containing point.- (int)isVertical
- (NSRect)knobRectFlipped:(BOOL)flipped
The knob rectangle depends on where in the slider the knob belongs-that is, it depends on the NSSliderCell's minimum and maximum values, and on the value the position of the knob will represent.
You should never invoke this method explicitly. It's included so you can override it in a subclass.
- (float)knobThickness
See Also: - setKnobThickness:
- (double)maxValue
See Also: - setMaxValue:
- (double)minValue
- (int)numberOfTickMarks
See Also: - setNumberOfTickMarks:
- (NSRect)rectOfTickMarkAtIndex:(int)index
See Also: - indexOfTickMarkAtPoint:
- (void)setAllowsTickMarkValuesOnly:(BOOL)flag
See Also: - allowsTickMarkValuesOnly
- (void)setAltIncrementValue:(double)increment
If you don't call this method, the slider behaves the same with the Alt key down as with it up. This is also the result when you call setAltIncrementValue: with an increment of -1.
See Also: - maxValue, - minValue
- (void)setKnobThickness:(float)thickness
See Also: - knobThickness
- (void)setMaxValue:(double)aDouble
See Also: - maxValue
- (void)setMinValue:(double)aDouble
See Also: - minValue
- (void)setNumberOfTickMarks:(int)numberOfTickMarks
See Also: - numberOfTickMarks
- (void)setTickMarkPosition:(NSTickMarkPosition)position
NSTickMarksBelow
(the default)
or NSTickMarksAbove
; for vertical
sliders, position can be NSTickMarksLeft
(the
default) or NSTickMarksRight
. This
method has no effect if no tick marks have been assigned (that is, numberOfTickMarks returns
zero).See Also: - tickMarkPosition
- (void)setTitle:(NSString
*)title
See Also: - title
- (void)setTitleCell:(NSCell
*)aCell
See Also: - titleCell
- (void)setTitleColor:(NSColor
*)color
See Also: - titleColor
- (void)setTitleFont:(NSFont
*)font
See Also: - titleFont
- (NSTickMarkPosition)tickMarkPosition
NSTickMarkBelow
, NSTickMarkAbove
, NSTickMarkLeft
,
or NSTickMarkRight
(the last two
are for vertical sliders). The default alignments are NSTickMarkBelow
and NSTickMarkLeft
.See Also: - setTickMarkPosition:
- (double)tickMarkValueAtIndex:(int)index
- (NSString *)title
See Also: - setTitle:
- (id)titleCell
See Also: - setTitleCell:
- (NSColor *)titleColor
See Also: - setTitleColor:
- (NSFont *)titleFont
See Also: - setTitleFont:
- (NSRect)trackRect