Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 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

Displaying

Target and Action

Assigning a Tag