NSColorPickingCustom Protocol Reference
| Adopted by | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in 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
-
– setColor:required method
Getting Color Picker Information
-
– currentModerequired method -
– supportsMode:required method
Displaying Color Pickers
-
– provideNewView:required method
Instance Methods
currentMode
Returns the receiver’s current mode (or submode, if applicable). (required)
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
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicking.hprovideNewView:
Returns the view containing the receiver’s user interface. (required)
Parameters
- initialRequest
YESonly when this method is first invoked for your color picker. If initialRequest isYES, 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
- Available in OS X v10.0 and later.
Declared In
NSColorPicking.hsetColor:
Adjusts the receiver to make the specified color the currently selected color. (required)
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
- Available in OS X v10.0 and later.
Declared In
NSColorPicking.hsupportsMode:
Returns a Boolean value indicating whether or not the receiver supports the specified picking mode. (required)
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
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicking.h© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-11-17)