Adopted by | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSColorPicking.h |
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.
Sent when the color panel's opacity controls have been hidden or displayed.
- (void)alphaControlAddedOrRemoved:(id)sender
The color panel sending the message.
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
.
NSColorPicking.h
Tells the receiver to attach the given color list, if it isn’t already displaying the list.
- (void)attachColorList:(NSColorList *)colorList
The color list to display.
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.
NSColorPicking.h
Provides the toolbar button help tag.
- (NSString *)buttonToolTip
Help tag text.
NSColorPicking.h
Tells the receiver to detach the given color list, unless the receiver isn’t displaying the list.
- (void)detachColorList:(NSColorList *)colorList
The color list to detach.
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.
NSColorPicking.h
Initializes the receiver with a given color panel and its mode.
- (id)initWithPickerMask:(NSUInteger)panelModes colorPanel:(NSColorPanel *)owningColorPanel
A mask indicating the various color picker modes supported by the color panel. This is determined by the argument to the NSColorPanel
method setPickerMask:
. If it has not been set, panelModes is NSColorPanelAllModesMask
. If your color picker supports any additional modes, you should invoke the setPickerMask:
method when your application initializes to notify the NSColorPanel
class. The standard mode constants are defined in “Choosing the Color Pickers in a Color Panel”.
The color panel than owns the receiver.
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
.
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.
+ setPickerMask:
(NSColorPanel class)NSColorPicking.h
Sets the image of a given button cell.
- (void)insertNewButtonImage:(NSImage *)newButtonImage in:(NSButtonCell *)buttonCell
The image to set for the button cell.
The NSButtonCell
object that lets the user choose the picker from the color panel—the color picker’s representation in the NSMatrix
of the NSColorPanel
.
This method should perform application-specific manipulation of the image before it’s inserted and displayed by the button cell.
NSColorPicking.h
Indicates the receiver’s minimum content size.
- (NSSize)minContentSize
The receiver does not allow a size smaller than minContentSize
.
NSColorPicking.h
Provides the image of the button used to select the receiver in the color panel.
- (NSImage *)provideNewButtonImage
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.
NSColorPicking.h
Specifies the receiver’s mode.
- (void)setMode:(NSColorPanelMode)mode
The color picker mode. The available modes are described in “Choosing the Color Pickers in a Color Panel”.
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.
NSColorPicking.h
Tells the recever when the color panel's view size changes in a way that might affect the color picker.
- (void)viewSizeChanged:(id)sender
The NSColorPanel
that contains the color picker.
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.
– provideNewView:
(NSColorPickingCustom
protocol)NSColorPicking.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-27)