Up

# NSButton

### Authors

Scott Christley (`scottc@net-community.com`)

> The button class

Copyright: (C) 1996 Free Software Foundation, Inc.

# Software documentation for the NSButton class

## NSButton : NSControl

> Declared in:
>   AppKit/NSButton.h

Availability: OpenStep
TODO Description
Method summary

- -allowsMixedState
- -alternateImage
- -alternateTitle
- -attributedAlternateTitle
- -attributedTitle
- -bezelStyle
- -getPeriodicDelay:interval:
- -highlight:
- -image
- -imagePosition
- -isBordered
- -isTransparent
- -keyEquivalent
- -keyEquivalentModifierMask
- -performKeyEquivalent:
- -setAllowsMixedState:
- -setAlternateImage:
- -setAlternateTitle:
- -setAttributedAlternateTitle:
- -setAttributedTitle:
- -setBezelStyle:
- -setBordered:
- -setButtonType:
- -setHighlightsBy:
- -setImage:
- -setImagePosition:
- -setKeyEquivalent:
- -setKeyEquivalentModifierMask:
- -setNextState
- -setPeriodicDelay:interval:
- -setShowsBorderOnlyWhileMouseInside:
- -setShowsStateBy:
- -setSound:
- -setState:
- -setTitle:
- -setTitleWithMnemonic:
- -setTransparent:
- -showsBorderOnlyWhileMouseInside
- -sound
- -state
- -title

### allowsMixedState

- (BOOL) allowsMixedState;
Availability: OpenStep
Description forthcoming.

### alternateImage

- (NSImage*) alternateImage;
Availability: OpenStep

Returns the NSButtonCell's alternate image.

See Also: -setAlternateImage: [NSButtonCell -alternateImage]

### alternateTitle

- (NSString*) alternateTitle;
Availability: OpenStep

Returns the NSButtonCell's alternate title.

See Also: -setAlternateTitle: [NSButtonCell -alternateTitle]

### attributedAlternateTitle

- (NSAttributedString*) attributedAlternateTitle;
Availability: MacOS-X 10.0.0
Description forthcoming.

### attributedTitle

- (NSAttributedString*) attributedTitle;
Availability: MacOS-X 10.0.0
Description forthcoming.

### bezelStyle

- (NSBezelStyle) bezelStyle;
Availability: MacOS-X 10.0.0

Returns the style of the NSButtonCell's bezeled border. See NSBezelStyle for more information.

See Also: -setBezelStyle: [NSButtonCell -bezelStyle]

### getPeriodicDelay: interval:

- (void) getPeriodicDelay: (float*)delay interval: (float*)interval;
Availability: OpenStep

Gets the NSButtonCell's delay and the interval parameters used when NSButton sends continouly action messages. By default delay is 0.4 and interval is 0.075.

See Also: [NSButtonCell -getPeriodicDelay:interval:] -setPeriodicDelay:interval: [NSCell -trackMouse:inRect:ofView:untilMouseUp:]

### highlight:

- (void) highlight: (BOOL)flag;
Availability: OpenStep

(Un)Highlights the NSButtonCell.

See Also: [NSButtonCell -highlight:withFrame:inView:]

### image

- (NSImage*) image;
Availability: OpenStep

Returns the NSButtonCell's image.

See Also: -setImage: [NSButtonCell -image]

### imagePosition

- (NSCellImagePosition) imagePosition;
Availability: OpenStep

Returns the position of the NSButtonCell's image. See NSCellImagePosition for more information.

See Also: -setImagePosition: [NSButtonCell -imagePosition]

### isBordered

- (BOOL) isBordered;
Availability: OpenStep

Returns whether the NSButton's cell has border.

See Also: -setBordered: [NSButtonCell -isBordered]

### isTransparent

- (BOOL) isTransparent;
Availability: OpenStep

Returns whether the NSButton's cell is transparent.

See Also: -setTransparent: [NSButtonCell -isTransparent]

### keyEquivalent

- (NSString*) keyEquivalent;
Availability: OpenStep

Returns the NSButtonCell's key equivalent. The key equivalent and its modifier mask are used to simulate the click of the button in -performKeyEquivalent: . Returns an empty string if no key equivalent is defined. By default NSButton hasn't key equivalent.

See Also: -setKeyEquivalent: -performKeyEquivalent: -keyEquivalentModifierMask [NSButtonCell -keyEquivalent]

### keyEquivalentModifierMask

- (unsigned int) keyEquivalentModifierMask;
Availability: OpenStep

Returns the modifier mask of the NSButtonCell's key equivalent. The key equivalent and its modifier mask are used to simulate the click of the button in -performKeyEquivalent: . The default mask is NSCommandKeyMask.

See Also: -setKeyEquivalentModifierMask: -keyEquivalent [NSButtonCell -setKeyEquivalentModifierMask:]

### performKeyEquivalent:

- (BOOL) performKeyEquivalent: (NSEvent*)anEvent;
Availability: OpenStep

Simulates the click of the button if the key equivalent and its modifier mask match the event anEvent. By default the key modifier mask is NSCommandKeyMask and there is no key equivalent

See Also: -keyEquivalent -keyEquivalentModifierMask [NSControl -performClick:] [NSEvent -charactersIgnoringModifiers] [NSEvent -modifierFlags]

Does nothing and returns `NO` if the receiver is disabled or if it is blocked by a modal window being run.

### setAllowsMixedState:

- (void) setAllowsMixedState: (BOOL)flag;
Availability: OpenStep
Description forthcoming.

### setAlternateImage:

- (void) setAlternateImage: (NSImage*)anImage;
Availability: OpenStep

Sets the NSButtonCell's alternate image to anImage and marks self for display.

See Also: -alternateImage [NSButtonCell -setAlternateImage:]

### setAlternateTitle:

- (void) setAlternateTitle: (NSString*)aString;
Availability: OpenStep

Sets the NSButtonCell's alternateTitle to aString and marks self for display.

See Also: -alternateTitle

### setAttributedAlternateTitle:

- (void) setAttributedAlternateTitle: (NSAttributedString*)aString;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setAttributedTitle:

- (void) setAttributedTitle: (NSAttributedString*)aString;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setBezelStyle:

- (void) setBezelStyle: (NSBezelStyle)bezelStyle;
Availability: MacOS-X 10.0.0

Sets the style of the NSButtonCell's bezeled border and marks self for display. See NSBezelStyle for more information.

See Also: -bezelStyle [NSButtonCell -setBezelStyle:]

### setBordered:

- (void) setBordered: (BOOL)flag;
Availability: OpenStep

Sets whether the NSButton's cell has border and marks self for display.

See Also: -isBordered [NSButtonCell -setBordered:]

### setButtonType:

- (void) setButtonType: (NSButtonType)aType;
Availability: OpenStep

Sets the NSButtonCell's type to aType and marks self for display.See NSButtonType for more information.

See Also: [NSButtonCell -setButtonType:]

### setHighlightsBy:

- (void) setHighlightsBy: (int)aType;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setImage:

- (void) setImage: (NSImage*)anImage;
Availability: OpenStep

Sets the NSButtonCell's image to anImage and marks self for display.

See Also: -image [NSButtonCell -setImage:]

### setImagePosition:

- (void) setImagePosition: (NSCellImagePosition)aPosition;
Availability: OpenStep

Sets the postion of the NSButtonCell's image to aPosition and marks self for display. See NSCellImagePosition for more information.

See Also: -imagePosition [NSButtonCell -setImagePosition:]

### setKeyEquivalent:

- (void) setKeyEquivalent: (NSString*)aKeyEquivalent;
Availability: OpenStep

Sets the NSButtonCell's key equivalent to aKeyEquivalent. The key equivalent and its modifier mask are used to simulate the click of the button in -performKeyEquivalent: . By default NSButton hasn't key equivalent.

See Also: -keyEquivalent -setKeyEquivalentModifierMask: -performKeyEquivalent: [NSButtonCell -setKeyEquivalent:]

### setKeyEquivalentModifierMask:

- (void) setKeyEquivalentModifierMask: (unsigned int)mask;
Availability: OpenStep

Sets the modifier mask of the NSButtonCell's key equivalent to mask. The key equivalent and its modifier mask are used to simulate the click of the button in -performKeyEquivalent: . By default the mask is NSCommandKeyMask.

See Also: -keyEquivalentModifierMask -setKeyEquivalent: -performKeyEquivalent: [NSButtonCell -setKeyEquivalentModifierMask:]

### setNextState

- (void) setNextState;
Availability: OpenStep

Sets the NSButtonCell to the next state and marks self for display.

See Also: [NSButtonCell -setNextState]

### setPeriodicDelay: interval:

- (void) setPeriodicDelay: (float)delay interval: (float)interval;
Availability: OpenStep

Sets the NSButtonCell's delay and interval parameters used when NSButton sends continouly action messages. By default delay is 0.4 and interval is 0.075.

See Also: [NSButtonCell -setPeriodicDelay:interval:] -getPeriodicDelay:interval: [NSCell -trackMouse:inRect:ofView:untilMouseUp:]

### setShowsBorderOnlyWhileMouseInside:

- (void) setShowsBorderOnlyWhileMouseInside: (BOOL)show;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setShowsStateBy:

- (void) setShowsStateBy: (int)aType;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setSound:

- (void) setSound: (NSSound*)aSound;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setState:

- (void) setState: (int)value;
Availability: OpenStep

Sets the NSButtonCell's state to value and marks self for display.

See Also: -state [NSButtonCell -setState:]

### setTitle:

- (void) setTitle: (NSString*)aString;
Availability: OpenStep

Sets the NSButtonCell's title to aString and marks self for display.

See Also: -title

### setTitleWithMnemonic:

- (void) setTitleWithMnemonic: (NSString*)aString;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setTransparent:

- (void) setTransparent: (BOOL)flag;
Availability: OpenStep

Sets whether the NSButton's cell is transparent and marks self for display.

See Also: -isTransparent [NSButtonCell -setTransparent:]

### showsBorderOnlyWhileMouseInside

- (BOOL) showsBorderOnlyWhileMouseInside;
Availability: MacOS-X 10.0.0
Description forthcoming.

### sound

- (NSSound*) sound;
Availability: MacOS-X 10.0.0
Description forthcoming.

### state

- (int) state;
Availability: OpenStep

Returns the NSButtonCell's state.

See Also: -setState: [NSButtonCell -state]

### title

- (NSString*) title;
Availability: OpenStep

Returns the NSButtonCell's title.

See Also: [NSButtonCell -title] -setTitle:

Up