NSColorPickingDefault Protocol Reference
| Adopted by | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSColorPicking.h |
Overview
The NSColorPickingDefault protocol, together with the NSColorPickingCustom protocol, provides an interface for adding 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 NSColorPickingCustom protocol provides implementation-specific behavior.
Instance Methods
alphaControlAddedOrRemoved:
Sent when the color panel's opacity controls have been hidden or displayed.
Parameters
- sender
The color panel sending the message.
Discussion
This method is invoked automatically when the opacity slider of the NSColorPanel is added or removed; you never invoke this method directly.
If the color picker has its own opacity controls, it should hide or display them, depending on whether the sender’s showsAlpha method returns NO or YES.
Availability
- Available in OS X v10.0 and later.
Declared In
NSColorPicking.hattachColorList:
Tells the receiver to attach the given color list, if it isn’t already displaying the list.
Parameters
- colorList
The color list to display.
Discussion
You never invoke this method; it’s invoked automatically by the NSColorPanel object when its attachColorList: method is invoked. Because the NSColorPanel list mode manages NSColorList objects, this method need only be implemented by a custom color picker that manages NSColorList objects itself.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicking.hbuttonToolTip
Provides the toolbar button help tag.
Return Value
Help tag text.
Availability
- Available in OS X v10.5 and later.
Declared In
NSColorPicking.hdetachColorList:
Tells the receiver to detach the given color list, unless the receiver isn’t displaying the list.
Parameters
- colorList
The color list to detach.
Discussion
You never invoke this method; it’s invoked automatically by the NSColorPanel object when its detachColorList: method is invoked. Because the NSColorPanel list mode manages NSColorList objects, this method need only be implemented by a custom color picker that manages NSColorList objects itself.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicking.hinitWithPickerMask:colorPanel:
Initializes the receiver with a given color panel and its mode.
Parameters
- panelModes
A mask indicating the various color picker modes supported by the color panel. This is determined by the argument to the
NSColorPanelmethodsetPickerMask:. If it has not been set, panelModes isNSColorPanelAllModesMask. If your color picker supports any additional modes, you should invoke thesetPickerMask:method when your application initializes to notify theNSColorPanelclass. The standard mode constants are defined in “Choosing the Color Pickers in a Color Panel”.- owningColorPanel
The color panel than owns the receiver.
Return Value
If your color picker responds to any of the modes represented in panelModes, it should perform its initialization and return an initialized color picker. Color pickers that do so have their buttons inserted in the color panel and continue to receive messages from the panel as the user manipulates it. If the color picker doesn’t respond to any of the modes represented in panelModes, it should do nothing and return nil.
Discussion
This method is sent by the NSColorPanel to all implementors of the color-picking protocols when the application’s color panel is first initialized. In order for your color picker to receive this message, it must have a bundle in your application’s “ColorPickers” directory (described in “Color Picker Bundles”).
This method should examine the mask and determine whether it supports any of the modes included there. You may also check the value in mask to enable or disable any subpickers or optional controls implemented by your color picker. Your color picker may also retain owningColorPanel in an instance variable for future communication with the color panel.
This method is provided to initialize your color picker; however, much of a color picker’s initialization may be done lazily through the NSColorPickingCustom protocol’s provideNewView: method.
Availability
- Available in OS X v10.0 and later.
See Also
-
+ setPickerMask:(NSColorPanel class)
Declared In
NSColorPicking.hinsertNewButtonImage:in:
Sets the image of a given button cell.
Parameters
- newButtonImage
The image to set for the button cell.
- buttonCell
The
NSButtonCellobject that lets the user choose the picker from the color panel—the color picker’s representation in theNSMatrixof theNSColorPanel.
Discussion
This method should perform application-specific manipulation of the image before it’s inserted and displayed by the button cell.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSColorPicking.hminContentSize
Indicates the receiver’s minimum content size.
Discussion
The receiver does not allow a size smaller than minContentSize.
Availability
- Available in OS X v10.5 and later.
Declared In
NSColorPicking.hprovideNewButtonImage
Provides the image of the button used to select the receiver in the color panel.
Return Value
The image for the mode button the user uses to select this picker in the color panel; that is, the color picker's representation in the NSMatrix of the NSColorPanel.
This image is the same one the color panel uses as an argument when sending the insertNewButtonImage:in: message.
Availability
- Available in OS X v10.0 and later.
Declared In
NSColorPicking.hsetMode:
Specifies the receiver’s mode.
Parameters
- mode
The color picker mode. The available modes are described in “Choosing the Color Pickers in a Color Panel”.
Discussion
This method is invoked by the NSColorPanel method setMode: method to ensure the color picker reflects the current mode. For example, invoke this method during color picker initialization to ensure that all color pickers are restored to the mode the user left them in the last time an NSColorPanel was used.
Most color pickers have only one mode and thus don’t need to do any work in this method. An example of a color picker that uses this method is the slider picker, which can choose from one of several submodes depending on the value of mode.
Availability
- Available in OS X v10.0 and later.
Declared In
NSColorPicking.hviewSizeChanged:
Tells the recever when the color panel's view size changes in a way that might affect the color picker.
Parameters
- sender
The
NSColorPanelthat contains the color picker.
Discussion
Use this method to perform special preparation when resizing the color picker’s view. Because this method is invoked only as appropriate, it’s better to implement this method than to override the method superviewSizeChanged: for the NSView in which the color picker’s user interface is contained.
Availability
- Available in OS X v10.0 and later.
See Also
-
– provideNewView:(NSColorPickingCustomprotocol)
Declared In
NSColorPicking.h© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-11-17)