NSLevelIndicator Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.4 and later.
Declared in
NSLevelIndicator.h
Related sample code

Overview

NSLevelIndicator is a subclass of NSControl that displays a value on a linear scale.

Level indicators provide a visual representation of a level or amount of something, using discrete values. While similar to NSSlider, it provides a more customized visual feedback to the user. Level indicators do not have a “knob” indicating the current setting or allowing the user to adjust settings. The supported indicator styles include:

NSLevelIndicator uses an NSLevelIndicatorCell to implement much of the control’s functionality. NSLevelIndicator provides cover methods for most of NSLevelIndicatorCell’s methods, which invoke the corresponding cell method.

Tasks

Configuring the Range of Values

Managing Tick Marks

Instance Methods

criticalValue

Returns the receiver’s critical value.

- (double)criticalValue
Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

maxValue

Returns the receiver’s maximum value.

- (double)maxValue
Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

minValue

Returns the receiver’s minimum value.

- (double)minValue
Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

numberOfMajorTickMarks

Returns the number of major tick marks associated with the receiver.

- (NSInteger)numberOfMajorTickMarks
Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

numberOfTickMarks

Returns the number of tick marks associated with the receiver.

- (NSInteger)numberOfTickMarks
Discussion

The tick marks assigned to the minimum and maximum values are included.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

rectOfTickMarkAtIndex:

Returns the bounding rectangle of the tick mark identified by index (the minimum-value tick mark is at index 0).

- (NSRect)rectOfTickMarkAtIndex:(NSInteger)index
Discussion

If no tick mark is associated with index, the method raises a NSRangeException.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

setCriticalValue:

Sets the receiver’s critical value to criticalValue.

- (void)setCriticalValue:(double)criticalValue
Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

setMaxValue:

Sets the maximum value the receiver can represent to maxValue.

- (void)setMaxValue:(double)maxValue
Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSLevelIndicator.h

setMinValue:

Sets the minimum value the receiver can represent to minValue.

- (void)setMinValue:(double)minValue
Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSLevelIndicator.h

setNumberOfMajorTickMarks:

Sets the number of major tick marks displayed by the receiver.

- (void)setNumberOfMajorTickMarks:(NSInteger)count
Discussion

The count must be less than or equal to the number of tick marks returned by numberOfTickMarks. For example, if the number of tick marks is 11 and you specify 3 major tick marks, the resulting level indicator will display 3 major tickmarks alternating with 8 minor tick marks, as in the example shown in Figure 1.

Figure 1  Major and minor tick marks in a level indicator
Major and minor tick marks in a level indicator
Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

setNumberOfTickMarks:

Sets the number of tick marks displayed by the receiver (which include those assigned to the minimum and maximum values) to count.

- (void)setNumberOfTickMarks:(NSInteger)count
Discussion

By default, this value is 0, and no tick marks appear. The number of tick marks assigned to a slider, along with the slider’s minimum and maximum values, determines the values associated with the tick marks.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

setTickMarkPosition:

Sets where tick marks appear relative to the receiver.

- (void)setTickMarkPosition:(NSTickMarkPosition)position
Discussion

This method has no effect if no tick marks have been assigned (that is, numberOfTickMarks returns 0).

Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

setWarningValue:

Sets the receiver’s warning value to warningValue.

- (void)setWarningValue:(double)warningValue
Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

tickMarkPosition

Returns how the receiver’s tick marks are aligned with it.

- (NSTickMarkPosition)tickMarkPosition
Discussion

The default alignments are NSTickMarkBelow and NSTickMarkLeft.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

tickMarkValueAtIndex:

Returns the receiver’s value represented by the tick mark at index (the minimum-value tick mark has an index of 0).

- (double)tickMarkValueAtIndex:(NSInteger)index
Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h

warningValue

Returns the receiver’s warning value.

- (double)warningValue
Availability
  • Available in OS X v10.4 and later.
Declared In
NSLevelIndicator.h