Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights
Reserved.
NSSlider
Inherits From: NSControl : NSView : NSResponder : NSObject
Conforms To: NSCoding (NSResponder)
NSObject (NSObject)
Declared In: AppKit/NSSlider.h
Class Description
NSSlider is a type of NSControl with a sliding knob that can be moved to
represent a value between a minimum and a maximum setting. A slider may be
either horizontal or vertical, but its minimum value is always at the left or
bottom end of the bar, and the maximum at the right or top. By default, an
NSSlider is a continuous NSControl: It sends its action message to its target
continuously while the user drags its knob. To configure an NSSlider to send
its action only when the mouse is released, send setContinuous: (an
NSControl method) with an argument of NO.
An NSSlider can be configured to display an image, a title, or both, in the
area behind its knob. An NSSlider's title can be drawn in any gray level or
color, and in any font available. An NSSlider's value can be set
programmatically with any of the standard NSControl value-setting methods, such
as setFloatValue:.
For more information, see the method descriptions in the NSSliderCell class
specification.
Setting the Cell Class
- + (Class)cellClass Returns the class last set in a setCellClass:
message, or the NSSliderCell class if setCellClass: has never been
called.
- + (void)setCellClass:(Class)classId Sets the class of NSCell used
in the NSSlider.
Modifying an NSSlider's Appearance
- - (NSImage *)image Returns the image within the NSSlider.
- - (int)isVertical Returns 1 if the NSSlider is vertical, 0 if
horizontal, -1 if unknown.
- - (float)knobThickness Returns the knob's thickness as a float value
(width if horizontal slider, height if vertical slider).
- - (void)setImage:(NSImage *)backgroundImage Sets the image within
the NSSlider to backgroundImage.
- - (void)setKnobThickness:(float)aFloat Sets the knob's thickness
(its width if the slider is horizontal, height if vertical) to aFloat,
expressed in units of the NSSlider's coordinate system.
- - (void)setTitle:(NSString *)aString Sets the title within the
NSSlider to a copy of aString.
- - (void)setTitleCell:(NSCell *)aCell Sets the NSCell (or subclass
thereof) object used to draw the title within the NSSlider. The cell object
should ideally be an instance of NSTextFieldCell or one of its subclasses.
- - (void)setTitleColor:(NSColor *)aColor Sets the color of text in
the title to aColor.
- - (void)setTitleFont:(NSFont *)fontObject Sets the NSFont object
used for the title within the NSSlider.
- - (NSString *)title Returns the title within the NSSlider.
- - (id)titleCell Returns the NSCell (or subclass thereof) object used to
draw the title within the NSSlider.
- - (NSColor *)titleColor Returns the color of text in the title.
- - (NSFont *)titleFont Returns the NSFont object used in drawing the
title within the NSSlider.
Setting and Getting Value Limits
- - (double)maxValue Returns theNSSlider's maximum value.
- - (double)minValue Returns the NSSlider's minimum value.
- - (void)setMaxValue:(double)aDouble Sets the NSSlider's maximum
value to aDouble.
- - (void)setMinValue:(double)aDouble Sets the NSSlider's minimum
value to aDouble.
Handling Events
- - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent Returns YES by
default, since NSSliders always accept a mouse-down event that activates a
window, whether or not the NSSlider is enabled. Override this if you want
different behavior.