Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

ActionCell



Inherits From: Cell : Object
Declared In: appkit/ActionCell.h



Class Description

An ActionCell defines an active area inside a Control (an instance of Control or one of its subclasses).  As a Control's active area, an ActionCell does three things:  it performs display of text or an icon;  it provides the Control 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.  You can set an ActionCell's Control only by sending the drawSelf:inView: message to the ActionCell, passing the Control as the argument for the inView: keyword of the method.

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

A single Control may have more than one ActionCell.  An integer tag is used to identify an ActionCell; this is important for Controls that contain more than one ActionCell.  Note, however, that no checking is done by the ActionCell object itself to ensure that the tag is unique.  See the Matrix class for an example of a subclass of Control that contains multiple ActionCells.

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



Instance Variables

int tag;

id target;

SEL action;


tag An integer used to identify the ActionCell.
target The object that is sent the ActionCell's action.
action The message that the ActionCell sends to its target.



Method Types

Configuring an ActionCell setEnabled:
setBezeled:
setBordered:
setAlignment:
setFloatingPointFormat:left:right:
setFont:
setIcon:
Manipulating ActionCell values
doubleValue
floatValue
intValue
setStringValue:
setStringValueNoCopy:shouldFree:
stringValue
Displaying drawSelf:inView:
controlView
Target and action setAction:
action
setTarget:
target
Assigning a tag setTag:
tag
Archiving write:
read:



Instance Methods

action
(SEL)action

Returns the ActionCell's action method.  Keep in mind that the argument of an action method sent by an ActionCell is its associated Control (the object returned by controlView).

See also:  setAction:, target, controlView



controlView
controlView

Returns the Control in which the ActionCell was most recently drawn.  In general, your code should use the object returned by this method only to (indirectly) redisplay the ActionCell.  For example, the subclasses of ActionCell defined by the Application Kit invoke this method in order to send the Control a message such as updateCellInside:.

The Control in which an ActionCell is drawn is set automatically by the drawSelf:inView: method.  You can't explicitly set the Control.

See also:  drawSelf:inView:



doubleValue
(double)doubleValue

Returns the ActionCell's contents as a double-precision floating point number.  If the ActionCell is being edited when this message is received, editing is validated first.

See also:  setDoubleValue: (Cell), floatValue, intValue, stringValue, validateEditing (Control)



drawSelf:inView:
drawSelf:(const NXRect *)cellFrame inView:controlView

Displays the ActionCell.  Sets the ActionCell's Control to controlView and performs drawing if and only if controlView is a Control object (an instance of Control or a subclass thereof).  You must lock focus on the Control before invoking this method (Control's display method automatically performs this).

See also:  drawSelf:inView: (Cell)



floatValue
(float)floatValue

Returns the ActionCell's contents as a single-precision floating point number.  If the ActionCell is being edited when this message is received, editing is validated first.

See also:  setFloatValue: (Cell), doubleValue, intValue, stringValue, validateEditing (Control)



intValue
(int)intValue

Returns the ActionCell's contents as an integer.  If the ActionCell is being edited when this message is received, editing is validated first.

See also:  setIntValue: (Cell), doubleValue, floatValue, stringValue, validateEditing (Control)



read:
read:(NXTypedStream *)stream

Reads the ActionCell from the typed stream stream.  Returns self.

See also:  write:



setAction:
setAction:(SEL)aSelector

Sets the ActionCell's action method to aSelector.  The argument of an action method sent by an ActionCell is its associated Control (the object returned by controlView).  Returns self.

See also:  action, setTarget:, controlView, sendAction:to: (Control)



setAlignment:
setAlignment:(int)mode

If the ActionCell is a text Cell (type NX_TEXTCELL), this sets its text alignment to mode, which should be NX_LEFTALIGNED, NX_CENTERED, or NX_RIGHTALIGNED.  If it's currently in a Control view, the ActionCell is redisplayed or marked as needing redisplay.  Returns self.

See also:  alignment (Cell)



setBezeled:
setBezeled:(BOOL)flag

Adds or removes the ActionCell's bezel, according to the value of flag.  Adding a bezel will remove the ActionCell's border, if any.  If it's currently in a Control view, the ActionCell is redisplayed or marked as needing redisplay.  Returns self.

See also:  isBezeled (Cell), setBordered:



setBordered:
setBordered:(BOOL)flag

Adds or removes the ActionCell's border, according to the value of flag.  The border is black and has a width of 1.0.  Adding a border will remove the ActionCell's bezel, if any.  If it's currently in a Control view, the ActionCell is redisplayed or marked as needing redisplay.  Returns self.

See also:  isBordered (Cell), setBezeled:



setEnabled:
setEnabled:(BOOL)flag

Enables or disables the ActionCell's ability to receive mouse events, according to the value of flag.  If it's currently in a Control view, the ActionCell is redisplayed or marked as needing redisplay.  Returns self.

See also:  isEnabled (Cell)



setFloatingPointFormat:left:right:
setFloatingPointFormat:(BOOL)autoRange
left:(unsigned int)leftDigits
right:(unsigned int)rightDigits

Sets the ActionCell's floating point format as described in the Cell class specification for the setFloatingPointFormat:left:right: method.  If it's currently in a Control view, the ActionCell is redisplayed or marked as needing redisplay.  Returns self.

See also:  setFloatingPointFormat:left:right: (Cell)



setFont:
setFont:fontObject

If the ActionCell is a text Cell (type NX_TEXTCELL), this sets its Font to fontObject.  In addition, if it's currently in a Control view, the ActionCell is redisplayed or marked as needing redisplay.  Returns self.

See also:  font (Cell)



setIcon:
setIcon:(const char *)iconName

Sets the ActionCell's icon to iconName and sets its Cell type to NX_ICONCELL.  If it's currently in a Control view, the ActionCell is redisplayed or marked as needing redisplay.  Returns self.

See also:  setIcon: (Cell)



setStringValue:
setStringValue:(const char *)aString

Sets the ActionCell's contents to a copy of aString.  If it's currently in a Control view, the ActionCell is redisplayed or marked as needing redisplay.  Returns self.

See also:  setStringValueNoCopy:shouldFree:, setStringValue: (Cell), stringValue, doubleValue, floatValue, intValue



setStringValueNoCopy:shouldFree:
setStringValueNoCopy:(char *)aString shouldFree:(BOOL)flag

Sets the ActionCell's contents to a aString.  If flag is YES, aString will be freed when the ActionCell is freed.  If it's currently in a Control view, the ActionCell is redisplayed or marked as needing redisplay.  Returns self.

See also:  setStringValue:, setStringValueNoCopy:shouldFree: (Cell), stringValue, doubleValue, floatValue, intValue



setTag:
setTag:(int)anInt

Sets the ActionCell's tag to anInt.  The tag can be used to identify the ActionCell in a Control that contains multiple Cells (Matrix, for example).  Returns self.

See also:  tag, setTag: (Control)



setTarget:
setTarget:anObject

Sets the ActionCell's target to anObject.  This is the object that is sent the ActionCell's action method.  Returns self.

See also:  target, setAction:



stringValue
(const char *)stringValue

Returns the ActionCell's contents as a string.  If the ActionCell is being edited when this message is received, editing is validated first.

See also:  setStringValue:, stringValue (Cell), validateEditing (Control), doubleValue, floatValue, intValue



tag
(int)tag

Returns the ActionCell's tag.  The tag can be used to identify the ActionCell in a Control that contains multiple Cells (Matrix, for example).

See also:  setTag:, tag (Control)



target
target

Returns the ActionCell's target, the object that is sent the ActionCell's action method.

See also:  setTarget:, action



write:
write:(NXTypedStream *)stream

Writes the ActionCell to the typed stream stream.  Returns self.

See also:  read: