Developer Documentation
PATH  Mac OS X Documentation > Application Kit Reference: Objective-C


[Previous] [Class List] [Next]

NSColorWell


Inherits from: NSControl : NSView : NSResponder : NSObject
Conforms to: NSCoding
(NSResponder)
NSObject (NSObject)
Declared in: AppKit/NSColorWell.h




Class Description


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

An application can have one or more active color wells. You can activate multiple color wells by invoking the activate: method with NO as its argument. When a mouse-down event occurs on a color well's border, it becomes the only active color well. When a color well becomes active, it brings up the color panel also.

The mouseDown: method enables a color well to send its color to another color well or any other subclass of NSView that implements the NSDraggingDestination protocol.


Method Types


Drawing
- drawWellInside:
Activating
- activate:
- deactivate
- isActive
Managing Color
- color
- setColor:
- takeColorFrom:
Managing Borders
- isBordered
- setBordered:


Instance Methods



activate:

- (void)activate:(BOOL)exclusive

Activates the NSColorWell, displays the Color panel, and makes the NSColorPanel's current color the same as its own. If exclusive is YES, deactivates any other color wells; if YES, keeps them active. Redraws the receiver. An active color well will have its color updated when the NSColorPanel's current color changes. Any color well that shows its border highlights the border when it's active.

See Also: - deactivate, - isActive



color

- (NSColor *)color

Returns the color of the NSColorWell.

See Also: - setColor:, - takeColorFrom:



deactivate

- (void)deactivate

Deactivates the NSColorWell and redraws it.

See Also: - activate:, - isActive



drawWellInside:

- (void)drawWellInside:(NSRect)insideRect

Draws the colored area inside the NSColorWell at the location specified by insideRect without drawing borders.

isActive

- (BOOL)isActive

Returns YES if the NSColorWell is active, NO otherwise.

isBordered

- (BOOL)isBordered

Returns YES if the NSColorWell is bordered, NO otherwise.

See Also: - setBordered:



setBordered:

- (void)setBordered:(BOOL)bordered

Places or removes a border on the NSColorWell, depending on bordered, and redraws the receiver.

See Also: - isBordered



setColor:

- (void)setColor:(NSColor *)color

Sets the color of the NSColorWell to color and redraws the receiver.

See Also: - color, - takeColorFrom:



takeColorFrom:

- (void)takeColorFrom:(id)sender

Changes the color of the NSColorWell to that of sender.

See Also: - color, - setColor:




[Previous] [Next]