Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSButtonCell.h |
Related sample code |
The NSButtonCell
class is a subclass of NSActionCell
used to implement the user interfaces of push buttons, checkboxes (switches), and radio buttons. It can also be used for any other region of a view that’s designed to send a message to a target when clicked. The NSButton
subclass of NSControl
uses a single NSButtonCell
.
The NSButtonCell
class implements the user interface of NSButton
.
Setting the integer, float, double, or object value of an NSButtonCell
object results in a call to setState:
with the value converted to integer. In the case of setObjectValue:
, nil
is equivalent to 0, and a non-nil
object that doesn't respond to intValue
sets the state to 1. Otherwise, the state is set to the object's intValue
. Similarly, querying the integer, float, double, or object value of an NSButtonCell
returns the current state in the requested representation. In the case of objectValue
, this is an NSNumber
containing YES
for on, NO
for off, and integer value -1 for the mixed state.
For more information on the behavior of NSButtonCell
, see the NSButton
and NSMatrix
class specifications, and Button Programming Topics for Cocoa.
In its implementation of the compare:
method (declared in NSCell
), NSButtonCell
raises an NSBadComparisonException
if the otherCell argument is not of the NSButtonCell
class.
– alternateMnemonic
– alternateMnemonicLocation
– alternateTitle
– attributedAlternateTitle
– attributedTitle
– setAlternateMnemonicLocation:
– setAlternateTitle:
– setAlternateTitleWithMnemonic:
– setAttributedAlternateTitle:
– setAttributedTitle:
– setFont:
– setTitle:
– setTitleWithMnemonic:
– title
– alternateImage
– imagePosition
– setAlternateImage:
– setImagePosition:
– imageScaling
– setImageScaling:
– keyEquivalent
– keyEquivalentFont
– keyEquivalentModifierMask
– setKeyEquivalent:
– setKeyEquivalentModifierMask:
– setKeyEquivalentFont:
– setKeyEquivalentFont:size:
– backgroundColor
– setBackgroundColor:
– bezelStyle
– setBezelStyle:
– gradientType
– setGradientType:
– imageDimsWhenDisabled
– setImageDimsWhenDisabled:
– isOpaque
– isTransparent
– setTransparent:
– showsBorderOnlyWhileMouseInside
– setShowsBorderOnlyWhileMouseInside:
Returns the image the button displays in its alternate state.
- (NSImage *)alternateImage
The image displayed by the button when it's in its alternate state, or nil
if there is no alternate image.
Note that some button types don’t display an alternate image. Buttons don’t display images by default.
NSButtonCell.h
Returns the character in the alternate title that’s marked as the “keyboard mnemonic.”
- (NSString *)alternateMnemonic
The character in the alternate title (the title displayed on the receiver when it's in its alternate state) marked as the "keyboard mnemonic."
Mnemonics are not supported in Mac OS X.
NSButtonCell.h
Returns an unsigned integer indicating the character in the alternate title that’s marked as the “keyboard mnemonic.”
- (NSUInteger)alternateMnemonicLocation
An unsigned integer indicating the character in the alternate title (the title displayed on the receiver when it’s in its alternate state) that’s marked as the “keyboard mnemonic.” If the alternate title doesn’t have a keyboard mnemonic, returns NSNotFound
.
Mnemonics are not supported in Mac OS X.
– setAlternateMnemonicLocation:
– alternateMnemonic
– setAlternateTitleWithMnemonic:
– mnemonicLocation
(NSCell
)NSButtonCell.h
Returns the string displayed by the button when it’s in its alternate state.
- (NSString *)alternateTitle
The string that appears on the button when it's in its alternate state, or the empty string if the receiver doesn’t display an alternate title.
Note that some button types don’t display an alternate title. By default, a button’s alternate title is “Button.”
NSButtonCell.h
Returns the title displayed by the button when it’s in its alternate state, as an attributed string.
- (NSAttributedString *)attributedAlternateTitle
The attributed string that appears on the button when it's in its alternate state, or the empty string if the receiver doesn’t display an alternate title.
Note that some button types don’t display an alternate title. By default, a button’s alternate title is “Button.”
NSButtonCell.h
Returns the title displayed by the button when it’s in its normal state as an attributed string.
- (NSAttributedString *)attributedTitle
The attributes string that appears on the button when it's in its normal state, or an empty attributed string if the receiver doesn’t display a title.
A button’s title is always displayed if the button doesn’t use its alternate contents for highlighting or displaying the alternate state. By default, a button’s title is “Button.”
NSButtonCell.h
Returns the background color of the receiver.
- (NSColor *)backgroundColor
The receiver’s background color.
The background color is used only when drawing borderless buttons.
NSButtonCell.h
Returns the appearance of the receiver’s border.
- (NSBezelStyle)bezelStyle
A constant specifying the bezel style used by the button. See “Bezel Styles” for a list of possible values.
NSButtonCell.h
Draws the border of the button using the current bezel style.
- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
The bounding rectangle of the button.
The control being drawn.
This method is called automatically when the button is redrawn; you should not call it directly.
NSButtonCell.h
Draws the image associated with the button’s current state.
- (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView
The image associated with the button's current state.
The bounding rectangle of the button.
The control being drawn.
This method is called automatically when the button is redrawn; you should not call it directly.
You specify the primary and alternate images for the button using Interface Builder.
NSButtonCell.h
Draws the button’s title centered vertically in a specified rectangle.
- (NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView
The title of the button.
The rectangle in which to draw the title.
The control being drawn.
The bounding rectangle for the text of the title.
This method is called automatically when the button is redrawn; you should not call it directly.
NSButtonCell.h
Returns by reference the delay and interval periods for a continuous button.
- (void)getPeriodicDelay:(float *)delay interval:(float *)interval
On return, the amount of time (in seconds) that the button will pause before starting to periodically send action messages to the target object. Default values are taken from the user's defaults (60 seconds maximum); if the user hasn't specified a default value, this defaults to 0.4 seconds.
On return, the amount of time (in seconds) between each action message. Default values are taken from the user's defaults (60 seconds maximum); if the user hasn't specified a default value, this defaults to 0.075 seconds.
– isContinuous
– isContinuous
(NSCell
)NSButtonCell.h
Returns the gradient of the receiver’s border.
- (NSGradientType)gradientType
A constant specifying the gradient used for the button's border. See “Gradient Types” for a list of possible values.
NSButtonCell.h
Returns flags indicating how the button highlights when it receives a mouse-down event.
- (NSInteger)highlightsBy
The logical OR of flags that indicate the way the receiver highlights when it receivers a mouse-down event. See the “Constants” section of NSCell for the list of flags.
NSButtonCell.h
Returns a Boolean value that indicates whether the receiver’s image and text appear “dim” when the receiver is disabled.
- (BOOL)imageDimsWhenDisabled
YES
if the button's image and text are dimmed when the button is disabled, otherwise NO
.
By default, all button types except NSSwitchButton
and NSRadioButton
do dim when disabled. When buttons of type NSSwitchButton
and NSRadioButton
are disabled, only the associated text dims.
NSButtonCell.h
Returns the position of the receiver’s image relative to its title.
- (NSCellImagePosition)imagePosition
The position of the button's image. This is one of the image positions described in the “Constants” section of NSCell.
If the title is above, below, or overlapping the image, or if there is no image, the text is horizontally centered within the button.
NSButtonCell.h
Returns the scale factor for the receiver’s image.
- (NSImageScaling)imageScaling
The scale factor for the receiver’s image.
NSButtonCell.h
Returns a Boolean value that indicates whether the receiver is opaque.
- (BOOL)isOpaque
YES
if the receiver draws over every pixel in its frame, otherwise NO
.
A button cell is opaque only if it isn’t transparent and if it has a border.
NSButtonCell.h
Returns a Boolean value that indicates whether the receiver is transparent.
- (BOOL)isTransparent
YES
if the receiver is transparent, NO
otherwise.
A transparent button never draws itself, but it receives mouse-down events and tracks the mouse properly.
NSButtonCell.h
Returns the receiver's key-equivalent character.
- (NSString *)keyEquivalent
The string containing the key equivalent character of the button, or the empty string if one hasn't been defined.
Buttons don't have a default key equivalent.
NSButtonCell.h
Returns the font used to draw the key equivalent.
- (NSFont *)keyEquivalentFont
The font object describing the font used to draw the button's key equivalent, or nil
if the receiver doesn’t have a key equivalent.
The default font is the same as that used to draw the title.
NSButtonCell.h
Returns the mask identifying the modifier keys for the button's key equivalent.
- (NSUInteger)keyEquivalentModifierMask
A mask indicating the modifier keys that are applied to the receiver's key equivalent.
Mask bits are defined in NSEvent.h
. The only mask bits relevant in button key-equivalent modifier masks are NSControlKeyMask
, NSAlternateKeyMask
, and NSCommandKeyMask
bits.
NSButtonCell.h
Draws the receiver’s border.
- (void)mouseEntered:(NSEvent *)event
The event object generated by the mouse movement.
This method is called only when the cursor moves onto the receiver and showsBorderOnlyWhileMouseInside
returns YES
.
NSButtonCell.h
Erases the receiver’s border.
- (void)mouseExited:(NSEvent *)event
The event object generated by the mouse movement.
This method is called only when the cursor moves off the receiver and showsBorderOnlyWhileMouseInside
returns YES
.
NSButtonCell.h
Simulates the user clicking the receiver with the cursor.
- (void)performClick:(id)sender
The sender of the message.
This method essentially highlights the button, sends the button’s action message to the target object, and then unhighlights the button. If an exception is raised while the target object is processing the action message, the button is unhighlighted before the exception is propagated out of performClick:
.
NSButtonCell.h
Sets the image the button displays in its alternate state and, if necessary, redraws its contents.
- (void)setAlternateImage:(NSImage *)image
The image displayed by the button when it's in its alternate state.
Note that some button types don’t display an alternate image.
– alternateImage
– setButtonType:
– setImage:
(NSCell
)NSButtonCell.h
Sets the character in the alternate title that should be the “keyboard mnemonic.”
- (void)setAlternateMnemonicLocation:(NSUInteger)location
An unsigned integer indicating the character in the alternate title that should be marked as the "keyboard mnemonic." If you don’t want the alternate title to have a keyboard mnemonic, specify a location of NSNotFound
.
Mnemonics are not supported in Mac OS X.
The setAlternateMnemonicLocation:
method doesn’t cause the button cell to be redisplayed.
NSButtonCell.h
Sets the title the button displays when it’s in its alternate state.
- (void)setAlternateTitle:(NSString *)aString
The string to set as the button's title when it's in its alternate state.
Note that some button types don’t display an alternate title.
– alternateTitle
– setAlternateMnemonicLocation:
– setAlternateTitleWithMnemonic:
– setTitle:
– setButtonType:
– setFont:
NSButtonCell.h
Sets the title the button displays when it’s in its alternate state to the given string with an embedded mnemonic.
- (void)setAlternateTitleWithMnemonic:(NSString *)aString
The string to set as the button's alternate title, taking into account the fact that an embedded “&” character is not a literal but instead marks the alternate state’s “keyboard mnemonic.”
Mnemonics are not supported in Mac OS X.
If necessary, setAlternateTitleWithMnemonic:
redraws the button cell. Note that some button types don’t display an alternate title.
NSButtonCell.h
Sets the string the button displays when it’s in its alternate state to the given attributed string.
- (void)setAttributedAlternateTitle:(NSAttributedString *)aString
The attributed string to set as the button's alternate title.
Note that some button types don’t display an alternate title.
Graphics attributes that are set on the cell (backgroundColor
, alignment
, font
, etc.) are overriden when corresponding properties are set for the attributed string.
– attributedAlternateTitle
– setAlternateMnemonicLocation:
– setAlternateTitleWithMnemonic:
– setAttributedTitle:
– setButtonType:
– setFont:
NSButtonCell.h
Sets the string the button displays when it’s in its normal state to the given attributed string and redraws the button.
- (void)setAttributedTitle:(NSAttributedString *)aString
The attributed string to set as the button's title.
The title is always shown on buttons that don’t use their alternate contents when highlighting or displaying their alternate state.
Graphics attributes configured for the cell (backgroundColor
, alignment
, font
, etc.) are overriden when corresponding properties are set for the attributed string.
– attributedTitle
– setAttributedAlternateTitle:
– setButtonType:
– setFont:
– setMnemonicLocation:
(NSCell
)NSButtonCell.h
Sets the background color of the receiver.
- (void)setBackgroundColor:(NSColor *)color
The color to use for the receiver’s background.
The background color is used only when drawing borderless buttons.
NSButtonCell.h
Sets the appearance of the border, if the receiver has one.
- (void)setBezelStyle:(NSBezelStyle)bezelStyle
A constant specifying the bezel style to use for the button. This must be one of the values specified in “Bezel Styles.”
If the receiver is not bordered, the bezel style is ignored.
A button uses shading to look like it’s sticking out or pushed in. You can set the shading with setGradientType:
.
NSButtonCell.h
Sets how the receiver highlights while pressed and how it shows its state.
- (void)setButtonType:(NSButtonType)aType
A constant specifying the type of button. This can be one of the constants defined in “Button Types.”
setButtonType:
redisplays the receiver before returning.
The types available are for the most common button types, which are also accessible in Interface Builder; you can configure different behavior with the setHighlightsBy:
and setShowsStateBy:
methods.
Note that there is no -buttonType
method. The set method sets various button properties that together establish the behavior of the type.
– setAlternateImage:
– setImage:
(NSCell
)NSButtonCell.h
Sets the font used to display the button's title and alternate title.
- (void)setFont:(NSFont *)fontObj
The font object specifying the font to use.
This method does nothing if the receiver has no title or alternate title.
If the button cell has a key equivalent, its font is not changed, but the key equivalent’s font size is changed to match the new title font.
NSButtonCell.h
Sets the type of gradient to use for the receiver.
- (void)setGradientType:(NSGradientType)gradientType
A constant specifying the gradient to use for the button's border. This can be one of the constants defined in “Gradient Types.”
If the receiver has no border, this method has no effect on its appearance. A concave gradient is darkest in the top-left corner; a convex gradient is darkest in the bottom-right corner. Weak versus strong is how much contrast exists between the colors used in opposite corners.
NSButtonCell.h
Sets the way the receiver highlights itself while pressed.
- (void)setHighlightsBy:(NSInteger)aType
The logical OR of one or more of the cell masks described in the “Constants” section of NSCell.
If both NSChangeGrayCellMask
and NSChangeBackgroundCellMask
are specified, both are recorded, but which behavior is used depends on the button cell’s image. If the button has no image, or if the image has no alpha (transparency) data, NSChangeGrayCellMask
is used. If the image does have alpha data, NSChangeBackgroundCellMask
is used; this arrangement allows the color swap of the background to show through the image’s transparent pixels.
NSButtonCell.h
Sets whether the receiver’s image appears “dim” when the button cell is disabled.
- (void)setImageDimsWhenDisabled:(BOOL)flag
YES
to indicate that the button's image should dim when the button is disabled.
By default, all button types except NSSwitchButton
and NSRadioButton
do dim when disabled. When NSSwitchButton
s and NSRadioButton
s are disabled, only the associated text dims. The default setting for this condition is reasserted whenever you invoke setButtonType:
, so be sure to specify the button cell’s type before you invoke setImageDimsWhenDisabled:
.
NSButtonCell.h
Sets the position of the receiver’s image relative to its title.
- (void)setImagePosition:(NSCellImagePosition)aPosition
A constant specifying the position of the button's image. See the “Constants” section of NSCell for a listing of possible values.
NSButtonCell.h
Sets the scale factor for the receiver’s image.
- (void)setImageScaling:(NSImageScaling)scaling
The scale factor for the receiver’s image.
NSButtonCell.h
Sets the key equivalent character of the receiver.
- (void)setKeyEquivalent:(NSString *)aKeyEquivalent
The key equivalent character.
This method redraws the receiver’s inside if it displays a key equivalent instead of an image. The key equivalent isn’t displayed if the image position is set to NSNoImage
, NSImageOnly
, or NSImageOverlaps
; that is, the button must display both its title and its “image” (the key equivalent in this case), and they must not overlap.
To display a key equivalent on a button, set the image and alternate image to nil
, then set the key equivalent, then set the image position.
– keyEquivalent
– setAlternateImage:
– setImagePosition:
– setKeyEquivalentFont:
– setImage:
(NSCell)NSButtonCell.h
Sets the font used to draw the key equivalent and redisplays the receiver if necessary.
- (void)setKeyEquivalentFont:(NSFont *)fontObj
The font object specifying the font to use for the receiver's key equivalent.
This method does nothing if the receiver doesn’t have a key equivalent associated with it.
The default font is the same as that used to draw the title.
NSButtonCell.h
Sets by name and size of the font used to draw the key equivalent.
- (void)setKeyEquivalentFont:(NSString *)fontName size:(CGFloat)fontSize
The name of the font to use to draw the key equivalent.
The font size to use to draw the key equivalent.
This method redisplays the receiver if necessary. It does nothing if the receiver doesn’t have a key equivalent associated with it. The default font is the same as that used to draw the title.
NSButtonCell.h
Sets the mask identifying the modifier keys to use with the button's key equivalent.
- (void)setKeyEquivalentModifierMask:(NSUInteger)mask
The mask indicating the modifier keys to be applied to the receiver's key equivalent.
Mask bits are defined in NSEvent.h
. The only mask bits relevant in button key-equivalent modifier masks are NSControlKeyMask
, NSAlternateKeyMask
, and NSCommandKeyMask
.
NSButtonCell.h
Sets the message delay and interval for the receiver.
- (void)setPeriodicDelay:(float)delay interval:(float)interval
The amount of time (in seconds) that a continuous button will pause before starting to periodically send action messages to the target object.
The maximum value is 60.0 seconds; if a larger value is supplied, it’s ignored, and 60.0 seconds is used.
The amount of time (in seconds) between each action message.
The maximum value is 60.0 seconds; if a larger value is supplied, it’s ignored, and 60.0 seconds is used.
These values are used if the receiver is configured (by a setContinuous:
message) to continuously send the action message to the target object while tracking the mouse.
– setContinuous:
(NSCell)NSButtonCell.h
Sets whether the receiver’s border is displayed only when the cursor is over the button.
- (void)setShowsBorderOnlyWhileMouseInside:(BOOL)show
YES
to display the button's border only when the cursor is within the receiver’s border and the button is active. NO
to continue to display the border when the cursor is outside button’s bounds.
NSButtonCell.h
Sets the way the receiver indicates its alternate state.
- (void)setShowsStateBy:(NSInteger)aType
The logical OR
of one or more of the cell masks described in the “Constants” section of NSCell.
If both NSChangeGrayCellMask
and NSChangeBackgroundCellMask
are specified, both are recorded, but the actual behavior depends on the button cell’s image. If the button has no image, or if the image has no alpha (transparency) data, NSChangeGrayCellMask
is used. If the image exists and has alpha data, NSChangeBackgroundCellMask
is used; this arrangement allows the color swap of the background to show through the image’s transparent pixels.
NSButtonCell.h
Sets the sound that’s played when the user presses the receiver.
- (void)setSound:(NSSound *)aSound
The sound to play when the button is pressed.
The sound is played during a mouse-down event, such as NSLeftMouseDown
.
NSButtonCell.h
Sets the title the button displays when in its normal state and, if necessary, redraws the receiver’s contents.
- (void)setTitle:(NSString *)aString
The string to set as the button's title.
The title is always shown on buttons that don’t use their alternate contents when highlighting or displaying their alternate state.
NSButtonCell.h
Sets the title the button displays when it’s in its normal state to the given string with an embedded mnemonic.
- (void)setTitleWithMnemonic:(NSString *)aString
The string to set as the button's title, taking into account the fact that an embedded “&” character is not a literal but instead marks the alternate state’s “keyboard mnemonic.” This title is always shown on buttons that don’t use their alternate contents when highlighting or displaying their alternate state.
If necessary, setTitleWithMnemonic:
redraws the button cell. Mnemonics are not supported in Mac OS X.
– setAlternateTitleWithMnemonic:
– setTitleWithMnemonic:
(NSCell
)– setMnemonicLocation:
(NSCell
)NSButtonCell.h
Sets whether the receiver is transparent.
- (void)setTransparent:(BOOL)flag
YES
to make the button cell transparent.
This method redraws the receiver if necessary. A transparent button tracks the mouse and sends its action, but doesn’t draw. A transparent button is useful for sensitizing an area on the screen so that an action gets sent to a target when the area receives a mouse click.
NSButtonCell.h
Returns a Boolean value indicating whether the button displays its border only when the cursor is over it.
- (BOOL)showsBorderOnlyWhileMouseInside
YES
if the receiver’s border is displayed only when the cursor is over the button and the button is active.
By default, this method returns NO
.
NSButtonCell.h
Returns the flags indicating how the button cell shows its alternate state.
- (NSInteger)showsStateBy
The logical OR of flags that indicate the way the receiver shows its alternate state. See the “Constants” section of NSCell for the list of flags.
NSButtonCell.h
Returns the sound that’s played when the user presses the receiver.
- (NSSound *)sound
The sound played when the receiver is pressed.
NSButtonCell.h
Returns the title displayed on the receiver when it’s in its normal state.
- (NSString *)title
The title displayed by the button in its normal state, or the empty string if the button doesn’t display a title.
This title is always displayed if the button doesn’t use its alternate contents for highlighting or displaying the alternate state. By default, a button’s title is “Button.”
– setTitle:
– alternateTitle
– setButtonType:
– mnemonic
(NSCell
)– mnemonicLocation
(NSCell
)NSButtonCell.h
Type to define bezel styles.
typedef NSUInteger NSBezelStyle;
For possible values, see “Bezel Styles.”
NSButtonCell.h
Define the bezel styles used by bezelStyle
and setBezelStyle:
.
enum { NSRoundedBezelStyle = 1, NSRegularSquareBezelStyle = 2, NSThickSquareBezelStyle = 3, NSThickerSquareBezelStyle = 4, NSDisclosureBezelStyle = 5, NSShadowlessSquareBezelStyle = 6, NSCircularBezelStyle = 7, NSTexturedSquareBezelStyle = 8, NSHelpButtonBezelStyle = 9, NSSmallSquareBezelStyle = 10, NSTexturedRoundedBezelStyle = 11, NSRoundRectBezelStyle = 12, NSRecessedBezelStyle = 13, NSRoundedDisclosureBezelStyle = 14, }
NSRoundedBezelStyle
A rounded rectangle button, designed for text.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSRegularSquareBezelStyle
A rectangular button with a 2 point border, designed for icons.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSThickSquareBezelStyle
A rectangular button with a 3 point border, designed for icons.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSThickerSquareBezelStyle
A rectangular button with a 4 point border, designed for icons.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSDisclosureBezelStyle
A bezel style for use with a disclosure triangle.
To create the disclosure triangle, set the button bezel style to NSDisclosureBezelStyle
and the button type to NSOnOffButton
.
Available in Mac OS X v10.3 and later.
Declared in NSButtonCell.h
.
NSShadowlessSquareBezelStyle
Similar to NSRegularSquareBezelStyle
, but has no shadow so you can abut the cells without overlapping shadows.
This style would be used in a tool palette, for example.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSCircularBezelStyle
A round button with room for a small icon or a single character.
This style has both regular and small variants, but the large variant is available only in gray at this time.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSTexturedSquareBezelStyle
A bezel style appropriate for use with textured (metal) windows.
Available in Mac OS X v10.3 and later.
Declared in NSButtonCell.h
.
NSHelpButtonBezelStyle
A round button with a question mark providing the standard help button look.
Available in Mac OS X v10.3 and later.
Declared in NSButtonCell.h
.
NSSmallSquareBezelStyle
A simple square bezel style. Buttons using this style can be scaled to any size.
Available in Mac OS X v10.4 and later.
Declared in NSButtonCell.h
.
NSTexturedRoundedBezelStyle
A textured (metal) bezel style similar in appearance to the Finder’s action (gear) button.
The height of this button is fixed.
Available in Mac OS X v10.4 and later.
Declared in NSButtonCell.h
.
NSRoundRectBezelStyle
A bezel style that matches the search buttons in Finder and Mail.
Available in Mac OS X v10.4 and later.
Declared in NSButtonCell.h
.
NSRecessedBezelStyle
A bezel style that matches the recessed buttons in Mail, Finder and Safari.
Available in Mac OS X v10.4 and later.
Declared in NSButtonCell.h
.
NSRoundedDisclosureBezelStyle
A bezel style that matches the disclosure style used in the standard Save panel.
Available in Mac OS X v10.4 and later.
Declared in NSButtonCell.h
.
For examples of how these styles are displayed, see Button Programming Topics for Cocoa.
NSButtonCell.h
Type to define button types.
typedef NSUInteger NSButtonType;
For possible values, see “Button Types.”
NSButtonCell.h
Represent the button types that can be specified using setButtonType:
.
enum { NSMomentaryLightButton = 0, NSPushOnPushOffButton = 1, NSToggleButton = 2, NSSwitchButton = 3, NSRadioButton = 4, NSMomentaryChangeButton = 5, NSOnOffButton = 6, NSMomentaryPushInButton = 7, NSMomentaryPushButton = 0, NSMomentaryLight = 7 };
NSMomentaryLightButton
While the button is held down it’s shown as “lit,” and also “pushed in” to the screen if the button is bordered.
This type of button is best for simply triggering actions, as it doesn’t show its state; it always displays its normal image or title. This option is called “Momentary Light” in Interface Builder’s Button Inspector.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSPushOnPushOffButton
The first click both highlights and causes the button to be “pushed in” if the button is bordered; a second click returns it to its normal state.
This option is called “Push On Push Off” in Interface Builder’s Button Inspector.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSToggleButton
After the first click, the button displays its alternate image or title; a second click returns the button to its normal state.
This option is called “Toggle” in Interface Builder’s Button Inspector.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSSwitchButton
This style is a variant of NSToggleButton
that has no border and is used to represent a checkbox.
This type of button is available as a separate Library item in Interface Builder.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSRadioButton
This style is similar to NSSwitchButton
, but it used to constrain a selection to a single element from several.
You typically use this type of button in a group formed by an instance of NSMatrix
. In Interface Builder, a matrix of this type of button is available as a separate Library item.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSMomentaryChangeButton
While the button is held down, the alternate image and alternate title are displayed.
The normal image and title are displayed when the button isn’t pressed. This option is called “Momentary Change” in Interface Builder’s Button Inspector.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSOnOffButton
The first click highlights the button; a second click returns it to the normal (unhighlighted) state.
This option is called “On Off” in Interface Builder’s Button Inspector.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSMomentaryPushInButton
While the button is held down it’s shown as “lit.”
This type of button is best for simply triggering actions, as it doesn’t show its state; it always displays its normal image or title. This option is called “Momentary Push In” in Interface Builder’s Button Inspector.
This button type is the default.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSMomentaryPushButton
While the button is held down it’s shown as “lit,” and also “pushed in” to the screen if the button is bordered. (Deprecated. Use NSMomentaryLightButton
instead.)
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSMomentaryLight
While the button is held down it’s shown as “lit.” (Deprecated. Use NSMomentaryPushInButton
instead.)
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
For examples of how these types behave, see Button Programming Topics for Cocoa.
NSButtonCell.h
Type to define gradient types.
typedef NSUInteger NSGradientType;
For possible values, see “Gradient Types.”
NSButtonCell.h
Specify the gradients used by gradientType
and setGradientType:
.
typedef enum _NSGradientType { NSGradientNone = 0, NSGradientConcaveWeak = 1, NSGradientConcaveStrong = 2, NSGradientConvexWeak = 3, NSGradientConvexStrong = 4 } NSGradientType;
NSGradientNone
There is no gradient, so the button looks flat.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSGradientConcaveWeak
The top-left corner is light gray, and the bottom-right corner is dark gray, so the button appears to be pushed in.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSGradientConcaveStrong
As with NSGradientConcaveWeak
, the top-left corner is light gray, and the bottom-right corner is dark gray, but the difference between the grays is greater, so the appearance of being pushed in is stronger.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSGradientConvexWeak
The top-left corner is dark gray, and the bottom-right corner is light gray, so the button appears to be sticking out.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSGradientConvexStrong
As with NSGradientConvexWeak
, the top-left corner is dark gray, and the bottom-right corner is light gray, but the difference between the grays is greater, so the appearance of sticking out is stronger.
Available in Mac OS X v10.0 and later.
Declared in NSButtonCell.h
.
NSButtonCell.h
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-04-08)