ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/ApplicationKit/Classes/NSButton.rtf

This is NSButton.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc.  All Rights Reserved.

s4 li100 fi0 ri1007 ql f0 b fs36 fs100 
fs36 NSButton
pard s14 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSControl : NSView : NSResponder : NSObject
fs20 
fs28 s7 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding (NSResponder)
fi0 NSObject (NSObject)
fs20 
fs28 s8 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 AppKit/NSButton.h 
fs20 
fs28 pard s19 li100 fi0 ri1007 ql f0 b fs28 fs20 
fs28 Class Description
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 
fs28 NSButton is a subclass of NSControl that intercepts mouse-down events and sends an action message to a target object when it'27s clicked or pressed. By virtue of its NSButtonCell, NSButton is a two-state NSControl'd0it'27s either 'aaoff'ba or 'aaon'ba'd0and it displays its state depending on the configuration of the NSButtonCell. NSButton acquires other attributes of NSButtonCell. The state is used as the value, so NSControl methods like b setIntValue:b0  actually set the state (the methods b setState:b0  and b stateb0  are provided as a more conceptually accurate way of setting and getting the state). The NSButton can send its action continuously and display highlighting in several different ways. What'27s more, an NSButton can have a key equivalent that'27s eligible for triggering whenever the NSButton'27s NSPanel or NSWindow is the key window.
fs16 
fs28 NSButton and NSMatrix both provide a control view, which is needed to display an NSButtonCell object. However, while NSMatrix requires you to access the NSButtonCells directly, most of NSButton'27s methods are 'aacovers'ba for identically declared methods in NSButtonCell. (In other words, the implementation of the NSButton method invokes the corresponding NSButtonCell method for you, allowing you to be unconcerned with the NSButtonCell'27s existence.) The only NSButtonCell methods that don'27t have covers relate to the font used to display the key equivalent, and to specific methods for highlighting or showing the NSButton'27s state (these last are usually set together with NSButton'27s b setType:b0  method).
fs16 
fs28 pard s18 li477 fi0 ri1007 ql f0 b fs24 fs4 
fs24 Creating a Subclass of NSButton
pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 
fs28 Override the designated initializer (NSView'27sb  initWithFrame:b0  method) if you create a subclass of NSButton that performs its own initialization. If you want to use a custom NSButtonCell subclass with your subclass of NSButton, you have to override the b setCellClass:b0  method, as described in 'aaCreating New NSControls'ba in the NSControl class specification.
fs16 
fs28 See the NSButtonCell class specification for more on NSButton'27s behavior.
fs16 
fs28 pard s19 li100 fi0 ri1007 ql f0 b fs24 
fs28 fs28  fs28 Initializing the NSButton Factory 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (Class)b cellClasstab b0 Returns the subclass of NSButtonCell used by NSButtonb .
fi-6552 b0 fs16 
fs28 fi-6552 + (void)b setCellClass:b0 (Class)i classIdi0 tab Sets the subclass of NSButtonCell used by NSButton.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Setting the Button Type 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (void)b setType:b0 (int)i aTypei0 tab Sets how the NSButton highlights and shows its state.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Setting the State 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (void)b setState:b0 (int)i valuei0 tab Sets the NSButton'27s state to i valuei0  (0 or 1).
fi-6552 fs16 
fs28 fi-6552 {f3 -} (int)b stateb0 tab Returns the NSButton'27s current state (0 or 1).
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Setting the Repeat Interval 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (void)b getPeriodicDelay:b0 (float *)i delayi0 tab Gets repeat parameters for continuous buttons.
s11 li7030 fi-6553 fi-5796 b interval:b0 (float *)i interval
s9 li7029 fi-5794 fi-6552 i0 fs16 
fs28 fi-6552 {f3 -} (void)b setPeriodicDelay:b0 (float)i delayi0 tab Sets repeat parameters for continuous buttons.
s11 li7030 fi-6553 fi-5796 b interval:b0 (float)i interval
pard s19 li100 fi0 ri1007 ql f0 b i0 fs48 
fs28 Setting the Titles 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSString *)b alternateTitleb0 tab Returns the button'27s alternate title.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setAlternateTitle:b0 (NSString *)i aStringi0 tab Makes i aStringi0  the button'27s alternate title.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setTitle:b0 (NSString *)i aStringi0 tab Makes i aStringi0  the button'27s title.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b titleb0 tab Returns the button'27s title.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Setting the Images 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSImage *)b alternateImageb0 tab Returns the button'27s alternate image.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSImage *)b imageb0 tab Returns the button'27s image.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSCellImagePosition)b imagePositionb0 tab Returns the position of the button'27s image.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setAlternateImage:b0 (NSImage *)i anImagei0 tab Makes i anImagei0  the alternate image.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setImage:b0 (NSImage *)i anImagei0 tab Makes i anImagei0  the button'27s icon.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setImagePosition:b0 (NSCellImagePosition)i aPosition
s11 li7030 fi-6553 fi-5796 i0 tab Sets the position of the button'27s image to i aPositioni0 .
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Modifying Graphic Attributes 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (BOOL)b isBorderedb0 tab Returns whether the button has a bezeled border.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (BOOL)b isTransparentb0 tab Returns whether the button is transparent.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setBordered:b0 (BOOL)i flagi0 tab Sets whether the button has a bezeled border.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setTransparent:b0 (BOOL)i flagi0 tab Sets whether the button is transparent.
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Displaying 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (void)b highlight:b0 (BOOL)i flagi0 tab Highlights (or unhighlights) the button according to i flagi0 .
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Setting the Key Equivalent 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 tab 
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b keyEquivalentb0 tab Returns the button'27s key equivalent.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (unsigned int)b keyEquivalentModifierMasktab b0 Returns the mask indicating the possible modifier keys for button'27s key equivalent. 
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setKeyEquivalent:b0 (NSString *)i aKeyEquivalent
s11 li7030 fi-6553 fi-5796 i0 tab Makes i aKeyEquivalenti0  the button'27s key equivalent.
s9 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setKeyEquivalentModifierMask:b0 (unsigned int)i maski0 tab 
s11 li7030 fi-6553 fi-5796 tab Sets the mask that determines the possible modifier keys for button'27s key equivalent. 
pard s19 li100 fi0 ri1007 ql f0 b fs48 
fs28 Handling Events and Action Messages 
fs14 
fs28 pard s9 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (void)b performClick:b0 (id)i senderi0 tab Simulates the user'27s clicking the button.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (BOOL)b performKeyEquivalent:b0 (NSEvent *)i anEvent
s11 li7030 fi-6553 fi-5796 i0 tab Simulates a mouse click, if the key in i anEventi0  is right.
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.