Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSActionCell

Inherits From:	NSCell : NSObject

Conforms To:	NSCoding, NSCopying (NSCell)
NSObject (NSObject)

Declared In:	AppKit/NSActionCell.h 

Class Description

An NSActionCell defines an active area inside a control (an instance of NSControl or one of its subclasses). As an NSControl's active area, an NSActionCell does three things: it usually performs display of text or an icon (the subclass NSSliderCell is an exception); it provides the NSControl with a target and an action; and it handles mouse (cursor) tracking by properly highlighting its area and sending action messages to its target based on cursor movement. The only way to specify the NSControl for a particular NSActionCell is to send the NSActionCell a drawWithFrame:inView: message, passing the NSControl as the argument for the inView: keyword of the method.

NSActionCell implements the target object and action method as defined by its superclass, NSCell. As a user manipulates an NSControl, NSActionCell's trackMouse:inRect:ofView:untilMouseUp: method (inherited from NSCell) updates its appearance and sends the action message to the target object with the NSControl object as the only argument.

Usually, the responsibility for an NSControl's appearance and behavior is completely given over to a corresponding NSActionCell. (NSMatrix, and its subclass NSForm, are NSControls that don't follow this rule.)

A single NSControl may have more than one NSActionCell. To help identify it in this case, every NSActionCell has an integer tag. Note, however, that no checking is done by the NSActionCell object itself to ensure that the tag is unique. See the NSMatrix class for an example of a subclass of NSControl that contains multiple NSActionCells.

Many of the methods that define the contents and look of an NSActionCell, such as setFont: and setBordered:, are reimplementations of methods inherited from NSCell. They're subclassed to ensure that the NSActionCell is redisplayed if it's currently in an NSControl.

Configuring an NSActionCell 

- (void)setAlignment:(NSTextAlignment)mode	Sets the NSActionCell's text alignment to mode. 

- (void)setBezeled:(BOOL)flag	Adds or removes the NSActionCell's bezel. 

- (void)setBordered:(BOOL)flag	Adds or removes the NSActionCell's border. 

- (void)setEnabled:(BOOL)flag	Sets whether the NSActionCell reacts to mouse and keyboard events. 

- (void)setFloatingPointFormat:(BOOL)autoRange	 
left:(unsigned int)leftDigits	Sets the NSActionCell's floating point format. 
right:(unsigned int)rightDigits

- (void)setFont:(NSFont *)fontObject	Sets the NSActionCell's font to fontObject. 

- (void)setImage:(NSImage *)image	Sets the NSActionCell's icon to image.

Manipulating NSActionCell Values 

- (double)doubleValue	Returns the NSActionCell's contents as a double. 

- (float)floatValue	Returns the NSActionCell's contents as a float. 

- (int)intValue	Returns the NSActionCell's contents as an int. 

- (void)setStringValue:(NSString *)aString	Sets the NSActionCell's contents to a copy of aString. 

- (NSString *)stringValue	Returns the NSActionCell's contents as a string.

Displaying 

- (void)drawWithFrame:(NSRect)cellFrame	Draws the NSActionCell in the rectangle cellFrame of 
inView:(NSView *)controlView		controlView (which should normally be an NSControl). 

- (NSView *)controlView	Returns the view (normally an NSControl) in which the NSActionCell was last drawn. 

Target and Action 

- (SEL)action	Returns the NSActionCell's action method. 

- (void)setAction:(SEL)aSelector	Sets the NSActionCell's action method to aSelector. 

- (void)setTarget:(id)anObject	Sets the NSActionCell's target object to anObject. 

- (id)target	Returns the NSActionCell's target object. 

Assigning a Tag 

- (void)setTag:(int)anInt	Sets the NSActionCell's tag to anInt. 

- (int)tag	Returns the NSActionCell's tag.