NSColorWell Class Reference

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

Overview

An NSColorWell object is an NSControl for selecting and displaying a single color value. An example of an NSColorWell object (or simply color well) is found in an NSColorPanel, which uses a color well to display the current color selection. A color well is available from the Palettes panel of Interface Builder.

Tasks

Managing Color From Color Wells

Activating and Deactivating Color Wells

Managing Borders of Color Wells

Drawing a Color Well

Instance Methods

activate:

Activates the receiver, displays the color panel, and makes the current color the same as its own.

- (void)activate:(BOOL)exclusive
Parameters
exclusive

YES to deactivate any other color wells; NO to keep them active. If a color panel is active with exclusive set to YES and another is subsequently activated with exclusive set to NO, the exclusive setting of the first panel is ignored.

Discussion

This method redraws the receiver. An active color well will have its color updated when the current color of the NSColorPanel changes. Any color well that shows its border highlights the border when it’s active.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSColorWell.h

color

Returns the color of the receiver.

- (NSColor *)color
Return Value

The color of the receiver.

Availability
  • Available in OS X v10.0 and later.
Related Sample Code
Declared In
NSColorWell.h

deactivate

Deactivates the receiver and redraws it.

- (void)deactivate
Availability
  • Available in OS X v10.0 and later.
Declared In
NSColorWell.h

drawWellInside:

Draws the colored area inside the receiver at the specified location without drawing borders.

- (void)drawWellInside:(NSRect)insideRect
Parameters
insideRect

The rectangle specifying the area within which to draw.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSColorWell.h

isActive

Returns a Boolean value indicating whether the receiver is active.

- (BOOL)isActive
Return Value

YES if the receiver is active, NO otherwise.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSColorWell.h

isBordered

Returns a Boolean value indicating whether the receiver has a border.

- (BOOL)isBordered
Return Value

YES if the receiver is bordered, NO otherwise.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSColorWell.h

setBordered:

Places or removes a border on the receiver and redraws the receiver.

- (void)setBordered:(BOOL)bordered
Parameters
bordered

YES to place a border on the receiver, NO to remove it.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSColorWell.h

setColor:

Sets the color of the receiver and redraws the receiver.

- (void)setColor:(NSColor *)color
Parameters
color

The new color for the color well.

Availability
  • Available in OS X v10.0 and later.
Related Sample Code
Declared In
NSColorWell.h

takeColorFrom:

Changes the color of the receiver to that of the specified object.

- (void)takeColorFrom:(id)sender
Parameters
sender

The object from which to take the new color.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSColorWell.h