(Preliminary Documentation) Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSText

Inherits From:	NSView : NSResponder : NSObject 

Conforms To:	NSChangeSpelling
NSIgnoreMisspelledWords

Declared In:	appkit/NSTextView.h

Getting and Setting Contents 

- (void)replaceRange:(NSRange)range	Replaces the characters within the specified range of
withRTF:(NSData *)rtfData		text with the RTF data rtfData.
- (void)replaceRange:(NSRange)range	Replaces the characters within the specified range of
withRTFD:(NSData *)rtfdData		text with the RTFD data rtfdData.
- (NSData *)RTFFromRange:(NSRange)range	Extracts the specified range of RTF text from the NSText object and returns a data object initialized with that text.  This data is formatted according to the RTF file format.
- (NSData *)RTFDFromRange:(NSRange)range	Extracts the specified range of RTFD text from the NSText object and returns an data object initialized with that text.
- (void)setText:(NSString *)string	Sets the contents of the NSText object to be string. 
- (void)setText:(NSString *)string	Replaces the characters in the specified range of text in the   
range:(NSRange)range		NSText object to be string.
- (NSString *)text	Returns the contents of the NSText object as a immutable string object.

Managing Global Characteristics

- (NSTextAlignment)alignment	Returns how text in the NSText object is aligned between the margins.
- (BOOL)drawsBackground	Returns whether the NSText object draws its own background.
- (BOOL)importsGraphics	Returns whether the NSText object can accept images.
- (BOOL)isEditable	Returns whether users can edit the NSText object.
- (BOOL)isRichText	Returns whether the text in the NSText object is RTF.
- (BOOL)isSelectable	Returns whether users can select text in the NSText object.
- (void)setAlignment:(NSTextAlignment)mode	Sets how the text in the NSText object is aligned between the margins.
- (void)setDrawsBackground:(BOOL)flag	Sets whether the NSText object draws its own background.
- (void)setEditable:(BOOL)flag	Sets whether users can edit text in the NSText object.
- (void)setImportsGraphics:(BOOL)flag	Sets whether the NSText object can accept images.
- (void)setRichText:(BOOL)flag	Sets whether the text in the NSText object allows for multiple values of attributes, such as color and font (i.e. RTF).
- (void)setSelectable:(BOOL)flag	Sets whether users can select text in the NSText object.

Managing Font and Color

- (NSColor *)backgroundColor	Returns the background color for the NSText object.
- (void)changeFont:(id)sender	Initiates a font-change session.
- (NSFont *)font	Returns the default NSFont object for the NSText object.
- (void)setBackgroundColor:(NSColor *)color	Sets the background color for the NSText object.
- (void)setColor:(NSColor *)color	Sets the color for the specified range of text in the
ofRange:(NSRange)range		NSText object to color.
- (void)setFont:(NSFont *)obj	Sets the default NSFont object for the NSText object.
- (void)setFont:(NSFont *)font	Sets the font for the specified range of text in the   
ofRange:(NSRange)range		NSText object to font.
- (void)setTextColor:(NSColor *)color	Sets the textual color for the NSText object.
- (void)setUsesFontPanel:(BOOL)flag	Sets whether the NSText object uses the font panel.
- (NSColor *)textColor	Returns the textual color for the NSText object.
- (BOOL)usesFontPanel	Returns whether the NSText object uses the font panel

Managing the Selection

- (NSRange)selectedRange	Returns the range of the selected text in the NSText object.
- (void)setSelectedRange:(NSRange)range	Sets the range of selected text in the NSText object.

Sizing the Frame Rectangle

- (BOOL)isHorizontallyResizable	Returns whether the frame width can change.
- (BOOL)isVerticallyResizable	Returns whether the frame height can change.
- (NSSize)maxSize	Gets the maximum size of the NSTextView's frame.
- (NSSize)minSize	Gets the minimum size of the NSTextView's frame.
- (void)setHorizontallyResizable:(BOOL)flag	Sets whether the frame's width can change.
- (void)setMaxSize:(NSSize)newMaxSize	Sets the maximum size of the NSText object to newMaxSize.
- (void)setMinSize:(NSSize)newMinSize	Sets the minimum  size of the NSText object to newMinSize.
- (void)setVerticallyResizable:(BOOL)flag	Sets whether the frame's height can change.
- (void)sizeToFit	Resizes the frame to fit just around the text.

Responding to Editing Commands

- (void)alignCenter:(id)sender	Centers the selected text between the margins.
- (void)alignLeft:(id)sender	Aligns selected text to the left margin.
- (void)alignRight:(id)sender	Aligns selected text the the right margin.
- (void)copy:(id)sender	Copies the selected text to the pasteboard.
- (void)copyFont:(id)sender	Copies the selected text's font to the pasteboard.
- (void)copyRuler:(id)sender	Copies the selected text's ruler to the pasteboard.
- (void)cut:(id)sender	Deletes the selected text and copies it to the pasteboard.
- (void)delete:(id)sender	Deletes the selected text.
- (void)paste:(id)sender	Replaces the selected text with the contents of the pasteboard.
- (void)pasteFont:(id)sender	Replaces the selection's font with the pasteboard contents.
- (void)pasteRuler:(id)sender	Replaces the selection's ruler with the pasteboard contents.
- (void)selectAll:(id)sender	Selects all text in the NSText object.
- (void)subscript:(id)sender	Subscripts the current selection.
- (void)superscript:(id)sender	Superscripts the current selection.
- (void)underline:(id)sender	Underlines the selected text.
- (void)unscript:(id)sender	Removes superscript or subscript in the current selection..

Managing the Ruler

- (BOOL)isRulerVisible	Returns whether the ruler is visible.
- (void)toggleRuler:(id)sender	Displays the ruler if it's not visible, and removes it if it is visible.

Spelling

- (void)checkSpelling:(id)sender	Initiates a spell-checking session.
- (void)showGuessPanel:(id)sender	Displays the spell-checker's Show Guess panel.

Scrolling

- (void)scrollRangeToVisible:(NSRange)range	Scrolls the NSText object so that the range of text is visible.

Reading and Writing RTFD Files

- (BOOL)readRTFDFromFile:(NSString *)path	Reads RTFD data from the file package specified by path and initializes an NSText object with it;  returns whether the operation succeeded.
- (BOOL)writeRTFDToFile:(NSString *)path	Writes RTFD data from the receiving NSText object
atomically:(BOOL)flag		to the file package specified by path. flag determines whether writing occurs atomically.  Returns whether the operation succeeded.

Managing the Field Editor

- (BOOL)isFieldEditor	Returns whether the receiving NSText object gives up First Responder status on tab, carriage return, etc.
- (void)setFieldEditor:(BOOL)flag	Sets whether the receiving NSText object is to be used as a field editor.  flag indicates whether to end on carriage return, tab, or other terminating character.

Managing the Delegate

- (id)delegate	Returns the delegate of the NSText object.
- (void)setDelegate:(id)anObject	Makes anObject the NSText object's delegate.

Implemented by the Delegate

- (void)textDidBeginEditing:(NSNotification *)notification
	Alerts delegate to a change in the text after obtaining First Responder status.
- (void)textDidChange:(NSNotification *)notification	
	Sent upon any key-down events or paste operation that  changes the receiver's contents.
- (void)textDidEndEditing:(NSNotification *)notification
	Reports to delegate the loss of First Responder status.
- (BOOL)textShouldBeginEditing:(NSText *)textObject 
	Informs delegate of an impending textual change.  YES means go ahead and make the change.
- (BOOL)textShouldEndEditing:(NSText *)textObject
	Warns delegate of the impending loss of First Responder status.  YES means go ahead and change status.