Next Page > Hide TOC

NSColorPickingCustom Protocol Reference

Adopted by
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in Mac OS X v10.0 and later.
Companion guide
Declared in
NSColorPicking.h

Overview

Together with the NSColorPickingDefault protocol, NSColorPickingCustom provides a way to add color pickers—custom user interfaces for color selection—to an application’s NSColorPanel instance. The NSColorPickingDefault protocol provides basic behavior for a color picker. The NSColorPicker class adopts the NSColorPickingDefault protocol.

Tasks

Configuring Color Pickers

Getting Color Picker Information

Displaying Color Pickers

Instance Methods

currentMode

Returns the receiver’s current mode (or submode, if applicable).

- (NSColorPanelMode)currentMode

Return Value

The current color picker mode. The returned value should be unique to your color picker. See this protocol description’s list of the unique values for the standard color pickers used by the Application Kit.

Availability
See Also
Declared In
NSColorPicking.h

provideNewView:

Returns the view containing the receiver’s user interface.

- (NSView *)provideNewView:(BOOL)initialRequest

Parameters
initialRequest

YES only when this method is first invoked for your color picker. If initialRequest is YES, the method should perform any initialization required (such as lazily loading a nib file, initializing the view, or performing any other custom initialization required for your picker).

Return Value

The view containing the color picker's user interface. The NSView returned by this method should be set to automatically resize both its width and height.

Discussion

This message is sent to the color picker whenever the color panel attempts to display it. This may be when the panel is first presented, when the user switches pickers, or when the picker is switched through an API.

Availability
Declared In
NSColorPicking.h

setColor:

Adjusts the receiver to make the specified color the currently selected color.

- (void)setColor:(NSColor *)color

Parameters
color

The color to set as the currently selected color.

Discussion

This method is invoked on the current color picker each time NSColorPanel’s setColor: method is invoked. If color is actually different from the color picker’s color (as it would be if, for example, the user dragged a color into NSColorPanel’s color well), this method could be used to update the color picker’s color to reflect the change.

Availability
Declared In
NSColorPicking.h

supportsMode:

Returns a Boolean value indicating whether or not the receiver supports the specified picking mode.

- (BOOL)supportsMode:(NSColorPanelMode)mode

Parameters
mode

The color picking mode.

Return Value

YES if the color picker supports the specified color picking mode; otherwise NO.

Discussion

This method is invoked when the NSColorPanel is first initialized: It is used to attempt to restore the user’s previously selected mode. It is also invoked by NSColorPanel's setMode: method to find the color picker that supports a particular mode. See this protocol description’s list of the unique mode values for the standard color pickers used by the Application Kit.

Availability
See Also
Declared In
NSColorPicking.h

Next Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-01)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.