NSColorPicker 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 | NSColorPicker.h |
Overview
The NSColorPicker class is an abstract superclass that implements the NSColorPickingDefault protocol. The NSColorPickingDefault and NSColorPickingCustom protocols define a way to add color pickers (custom user interfaces for color selection) to the NSColorPanel.
Adopted Protocols
Tasks
Initializing an NSColorPicker Object
Getting the Color Panel
Adding Button Images
Setting the Mode
Mananging Color Lists
Responding to View Changes
Customizing the Color Picker
Instance Methods
attachColorList:
Does nothing. Override to attach a color list to a color picker.
Parameters
- colorList
The color list to attach to the color picker.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicker.hbuttonToolTip
Returns the tool tip to be shown when the mouse cursor is over the receiver’s button image.
Return Value
A string representing the tool tip.
Discussion
Override this method to provide a custom tool tip. The default implementation of this method returns the name of the receiver’s class. If you want the color picker to have no tool tip, return an empty string.
Availability
- Available in OS X v10.5 and later.
Declared In
NSColorPicker.hcolorPanel
Returns the NSColorPanel that owns the receiver.
Return Value
The owning color panel.
Availability
- Available in OS X v10.0 and later.
Declared In
NSColorPicker.hdetachColorList:
Does nothing. Override to detach a color list from a color picker.
Parameters
- colorList
The color list to detach.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicker.hinitWithPickerMask:colorPanel:
Initializes the color picker with the specified color panel and color picker mode mask.
Parameters
- mask
The color picker mask.
- owningColorPanel
The
NSColorPanelthat owns the color picker. This value is cached so it can be returned later by thecolorPanelmethod.
Return Value
An initialized color picker object.
Discussion
Override this method to respond to the values in mask or do other custom initialization. If you override this method in a subclass, you should forward the message to super as part of the implementation.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicker.hinsertNewButtonImage:in:
Sets the image used for the specified button cell.
Parameters
- newButtonImage
The image used for the specified button cell.
- buttonCell
The button cell for which to set the image.
Discussion
Called by the color panel to insert a new image into the specified cell by invoking NSButtonCell’s setImage: method. Override this method to customize newButtonImage before insertion in buttonCell.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicker.hminContentSize
Returns the minimum content size for the receiver.
Return Value
The minimum size of the receiver, an NSColorPicker object. The NSColorPanel object does not allow the color picker to be made smaller than this size.
Discussion
Override this method to return a minimum size for the color picker’s content area. The default implementation of this method obtains the minimum content size from the view-autoresizing behavior specified for the receiver and returns that. You should not have to override this method if you properly set up the color picker’s auto-sizing attributes in Interface Builder.
Availability
- Available in OS X v10.5 and later.
Declared In
NSColorPicker.hprovideNewButtonImage
Returns the button image for the receiver.
Return Value
The image placed on the mode button the user uses to select this color picker. This is the same image the color panel uses as an argument when sending the insertNewButtonImage:in: message.) The default implementation looks in the color picker’s bundle for a TIFF file named after the color picker’s class, with the extension “.tiff”.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicker.hsetMode:
Does nothing. Override to set the color picker’s mode.
Parameters
- mode
A constant specifying the color picking mode. These constants are defined in
AppKit/NSColorPanel.h.
Discussion
In grayscale-alpha, red-green-blue, cyan-magenta-yellow-black, and hue-saturation-brightness modes, the user adjusts colors by manipulating sliders. In the custom palette mode, the user can load an NSImage file (TIFF or EPS) into the NSColorPanel, then select colors from the image. In custom color list mode, the user can create and load lists of named colors. The two custom modes provide NSPopUpLists for loading and saving files. Finally, color wheel mode provides a simplified control for selecting colors.
Availability
- Available in OS X v10.0 and later.
Declared In
NSColorPicker.h© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-28)