NSCell

NSCell Mac OS X 10.0

This class is the base superclass for the hierarchy of lightweight objects that know how to draw into a view. Most NSControl classes in the Application Kit defer the implementation of drawing to an associated NSCell. For example, NSButton uses a concrete subclass of NSCell, NSButtonCell, to handle all of the drawing and event handling of a button interface component. Cells provide a leaner alternative to using views in situations when a control appears repeatedly in a view. The interface of NSCell is closely mirrored in NSControl; indeed, many concrete subclasses of NSControl forward most messages to their associated NSCell object.

figs/cocn_1514.gif

@interface NSCell : NSObject <NSCoding, NSCopying>
 // Initializers
   - (id)initImageCell:(NSImage *)image;
   - (id)initTextCell:(NSString *)aString;
 // Accessor Methods
   - (void)setBezeled:(BOOL)flag;
   - (void)setType:(NSCellType)aType;
   - (NSCellType)type;
   - (void)setCellAttribute:(NSCellAttribute)aParameter to:(int)value;
   - (void)setAllowsMixedState:(BOOL)flag;
   - (BOOL)allowsMixedState;
   - (void)setTarget:(id)anObject;
   - (id)target;
   - (void)setAction:(SEL)aSelector;
   - (SEL)action;
   - (void)setImportsGraphics:(BOOL)flag;
   - (BOOL)importsGraphics;
   - (void)setTag:(int)anInt;
   - (int)tag;
   - (void)setTitle:(NSString*)aString;
   - (NSString*)title;
   - (void)setAllowsEditingTextAttributes:(BOOL)flag;
   - (BOOL)allowsEditingTextAttributes;
   - (void)setEnabled:(BOOL)flag;
   - (void)setRepresentedObject:(id)anObject;
   - (id)representedObject;
   - (void)setAttributedStringValue:(NSAttributedString *)obj;
   - (NSAttributedString *)attributedStringValue;
   - (void)setSelectable:(BOOL)flag;
   - (void)setBordered:(BOOL)flag;
   - (void)setDoubleValue:(double)aDouble;
   - (double)doubleValue;
   - (void)setScrollable:(BOOL)flag;
   - (void)setSendsActionOnEndEditing:(BOOL)flag;
   - (BOOL)sendsActionOnEndEditing;
   - (void)setHighlighted:(BOOL)flag;
   - (void)setAlignment:(NSTextAlignment)mode;
   - (NSTextAlignment)alignment;
   - (void)setWraps:(BOOL)flag;
   - (BOOL)wraps;
   - (void)setImage:(NSImage *)image;
   - (NSImage *)image;
   - (void)setEntryType:(int)aType;
   - (int)entryType;
   - (NSText *)setUpFieldEditorAttributes:(NSText *)textObj;
   - (void)setFloatingPointFormat:(BOOL)autoRange left:(unsigned)leftDigits right:(unsigned)rightDigits;
   - (void)setFormatter:(NSFormatter *)newFormatter;
   - (id)formatter;
   - (void)setStringValue:(NSString *)aString;
   - (NSString *)stringValue;
   - (void)setIntValue:(int)anInt;
   - (int)intValue;
   - (void)setFloatValue:(float)aFloat;
   - (float)floatValue;
   - (void)setObjectValue:(id <NSCopying>)obj;
   - (id <NSCopying>)objectValue;
   - (void)setMenu:(NSMenu *)aMenu;
   - (NSMenu *)menu;
   - (void)setFont:(NSFont *)fontObj;
   - (NSFont *)font;
   - (void)setControlSize:(NSControlSize)size;
   - (NSControlSize)controlSize;
   - (void)setContinuous:(BOOL)flag;
   - (void)setState:(int)value;
   - (int)state;
   - (void)setNextState;
   - (int)nextState;
   - (void)setEditable:(BOOL)flag;
 // Class Methods
   + (NSMenu *)defaultMenu;
   + (BOOL)prefersTrackingUntilMouseUp;
 // Instance Methods
   - (NSSize)cellSize;
   - (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
   - (NSRect)imageRectForBounds:(NSRect)theRect;
   - (BOOL)isEnabled;
   - (int)cellAttribute:(NSCellAttribute)aParameter;
   - (BOOL)isContinuous;
   - (BOOL)isEditable;
   - (BOOL)isBordered;
   - (BOOL)isBezeled;
   - (void)calcDrawInfo:(NSRect)aRect;
   - (void)endEditing:(NSText *)textObj;
   - (NSSize)cellSizeForBounds:(NSRect)aRect;
   - (void)getPeriodicDelay:(float *)delay interval:(float *)interval;
   - (BOOL)hasValidObjectValue;
   - (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView:(NSView *)controlView;
   - (NSComparisonResult)compare:(id)otherCell;
   - (void)setControlTint:(NSControlTint)controlTint;
   - (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView;
   - (NSControlTint)controlTint;
   - (NSView *)controlView;
   - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
   - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
   - (NSRect)drawingRectForBounds:(NSRect)theRect;
   - (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj
        delegate:(id)anObject event:(NSEvent *)theEvent;
   - (BOOL)isEntryAcceptable:(NSString *)aString;
   - (BOOL)isHighlighted;
   - (BOOL)isOpaque;
   - (BOOL)isScrollable;
   - (BOOL)isSelectable;
   - (NSString *)keyEquivalent;
   - (NSMenu *)menuForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)view;
   - (int)mouseDownFlags;
   - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView *)controlView;
   - (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj
        delegate:(id)anObject start:(int)selStart length:(int)selLength;
   - (int)sendActionOn:(int)mask;
   - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView;
   - (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag;
   - (void)takeDoubleValueFrom:(id)sender;
   - (void)takeFloatValueFrom:(id)sender;
   - (void)takeIntValueFrom:(id)sender;
   - (void)takeObjectValueFrom:(id)sender;
   - (void)takeStringValueFrom:(id)sender;
   - (NSRect)titleRectForBounds:(NSRect)theRect;
   - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView
        untilMouseUp:(BOOL)flag;
 // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;
 // Methods Implementing NSCopying
   - (id)copyWithZone:(NSZone *)zone;

Subclasses

NSActionCell, NSBrowserCell, NSImageCell, NSTextAttachmentCell



    Part II: API Quick Reference
    Chapter 13. Foundation Classes