| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later.
|
| Companion guide | |
| Declared in | NSCell.h |
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.
– setObjectValue:
– objectValue
– hasValidObjectValue
– setIntValue:
– intValue
– setIntegerValue:
– integerValue
– setStringValue:
– stringValue
– setDoubleValue:
– doubleValue
– setFloatValue:
– floatValue
– setCellAttribute:to:
– cellAttribute:
– setType:
– type
– setEnabled:
– isEnabled
– allowsUndo
– setAllowsUndo:
– setBezeled:
– isBezeled
– setBordered:
– isBordered
– isOpaque
– setControlTint:
– controlTint
– setBackgroundStyle:
– backgroundStyle
– interiorBackgroundStyle
– setEditable:
– isEditable
– setSelectable:
– isSelectable
– setScrollable:
– isScrollable
– setAlignment:
– alignment
– setFont:
– font
– lineBreakMode
– setLineBreakMode:
– setWraps:
– wraps
– baseWritingDirection
– setBaseWritingDirection:
– setAttributedStringValue:
– attributedStringValue
– setAllowsEditingTextAttributes:
– allowsEditingTextAttributes
– setImportsGraphics:
– importsGraphics
– setUpFieldEditorAttributes:
– title
– setTitle:
– setFormatter:
– formatter
– isEntryAcceptable:
– setFloatingPointFormat:left:right:
– entryType Deprecated in Mac OS X v10.0 and later
– setEntryType: Deprecated in Mac OS X v10.0 and later
– acceptsFirstResponder
– setShowsFirstResponder:
– showsFirstResponder
– setTitleWithMnemonic:
– mnemonic
– refusesFirstResponder
– setMnemonicLocation:
– setRefusesFirstResponder:
– mnemonicLocation
– performClick:
– takeObjectValueFrom:
– takeIntegerValueFrom:
– takeIntValueFrom:
– takeStringValueFrom:
– takeDoubleValueFrom:
– takeFloatValueFrom:
– trackMouse:inRect:ofView:untilMouseUp:
– startTrackingAt:inView:
– continueTracking:at:inView:
– stopTracking:at:inView:mouseIsUp:
– mouseDownFlags
+ prefersTrackingUntilMouseUp
– getPeriodicDelay:interval:
– calcDrawInfo:
– cellSize
– cellSizeForBounds:
– drawingRectForBounds:
– imageRectForBounds:
– titleRectForBounds:
– controlSize
– setControlSize:
– drawWithFrame:inView:
– highlightColorWithFrame:inView:
– drawInteriorWithFrame:inView:
– controlView
– setControlView:
– highlight:withFrame:inView:
– setHighlighted:
– isHighlighted
– editWithFrame:inView:editor:delegate:event:
– selectWithFrame:inView:editor:delegate:start:length:
– sendsActionOnEndEditing
– setSendsActionOnEndEditing:
– endEditing:
– wantsNotificationForMarkedText
Returns the default type of focus ring for the receiver.
+ (NSFocusRingType)defaultFocusRingType
The default type of focus ring for the receiver (one of the values listed in NSFocusRingType).
NSCell.h
Returns the default menu for instances of the receiver.
+ (NSMenu *)defaultMenu
The default menu. The NSCell implementation of this method returns nil.
NSCell.hReturns a Boolean value that indicates whether tracking stops when the cursor leaves the cell.
+ (BOOL)prefersTrackingUntilMouseUp
YES if tracking stops when the cursor leaves the cell, otherwise NO.
The default implementation returns NO. Subclasses may override this method to return a different value.
NSCell.hReturns a Boolean value that indicates whether the receiver accepts first responder status.
- (BOOL)acceptsFirstResponder
YES if the receiver can become the first responder, otherwise NO.
The default value is YES if the receiver is enabled. Subclasses may override this method to return a different value.
NSCell.hReturns the default action-message selector associated with the cell.
- (SEL)action
The selector associated with the cell. The NSCell implementation of this method returns NULL by default.
NSCell.hReturns the alignment of text in the receiver.
- (NSTextAlignment)alignment
The alignment of text in the receiver (one of the following constants: NSLeftTextAlignment, NSRightTextAlignment,NSCenterTextAlignment, NSJustifiedTextAlignment, NSNaturalTextAlignment).
The default value is NSNaturalTextAlignment.
NSCell.hReturns a Boolean value that indicates whether the receiver allows user editing of textual attributes.
- (BOOL)allowsEditingTextAttributes
YES if the receiver allows the user to edit textual attributes of the cell's text, otherwise NO.
NSCell.hReturns a Boolean value that indicates whether the receiver supports three states.
- (BOOL)allowsMixedState
YES if the receiver supports all three states (on, off, and mixed), otherwise NO (the receiver supports only the on and off states).
NSCell.hReturns a Boolean value that indicates whether the receiver assumes responsibility for undo operations.
- (BOOL)allowsUndo
YES if the receiver handles undo operations, otherwise NO.
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.
NSCell.h
Returns the value of the receiver’s cell as an attributed string using the receiver's formatter object (if one exists).
- (NSAttributedString *)attributedStringValue
The value of the cell interpreted as an attributed string.
The textual attributes are the default paragraph style, the receiver’s font and alignment, and whether the receiver is enabled and scrollable.
For Mac 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.
NSCell.hReturns the background style for the receiver.
- (NSBackgroundStyle)backgroundStyle
The background style for the receiver.
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.
NSCell.hReturns the initial writing direction used to determine the actual writing direction for text.
- (NSWritingDirection)baseWritingDirection
The initial writing direction the receiver uses to determine the actual writing direction for text (one of the following values: NSWritingDirectionNatural, NSWritingDirectionLeftToRight, NSWritingDirectionRightToLeft). If no writing direction is set, returns NSWritingDirectionNatural.
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.
NSCell.hRecalculates the cell geometry.
- (void)calcDrawInfo:(NSRect)aRect
The reference rectangle to use when calculating the cell information.
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.
NSCell.h
Returns the value for the specified cell attribute.
- (NSInteger)cellAttribute:(NSCellAttribute)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.
The value for the cell attribute specified by aParameter.
NSCell.hReturns the minimum size needed to display the receiver.
- (NSSize)cellSize
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.
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.
NSCell.hReturns the minimum size needed to display the receiver, constraining it to the specified rectangle.
- (NSSize)cellSizeForBounds:(NSRect)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.
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).
NSCell.hCompares the string values of the receiver another cell, disregarding case.
- (NSComparisonResult)compare:(id)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 Mac OS X.
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.
NSCell.hReturns a Boolean value that indicates whether mouse tracking should continue in the receiving cell.
- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView
Contains either the initial location of the cursor when tracking began or the previous current point.
The current location of the cursor.
The NSControl object managing the receiver.
YES if mouse tracking should continue, otherwise NO.
This method is invoked in trackMouse:inRect:ofView:untilMouseUp:. The default implementation returns YES 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.
NSCell.hReturns the size of the receiver.
- (NSControlSize)controlSize
A value that specifies the size of the receiver (for possible values, see “Control Sizes”).
NSCell.hReturns the receiver’s control tint.
- (NSControlTint)controlTint
An NSControlTint value that specifies the tint of the receiver (see “Control Tints” for possible values).
NSCell.h
Returns the receiver's control.
- (NSView *)controlView
The view (normally an NSControl object) associated with this cell. The default implementation returns nil.
NSCell.h
Returns the value of the receiver’s cell as a double-precision floating-point number.
- (double)doubleValue
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.
NSCell.hReturns the rectangle within which the receiver draws itself
- (NSRect)drawingRectForBounds:(NSRect)theRect
The bounding rectangle of the receiver.
The rectangle in which the receiver draws itself. This rectangle is slightly inset from the one in theRect.