Mac Developer Library

Developer

AppKit Framework Reference NSCell Class Reference

Options
Deployment Target:

On This Page
Language:

NSCell

The NSCell class provides a mechanism for displaying text or images in an NSView object without the overhead of a full NSView subclass. It’s used heavily by most of the NSControl classes to implement their internal workings. More...

Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.0 and later.
  • Returns an NSCell object initialized with the specified image and set to have the cell’s default menu.

    Declaration

    Swift

    init(imageCell anImage: NSImage?)

    Objective-C

    - (instancetype)initImageCell:(NSImage *)anImage

    Parameters

    anImage

    The image to use for the cell. If this parameter is nil, no image is set.

    Return Value

    An initialized NSCell object, or nil if the cell could not be initialized.

    Discussion

    This is one of four designated initializers you must implement when subclassing. See Designated Initializers for the complete list.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns an NSCell object initialized with the specified string and set to have the cell’s default menu.

    Declaration

    Swift

    init(textCell aString: String)

    Objective-C

    - (instancetype)initTextCell:(NSString *)aString

    Parameters

    aString

    The initial string to use for the cell.

    Return Value

    An initialized NSCell object, or nil if the cell could not be initialized.

    Discussion

    If no field editor (a shared NSText object) has been created for all NSCell objects, one is created.

    This is one of four designated initializers you must implement when subclassing. See Designated Initializers for the complete list.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the receiver’s object value.

    Declaration

    Swift

    @NSCopying var objectValue: AnyObject?

    Objective-C

    @property(copy) id objectValue

    Parameters

    object

    The new object value for the cell.

    Discussion

    To be valid object value, the receiver must have a formatter capable of converting the object to and from its textual representation.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the receiver’s value as an Objective-C object

    Declaration

    Swift

    @NSCopying var objectValue: AnyObject?

    Objective-C

    @property(copy) id objectValue

    Return Value

    The receiver's object value, or nil if a valid object has not been associated with the receiver.

    Discussion

    To be valid object value, the receiver must have a formatter capable of converting the object to and from its textual representation.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the receiver has a valid object value.

    Declaration

    Swift

    var hasValidObjectValue: Bool { get }

    Objective-C

    @property(readonly) BOOL hasValidObjectValue

    Return Value

    YEStrue if the cell has a valid object value, otherwise NOfalse.

    Discussion

    A valid object value is one that the receiver's formatter can "understand." Objects are always assumed to be valid unless they are rejected by the formatter. Invalid objects can still be accepted by the delegate of the receiver’s NSControl object (using the control:didFailToFormatString:errorDescription: delegate method).

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the value of the receiver using an integer.

    Declaration

    Swift

    var intValue: Int32

    Objective-C

    @property int intValue

    Parameters

    anInt

    The value of the cell interpreted as an integer.

    Discussion

    In its implementation, this method invokes the setObjectValue: method to set the actual value. This method does nothing if the receiver is not a text-type cell.

    On OS X v10.5 and later, you should use setIntegerValue: instead.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the receiver’s value as an integer.

    Declaration

    Swift

    var intValue: Int32

    Objective-C

    @property int intValue

    Return Value

    The value of the cell interpreted as an integer. If the receiver is not a text-type cell or the cell value is not scannable, returns 0.

    Discussion

    On OS X v10.5 and later, you should use integerValue instead.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the value of the receiver using an NSInteger.

    Declaration

    Swift

    var integerValue: Int

    Objective-C

    @property NSInteger integerValue

    Parameters

    anInteger

    The value of the cell interpreted as an NSInteger.

    Discussion

    In its implementation, this method invokes the setObjectValue: method to set the actual value. This method does nothing if the receiver is not a text-type cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns the receiver’s value as an NSInteger.

    Declaration

    Swift

    var integerValue: Int

    Objective-C

    @property NSInteger integerValue

    Return Value

    The value of the cell interpreted as an NSInteger. If the receiver is not a text-type cell or the cell value is not scannable, returns 0.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Sets the value of the receiver’s cell using an NSString object.

    Declaration

    Swift

    var stringValue: String

    Objective-C

    @property(copy) NSString *stringValue

    Parameters

    aString

    The string value of the cell.

    Discussion

    In its implementation, this method invokes the setObjectValue: method to set the actual value. If no formatter is assigned to the receiver or if the formatter cannot “translate” aString to an underlying object, the receiver is flagged as having an invalid object. If the receiver is not a text-type cell, this method converts it to one before setting the object value.

    For OS X v10.3 and later: If you use a class that responds to the selector attributedStringValue for the object value of a cell, the cell uses that method to fetch the string to draw rather than the stringValue method.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – stringValue

  • Returns the value of the receiver’s cell as an NSString object.

    Declaration

    Swift

    var stringValue: String

    Objective-C

    @property(copy) NSString *stringValue

    Return Value

    The string value of the cell. This value may be an interpreted version of the cell's actual value. Interpretations are performed by the cell's formatter.

    Discussion

    If no formatter exists and the cell's value is an NSString object, this method returns the value as a plain, attributed, or localized formatted string. If the value is not an NSString object or cannot be converted to one, this method returns an empty string.

    For OS X v10.3 and later: If you use a class that responds to the selector attributedStringValue for the object value of a cell, the cell uses that method to fetch the string to draw rather than the stringValue method.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the value of the receiver’s cell using a double-precision floating-point number.

    Declaration

    Swift

    var doubleValue: Double

    Objective-C

    @property double doubleValue

    Parameters

    aDouble

    The value of the cell interpreted as a double-precision floating-point number.

    Discussion

    In its implementation, this method invokes the setObjectValue: method to set the actual value. This method does nothing if the receiver is not a text-type cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – doubleValue

  • Returns the value of the receiver’s cell as a double-precision floating-point number.

    Declaration

    Swift

    var doubleValue: Double

    Objective-C

    @property double doubleValue

    Return Value

    The value of the cell interpreted as a double-precision floating-point number. If the receiver is not a text-type cell or the cell value is not scannable, returns 0.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the value of the receiver’s cell using a single-precision floating-point number.

    Declaration

    Swift

    var floatValue: Float

    Objective-C

    @property float floatValue

    Parameters

    aFloat

    The value of the cell interpreted as a single-precision floating-point number.

    Discussion

    In its implementation, this method invokes the setObjectValue: method to set the actual value. This method does nothing if the receiver is not a text-type cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – floatValue

  • Returns the value of the receiver’s cell as a single-precision floating-point number.

    Declaration

    Swift

    var floatValue: Float

    Objective-C

    @property float floatValue

    Return Value

    The value of the cell interpreted as a single-precision floating-point number. If the receiver is not a text-type cell or the cell value is not scannable, returns 0.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the value for the specified cell attribute.

    Declaration

    Swift

    func setCellAttribute(_ aParameter: NSCellAttribute, to value: Int)

    Objective-C

    - (void)setCellAttribute:(NSCellAttribute)aParameter to:(NSInteger)value

    Parameters

    aParameter

    The cell attribute whose value you want to set. Attributes include the receiver's current state and whether it is disabled, editable, or highlighted.

    value

    The new value for the attribute.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the value for the specified cell attribute.

    Declaration

    Swift

    func cellAttribute(_ aParameter: NSCellAttribute) -> Int

    Objective-C

    - (NSInteger)cellAttribute:(NSCellAttribute)aParameter

    Parameters

    aParameter

    The cell attribute whose value you want to get. Attributes include the receiver's current state and whether it is disabled, editable, or highlighted.

    Return Value

    The value for the cell attribute specified by aParameter.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the type of the cell, changing it to a text cell, image cell, or null cell.

    Declaration

    Swift

    var type: NSCellType

    Objective-C

    @property NSCellType type

    Parameters

    aType

    The new type of the cell (see “NSCellType” for possible values).

    Discussion

    If the cell is already the same type as the one specified in the aType parameter, this method does nothing.

    If aType is NSTextCellType, this method converts the receiver to a cell of that type, giving it a default title and setting the font to the system font at the default size. If aType is NSImageCellType, the cell type is not changed until you set a new non-nil image.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the type of the receiver

    Declaration

    Swift

    var type: NSCellType

    Objective-C

    @property NSCellType type

    Return Value

    The type of the cell (see “NSCellType” for possible values).

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setType:

  • Sets whether the receiver is enabled or disabled.

    Declaration

    Swift

    var enabled: Bool

    Objective-C

    @property(getter=isEnabled) BOOL enabled

    Parameters

    flag

    If YEStrue the receiver is enabled; otherwise, if NOfalse, the receiver is disabled.

    Discussion

    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. However, you can still alter many attributes of a disabled cell programmatically. (The setState: method, for instance, still works.)

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – isEnabled

  • isEnabled isEnabled Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value that indicates whether the receiver is enabled or disabled.

    Declaration

    Objective-C

    - (BOOL)isEnabled

    Return Value

    YEStrue if the receiver is enabled, otherwise NOfalse.

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

    See Also

    – setEnabled:

  • Returns a Boolean value that indicates whether the receiver assumes responsibility for undo operations.

    Declaration

    Swift

    var allowsUndo: Bool

    Objective-C

    @property BOOL allowsUndo

    Return Value

    YEStrue if the receiver handles undo operations, otherwise NOfalse.

    Discussion

    By default, the NSTextFieldCell class uses this feature to handle undo operations for edited text. Other controls set a value that is appropriate for their implementation.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets whether the receiver assumes responsibility for undo operations within the cell.

    Declaration

    Swift

    var allowsUndo: Bool

    Objective-C

    @property BOOL allowsUndo

    Parameters

    allowsUndo

    If YEStrue, the receiver handles undo operations; otherwise, if NOfalse, the application's custom undo manager handles undo operations.

    Discussion

    Subclasses invoke this method to indicate their preference for handling undo operations; otherwise, you should not need to call this method directly.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – allowsUndo

  • Sets whether the receiver draws itself with a bezeled border.

    Declaration

    Swift

    var bezeled: Bool

    Objective-C

    @property(getter=isBezeled) BOOL bezeled

    Parameters

    flag

    If YEStrue, the receiver uses a bezeled border.

    Discussion

    The setBezeled: and setBordered: methods are mutually exclusive (that is, a border can be only plain or bezeled). Invoking this method automatically removes any border that had already been set, regardless of the value in the flag parameter.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – isBezeled

  • isBezeled isBezeled Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value that indicates whether the receiver has a bezeled border.

    Declaration

    Objective-C

    - (BOOL)isBezeled

    Return Value

    YEStrue if the receiver has a bezeled border, otherwise NOfalse.

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

    See Also

    – setBezeled:

  • Sets whether the receiver draws itself outlined with a plain border.

    Declaration

    Swift

    var bordered: Bool

    Objective-C

    @property(getter=isBordered) BOOL bordered

    Parameters

    flag

    If YEStrue, the receiver uses a plain border.

    Discussion

    The setBezeled: and setBordered: methods are mutually exclusive (that is, a border can be only plain or bezeled). Invoking this method automatically removes any bezel that had already been set, regardless of the value in the flag parameter.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – isBordered

  • isBordered isBordered Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value that indicates whether the receiver has a plain border.

    Declaration

    Objective-C

    - (BOOL)isBordered

    Return Value

    YEStrue if the receiver has a plain border, otherwise NOfalse.

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • isOpaque isOpaque Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value that indicates whether the receiver is opaque (nontransparent).

    Declaration

    Objective-C

    - (BOOL)isOpaque

    Return Value

    YEStrue if the receiver is opaque, otherwise NOfalse to indicate the receiver might have some transparency.

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • Sets the receiver’s control tint.

    Declaration

    Swift

    var controlTint: NSControlTint

    Objective-C

    @property NSControlTint controlTint

    Parameters

    controlTint

    An Designated Initializers value that specifies the tint of the receiver.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – controlTint

  • Returns the receiver’s control tint.

    Declaration

    Swift

    var controlTint: NSControlTint

    Objective-C

    @property NSControlTint controlTint

    Return Value

    An Designated Initializers value that specifies the tint of the receiver.).

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the background style for the receiver.

    Declaration

    Swift

    var backgroundStyle: NSBackgroundStyle

    Objective-C

    @property NSBackgroundStyle backgroundStyle

    Parameters

    style

    The background style for the receiver.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns the background style for the receiver.

    Declaration

    Swift

    var backgroundStyle: NSBackgroundStyle

    Objective-C

    @property NSBackgroundStyle backgroundStyle

    Return Value

    The background style for the receiver.

    Discussion

    The background describes the surface the cell is drawn onto in drawWithFrame:inView:. A control typically sets this before it asks the cell to draw. A cell may draw differently based on background characteristics. For example, a tableview drawing a cell in a selected row might call [cell setBackgroundStyle:NSBackgroundStyleDark]. A text cell might decide to render its text white as a result. A rating-style level indicator might draw its stars white instead of gray.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns the interior background style for the receiver.

    Declaration

    Swift

    var interiorBackgroundStyle: NSBackgroundStyle { get }

    Objective-C

    @property(readonly) NSBackgroundStyle interiorBackgroundStyle

    Return Value

    Returns the interior background style for the receiver.

    Discussion

    The interior background style describes the surface drawn onto in drawInteriorWithFrame:inView:. This is often the same as the backgroundStyle, but a button that draws a bezel would have a different interiorBackgroundStyle.

    This is both an override point and a useful method to call. In a custom button with a custom bezel you can override this method to describe that surface. A cell that has custom interior drawing might query this method to help pick an image that looks good on the cell. Calling this method gives you some independence from changes in framework art style.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns a Boolean value that indicates whether the receiver supports three states.

    Declaration

    Swift

    var allowsMixedState: Bool

    Objective-C

    @property BOOL allowsMixedState

    Return Value

    YEStrue if the receiver supports all three states (on, off, and mixed), otherwise NOfalse (the receiver supports only the on and off states).

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the receiver’s next state.

    Declaration

    Swift

    var nextState: Int { get }

    Objective-C

    @property(readonly) NSInteger nextState

    Return Value

    The receiver’s next state (for possible values, see “NSCellStateValue”).

    Discussion

    If the receiver has three states, it cycles through them in this order: on, off, mixed, on, and so forth. If the receiver has two states, it toggles between them.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether the receiver supports three states or just two.

    Declaration

    Swift

    var allowsMixedState: Bool

    Objective-C

    @property BOOL allowsMixedState

    Parameters

    flag

    If YEStrue, the receiver supports three states (on, off, and mixed); otherwise, if NOfalse, the receiver supports only two states (on and off).

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Changes the state of the receiver to its next state.

    Declaration

    Swift

    func setNextState()

    Objective-C

    - (void)setNextState

    Discussion

    If the receiver has three states, it cycles through them in this order: on, off, mixed, on, and so forth. If the receiver has two states, it toggles between them.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the receiver’s state to the specified value.

    Declaration

    Swift

    var state: Int

    Objective-C

    @property NSInteger state

    Parameters

    value

    The possible state values are NSOnState, NSOffState, and NSMixedState. If the cell supports only two states and you specify NSMixedState, this method sets the state to NSOnState.

    Discussion

    The NSOffState state indicates the normal or unpressed state. The NSOnState state indicates the alternate or pressed state. The NSMixedState state indicates that the feature represented by the control is in effect somewhere.

    Although using the enumerated constants is preferred, value can also be an integer. If the cell has two states, 0 is treated as NSOffState, and a nonzero value is treated as NSOnState. If the cell has three states, 0 is treated as NSOffState; a negative value, as NSMixedState; and a positive value, as NSOnState.

    Note that the value state returns may not be the same value you passed into the value parameter.

    To check whether the cell has three states (and uses the mixed state), invoke the allowsMixedState method.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the receiver’s state.

    Declaration

    Swift

    var state: Int

    Objective-C

    @property NSInteger state

    Return Value

    The receiver’s state (for possible values, see “NSCellStateValue”).

    Discussion

    Cells can have two or three states. If the receiver has two states, it returns either NSOffState (the normal or unpressed state) or NSOnState (the alternate or pressed state). If it has three, it may also return NSMixedState, indicating the feature is in effect somewhere.

    To check whether the receiver uses the mixed state, use the method allowsMixedState.

    Note that the value state returns may not be the same value you passed into setState:.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether the user can edit the receiver’s text.

    Declaration

    Swift

    var editable: Bool

    Objective-C

    @property(getter=isEditable) BOOL editable

    Parameters

    flag

    If YEStrue, the user is allowed to edit the receiver's text. If this value is YEStrue, the text is also made selectable. If it is NOfalse, the selectable attribute is restored to the value it was before the cell was last made editable.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • isEditable isEditable Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value that indicates whether the receiver is editable.

    Declaration

    Objective-C

    - (BOOL)isEditable

    Return Value

    YEStrue if the receiver is editable, otherwise NOfalse.

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • Sets whether text in the receiver can be selected.

    Declaration

    Swift

    var selectable: Bool

    Objective-C

    @property(getter=isSelectable) BOOL selectable

    Parameters

    flag

    If YEStrue, the receiver's text can be selected. If this value is NOfalse, editability is also disabled; if it is YEStrue, editability is not affected.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • isSelectable isSelectable Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value that indicates whether the text of the receiver can be selected.

    Declaration

    Objective-C

    - (BOOL)isSelectable

    Return Value

    YEStrue if the receiver's text can be selected, otherwise NOfalse.

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • Sets whether excess text in the receiver is scrolled past the cell’s bounds.

    Declaration

    Swift

    var scrollable: Bool

    Objective-C

    @property(getter=isScrollable) BOOL scrollable

    Parameters

    flag

    If YEStrue, text can be scrolled past the cell's bounds; otherwise, if NOfalse, the text wrapping is enabled.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • isScrollable isScrollable Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value that indicates whether the receiver scrolls excess text past the cell’s bounds.

    Declaration

    Objective-C

    - (BOOL)isScrollable

    Return Value

    YEStrue if excess text scrolls past the cell's bounds, otherwise NOfalse (text wrapping is enabled).

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • Sets the alignment of text in the receiver.

    Declaration

    Swift

    var alignment: NSTextAlignment

    Objective-C

    @property NSTextAlignment alignment

    Parameters

    mode

    This value can be one of the following constants: NSLeftTextAlignment, NSRightTextAlignment,NSCenterTextAlignment, NSJustifiedTextAlignment, orNSNaturalTextAlignment.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the alignment of text in the receiver.

    Declaration

    Swift

    var alignment: NSTextAlignment

    Objective-C

    @property NSTextAlignment alignment

    Return Value

    The alignment of text in the receiver (one of the following constants: NSLeftTextAlignment, NSRightTextAlignment,NSCenterTextAlignment, NSJustifiedTextAlignment, NSNaturalTextAlignment).

    Discussion

    The default value is NSNaturalTextAlignment.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the font to use when the receiver displays text.

    Declaration

    Swift

    var font: NSFont?

    Objective-C

    @property(strong) NSFont *font

    Parameters

    fontObj

    The font to use.

    Discussion

    If the receiver is not a text-type cell, the method converts it to that type before setting the font.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – font

  • Returns the font used to display text in the receiver

    Declaration

    Swift

    var font: NSFont?

    Objective-C

    @property(strong) NSFont *font

    Return Value

    The receiver's current font, or nil if the receiver is not a text-type cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setFont:

  • Returns the line break mode currently used when drawing text.

    Declaration

    Swift

    var lineBreakMode: NSLineBreakMode

    Objective-C

    @property NSLineBreakMode lineBreakMode

    Return Value

    The line break mode the receiver currently uses when drawing text. See NSLineBreakMode for supported values.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the line break mode to use when drawing text

    Declaration

    Swift

    var lineBreakMode: NSLineBreakMode

    Objective-C

    @property NSLineBreakMode lineBreakMode

    Parameters

    mode

    The line break mode the receiver currently uses when drawing text. See NSLineBreakMode for supported values.

    Discussion

    The line break mode can also be modified by calling the setWraps: method.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Returns a Boolean value indicating whether the receiver truncates and adds the ellipsis character to the last visible line if the text doesn't fit into the cell bounds.

    Declaration

    Swift

    var truncatesLastVisibleLine: Bool

    Objective-C

    @property BOOL truncatesLastVisibleLine

    Return Value

    YEStrue if the receiver truncates the last line; otherwise NOfalse.

    Discussion

    The line break mode must be either NSLineBreakByWordWrapping or NSLineBreakByCharWrapping. Otherwise, this setting is ignored.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Sets whether the receiver truncates and adds the ellipsis character to the last visible line if the text doesn't fit into the cell bounds.

    Declaration

    Swift

    var truncatesLastVisibleLine: Bool

    Objective-C

    @property BOOL truncatesLastVisibleLine

    Parameters

    flag

    If YEStrue, the receiver truncates the last line; if NOfalse, it does not truncate.

    Discussion

    The line break mode must be either NSLineBreakByWordWrapping or NSLineBreakByCharWrapping. Otherwise, this setting is ignored.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Sets whether text in the receiver wraps when its length exceeds the frame of the cell.

    Declaration

    Swift

    var wraps: Bool

    Objective-C

    @property BOOL wraps

    Parameters

    flag

    If YEStrue, the receiver wraps text and also makes the receiver non-scrollable; otherwise, if NOfalse, text is not wrapped.

    Discussion

    If the text of the receiver is an attributed string value you must explicitly set the paragraph style line break mode. Calling this method with the value YEStrue is equivalent to calling the setLineBreakMode: method with the value NSLineBreakByWordWrapping.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the receiver wraps its text when the text exceeds the borders of the cell.

    Declaration

    Swift

    var wraps: Bool

    Objective-C

    @property BOOL wraps

    Return Value

    YEStrue if the receiver wraps text, otherwise NOfalse.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setWraps:

  • Returns the initial writing direction used to determine the actual writing direction for text.

    Declaration

    Swift

    var baseWritingDirection: NSWritingDirection

    Objective-C

    @property NSWritingDirection baseWritingDirection

    Return Value

    The initial writing direction the receiver uses to determine the actual writing direction for text. See NSWritingDirection for possible values.

    Discussion

    The default value is NSWritingDirectionNatural.

    The Text system uses this value as a hint for calculating the actual direction for displaying Unicode characters. You should not need to call this method directly.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the initial writing direction used to determine the actual writing direction for text .

    Declaration

    Swift

    var baseWritingDirection: NSWritingDirection

    Objective-C

    @property NSWritingDirection baseWritingDirection

    Parameters

    writingDirection

    The initial writing direction the receiver uses to determine the actual writing direction for text. See NSWritingDirection for possible values.

    Discussion

    If you know the base writing direction of the text you are rendering, you can use this method to specify that direction to the text system.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the value of the receiver’s cell using an attributed string.

    Declaration

    Swift

    @NSCopying var attributedStringValue: NSAttributedString

    Objective-C

    @property(copy) NSAttributedString *attributedStringValue

    Parameters

    attribStr

    The value of the cell interpreted as an attributed string.

    Discussion

    If a formatter is set for the receiver, but the formatter does not understand the attributed string, it marks attribStr as an invalid object. If the receiver is not a text-type cell, it is converted to one before the value is set.

    For OS X v10.3 and later: If you use a class that responds to the selector attributedStringValue for the object value of a cell, then the cell uses that method to fetch the string to draw rather than using stringValue.

    The following example sets the text in a cell to 14 points, red, in the system font.

    • NSColor *txtColor = [NSColor redColor];
    • NSFont *txtFont = [NSFont boldSystemFontOfSize:14];
    • NSDictionary *txtDict = [NSDictionary dictionaryWithObjectsAndKeys:
    • txtFont, NSFontAttributeName, txtColor, NSForegroundColorAttributeName, nil];
    • NSAttributedString *attrStr = [[[NSAttributedString alloc]
    • initWithString:@"Hello!" attributes:txtDict] autorelease];
    • [[attrStrTextField cell] setAttributedStringValue:attrStr];
    • [attrStrTextField updateCell:[attrStrTextField cell]];

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the value of the receiver’s cell as an attributed string using the receiver's formatter object (if one exists).

    Declaration

    Swift

    @NSCopying var attributedStringValue: NSAttributedString

    Objective-C

    @property(copy) NSAttributedString *attributedStringValue

    Return Value

    The value of the cell interpreted as an attributed string.

    Discussion

    The textual attributes are the default paragraph style, the receiver’s font and alignment, and whether the receiver is enabled and scrollable.

    For OS X v10.3 and later: If you use a class that responds to the selector attributedStringValue for the object value of a cell, then the cell will use that method to fetch the string to draw rather than using stringValue.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether the receiver allows the user to edit textual attributes of its contents.

    Declaration

    Swift

    var allowsEditingTextAttributes: Bool

    Objective-C

    @property BOOL allowsEditingTextAttributes

    Parameters

    flag

    If YEStrue, the user can modify the font and other textual attributes of the cell's text. If NOfalse, the user cannot edit the text or import graphics, which effectively means the cell cannot support RTFD text.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the receiver allows user editing of textual attributes.

    Declaration

    Swift

    var allowsEditingTextAttributes: Bool

    Objective-C

    @property BOOL allowsEditingTextAttributes

    Return Value

    YEStrue if the receiver allows the user to edit textual attributes of the cell's text, otherwise NOfalse.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether the receiver can import images into its text.

    Declaration

    Swift

    var importsGraphics: Bool

    Objective-C

    @property BOOL importsGraphics

    Parameters

    flag

    If YEStrue, the receiver can import images into its text and support RTFD text. If NOfalse, RTFD text is not supported.

    Discussion

    If flag is YEStrue, the receiver is also set to allow editing of text attributes.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the text of the receiver can contain imported graphics.

    Declaration

    Swift

    var importsGraphics: Bool

    Objective-C

    @property BOOL importsGraphics

    Return Value

    YEStrue if the receiver's text is in the RTFD format and supports imported graphics, otherwise NOfalse.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Configures the textual and background attributes of the receiver's field editor.

    Declaration

    Swift

    func setUpFieldEditorAttributes(_ textObj: NSText) -> NSText

    Objective-C

    - (NSText *)setUpFieldEditorAttributes:(NSText *)textObj

    Parameters

    textObj

    The field editor to configure. .

    Return Value

    The configured field editor.

    Discussion

    If the receiver is disabled, this method sets the text color to dark gray; otherwise the method sets it to the default color. If the receiver has a bezeled border, this method sets the background to the default color for text backgrounds; otherwise, the method sets it to the color of the receiver’s NSControl object.

    You should not use this method to substitute a new field editor. setUpFieldEditorAttributes: is intended to modify the attributes of the text object (that is, the field editor) passed into it and return that text object. If you want to substitute your own field editor, use the fieldEditor:forObject: method or the windowWillReturnFieldEditor:toObject: delegate method of NSWindow.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the receiver’s title.

    Declaration

    Swift

    var title: String

    Objective-C

    @property(copy) NSString *title

    Return Value

    The cell's string value.

    Discussion

    Subclasses (such as NSButtonCell) may override this method to return a different value.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setTitle:

  • Sets the title of the receiver.

    Declaration

    Swift

    var title: String

    Objective-C

    @property(copy) NSString *title

    Parameters

    aString

    The new string value for the cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – title

  • Sets the cell's action method to the specified selector.

    Declaration

    Swift

    var action: Selector

    Objective-C

    @property SEL action

    Parameters

    aSelector

    The new action-message selector to associate with the receiver's cell. Specify NULL to prevent action messages from being sent to the receiver's target.

    Discussion

    The NSCell implementation of this method raises NSInternalInconsistencyException. Subclasses (such as NSActionCell) override this method to set the action method as part of the target/action implementation.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the default action-message selector associated with the cell.

    Declaration

    Swift

    var action: Selector

    Objective-C

    @property SEL action

    Return Value

    The selector associated with the cell. The NSCell implementation of this method returns NULL by default.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the target object to receive action messages.

    Declaration

    Swift

    weak var target: AnyObject?

    Objective-C

    @property(weak) id target

    Parameters

    anObject

    The new target object to associate with the receiver's cell, or nil to remove the current target.

    Discussion

    The NSCell implementation of this method raises NSInternalInconsistencyException. Subclasses (such as NSActionCell) override this method to set the target object as part of the target/action implementation.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – target

  • Returns the target object of the receiver.

    Declaration

    Swift

    weak var target: AnyObject?

    Objective-C

    @property(weak) id target

    Return Value

    The target object that receives action messages from the cell. The NSCell implementation of this method returns nil.

    Discussion

    Subclasses (such as NSActionCell) override this method to return the target object as part of the target/action implementation.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setTarget:

  • Sets whether the receiver’s cell sends its action message continuously to its target during mouse tracking.

    Declaration

    Swift

    var continuous: Bool

    Objective-C

    @property(getter=isContinuous) BOOL continuous

    Parameters

    flag

    If YEStrue, the action message should be sent continuously.

    Discussion

    In practice, the continuous setting of action messages has meaning only for NSActionCell and its subclasses, which implement the target/action mechanism. Some NSControl subclasses, notably NSMatrix, send a default action to a default target when a cell doesn’t provide a target or action.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • isContinuous isContinuous Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value that indicates whether the receiver’s cell sends its action message continuously to its target during mouse tracking.

    Declaration

    Objective-C

    - (BOOL)isContinuous

    Return Value

    YEStrue if the action message should be sent continuously, otherwise NOfalse.

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • Sets the conditions on which the receiver sends action messages to its target.

    Declaration

    Swift

    func sendActionOn(_ mask: Int) -> Int

    Objective-C

    - (NSInteger)sendActionOn:(NSInteger)mask

    Parameters

    mask

    A bit mask containing the conditions for sending the action. The only conditions that are actually checked are associated with the NSLeftMouseDownMask, NSLeftMouseUpMask, NSLeftMouseDraggedMask, and NSPeriodicMask bits.

    Return Value

    A bit mask containing the previous settings. This bit mask uses the same values as specified in the mask parameter.

    Discussion

    You use this method during mouse tracking when the mouse button changes state, the mouse moves, or if the cell is marked to send its action continuously while tracking. Because of this, the only bits checked in mask are NSLeftMouseDownMask, NSLeftMouseUpMask, NSLeftMouseDraggedMask, and NSPeriodicMask, which are declared in the NSEvent class reference.

    You can use the setContinuous: method to turn on the flag corresponding to NSPeriodicMask or NSLeftMouseDraggedMask, whichever is appropriate to the given subclass of NSCell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – action

  • Sets the image to be displayed by the receiver.

    Declaration

    Swift

    var image: NSImage?

    Objective-C

    @property(strong) NSImage *image

    Parameters

    image

    The image to display in the cell.

    Discussion

    If the receiver is not an image-type cell, the method converts it to that type of cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the image displayed by the receiver (if any).

    Declaration

    Swift

    var image: NSImage?

    Objective-C

    @property(strong) NSImage *image

    Return Value

    The image displayed by the receiver, or nil if the receiver is not an image-type cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setImage:

  • Sets the tag of the receiver.

    Declaration

    Swift

    var tag: Int

    Objective-C

    @property NSInteger tag

    Parameters

    anInteger

    The new tag for the cell.

    Discussion

    The NSCell implementation of this method raises NSInternalInconsistencyException. The NSActionCell implementation sets the receiver’s tag integer to anInteger.

    Tags allow you to identify particular cells. Tag values are not used internally; they are only changed by external invocations of setTag:. You typically set tag values in Interface Builder and use them at runtime in your application. When you set the tag of a control with a single cell in Interface Builder, it sets the tags of both the control and the cell to the same value as a convenience.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – tag

  • Returns the tag identifying the receiver.

    Declaration

    Swift

    var tag: Int

    Objective-C

    @property NSInteger tag

    Return Value

    The tag value. The NSCell implementation of this method returns –1.

    Discussion

    Tags allow you to identify particular cells. Tag values are not used internally; they are only changed by external invocations of setTag:. You typically set tag values in Interface Builder and use them at runtime in your application. When you set the tag of a control with a single cell in Interface Builder, it sets the tags of both the control and the cell to the same value as a convenience.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setTag:

  • Sets the receiver's formatter object.

    Declaration

    Swift

    var formatter: AnyObject?

    Objective-C

    @property(strong) id formatter

    Parameters

    newFormatter

    The formatter to use with the cell, or nil if you do not want the cell to use a formatter.

    Discussion

    Cells use a formatter object to format the textual representation of their object value and to validate cell input and convert that input to an object value. If the new formatter cannot interpret the receiver’s current object value, that value is converted to a string object.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – formatter

  • Returns the receiver's formatter object.

    Declaration

    Swift

    var formatter: AnyObject?

    Objective-C

    @property(strong) id formatter

    Return Value

    An object of type NSFormatter used to format the receiver's content.

    Discussion

    The returned object handles translation of the receiver’s contents between its onscreen representation and its object value.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets how numeric data is formatted in the receiver and places restrictions on acceptable input.

    Deprecation Statement

    Use a formatter instead—see setFormatter:.

    Declaration

    Objective-C

    - (void)setEntryType:(NSInteger)aType

    Parameters

    aType

    One of the types listed for this method in “Data Entry Types”.

    Import Statement

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.0.

  • entryType entryType (OS X v10.0)

    Returns the type of data the user can type into the receiver.

    Deprecation Statement

    Use a formatter instead—see setFormatter:.

    Declaration

    Objective-C

    - (NSInteger)entryType

    Return Value

    One of the types listed for this method in “Data Entry Types”. If the receiver is not a text-type cell, or if no type has been set, NSAnyType is returned.

    Import Statement

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.0.

  • isEntryAcceptable: isEntryAcceptable: Deprecated in OS X v 10.0 and later

    Returns whether a string representing a numeric or date value is formatted in a suitable way for the cell's entry type.

    Deprecation Statement

    Use NSFormatter instead.

    Declaration

    Objective-C

    - (BOOL)isEntryAcceptable:(NSString *)aString

    Parameters

    aString

    A string containing the numeric or date value.

    Return Value

    YEStrue if aString is formatted appropriately for the receiver, otherwise NOfalse.

    Import Statement

    Availability

    Deprecated in OS X v 10.0 and later.

  • Sets the auto-ranging and floating point number format of the receiver’s cell.

    Deprecation Statement

    Use a formatter instead. See setFormatter:

    Declaration

    Objective-C

    - (void)setFloatingPointFormat:(BOOL)autoRange left:(NSUInteger)leftDigits right:(NSUInteger)rightDigits

    Parameters

    autoRange

    If YEStrue, auto-ranging is enabled, otherwise it is disabled.

    leftDigits

    The number of digits to display to the left of the decimal point.

    rightDigits

    The number of digits to display to the right of the decimal point.

    Discussion

    Sets whether floating-point numbers are auto-ranged in the receiver and sets the sizes of the fields to the left and right of the decimal point. If autoRange is NOfalse, leftDigits specifies the maximum number of digits to the left of the decimal point, and rightDigits specifies the number of digits to the right (the fractional digit places will be padded with zeros to fill this width). However, if a number is too large to fit its integer part in leftDigits digits, as many places as are needed on the left are effectively removed from rightDigits when the number is displayed.

    If autoRange is YEStrue, leftDigits and rightDigits are simply added to form a maximum total field width for the receiver (plus 1 for the decimal point). The fractional part will be padded with zeros on the right to fill this width, or truncated as much as possible (up to removing the decimal point and displaying the number as an integer). The integer portion of a number is never truncated—that is, it is displayed in full no matter what the field width limit is.

    The following example sets a cell used to display dollar amounts up to 99,999.99:

    • [[currencyDollarsField cell] setEntryType:NSFloatType];
    • [[currencyDollarsField cell] setFloatingPointFormat:NO left:5 right:2];

    Import Statement

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.0.

  • Returns the default menu for instances of the receiver.

    Declaration

    Swift

    class func defaultMenu() -> NSMenu?

    Objective-C

    + (NSMenu *)defaultMenu

    Return Value

    The default menu. The NSCell implementation of this method returns nil.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the contextual menu for the cell.

    Declaration

    Swift

    var menu: NSMenu?

    Objective-C

    @property(strong) NSMenu *menu

    Parameters

    aMenu

    A menu that has commands contextually related to the receiver. Specify nil to clear the previous menu.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – menu

  • Returns the receiver’s contextual menu.

    Declaration

    Swift

    var menu: NSMenu?

    Objective-C

    @property(strong) NSMenu *menu

    Return Value

    The receiver’s contextual menu, or nil if no menu is assigned.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setMenu:

  • Returns the menu associated with the receiver and related to the specified event and frame.

    Declaration

    Swift

    func menuForEvent(_ anEvent: NSEvent, inRect cellFrame: NSRect, ofView aView: NSView) -> NSMenu?

    Objective-C

    - (NSMenu *)menuForEvent:(NSEvent *)anEvent inRect:(NSRect)cellFrame ofView:(NSView *)aView

    Parameters

    anEvent

    The event used to find the menu.

    cellFrame

    The cell's rectangle. This rectangle indicates the region containing the cursor.

    aView

    The view that manages the receiver. This is usually the control object that owns the cell.

    Return Value

    The menu associated with the cell and event parameters, or nil if no menu is set.

    Discussion

    This method is usually invoked by the NSControl object (aView) managing the receiver. The default implementation simply invokes menu and returns nil if no menu has been set. Subclasses can override to customize the returned menu according to the event received and the area in which the mouse event occurs.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Compares the string values of the receiver another cell, disregarding case.

    Declaration

    Swift

    func compare(_ otherCell: AnyObject) -> NSComparisonResult

    Objective-C

    - (NSComparisonResult)compare:(id)otherCell

    Parameters

    otherCell

    The cell to compare against the receiver. This parameter must be of type NSCell; if it is not, this method raises NSBadComparisonException.

    This value must not be nil. If the value is nil, the behavior is undefined and may change in future versions of OS X.

    Return Value

    NSOrderedAscending if the string value of the receiver precedes the string value of otherCell in lexical ordering, NSOrderedSame if the string values are equivalent in lexical value, and NSOrderedDescending string value of the receiver follows the string value of otherCell in lexical ordering.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the receiver accepts first responder status.

    Declaration

    Swift

    var acceptsFirstResponder: Bool { get }

    Objective-C

    @property(readonly) BOOL acceptsFirstResponder

    Return Value

    YEStrue if the receiver can become the first responder, otherwise NOfalse.

    Discussion

    The default value is YEStrue if the receiver is enabled. Subclasses may override this method to return a different value.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether the receiver draws some indication of its first responder status.

    Declaration

    Swift

    var showsFirstResponder: Bool

    Objective-C

    @property BOOL showsFirstResponder

    Parameters

    flag

    If YEStrue, the receiver draws an indication of its first responder status, otherwise it does not.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the receiver should draw some indication of its first responder status.

    Declaration

    Swift

    var showsFirstResponder: Bool

    Objective-C

    @property BOOL showsFirstResponder

    Return Value

    YEStrue if the receiver should draw an indication of its first responder status, otherwise NOfalse.

    Discussion

    The NSCell class itself does not draw a first-responder indicator. Subclasses may use the returned value to determine whether or not they should draw one, however.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the title of the receiver with one character in the string denoted as an access key.

    Declaration

    Objective-C

    - (void)setTitleWithMnemonic:(NSString *)aString

    Parameters

    aString

    The new title of the cell. One character in the string should be preceded by an ampersand (&) character. The character that follows becomes the mnemonic character for the title.

    Discussion

    Mnemonics are not supported in OS X.

    Import Statement

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.8.

  • mnemonic mnemonic (OS X v10.8)

    Returns the character in the receiver’s title that appears underlined for use as a mnemonic.

    Declaration

    Objective-C

    - (NSString *)mnemonic

    Return Value

    A string containing the mnemonic character, or an empty string if no mnemonic character is set.

    Discussion

    Mnemonics are not supported in OS X

    Import Statement

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.8.

  • Returns a Boolean value that indicates whether the receiver should not become the first responder.

    Declaration

    Swift

    var refusesFirstResponder: Bool

    Objective-C

    @property BOOL refusesFirstResponder

    Return Value

    YEStrue if the receiver should never become the first responder, otherwise NOfalse if the receiver can become the first responder.

    Discussion

    To find out whether the receiver can become first responder at this time, use the method acceptsFirstResponder.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the character of the receiver’s title to be used as a mnemonic character.

    Declaration

    Objective-C

    - (void)setMnemonicLocation:(NSUInteger)location

    Parameters

    location

    The zero-based index into the cell's title string specifying the location of the mnemonic character. The specified character is underlined when the title is drawn.

    Discussion

    Mnemonics are not supported in OS X.

    Import Statement

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.8.

  • Sets whether the receiver should not become the first responder.

    Declaration

    Swift

    var refusesFirstResponder: Bool

    Objective-C

    @property BOOL refusesFirstResponder

    Parameters

    flag

    If YEStrue, the receiver should never become the first responder; otherwise, it may become the first responder.

    Discussion

    If refusesFirstResponder returns NOfalse and the cell is enabled, the method acceptsFirstResponder returns YEStrue, allowing the cell to become first responder.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the position of the underlined mnemonic character in the receiver’s title.

    Declaration

    Objective-C

    - (NSUInteger)mnemonicLocation

    Return Value

    A zero-based index into the receiver's title string indicating the position of the character. If there is no mnemonic character, this method returns NSNotFound.

    Discussion

    Mnemonics are not supported in OS X.

    Import Statement

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.8.

  • Simulates a single mouse click on the receiver.

    Declaration

    Swift

    func performClick(_ sender: AnyObject?)

    Objective-C

    - (void)performClick:(id)sender

    Parameters

    sender

    The object to use as the sender of the event (if the receiver's control view is not valid). This object must be a subclass of NSView.

    Discussion

    This method performs the receiver's action on its target. The receiver must be enabled to perform the action. If the receiver's control view is valid, that view is used as the sender; otherwise, the value in sender is used.

    The receiver of this message must be a cell of type NSActionCell. This method raises an exception if the action message cannot be successfully sent.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – controlView

  • Sets the value of the receiver’s cell to the object value obtained from the specified object.

    Declaration

    Swift

    func takeObjectValueFrom(_ sender: AnyObject?)

    Objective-C

    - (void)takeObjectValueFrom:(id)sender

    Parameters

    sender

    The object from which to take the value. This object must respond to the objectValue message.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the value of the receiver’s cell to an integer value obtained from the specified object.

    Declaration

    Swift

    func takeIntegerValueFrom(_ sender: AnyObject?)

    Objective-C

    - (void)takeIntegerValueFrom:(id)sender

    Parameters

    sender

    The object from which to take the value. This object must respond to the integerValue message.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Sets the value of the receiver’s cell to an integer value obtained from the specified object.

    Declaration

    Swift

    func takeIntValueFrom(_ sender: AnyObject?)

    Objective-C

    - (void)takeIntValueFrom:(id)sender

    Parameters

    sender

    The object from which to take the value. This object must respond to the intValue message.

    Discussion

    On OS X v10.5 and later you should use takeIntegerValueFrom: instead.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the value of the receiver’s cell to the string value obtained from the specified object.

    Declaration

    Swift

    func takeStringValueFrom(_ sender: AnyObject?)

    Objective-C

    - (void)takeStringValueFrom:(id)sender

    Parameters

    sender

    The object from which to take the value. This object must respond to the stringValue message.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the value of the receiver’s cell to a double-precision floating-point value obtained from the specified object.

    Declaration

    Swift

    func takeDoubleValueFrom(_ sender: AnyObject?)

    Objective-C

    - (void)takeDoubleValueFrom:(id)sender

    Parameters

    sender

    The object from which to take the value. This object must respond to the doubleValue message.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the value of the receiver’s cell to a single-precision floating-point value obtained from the specified object.

    Declaration

    Swift

    func takeFloatValueFrom(_ sender: AnyObject?)

    Objective-C

    - (void)takeFloatValueFrom:(id)sender

    Parameters

    sender

    The object from which to take the value. This object must respond to the floatValue message.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the object represented by the receiver.

    Declaration

    Swift

    var representedObject: AnyObject?

    Objective-C

    @property(strong) id representedObject

    Parameters

    anObject

    The object to associate with the receiver.

    Discussion

    You can use this method to link two objects together. For example, if the receiver's title was "Blue", you could associate an NSColor object whose color was set to blue.

    Special Considerations

    Note that if you copy an NSCell instance, the represented object in the copy is set to nil.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the object the receiver represents.

    Declaration

    Swift

    var representedObject: AnyObject?

    Objective-C

    @property(strong) id representedObject

    Return Value

    The object represented by the receiver.

    Discussion

    Represented objects let you link a cell to an appropriate object. For example, you could have a pop-up list of color names, and the represented objects could be the appropriate NSColor objects.

    Special Considerations

    Note that if you copy an NSCell instance, the represented object in the copy is set to nil.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Initiates the mouse tracking behavior in a cell.

    Declaration

    Swift

    func trackMouse(_ theEvent: NSEvent, inRect cellFrame: NSRect, ofView controlView: NSView, untilMouseUp untilMouseUp: Bool) -> Bool

    Objective-C

    - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp

    Parameters

    theEvent

    The event that caused the mouse tracking to occur.

    cellFrame

    The receiver's frame rectangle.

    controlView

    The view containing the receiver. This is usually an NSControl object.

    untilMouseUp

    If YEStrue, mouse tracking continues until the user releases the mouse button. If NOfalse, tracking continues until the cursor leaves the tracking rectangle, specified by the cellFrame parameter, regardless of the mouse button state. See the discussion for more information.

    Return Value

    YEStrue if the mouse tracking conditions are met, otherwise NOfalse.

    Discussion

    This method is generally not overridden because the default implementation invokes other NSCell methods that can be overridden to handle specific events in a dragging session. This method’s return value depends on the untilMouseUp flag. If untilMouseUp is set to YEStrue, this method returns YEStrue if the mouse button goes up while the cursor is anywhere; NOfalse, otherwise. If untilMouseUp is set to NOfalse, this method returns YEStrue if the mouse button goes up while the cursor is within cellFrame; NOfalse, otherwise.

    This method first invokes startTrackingAt:inView:. If that method returns YEStrue, then as mouse-dragged events are intercepted, continueTracking:at:inView: is invoked until either the method returns NOfalse or the mouse is released. Finally, stopTracking:at:inView:mouseIsUp: is invoked if the mouse is released. If untilMouseUp is YEStrue, it’s invoked when the mouse button goes up while the cursor is anywhere. If untilMouseUp is NOfalse, it’s invoked when the mouse button goes up while the cursor is within cellFrame. You usually override one or more of these methods to respond to specific mouse events.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Begins tracking mouse events within the receiver.

    Declaration

    Swift

    func startTrackingAt(_ startPoint: NSPoint, inView controlView: NSView) -> Bool

    Objective-C

    - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView

    Parameters

    startPoint

    The initial location of the cursor.

    controlView

    The NSControl object managing the receiver.

    Return Value

    YEStrue if the receiver is set to respond continuously or set to respond when the mouse is dragged, otherwise NOfalse.

    Discussion

    The NSCell implementation of trackMouse:inRect:ofView:untilMouseUp: invokes this method when tracking begins. Subclasses can override this method to implement special mouse-tracking behavior at the beginning of mouse tracking—for example, displaying a special cursor.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether mouse tracking should continue in the receiving cell.

    Declaration

    Swift

    func continueTracking(_ lastPoint: NSPoint, at currentPoint: NSPoint, inView controlView: NSView) -> Bool

    Objective-C

    - (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView

    Parameters

    lastPoint

    Contains either the initial location of the cursor when tracking began or the previous current point.

    currentPoint

    The current location of the cursor.

    controlView

    The NSControl object managing the receiver.

    Return Value

    YEStrue if mouse tracking should continue, otherwise NOfalse.

    Discussion

    This method is invoked in trackMouse:inRect:ofView:untilMouseUp:. The default implementation returns YEStrue if the cell is set to continuously send action messages to its target when the mouse button is down or the mouse is being dragged. Subclasses can override this method to provide more sophisticated tracking behavior.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Stops tracking mouse events within the receiver.

    Declaration

    Swift

    func stopTracking(_ lastPoint: NSPoint, at stopPoint: NSPoint, inView controlView: NSView, mouseIsUp flag: Bool)

    Objective-C

    - (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag

    Parameters

    lastPoint

    Contains the previous position of the cursor.

    stopPoint

    The current location of the cursor.

    controlView

    The NSControl object managing the receiver.

    flag

    If YEStrue, this method was invoked because the user released the mouse button; otherwise, if NOfalse, the cursor left the designated tracking rectangle.

    Discussion

    The default NSCell implementation of trackMouse:inRect:ofView:untilMouseUp: invokes this method when the cursor has left the bounds of the receiver or the mouse button goes up. The default NSCell implementation of this method does nothing. Subclasses often override this method to provide customized tracking behavior. The following example increments the state of a tristate cell when the mouse button is clicked:

    • - (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint
    • inView:(NSView *)controlView mouseIsUp:(BOOL)flag
    • {
    • if (flag == YES) {
    • [self setTriState:([self triState]+1)];
    • }
    • }

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the modifier flags for the last (left) mouse-down event.

    Declaration

    Swift

    var mouseDownFlags: Int { get }

    Objective-C

    @property(readonly) NSInteger mouseDownFlags

    Return Value

    The modifier flags, or 0 if tracking has not yet occurred or no modifier keys accompanied the mouse-down event.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    modifierFlags (NSEvent)

  • Returns a Boolean value that indicates whether tracking stops when the cursor leaves the cell.

    Declaration

    Swift

    class func prefersTrackingUntilMouseUp() -> Bool

    Objective-C

    + (BOOL)prefersTrackingUntilMouseUp

    Return Value

    YEStrue if tracking stops when the cursor leaves the cell, otherwise NOfalse.

    Discussion

    The default implementation returns NOfalse. Subclasses may override this method to return a different value.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the initial delay and repeat values for continuous sending of action messages to target objects.

    Declaration

    Swift

    func getPeriodicDelay(_ delay: UnsafeMutablePointer<Float>, interval interval: UnsafeMutablePointer<Float>)

    Objective-C

    - (void)getPeriodicDelay:(float *)delay interval:(float *)interval

    Parameters

    delay

    On input, a pointer to a floating-point variable. On output, the variable contains the current delay (measured in seconds) before messages are sent. This parameter must not be NULL.

    interval

    On input, a pointer to a floating point variable. On output, the variable contains the interval (measured in seconds) at which messages are sent. This parameter must not be NULL.

    Discussion

    The default implementation returns a delay of 0.2 and an interval of 0.025 seconds. Subclasses can override this method to supply their own delay and interval values.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns hit testing information for the receiver.

    Declaration

    Swift

    func hitTestForEvent(_ event: NSEvent, inRect cellFrame: NSRect, ofView controlView: NSView) -> NSCellHitResult

    Objective-C

    - (NSCellHitResult)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView

    Parameters

    event

    The current event.

    cellFrame

    The cell’s frame.

    controlView

    The control object in which the cell is located.

    Return Value

    A constant that specifies the type of area in which the event occurred—see “Hit Testing” for values.

    Discussion

    You can use a bit-wise mask to look for a specific value when calling this method—see “Hit Testing” for values.

    Generally, this method should be overridden by custom NSCell subclasses to return the correct result. Currently, it is called by some multi-cell views, such as NSTableView.

    By default, NSCell looks at the cell type and does the following:

    • NSImageCellType: If the image exists and the event point is in the image returns NSCellHitContentArea, otherwise NSCellHitNone.

    • NSTextCellType (also applies to NSTextFieldCell):

      If there is text: If the event point hits in the text, return NSCellHitContentArea. Additionally, if the cell is enabled return NSCellHitContentArea | NSCellHitEditableTextArea.

      If there is not text: return NSCellHitNone.

    • NSNullCellType (this is the default that applies to non text or image cells who don't override hitTestForEvent:inRect:ofView:):

      Return NSCellHitContentArea by default;

      If the cell not disabled, and it would track, return NSCellHitContentArea | NSCellHitTrackableArea.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Sets the receiver to show the I-beam cursor while it tracks the mouse.

    Declaration

    Swift

    func resetCursorRect(_ cellFrame: NSRect, inView controlView: NSView)

    Objective-C

    - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView *)controlView

    Parameters

    cellFrame

    The rectangle in which to display the I-beam cursor.

    controlView

    The control that manages the cell.

    Discussion

    The receiver must be an enabled and selectable (or editable) text-type cell.

    This method is invoked by resetCursorRects and in general you do not need to call this method unless you have a custom NSView that uses a cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the key equivalent to clicking the cell.

    Declaration

    Swift

    var keyEquivalent: String { get }

    Objective-C

    @property(readonly, copy) NSString *keyEquivalent

    Return Value

    An empty string object.

    Discussion

    Subclasses can override this method to return a string with a valid character for the key equivalent.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Draws the focus ring for the control.

    Declaration

    Swift

    func drawFocusRingMaskWithFrame(_ cellFrame: NSRect, inView controlView: NSView)

    Objective-C

    - (void)drawFocusRingMaskWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

    Parameters

    cellFrame

    The bounding rectangle of the receiver, or a portion of the bounding rectangle.

    controlView

    The view that manages the cell.

    Discussion

    Implemented by NSCell subclasses to draw the appropriate focus ring for the control The default implementation does nothing.

    The Application Kit automatically invokes this method when appropriate, to render the view's focus ring. The view must be eligible to become its window's firstResponder, by overriding acceptsFirstResponder returning YEStrue.

    The focus ring is rendered using the style specified by the view's focusRingType, which must not be NSFocusRingTypeNone unless you want to suppress drawing of the focus ring. An implementation of drawFocusRingMaskWithFrame:inView: can assume that it is drawing in the view's bounds, and that the fill and stroke colors have been set to an arbitrary fully opaque color. It needs only draw the desired focus ring shape or an image or other object whose outline defines the focus ring mask.

    This new OS X v10.7 focus ring API should no longer call NSSetFocusRingStyle() and perform it's own drawing.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Returns the bounds of the focus ring mask.

    Declaration

    Swift

    func focusRingMaskBoundsForFrame(_ cellFrame: NSRect, inView controlView: NSView) -> NSRect

    Objective-C

    - (NSRect)focusRingMaskBoundsForFrame:(NSRect)cellFrame inView:(NSView *)controlView

    Parameters

    cellFrame

    The bounding rectangle of the receiver, or a portion of the bounding rectangle.

    controlView

    The view that manages the cell.

    Return Value

    Returns a rectangle encompassing the focus ring bounds in the controlView coordinate space.

    Discussion

    Implemented by NSCell subclasses to allow the cell to provide the rectangular bounds of the focus ring mask for the cell.

    The default implementation returns an empty value. Subclasses are expected to implement this method if they intend to draw a focus ring.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Returns the default type of focus ring for the receiver.

    Declaration

    Swift

    class func defaultFocusRingType() -> NSFocusRingType

    Objective-C

    + (NSFocusRingType)defaultFocusRingType

    Return Value

    The default type of focus ring for the receiver (one of the values listed in NSFocusRingType).

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Sets the type of focus ring to be used.

    Declaration

    Swift

    var focusRingType: NSFocusRingType

    Objective-C

    @property NSFocusRingType focusRingType

    Parameters

    focusRingType

    Possible values are listed in NSFocusRingType. To disable a view's focus ring, specify NSFocusRingTypeNone.

    Discussion

    You should only disable a view from drawing its focus ring if you want to draw your own focus ring, or if there is not sufficient space to display a focus ring in the default location.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Returns the type of focus ring currently set for the receiver.

    Declaration

    Swift

    var focusRingType: NSFocusRingType

    Objective-C

    @property NSFocusRingType focusRingType

    Return Value

    The type of focus ring currently set for the receiver (one of the values listed in NSFocusRingType).

    Discussion

    You can disable a view's focus ring drawing by overriding this method so it always returns NSFocusRingTypeNone, or by calling setFocusRingType: with NSFocusRingTypeNone. You should only disable a view from drawing its focus ring if you want to draw your own focus ring, or if there isn't sufficient space to display a focus ring in the default location.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Recalculates the cell geometry.

    Declaration

    Swift

    func calcDrawInfo(_ aRect: NSRect)

    Objective-C

    - (void)calcDrawInfo:(NSRect)aRect

    Parameters

    aRect

    The reference rectangle to use when calculating the cell information.

    Discussion

    Objects (such as controls) that manage NSCell objects generally maintain a flag that informs them if any of their cells have been modified in such a way that the location or size of the cell should be recomputed. If so, calcSize method of NSControl is automatically invoked prior to the display of the cell, and that method invokes the calcDrawInfo: method of the cell.

    The default implementation of this method does nothing.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the minimum size needed to display the receiver.

    Declaration

    Swift

    var cellSize: NSSize { get }

    Objective-C

    @property(readonly) NSSize cellSize

    Return Value

    The size of the cell, or the size (10000, 10000) if the receiver is not a text or image cell. If the cell is an image cell but no image has been set, returns NSZeroSize.

    Discussion

    This method takes into account of the size of the image or text within a certain offset determined by the border type of the cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the minimum size needed to display the receiver, constraining it to the specified rectangle.

    Declaration

    Swift

    func cellSizeForBounds(_ aRect: NSRect) -> NSSize

    Objective-C

    - (NSSize)cellSizeForBounds:(NSRect)aRect

    Parameters

    aRect

    The size of the cell, or the size of the aRect parameter if the cell is not a text or image cell. If the cell is an image cell but no image has been set, returns NSZeroSize.

    Discussion

    This method takes into account of the size of the image or text within a certain offset determined by the border type of the cell. If the receiver is of text type, the text is resized to fit within aRect (as much as aRect is within the bounds of the cell).

    To support constraint-based layout, when the content of a custom cell changes in such a way that the return value of this method would change, it needs to notify its control of the change via invalidateIntrinsicContentSizeForCell:.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the rectangle within which the receiver draws itself

    Declaration

    Swift

    func drawingRectForBounds(_ theRect: NSRect) -> NSRect

    Objective-C

    - (NSRect)drawingRectForBounds:(NSRect)theRect

    Parameters

    theRect

    The bounding rectangle of the receiver.

    Return Value

    The rectangle in which the receiver draws itself. This rectangle is slightly inset from the one in theRect.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    calcSize (NSControl)

  • Returns the rectangle in which the receiver draws its image.

    Declaration

    Swift

    func imageRectForBounds(_ theRect: NSRect) -> NSRect

    Objective-C

    - (NSRect)imageRectForBounds:(NSRect)theRect

    Parameters

    theRect

    The bounding rectangle of the receiver.

    Return Value

    The rectangle in which the receiver draws its image. This rectangle is slightly offset from the one in theRect.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the rectangle in which the receiver draws its title text.

    Declaration

    Swift

    func titleRectForBounds(_ theRect: NSRect) -> NSRect

    Objective-C

    - (NSRect)titleRectForBounds:(NSRect)theRect

    Parameters

    theRect

    The bounding rectangle of the receiver.

    Return Value

    The rectangle in which the receiver draws its title text.

    Discussion

    If the receiver is a text-type cell, this method resizes the drawing rectangle for the title (theRect) inward by a small offset to accommodate the cell border. If the receiver is not a text-type cell, the method does nothing.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the size of the receiver.

    Declaration

    Swift

    var controlSize: NSControlSize

    Objective-C

    @property NSControlSize controlSize

    Return Value

    A value that specifies the size of the receiver (for possible values, see “NSControlSize”).

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the size of the receiver.

    Declaration

    Swift

    var controlSize: NSControlSize

    Objective-C

    @property NSControlSize controlSize

    Parameters

    size

    A value that specifies the size of the receiver (for possible values, see “NSControlSize”).

    Discussion

    Changing the cell’s control size does not change the font of the cell. Use the systemFontSizeForControlSize: class method of NSFont to obtain the system font based on the new control size and set it.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – controlSize

  • Draws the receiver’s border and then draws the interior of the cell.

    Declaration

    Swift

    func drawWithFrame(_ cellFrame: NSRect, inView controlView: NSView)

    Objective-C

    - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

    Parameters

    cellFrame

    The bounding rectangle of the receiver.

    controlView

    The control that manages the cell.

    Discussion

    This method draws the cell in the currently focused view, which can be different from the controlView passed in. Taking advantage of this behavior is not recommended, however.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the color the receiver uses when drawing the selection highlight.

    Declaration

    Swift

    func highlightColorWithFrame(_ cellFrame: NSRect, inView controlView: NSView) -> NSColor

    Objective-C

    - (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

    Parameters

    cellFrame

    The bounding rectangle of the receiver.

    controlView

    The control that manages the cell.

    Return Value

    The color the receiver uses when drawing the selection highlight.

    Discussion

    You should not assume that a cell would necessarily want to draw itself with the value returned from selectedControlColor. A cell may wish to draw with different a selection highlight color depending on such things as the key state of its controlView.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.1 and later.

  • Draws the interior portion of the receiver, which includes the image or text portion but does not include the border.

    Declaration

    Swift

    func drawInteriorWithFrame(_ cellFrame: NSRect, inView controlView: NSView)

    Objective-C

    - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

    Parameters

    cellFrame

    The bounding rectangle of the receiver, or a portion of the bounding rectangle.

    controlView

    The control that manages the cell.

    Discussion

    Text-type NSCell objects display their contents in a rectangle slightly inset from cellFrame using a global NSText object. Image-type NSCell objects display their contents centered within cellFrame. If the proper attributes are set, this method also displays the dotted-line rectangle to indicate if the control is the first responder and highlights the cell. This method is invoked from the drawCellInside: method of NSControl to visually update what the cell displays when its contents change. The drawing done by the NSCell implementation is minimal and becomes more complex in objects such as NSButtonCell and NSSliderCell.

    This method draws the cell in the currently focused view, which can be different from the controlView passed in. Taking advantage of this is not recommended.

    Subclasses often override this method to provide more sophisticated drawing of cell contents. Because drawWithFrame:inView: invokes drawInteriorWithFrame:inView: after it draws the cell's border, do not invoke drawWithFrame:inView: in your override implementation.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the receiver's control.

    Declaration

    Swift

    unowned(unsafe) var controlView: NSView?

    Objective-C

    @property(assign) NSView *controlView

    Return Value

    The view (normally an NSControl object) associated with this cell. The default implementation returns nil.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the receiver’s control view.

    Declaration

    Swift

    unowned(unsafe) var controlView: NSView?

    Objective-C

    @property(assign) NSView *controlView

    Parameters

    view

    The view (normally an NSControl object) to associate with the cell.

    Discussion

    The control view represents the control currently being rendered by the cell.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – controlView

  • Redraws the receiver with the specified highlight setting.

    Declaration

    Swift

    func highlight(_ flag: Bool, withFrame cellFrame: NSRect, inView controlView: NSView)

    Objective-C

    - (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView:(NSView *)controlView

    Parameters

    flag

    If YEStrue, the cell is redrawn with a highlight; otherwise, if NOfalse, the highlight is removed.

    cellFrame

    The bounding rectangle of the receiver.

    controlView

    The control that manages the cell.

    Discussion

    Note that the NSCell highlighting does not appear when highlighted cells are printed (although instances of NSTextFieldCell, NSButtonCell, and others can print themselves highlighted). Generally, you cannot depend on highlighting being printed because implementations of this method may choose (or not choose) to use transparency.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether the receiver has a highlighted appearance.

    Declaration

    Swift

    var highlighted: Bool

    Objective-C

    @property(getter=isHighlighted) BOOL highlighted

    Parameters

    flag

    If YES, the receiver has a highlight.

    Discussion

    By default, this method does nothing. The NSButtonCell class overrides this method to draw the button with the appearance specified by NSCellLightsByBackground, NSCellLightsByContents, or NSCellLightsByGray.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • isHighlighted isHighlighted Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value that indicates whether the receiver is highlighted.

    Declaration

    Objective-C

    - (BOOL)isHighlighted

    Return Value

    YEStrue if the receiver has a highlight, otherwise NOfalse.

    Import Statement

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • Begins editing of the receiver’s text using the specified field editor.

    Declaration

    Swift

    func editWithFrame(_ aRect: NSRect, inView controlView: NSView, editor textObj: NSText, delegate anObject: AnyObject?, event theEvent: NSEvent)

    Objective-C

    - (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent

    Parameters

    aRect

    The bounding rectangle of the cell.

    controlView

    The control that manages the cell.

    textObj

    The field editor to use for editing the cell.

    anObject

    The object to use as a delegate for the field editor (textObj parameter). This delegate object receives various NSText delegation and notification methods during the course of editing the cell's contents.

    theEvent

    The NSLeftMouseDown event that initiated the editing behavior.

    Discussion

    If the receiver isn’t a text-type NSCell object, no editing is performed. Otherwise, the field editor (textObj) is sized to aRect and its superview is set to controlView, so it exactly covers the receiver. The field editor is then activated and editing begins. It’s the responsibility of the delegate to end editing when responding to textShouldEndEditing:. Upon ending the editing session, the delegate should remove any data from the field editor.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Selects the specified text range in the cell's field editor.

    Declaration

    Swift

    func selectWithFrame(_ aRect: NSRect, inView controlView: NSView, editor textObj: NSText, delegate anObject: AnyObject?, start selStart: Int, length selLength: Int)

    Objective-C

    - (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart length:(NSInteger)selLength

    Parameters

    aRect

    The bounding rectangle of the cell.

    controlView

    The control that manages the cell.

    textObj

    The field editor to use for editing the cell.

    anObject

    The object to use as a delegate for the field editor (textObj parameter). This delegate object receives various NSText delegation and notification methods during the course of editing the cell's contents.

    selStart

    The start of the text selection.

    selLength

    The length of the text range.

    Discussion

    This method is similar to editWithFrame:inView:editor:delegate:event:, except that it can be invoked in any situation, not only on a mouse-down event. This method returns without doing anything if controlView, textObj, or the receiver is nil, or if the receiver has no font set for it.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the receiver’s NSControl object sends its action message whenever the user finishes editing the cell’s text.

    Declaration

    Swift

    var sendsActionOnEndEditing: Bool

    Objective-C

    @property BOOL sendsActionOnEndEditing

    Return Value

    YEStrue if the receiver's control sends its action message when editing is complete, otherwise NOfalse.

    Discussion

    If this method returns YEStrue, the receiver’s NSControl object sends its action message when the user does one of the following:

    • Presses the Return key

    • Presses the Tab key to move out of the field

    • Clicks another text field

    If it returns NOfalse, the cell’s NSControl object sends its action message only when the user presses the Return key.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether the receiver’s NSControl object sends its action message whenever the user finishes editing the cell’s text.

    Declaration

    Swift

    var sendsActionOnEndEditing: Bool

    Objective-C

    @property BOOL sendsActionOnEndEditing

    Parameters

    flag

    If YEStrue, the receiver's control sends its action message when editing is complete; otherwise, if NOfalse, it sends the action message only when the user presses the Return key.

    Discussion

    If flag is YEStrue, the receiver’s NSControl object sends its action message when the user does one of the following:

    • Presses the Return key

    • Presses the Tab key to move out of the field

    • Clicks another text field

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Ends the editing of text in the receiver using the specified field editor.

    Declaration

    Swift

    func endEditing(_ textObj: NSText)

    Objective-C

    - (void)endEditing:(NSText *)textObj

    Parameters

    textObj

    The field editor currently handling the editing of the cell's content.

    Discussion

    Ends any editing of text that began with a call to editWithFrame:inView:editor:delegate:event: or selectWithFrame:inView:editor:delegate:start:length:.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the field editor initiated by the receiver should post text change notifications.

    Declaration

    Swift

    var wantsNotificationForMarkedText: Bool { get }

    Objective-C

    @property(readonly) BOOL wantsNotificationForMarkedText

    Return Value

    YEStrue if the field editor initiated by the receiver should post text change notifications (NSTextDidChangeNotification) while editing marked text; otherwise, they are delayed until the marked text confirmation.

    Discussion

    NSCell's implementation returns NOfalse.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Returns a custom field editor for editing in the view.

    Declaration

    Swift

    func fieldEditorForView(_ aControlView: NSView) -> NSTextView?

    Objective-C

    - (NSTextView *)fieldEditorForView:(NSView *)aControlView

    Parameters

    aControlView

    The view containing cells that require a custom field editor.

    Return Value

    A custom field editor. The field editor must have isFieldEditor set to YEStrue.

    Discussion

    This is an override point for NSCell subclasses designed to use their own custom field editors. This message is sent to the selected cell of aControlView using the NSWindow method in fieldEditor:forObject:.

    Returning non-nil from this method indicates skipping the standard field editor querying processes including windowWillReturnFieldEditor:toObject: delegation.

    The default implementation returns nil.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Returns whether the text cell restricts layout and rendering of its content to a single line.

    Declaration

    Swift

    var usesSingleLineMode: Bool

    Objective-C

    @property BOOL usesSingleLineMode

    Return Value

    YEStrue if layout and rendering is restricted to a single line, otherwise NOfalse.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Sets whether the text cell restricts layout and rendering of its content to a single line.

    Declaration

    Swift

    var usesSingleLineMode: Bool

    Objective-C

    @property BOOL usesSingleLineMode

    Parameters

    flag

    YEStrue if layout and rendering should be restricted to a single line, otherwise NOfalse.

    Discussion

    If YES, the cell ignores the return value from wraps, interprets NSLineBreakByWordWrapping and NSLineBreakByCharWrapping returned by lineBreakMode as NSLineBreakByClipping, and configures the field editor to ignore key binding commands that insert paragraph and line separators.

    The field editor bound to a single line cell filters paragraph and line separator insertion from user actions. Cells in the single line mode use the fixed baseline layout. The text baseline position is determined solely by the control size regardless of content font style or size.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Returns the expansion cell frame for the receiver.

    Declaration

    Swift

    func expansionFrameWithFrame(_ cellFrame: NSRect, inView view: NSView) -> NSRect

    Objective-C

    - (NSRect)expansionFrameWithFrame:(NSRect)cellFrame inView:(NSView *)view

    Parameters

    cellFrame

    The frame for the receiver.

    view

    The view in which the receiver will be drawn.

    Return Value

    The expansion cell frame for the receiver. If the frame is not too small, return an empty rect (NSZeroRect), and no expansion tool tip view will be shown.

    Discussion

    This method allows the cell to return an expansion cell frame if cellFrame is too small for the entire contents in the view. When the mouse is hovered over the cell in certain controls, the full cell contents are shown in a special floating tool tip view. By default, NSCell returns NSZeroRect, while some subclasses (such as NSTextFieldCell) will return the proper frame when required.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Instructs the receiver to draw in an expansion frame.

    Declaration

    Swift

    func drawWithExpansionFrame(_ cellFrame: NSRect, inView view: NSView)

    Objective-C

    - (void)drawWithExpansionFrame:(NSRect)cellFrame inView:(NSView *)view

    Parameters

    cellFrame

    The frame in which to draw.

    view

    The view in which to draw. This view may be different from the original view that the cell appeared in.

    Discussion

    This method allows the cell to perform custom expansion tool tip drawing. By default, NSCell simply calls drawWithFrame:inView:.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • These constants specify how a cell represents its data (as text or as an image). These constants are used by setType: and type.

    Declaration

    Swift

    enum NSCellType : UInt { case NullCellType case TextCellType case ImageCellType }

    Objective-C

    enum { NSNullCellType = 0, NSTextCellType = 1, NSImageCellType = 2 }; typedef NSUInteger NSCellType;

    Constants

    • NullCellType

      NSNullCellType

      Cell displays nothing.

      Available in OS X v10.0 and later.

    • TextCellType

      NSTextCellType

      Cell displays text.

      Available in OS X v10.0 and later.

    • ImageCellType

      NSImageCellType

      Cell displays images.

      Available in OS X v10.0 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • These constants specify how a button behaves when pressed and how it displays its state. These constants are used by the NSButton and NSButtonCell classes

    Declaration

    Swift

    enum NSCellAttribute : UInt { case CellDisabled case CellState case PushInCell case CellEditable case ChangeGrayCell case CellHighlighted case CellLightsByContents case CellLightsByGray case ChangeBackgroundCell case CellLightsByBackground case CellIsBordered case CellHasOverlappingImage case CellHasImageHorizontal case CellHasImageOnLeftOrBottom case CellChangesContents case CellIsInsetButton case CellAllowsMixedState }

    Objective-C

    enum { NSCellDisabled = 0, NSCellState = 1, NSPushInCell = 2, NSCellEditable = 3, NSChangeGrayCell = 4, NSCellHighlighted = 5, NSCellLightsByContents = 6, NSCellLightsByGray = 7, NSChangeBackgroundCell = 8, NSCellLightsByBackground = 9, NSCellIsBordered = 10, NSCellHasOverlappingImage = 11, NSCellHasImageHorizontal = 12, NSCellHasImageOnLeftOrBottom = 13, NSCellChangesContents = 14, NSCellIsInsetButton = 15, NSCellAllowsMixedState = 16 }; typedef NSUInteger NSCellAttribute;

    Constants

    • CellAllowsMixedState

      NSCellAllowsMixedState

      Lets the cell’s state be NSMixedState, as well as NSOffState and NSOnState.

      Available in OS X v10.0 and later.

    • ChangeBackgroundCell

      NSChangeBackgroundCell

      If the cell’s state is NSMixedState or NSOnState, changes the cell’s background color from gray to white.

      Available in OS X v10.0 and later.

    • CellChangesContents

      NSCellChangesContents

      If the cell’s state is NSMixedState or NSOnState, displays the cell’s alternate image.

      Available in OS X v10.0 and later.

    • ChangeGrayCell

      NSChangeGrayCell

      If the cell’s state is NSMixedState or NSOnState, displays the cell’s image as darkened.

      Available in OS X v10.0 and later.

    • CellDisabled

      NSCellDisabled

      Does not let the user manipulate the cell.

      Available in OS X v10.0 and later.

    • CellEditable

      NSCellEditable

      Lets the user edit the cell’s contents.

      Available in OS X v10.0 and later.

    • CellHasImageHorizontal

      NSCellHasImageHorizontal

      Controls the position of the cell’s image: places the image on the right of any text in the cell.

      Together, NSCellHasImageOnLeftOrBottom, NSCellHasImageHorizontal, and NSCellHasOverlappingImage control the position of the cell’s image and text. To place the image above, set none of them. To place the image below, set NSCellHasImageOnLeftOrBottom. To place the image to the right, set NSCellHasImageHorizontal. To place the image to the left, set NSCellHasImageHorizontal and NSCellHasImageOnLeftOrBottom. To place the image directly over, set NSCellHasOverlappingImage.

      Available in OS X v10.0 and later.

    • CellHasImageOnLeftOrBottom

      NSCellHasImageOnLeftOrBottom

      Controls the position of the cell’s image: places the image on the left of or below any text in the cell.

      See NSCellHasImageHorizontal for more details.

      Available in OS X v10.0 and later.

    • CellHasOverlappingImage

      NSCellHasOverlappingImage

      Controls the position of the cell’s image: places the image over any text in the cell.

      See NSCellHasImageHorizontal for more details.

      Available in OS X v10.0 and later.

    • CellHighlighted

      NSCellHighlighted

      Draws the cell with a highlighted appearance.

      Use setHighlighted: instead.

      Available in OS X v10.0 and later.

    • CellIsBordered

      NSCellIsBordered

      Draws a border around the cell.

      Available in OS X v10.0 and later.

    • CellIsInsetButton

      NSCellIsInsetButton

      Insets the cell’s contents from the border.

      By default, the cell’s contents are inset by 2 points. This constant is ignored if the cell has no border.

      Available in OS X v10.0 and later.

    • CellLightsByBackground

      NSCellLightsByBackground

      If the cell is pushed in, changes the cell’s background color from gray to white.

      Available in OS X v10.0 and later.

    • CellLightsByContents

      NSCellLightsByContents

      If the cell is pushed in, displays the cell’s alternate image.

      Available in OS X v10.0 and later.

    • CellLightsByGray

      NSCellLightsByGray

      If the cell is pushed in, displays the cell’s image as darkened.

      Available in OS X v10.0 and later.

    • PushInCell

      NSPushInCell

      Determines whether the cell’s image and text appear to be shifted down and to the right.

      Available in OS X v10.0 and later.

    • CellState

      NSCellState

      The cell’s state.

      The cell’s state can be NSMixedState, NSOffState, or NSOnState.

      Available in OS X v10.0 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • These constants specify the position of a button’s image relative to its title. These constants are used by the setImagePosition: and imagePosition methods of NSButton and NSButtonCell.

    Declaration

    Swift

    enum NSCellImagePosition : UInt { case NoImage case ImageOnly case ImageLeft case ImageRight case ImageBelow case ImageAbove case ImageOverlaps }

    Objective-C

    enum { NSNoImage = 0, NSImageOnly = 1, NSImageLeft = 2, NSImageRight = 3, NSImageBelow = 4, NSImageAbove = 5, NSImageOverlaps = 6 }; typedef NSUInteger NSCellImagePosition;

    Constants

    • NoImage

      NSNoImage

      The cell doesn’t display an image.

      Available in OS X v10.0 and later.

    • ImageOnly

      NSImageOnly

      The cell displays an image, but not a title.

      Available in OS X v10.0 and later.

    • ImageLeft

      NSImageLeft

      The image is to the left of the title.

      Available in OS X v10.0 and later.

    • ImageRight

      NSImageRight

      The image is to the right of the title.

      Available in OS X v10.0 and later.

    • ImageBelow

      NSImageBelow

      The image is below the title.

      Available in OS X v10.0 and later.

    • ImageAbove

      NSImageAbove

      The image is above the title.

      Available in OS X v10.0 and later.

    • ImageOverlaps

      NSImageOverlaps

      The image overlaps the title.

      Available in OS X v10.0 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • These constants specify a cell’s image scaling behavior.

    Declaration

    Swift

    enum NSImageScaling : UInt { case ImageScaleProportionallyDown case ImageScaleAxesIndependently case ImageScaleNone case ImageScaleProportionallyUpOrDown }

    Objective-C

    enum { NSImageScaleProportionallyDown = 0, NSImageScaleAxesIndependently, NSImageScaleNone, NSImageScaleProportionallyUpOrDown }; typedef NSUInteger NSImageScaling;

    Constants

    • ImageScaleProportionallyDown

      NSImageScaleProportionallyDown

      If it is too large for the destination, scale the image down while preserving the aspect ratio.

      Available in OS X v10.5 and later.

    • ImageScaleAxesIndependently

      NSImageScaleAxesIndependently

      Scale each dimension to exactly fit destination.

      This setting does not preserve the aspect ratio of the image.

      Available in OS X v10.5 and later.

    • ImageScaleNone

      NSImageScaleNone

      Do not scale the image.

      Available in OS X v10.5 and later.

    • ImageScaleProportionallyUpOrDown

      NSImageScaleProportionallyUpOrDown

      Scale the image to its maximum possible dimensions while both staying within the destination area and preserving its aspect ratio.

      Available in OS X v10.5 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • These constants specify a cell’s state and are used mostly for buttons. These constants are described in Cell States in Control and Cell Programming Topics of Control and Cell Programming Topics.

    Declaration

    Swift

    typealias NSCellStateValue = Int

    Objective-C

    enum { NSMixedState = -1, NSOffState = 0, NSOnState = 1 }; typedef NSUInteger NSCellStateValue;

    Constants

    • NSMixedState

      NSMixedState

      The corresponding feature is in effect somewhere.

      Available in OS X v10.0 and later.

    • NSOffState

      NSOffState

      The corresponding feature is in effect nowhere.

      Available in OS X v10.0 and later.

    • NSOnState

      NSOnState

      The corresponding feature is in effect everywhere.

      Available in OS X v10.0 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • These constants specify what happens when a button is pressed or is displaying its alternate state. These contents are used by the highlightsBy and showsStateBy methods of NSButtonCell.

    Declaration

    Swift

    struct NSCellStyleMask : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var NoCellMask: NSCellStyleMask { get } static var ContentsCellMask: NSCellStyleMask { get } static var PushInCellMask: NSCellStyleMask { get } static var ChangeGrayCellMask: NSCellStyleMask { get } static var ChangeBackgroundCellMask: NSCellStyleMask { get } }

    Objective-C

    enum { NSNoCellMask = 0, NSContentsCellMask = 1, NSPushInCellMask = 2, NSChangeGrayCellMask = 4, NSChangeBackgroundCellMask = 8 };

    Constants

    • NoCellMask

      NSNoCellMask

      The button cell doesn’t change.

      Available in OS X v10.0 and later.

    • PushInCellMask

      NSPushInCellMask

      The button cell “pushes in” if it has a border.

      Available in OS X v10.0 and later.

    • ContentsCellMask

      NSContentsCellMask

      The button cell displays its alternate icon and/or title.

      Available in OS X v10.0 and later.

    • ChangeGrayCellMask

      NSChangeGrayCellMask

      The button cell swaps the “control color” (the controlColor method of NSColor) and white pixels on its background and icon.

      Available in OS X v10.0 and later.

    • ChangeBackgroundCellMask

      NSChangeBackgroundCellMask

      Same as NSChangeGrayCellMask, but only background pixels are changed.

      Available in OS X v10.0 and later.

    Import Statement

  • These constants specify a cell’s tint. These constants are used by controlTint and setControlTint:.

    Declaration

    Swift

    enum NSControlTint : UInt { case DefaultControlTint case BlueControlTint case GraphiteControlTint case ClearControlTint }

    Objective-C

    enum { NSDefaultControlTint = 0, NSBlueControlTint = 1, NSGraphiteControlTint = 6, NSClearControlTint = 7 }; typedef NSUInteger NSControlTint;

    Constants

    • DefaultControlTint

      NSDefaultControlTint

      The current default tint setting

      Available in OS X v10.0 and later.

    • ClearControlTint

      NSClearControlTint

      Clear control tint

      Available in OS X v10.0 and later.

    • BlueControlTint

      NSBlueControlTint

      Aqua control tint

      Available in OS X v10.3 and later.

    • GraphiteControlTint

      NSGraphiteControlTint

      Graphite control tint

      Available in OS X v10.3 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • These constants specify a cell’s size. These constants are used by controlSize and setControlSize:.

    Declaration

    Swift

    enum NSControlSize : UInt { case RegularControlSize case SmallControlSize case MiniControlSize }

    Objective-C

    enum { NSRegularControlSize, NSSmallControlSize, NSMiniControlSize }; typedef NSUInteger NSControlSize;

    Constants

    • RegularControlSize

      NSRegularControlSize

      The control is sized as regular.

      Available in OS X v10.0 and later.

    • SmallControlSize

      NSSmallControlSize

      The control has a smaller size.

      This constant is for controls that cannot be resized in one direction, such as push buttons, radio buttons, checkboxes, sliders, scroll bars, pop-up buttons, tabs, and progress indicators. You should use a small system font with a small control.

      Available in OS X v10.0 and later.

    • MiniControlSize

      NSMiniControlSize

      The control has a smaller size than NSSmallControlSize.

      Available in OS X v10.3 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • These constants are used by hitTestForEvent:inRect:ofView: to determine the effect of an event.

    Declaration

    Swift

    struct NSCellHitResult : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var None: NSCellHitResult { get } static var ContentArea: NSCellHitResult { get } static var EditableTextArea: NSCellHitResult { get } static var TrackableArea: NSCellHitResult { get } }

    Objective-C

    enum { NSCellHitNone = 0, NSCellHitContentArea = 1 << 0, NSCellHitEditableTextArea = 1 << 1, NSCellHitTrackableArea = 1 << 2, };

    Constants

    • None

      NSCellHitNone

      An empty area, or did not hit in the cell.

      Available in OS X v10.5 and later.

    • ContentArea

      NSCellHitContentArea

      A content area in the cell.

      Available in OS X v10.5 and later.

    • EditableTextArea

      NSCellHitEditableTextArea

      An editable text area of the cell.

      Available in OS X v10.5 and later.

    • TrackableArea

      NSCellHitTrackableArea

      A trackable area in the cell.

      Available in OS X v10.5 and later.

    Import Statement

  • Background styles used with backgroundStyle, setBackgroundStyle:, and interiorBackgroundStyle.

    Declaration

    Swift

    enum NSBackgroundStyle : Int { case Light case Dark case Raised case Lowered }

    Objective-C

    enum { NSBackgroundStyleLight = 0, NSBackgroundStyleDark, NSBackgroundStyleRaised, NSBackgroundStyleLowered }; typedef NSUInteger NSBackgroundStyle;

    Constants

    • Light

      NSBackgroundStyleLight

      The background is a light color.

      Dark content contrasts well with this background.

      Available in OS X v10.5 and later.

    • Dark

      NSBackgroundStyleDark

      The background is a dark color.

      Light content contrasts well with this background.

      Available in OS X v10.5 and later.

    • Raised

      NSBackgroundStyleRaised

      The background is intended to appear higher than the content drawn on it.

      Content might need to be inset.

      Available in OS X v10.5 and later.

    • Lowered

      NSBackgroundStyleLowered

      The background is intended to appear lower than the content drawn on it.

      Content might need to be embossed.

      Available in OS X v10.5 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • These are deprecated scaling constants.

    Use NSImageScaling constants instead.

    Declaration

    Objective-C

    enum { NSScaleProportionally = 0, NSScaleToFit, NSScaleNone };

    Constants

    Import Statement

  • These constants specify how a cell formats numeric data.

    Declaration

    Swift

    var NSIntType: Int { get } var NSPositiveIntType: Int { get } var NSFloatType: Int { get } var NSPositiveFloatType: Int { get } var NSDoubleType: Int { get } var NSPositiveDoubleType: Int { get } var NSAnyType: Int { get }

    Objective-C

    enum { NSAnyType = 0, NSIntType = 1, NSPositiveIntType = 2, NSFloatType = 3, NSPositiveFloatType = 4, NSDoubleType = 6, NSPositiveDoubleType = 7 };

    Constants

    • NSIntType

      NSIntType

      Must be between INT_MIN and INT_MAX.

      Deprecated in OS X v10.4 and later.

    • NSPositiveIntType

      NSPositiveIntType

      Must be between 1 and INT_MAX.

      Deprecated in OS X v10.4 and later.

    • NSFloatType

      NSFloatType

      Must be between –FLT_MAX and FLT_MAX.

      Deprecated in OS X v10.4 and later.

    • NSPositiveFloatType

      NSPositiveFloatType

      Must be between FLT_MIN and FLT_MAX.

      Deprecated in OS X v10.4 and later.

    • NSDoubleType

      NSDoubleType

      Must be between –FLT_MAX and FLT_MAX.

      Deprecated in OS X v10.4 and later.

    • NSPositiveDoubleType

      NSPositiveDoubleType

      Must be between FLT_MIN and FLT_MAX.

      Deprecated in OS X v10.4 and later.

    • NSAnyType

      NSAnyType

      Any value is allowed.

      Deprecated in OS X v10.4 and later.

    Discussion

    These constants are used by setEntryType: and entryType.

    Import Statement