Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSActionCell.h |
Related sample code |
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.
– setAlignment:
– setBezeled:
– setBordered:
– setEnabled:
– setFloatingPointFormat:left:right:
– setFont:
– setImage:
Returns the receiver’s action-message selector.
- (SEL)action
NSActionCell.h
Returns the view in which the receiver was last drawn.
- (NSView *)controlView
The returned view is normally an NSControl
object. The method returns nil
if the receiver has no control view (usually because it hasn’t yet been placed in the view hierarchy).
NSActionCell.h
Returns the receiver’s value as a double after validating any editing of cell content.
- (double)doubleValue
If the receiver is not a text-type cell or the cell value is not scannable, the method returns 0.
– validateEditing
(NSControl)NSActionCell.h
Returns the receiver’s value as a float after validating any editing of cell content.
- (float)floatValue
If the receiver is not a text-type cell or the cell value is not scannable, the method returns 0.
– validateEditing
(NSControl)NSActionCell.h
Returns the receiver’s value as a 64-bit compatible integer after validating any editing of cell content.
- (NSInteger)integerValue
A 64-bit compatible integer value, as defined by the NSInteger
type.
If the receiver is not a text-type cell or the cell value is not scannable, the method returns 0.
NSActionCell.h
Returns the receiver’s value as an int
after validating any editing of cell content.
- (int)intValue
If the receiver is not a text-type cell or the cell value is not scannable, the method returns 0.
– validateEditing
(NSControl)NSActionCell.h
Sets the selector used for action messages sent by the receiver's control.
- (void)setAction:(SEL)aSelector
The selector that identifies the action method to invoke.
NSActionCell.h
Sets the alignment of text in the receiver.
- (void)setAlignment:(NSTextAlignment)mode
One of five constants that specifies alignment within the cell: NSLeftTextAlignment
, NSRightTextAlignment
, NSCenterTextAlignment
, NSJustifiedTextAlignment
, and NSNaturalTextAlignment
(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.
NSActionCell.h
Sets whether the receiver draws itself with a bezeled border.
- (void)setBezeled:(BOOL)flag
YES
if the cell is to be drawn with a bezeled border, NO
otherwise.
After setting the attribute the method marks the receiver as needing redisplay. The setBezeled:
and setBordered:
methods are mutually exclusive—that is, a border can be only plain or bezeled.
NSActionCell.h
Sets whether the receiver draws itself outlined with a plain border.
- (void)setBordered:(BOOL)flag
YES
if the cell is to be drawn with a plain border, NO
otherwise.
After setting the attribute the method marks the receiver as needing redisplay. The setBezeled:
and setBordered:
methods are mutually exclusive—that is, a border can be only plain or bezeled.
NSActionCell.h
Sets the receiver's control view, the view in which it is drawn.
- (void)setControlView:(NSView *)view
The view object, which is normally an NSControl view. Pass in nil
if the receiver has no control view (usually because it hasn’t yet been placed in the view hierarchy).
The control view is typically set in the receiver’s implementation of drawWithFrame:inView:
(NSCell
).
NSActionCell.h
Sets whether the receiver is enabled or disabled.
- (void)setEnabled:(BOOL)flag
YES
if the cell is to be enabled, NO
otherwise
The text of disabled cells is changed to gray. If a cell is disabled, it cannot be highlighted, cannot be edited, and does not support mouse tracking (and thus cannot participate in target-action behavior). The method marks the receiver as needing redisplay after discarding any editing changes that were being made to cell text.
NSActionCell.h
Sets the receiver’s floating-point format.
- (void)setFloatingPointFormat:(BOOL)autoRange left:(NSUInteger)leftDigits right:(NSUInteger)rightDigits
NO
if you want the receiver to places digits to the right and left of the decimal point as specified (in leftDigits
and rightDigits
; YES
if you want it to place the digits flexibly.
The maximum number of digits to the left of the decimal point. The receiver might interpret this value flexibly if autoRange
is YES
.
The maximum number of digits to the right of the decimal point. The receiver might interpret this value flexibly if autoRange
is YES
.
The implementation of this method is based on the NSCell
method setFloatingPointFormat:left:right:
. See the description of that method for details.
The NSActionCell
implementation of the method supplements the NSCell
implementation by marking the receiver as needing redisplay after discarding any editing changes that were being made to cell text.
Note: This method is being deprecated in favor of NSFormatter
objects. For more information, see NSFormatter
. This documentation is provided only for developers who need to modify older applications.
NSActionCell.h
Sets the font to be used when the receiver displays text.
- (void)setFont:(NSFont *)fontObj
The font object encapsulating information about the new font. If fontObj is nil
and the receiver is a text-type cell, the font object currently held by the receiver is autoreleased.
If the receiver is not a text-type cell, the method converts it to that type. NSActionCell
supplements the NSCell
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.
NSActionCell.h
Sets the image to be displayed in the receiver.
- (void)setImage:(NSImage *)image
The image for the receiver to display. If image is nil
, the image currently displayed by the receiver is removed.
NSActionCell.h
Discards any editing of the receiver’s text and sets its object value to object.
- (void)setObjectValue:(id < NSCopying >)object
The object value to assign to the receiver.
If the object value is afterward different from what it was before the method was invoked, the method marks the receiver as needing redisplay.
NSActionCell.h
Sets the receiver’s tag.
- (void)setTag:(NSInteger)anInt
An integer tag to be associated with the receiver.
NSActionCell.h
Sets the receiver’s target object.
- (void)setTarget:(id)anObject
The object that is the target of action messages sent by the receiver's control.
NSActionCell.h
Returns the receiver’s value as a string object as converted by the cell’s formatter, if one exists.
- (NSString *)stringValue
If no formatter exists and the value is an NSString
, returns the value as a plain, attributed, or localized formatted string. If the value is not an NSString
or cannot be converted to one, returns an empty string. The method supplements the NSCell
implementation by validating and retaining any editing changes being made to cell text.
– validateEditing
(NSControl)NSActionCell.h
Returns the receiver’s tag.
- (NSInteger)tag
NSActionCell.h
Returns the receiver’s target object.
- (id)target
NSActionCell.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-28)