- Inherits from:
- NSActionCell : NSCell : NSObject
- Package:
- com.apple.yellow.application
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, drawKnob, or prefersTrackingUntilMouseUp.
- Constructors
- NSSliderCell
- Asking about the cell's behavior
- altIncrementValue
- prefersTrackingUntilMouseUp
- trackRect
- Changing the cell's behavior
- setAltIncrementValue
- Displaying the cell
- knobRectFlipped
- drawBarInside
- drawKnob
- drawKnobInRect
- 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
public NSSliderCell()
public NSSliderCell(String aString)
public NSSliderCell(NSImage anImage)
public static boolean prefersTrackingUntilMouseUp()
true
,
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.
public boolean allowsTickMarkValuesOnly()
See Also: setAllowsTickMarkValuesOnly
public 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
public double closestTickMarkValueToValue(double aValue)
See Also: indexOfTickMarkAtPoint
public void drawBarInside(
NSRect aRect,
boolean 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: drawKnobInRect
public 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 drawKnobInRect instead.
public void drawKnobInRect(NSRect knobRect)
You should never invoke this method explicitly. It's included so you can override it in a subclass.
public 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.public int isVertical()
public NSRect knobRectFlipped(boolean 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.
public float knobThickness()
See Also: setKnobThickness
public double maxValue()
See Also: setMaxValue
public double minValue()
public int numberOfTickMarks()
See Also: setNumberOfTickMarks
public NSRect rectOfTickMarkAtIndex(int index)
See Also: indexOfTickMarkAtPoint
public void setAllowsTickMarkValuesOnly(boolean flag)
See Also: allowsTickMarkValuesOnly
public 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.
public void setKnobThickness(float thickness)
See Also: knobThickness
public void setMaxValue(double aDouble)
See Also: maxValue
public void setMinValue(double aDouble)
See Also: minValue
public void setNumberOfTickMarks(int numberOfTickMarks)
See Also: numberOfTickMarks
public void setTickMarkPosition(int position)
TickMarkBelow
(the default) or TickMarkAbove
;
for vertical sliders, position can
be TickMarkLeft
(the default) or TickMarkRight
.
This method has no effect if no tick marks have been assigned (that
is, numberOfTickMarks returns
zero).See Also: tickMarkPosition
public void setTitle(String title)
See Also: title
public void setTitleCell(NSCell aCell)
See Also: titleCell
public void setTitleColor(NSColor color)
See Also: titleColor
public void setTitleFont(NSFont font)
See Also: titleFont
public int tickMarkPosition()
TickMarkBelow
, TickMarkAbove
, TickMarkLeft
,
or TickMarkRight
(the last two are
for vertical sliders). The default alignments are TickMarkBelow
and TickMarkLeft
.See Also: setTickMarkPosition
public double tickMarkValueAtIndex(int index)
public String title()
See Also: setTitle
public NSCell titleCell()
See Also: setTitleCell
public NSColor titleColor()
See Also: setTitleColor
public NSFont titleFont()
See Also: setTitleFont
public NSRect trackRect()