Important: The information in this document is obsolete and should not be used for new development.
Inherits from | |
Implements | |
Package | com.apple.cocoa.application |
Companion guide |
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; 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.
Creates an empty NSActionCell.
public NSActionCell
()
Creates an NSActionCell initialized with aString and set to have the cell’s default menu.
public NSActionCell
(String aString)
If no field editor (a shared NSText object) has been created for all NSActionCells, one is created.
Creates an NSActionCell initialized with anImage and set to have the cell’s default menu.
public NSActionCell
(NSImage anImage)
If anImage is null
, no image is set.
Returns the receiver’s action message selector.
public NSSelector action
()
Returns the view (normally an NSControl) in which the receiver was last drawn or null
if the receiver has no control view (usually because it hasn’t yet been placed in the view hierarchy).
public NSView controlView
()
Returns the receiver’s value as a double after validating any editing of cell content.
public double doubleValue
()
If the receiver is not a text-type cell or the cell value is not scannable, the method returns 0.
validateEditing
(NSControl)Returns the receiver’s value as a float after validating any editing of cell content.
public float floatValue
()
If the receiver is not a text-type cell or the cell value is not scannable, the method returns 0.
validateEditing
(NSControl)Returns the receiver’s value as an int
after validating any editing of cell content.
public int intValue
()
If the receiver is not a text-type cell or the cell value is not scannable, the method returns 0.
validateEditing
(NSControl)Sets the selector used for the action message to aSelector.
public void setAction
(NSSelector aSelector)
Sets the alignment of text in the receiver.
public void setAlignment
(int mode)
mode is one of five constants: NSText.LeftTextAlignment
, NSText.RightTextAlignment
, NSText.CenterTextAlignment
, NSText.JustifiedTextAlignment
, and NSText.NaturalTextAlignment
(the default alignment for the text). The method marks the receiver as needing redisplay after discarding any editing changes that were being made to cell text.
Sets whether the receiver draws itself with a bezeled border and marks it as needing redisplay.
public void setBezeled
(boolean flag)
The setBezeled
and setBordered
methods are mutually exclusive—that is, a border can be only plain or bezeled.
Sets whether the receiver draws itself outlined with a plain border and marks it as needing redisplay.
public void setBordered
(boolean flag)
The setBezeled
and setBordered
methods are mutually exclusive—that is, a border can be only plain or bezeled.
Sets the view (normally an NSControl) of the receiver to view.
public void setControlView
(NSView view)
The control view is typically set in the receiver’s implementation of drawWithFrameInView
(NSCell). Set to null
if the receiver has no control view (usually because it hasn’t yet been placed in the view hierarchy).
Sets whether the receiver is enabled or disabled.
public void setEnabled
(boolean flag)
The text of disabled cells is changed to gray. If a cell is disabled, it cannot be highlighted, does not support mouse tracking (and thus cannot participate in target/action functionality), and cannot be edited. The method marks the receiver as needing redisplay after discarding any editing changes that were being made to cell text.
Sets the receiver’s floating-point format as described in the NSCell class specification for the setFloatingPointFormat
method.
public void setFloatingPointFormat
(boolean autoRange, int leftDigits, int rightDigits)
NSActionCell’s implementation of the method supplements NSCell’s by marking the receiver as needing redisplay after discarding any editing changes that were being made to cell text.
Sets the font to be used when the receiver displays text.
public void setFont
(NSFont fontObj)
If the receiver is not a text-type cell, the method converts it to that type. If fontObj is null
and the receiver is a text-type cell, the font currently held by the receiver is autoreleased. NSActionCell supplements NSCell’s implementation of this method by marking the updated cell as needing redisplay. If the receiver was converted to a text-type cell and is selected, it also updates the field editor with fontObj.
Sets the image to be displayed in the receiver.
public void setImage
(NSImage image)
If image is null
, the image currently displayed by the receiver is removed.
Discards any editing of the receiver’s text and sets its object value to object.
public void setObjectValue
(Object object)
If the object value is afterward different from what it was before the method was invoked, the method marks the receiver as needing redisplay.
Sets the receiver’s tag to anInt.
public void setTag
(int anInt)
Sets the receiver’s target object to anObject.
public void setTarget
(Object anObject)
Returns the receiver’s value as a string object as converted by the cell’s formatter, if one exists.
public String stringValue
()
If no formatter exists and the value is a String, returns the value as a plain, attributed, or localized formatted string. If the value is not a String or can’t be converted to one, returns an empty string. The method supplements NSCell’s implementation by validating and retaining any editing changes being made to cell text.
validateEditing
(NSControl)Returns the receiver’s tag.
public int tag
()
Returns the receiver’s target object.
public Object target
()
© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)