Up

# NSTextView

### Authors

Scott Christley (`scottc@net-community.com`)
Felipe A. Rodriguez (`far@ix.netcom.com`)
Daniel Bðhringer (`boehring@biomed.ruhr-uni-bochum.de`)
Fred Kiefer (`FredKiefer@gmx.de`)
Nicola Pero (`n.pero@mi.flashnet.it`)
Pierre-Yves Rivaille (`pyrivail@ens-lyon.fr`)

Copyright: (C) 1996, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.

### Contents -

1. Software documentation for the NSTextView class
2. Software documentation for the NSObject(NSTextViewDelegate) informal protocol
3. Software documentation for the NSTextView(GSTextView_sync) category
4. Software documentation for the NSTextView(leftovers) category
5. Software documentation for the NSTextView(user_actions) category

# Software documentation for the NSTextView class

## NSTextView : NSText

> Declared in:
>   AppKit/NSTextView.h

> Conforms to:
>   NSTextInput

> Standards:
> - MacOS-X
> - OpenStep
> - GNUstep

Description forthcoming.

Method summary

- -_layoutManagerDidInvalidateLayout
- -_recacheDelegateResponses
- -_syncTextViewsByCalling:withFlag:
- -_updateMultipleTextViews
- -acceptableDragTypes
- -cleanUpAfterDragOperation
- -dragImageForSelectionWithEvent:origin:
- -dragOperationForDraggingInfo:type:
- -dragSelectionWithEvent:offset:slideBack:
- -drawInsertionPointInRect:color:turnedOn:
- -preferredPasteboardTypeFromArray:restrictedToTypesFromArray:
- -readSelectionFromPasteboard:
- -readSelectionFromPasteboard:type:
- -readablePasteboardTypes
- -rulerView:didAddMarker:
- -rulerView:didMoveMarker:
- -rulerView:didRemoveMarker:
- -rulerView:handleMouseDown:
- -rulerView:shouldAddMarker:
- -rulerView:shouldMoveMarker:
- -rulerView:shouldRemoveMarker:
- -rulerView:willAddMarker:atLocation:
- -rulerView:willMoveMarker:toLocation:
- -selectedRange
- -selectionAffinity
- -selectionGranularity
- -selectionRangeForProposedRange:granularity:
- -setNeedsDisplayInRect:avoidAdditionalLayout:
- -setSelectedRange:
- -setSelectedRange:affinity:stillSelecting:
- -setSelectionGranularity:
- -setTypingAttributes:
- -shouldDrawInsertionPoint
- -smartDeleteRangeForProposedRange:
- -smartInsertForString:replacingRange:beforeString:afterString:
- -spellCheckerDocumentTag
- -typingAttributes
- -updateDragTypeRegistration
- -updateFontPanel
- -updateInsertionPointStateAndRestartTimer:
- -updateRuler
- -validRequestorForSendType:returnType:
- -writablePasteboardTypes
- -writeSelectionToPasteboard:type:
- -writeSelectionToPasteboard:types:
- -alignJustified:
- -loosenKerning:
- -lowerBaseline:
- -raiseBaseline:
- -tightenKerning:
- -toggleContinuousSpellChecking:
- -toggleTraditionalCharacterShape:
- -transpose:
- -turnOffKerning:
- -turnOffLigatures:
- -useAllLigatures:
- -useStandardKerning:
- -useStandardLigatures:
- +defaultTypingAttributes
- +registerForServices
- -_updateInputMethodState
- -_updateInputMethodWithInsertionPoint:
- -allowsUndo
- -didChangeText
- -initWithFrame:
- -initWithFrame:textContainer:
- -insertionPointColor
- -invalidateTextContainerOrigin
- -isContinuousSpellCheckingEnabled
- -layoutManager
- -markedTextAttributes
- -pasteAsPlainText:
- -pasteAsRichText:
- -rangeForUserCharacterAttributeChange
- -rangeForUserParagraphAttributeChange
- -rangeForUserTextChange
- -replaceCharactersInRange:withAttributedString:
- -replaceCharactersInRange:withString:
- -replaceTextContainer:
- -selectedTextAttributes
- -setAlignment:range:
- -setAllowsUndo:
- -setConstrainedFrameSize:
- -setContinuousSpellCheckingEnabled:
- -setInsertionPointColor:
- -setMarkedTextAttributes:
- -setRulerVisible:
- -setSelectedTextAttributes:
- -setSmartInsertDeleteEnabled:
- -setTextContainer:
- -setTextContainerInset:
- -setUsesRuler:
- -shouldChangeTextInRange:replacementString:
- -smartInsertDeleteEnabled
- -textContainer
- -textContainerInset
- -textContainerOrigin
- -textStorage
- -usesRuler

### defaultTypingAttributes

+ (NSDictionary*) defaultTypingAttributes;

Returns the default typing attributes: black text, default paragraph style (as returned by [NSParagraphStyle defaultParagraphStyle]), and default user font and size (as returned by [NSFont userFontOfSize: 0.0]). GNUstep extension.

### registerForServices

+ (void) registerForServices;

Description forthcoming.

### _updateInputMethodState

- (void) _updateInputMethodState;

Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.

### _updateInputMethodWithInsertionPoint:

- (void) _updateInputMethodWithInsertionPoint: (NSPoint)insertionPoint;

Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.

### allowsUndo

- (BOOL) allowsUndo;

Description forthcoming.

### didChangeText

- (void) didChangeText;

Description forthcoming.

### initWithFrame:

- (id) initWithFrame: (NSRect)frameRect;

Description forthcoming.

### initWithFrame:textContainer:

- (id) initWithFrame: (NSRect)frameRect textContainer: (NSTextContainer*)container;

Description forthcoming.

### insertionPointColor

- (NSColor*) insertionPointColor;

Description forthcoming.

### invalidateTextContainerOrigin

- (void) invalidateTextContainerOrigin;

Description forthcoming.

### isContinuousSpellCheckingEnabled

- (BOOL) isContinuousSpellCheckingEnabled;

Description forthcoming.

### layoutManager

- (NSLayoutManager*) layoutManager;

Description forthcoming.

### markedTextAttributes

- (NSDictionary*) markedTextAttributes;

Description forthcoming.

### pasteAsPlainText:

- (void) pasteAsPlainText: (id)sender;

Description forthcoming.

### pasteAsRichText:

- (void) pasteAsRichText: (id)sender;

Description forthcoming.

### rangeForUserCharacterAttributeChange

- (NSRange) rangeForUserCharacterAttributeChange;

Description forthcoming.

### rangeForUserParagraphAttributeChange

- (NSRange) rangeForUserParagraphAttributeChange;

Description forthcoming.

### rangeForUserTextChange

- (NSRange) rangeForUserTextChange;

Description forthcoming.

### replaceCharactersInRange:withAttributedString:

- (void) replaceCharactersInRange: (NSRange)aRange withAttributedString: (NSAttributedString*)aString;

Description forthcoming.

### replaceCharactersInRange:withString:

- (void) replaceCharactersInRange: (NSRange)aRange withString: (NSString*)aString;

Description forthcoming.

### replaceTextContainer:

- (void) replaceTextContainer: (NSTextContainer*)newContainer;

Description forthcoming.

### selectedTextAttributes

- (NSDictionary*) selectedTextAttributes;

Description forthcoming.

### setAlignment:range:

- (void) setAlignment: (NSTextAlignment)alignment range: (NSRange)range;

Description forthcoming.

### setAllowsUndo:

- (void) setAllowsUndo: (BOOL)flag;

Description forthcoming.

### setConstrainedFrameSize:

- (void) setConstrainedFrameSize: (NSSize)desiredSize;

Description forthcoming.

### setContinuousSpellCheckingEnabled:

- (void) setContinuousSpellCheckingEnabled: (BOOL)flag;

Description forthcoming.

### setInsertionPointColor:

- (void) setInsertionPointColor: (NSColor*)color;

Description forthcoming.

### setMarkedTextAttributes:

- (void) setMarkedTextAttributes: (NSDictionary*)attributeDictionary;

Description forthcoming.

### setRulerVisible:

- (void) setRulerVisible: (BOOL)flag;

Description forthcoming.

### setSelectedTextAttributes:

- (void) setSelectedTextAttributes: (NSDictionary*)attributeDictionary;

Description forthcoming.

### setSmartInsertDeleteEnabled:

- (void) setSmartInsertDeleteEnabled: (BOOL)flag;

Description forthcoming.

### setTextContainer:

- (void) setTextContainer: (NSTextContainer*)container;

Description forthcoming.

### setTextContainerInset:

- (void) setTextContainerInset: (NSSize)inset;

Description forthcoming.

### setUsesRuler:

- (void) setUsesRuler: (BOOL)flag;

Description forthcoming.

### shouldChangeTextInRange:replacementString:

- (BOOL) shouldChangeTextInRange: (NSRange)affectedCharRange replacementString: (NSString*)replacementString;

Description forthcoming.

### smartInsertDeleteEnabled

- (BOOL) smartInsertDeleteEnabled;

Description forthcoming.

### textContainer

- (NSTextContainer*) textContainer;

Description forthcoming.

### textContainerInset

- (NSSize) textContainerInset;

Description forthcoming.

### textContainerOrigin

- (NSPoint) textContainerOrigin;

Description forthcoming.

### textStorage

- (NSTextStorage*) textStorage;

Description forthcoming.

### usesRuler

- (BOOL) usesRuler;

Description forthcoming.

# Software documentation for the NSObject(NSTextViewDelegate) informal protocol

## NSObject(NSTextViewDelegate)

> Declared in:
>   AppKit/NSTextView.h

> Standards:
> - MacOS-X
> - NotOpenStep
> - GNUstep

Description forthcoming.

Method summary

- -textView:clickedOnCell:inRect:
- -textView:clickedOnCell:inRect:atIndex:
- -textView:clickedOnLink:
- -textView:clickedOnLink:atIndex:
- -textView:doCommandBySelector:
- -textView:doubleClickedOnCell:inRect:
- -textView:doubleClickedOnCell:inRect:atIndex:
- -textView:draggedCell:inRect:event:
- -textView:draggedCell:inRect:event:atIndex:
- -textView:shouldChangeTextInRange:replacementString:
- -textView:willChangeSelectionFromCharacterRange:toCharacterRange:
- -textViewDidChangeSelection:
- -undoManagerForTextView:

### textView:clickedOnCell:inRect:

- (void) textView: (NSTextView*)textView clickedOnCell: (id<NSTextAttachmentCell>)cell inRect: (NSRect)cellFrame;

Description forthcoming.

### textView:clickedOnCell:inRect:atIndex:

- (void) textView: (NSTextView*)textView clickedOnCell: (id<NSTextAttachmentCell>)cell inRect: (NSRect)cellFrame atIndex: (unsigned)charIndex;

Description forthcoming.

### textView:clickedOnLink:

- (BOOL) textView: (NSTextView*)textView clickedOnLink: (id)link;

Description forthcoming.

### textView:clickedOnLink:atIndex:

- (BOOL) textView: (NSTextView*)textView clickedOnLink: (id)link atIndex: (unsigned)charIndex;

Description forthcoming.

### textView:doCommandBySelector:

- (BOOL) textView: (NSTextView*)textView doCommandBySelector: (SEL)commandSelector;

Description forthcoming.

### textView:doubleClickedOnCell:inRect:

- (void) textView: (NSTextView*)textView doubleClickedOnCell: (id<NSTextAttachmentCell>)cell inRect: (NSRect)cellFrame;

Description forthcoming.

### textView:doubleClickedOnCell:inRect:atIndex:

- (void) textView: (NSTextView*)textView doubleClickedOnCell: (id<NSTextAttachmentCell>)cell inRect: (NSRect)cellFrame atIndex: (unsigned)charIndex;

Description forthcoming.

### textView:draggedCell:inRect:event:

- (void) textView: (NSTextView*)view draggedCell: (id<NSTextAttachmentCell>)cell inRect: (NSRect)rect event: (NSEvent*)event;

Description forthcoming.

### textView:draggedCell:inRect:event:atIndex:

- (void) textView: (NSTextView*)view draggedCell: (id<NSTextAttachmentCell>)cell inRect: (NSRect)rect event: (NSEvent*)event atIndex: (unsigned)charIndex;

Description forthcoming.

### textView:shouldChangeTextInRange:replacementString:

- (BOOL) textView: (NSTextView*)textView shouldChangeTextInRange: (NSRange)affectedCharRange replacementString: (NSString*)replacementString;

Description forthcoming.

### textView:willChangeSelectionFromCharacterRange:toCharacterRange:

- (NSRange) textView: (NSTextView*)textView willChangeSelectionFromCharacterRange: (NSRange)oldSelectedCharRange toCharacterRange: (NSRange)newSelectedCharRange;

Description forthcoming.

### textViewDidChangeSelection:

- (void) textViewDidChangeSelection: (NSNotification*)notification;

Description forthcoming.

### undoManagerForTextView:

- (NSUndoManager*) undoManagerForTextView: (NSTextView*)view;

Description forthcoming.

# Software documentation for the NSTextView(GSTextView_sync) category

## NSTextView(GSTextView_sync)

> Declared in:
>   AppKit/NSTextView.h

> Standards:
> - MacOS-X
> - OpenStep
> - GNUstep

Description forthcoming.

Method summary

- -_layoutManagerDidInvalidateLayout
- -_recacheDelegateResponses
- -_syncTextViewsByCalling:withFlag:
- -_updateMultipleTextViews

### _layoutManagerDidInvalidateLayout

- (void) _layoutManagerDidInvalidateLayout;

Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.

### _recacheDelegateResponses

- (void) _recacheDelegateResponses;

Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.

### _syncTextViewsByCalling:withFlag:

- (void) _syncTextViewsByCalling: (SEL)action withFlag: (BOOL)flag;

Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.

### _updateMultipleTextViews

- (void) _updateMultipleTextViews;

Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.

# Software documentation for the NSTextView(leftovers) category

## NSTextView(leftovers)

> Declared in:
>   AppKit/NSTextView.h

> Standards:
> - MacOS-X
> - OpenStep
> - GNUstep

Description forthcoming.

Method summary

- -acceptableDragTypes
- -cleanUpAfterDragOperation
- -dragImageForSelectionWithEvent:origin:
- -dragOperationForDraggingInfo:type:
- -dragSelectionWithEvent:offset:slideBack:
- -drawInsertionPointInRect:color:turnedOn:
- -preferredPasteboardTypeFromArray:restrictedToTypesFromArray:
- -readSelectionFromPasteboard:
- -readSelectionFromPasteboard:type:
- -readablePasteboardTypes
- -rulerView:didAddMarker:
- -rulerView:didMoveMarker:
- -rulerView:didRemoveMarker:
- -rulerView:handleMouseDown:
- -rulerView:shouldAddMarker:
- -rulerView:shouldMoveMarker:
- -rulerView:shouldRemoveMarker:
- -rulerView:willAddMarker:atLocation:
- -rulerView:willMoveMarker:toLocation:
- -selectedRange
- -selectionAffinity
- -selectionGranularity
- -selectionRangeForProposedRange:granularity:
- -setNeedsDisplayInRect:avoidAdditionalLayout:
- -setSelectedRange:
- -setSelectedRange:affinity:stillSelecting:
- -setSelectionGranularity:
- -setTypingAttributes:
- -shouldDrawInsertionPoint
- -smartDeleteRangeForProposedRange:
- -smartInsertForString:replacingRange:beforeString:afterString:
- -spellCheckerDocumentTag
- -typingAttributes
- -updateDragTypeRegistration
- -updateFontPanel
- -updateInsertionPointStateAndRestartTimer:
- -updateRuler
- -validRequestorForSendType:returnType:
- -writablePasteboardTypes
- -writeSelectionToPasteboard:type:
- -writeSelectionToPasteboard:types:

### acceptableDragTypes

- (NSArray*) acceptableDragTypes;

Description forthcoming.

### cleanUpAfterDragOperation

- (void) cleanUpAfterDragOperation;

Description forthcoming.

### dragImageForSelectionWithEvent:origin:

- (NSImage*) dragImageForSelectionWithEvent: (NSEvent*)event origin: (NSPoint*)origin;

Description forthcoming.

### dragOperationForDraggingInfo:type:

- (unsigned int) dragOperationForDraggingInfo: (id)dragInfo type: (NSString*)type;

Description forthcoming.

### dragSelectionWithEvent:offset:slideBack:

- (BOOL) dragSelectionWithEvent: (NSEvent*)event offset: (NSSize)mouseOffset slideBack: (BOOL)slideBack;

Description forthcoming.

### drawInsertionPointInRect:color:turnedOn:

- (void) drawInsertionPointInRect: (NSRect)rect color: (NSColor*)color turnedOn: (BOOL)flag;

Description forthcoming.

### preferredPasteboardTypeFromArray:restrictedToTypesFromArray:

- (NSString*) preferredPasteboardTypeFromArray: (NSArray*)availableTypes restrictedToTypesFromArray: (NSArray*)allowedTypes;

Description forthcoming.

### readSelectionFromPasteboard:

- (BOOL) readSelectionFromPasteboard: (NSPasteboard*)pboard;

Description forthcoming.

### readSelectionFromPasteboard:type:

- (BOOL) readSelectionFromPasteboard: (NSPasteboard*)pboard type: (NSString*)type;

Description forthcoming.

### readablePasteboardTypes

- (NSArray*) readablePasteboardTypes;

Description forthcoming.

### rulerView:didAddMarker:

- (void) rulerView: (NSRulerView*)ruler didAddMarker: (NSRulerMarker*)marker;

Description forthcoming.

### rulerView:didMoveMarker:

- (void) rulerView: (NSRulerView*)ruler didMoveMarker: (NSRulerMarker*)marker;

Mote movement of marker

### rulerView:didRemoveMarker:

- (void) rulerView: (NSRulerView*)ruler didRemoveMarker: (NSRulerMarker*)marker;

Handle removal of marker.

### rulerView:handleMouseDown:

- (void) rulerView: (NSRulerView*)ruler handleMouseDown: (NSEvent*)event;

Set new marker position from mouse down location.

### rulerView:shouldAddMarker:

- (BOOL) rulerView: (NSRulerView*)ruler shouldAddMarker: (NSRulerMarker*)marker;

Return `YES` if the marker should be added, `NO` otherwise.

### rulerView:shouldMoveMarker:

- (BOOL) rulerView: (NSRulerView*)ruler shouldMoveMarker: (NSRulerMarker*)marker;

Return `YES` if the marker should be moved, `NO` otherwise.

### rulerView:shouldRemoveMarker:

- (BOOL) rulerView: (NSRulerView*)ruler shouldRemoveMarker: (NSRulerMarker*)marker;

Return `YES` if the marker should be removed, `NO` otherwise.

### rulerView:willAddMarker:atLocation:

- (float) rulerView: (NSRulerView*)ruler willAddMarker: (NSRulerMarker*)marker atLocation: (float)location;

Return a position for adding by constraining the specified location.

### rulerView:willMoveMarker:toLocation:

- (float) rulerView: (NSRulerView*)ruler willMoveMarker: (NSRulerMarker*)marker toLocation: (float)location;

Return a new position by constraining the specified location.

### selectedRange

- (NSRange) selectedRange;

Description forthcoming.

### selectionAffinity

- (NSSelectionAffinity) selectionAffinity;

Description forthcoming.

### selectionGranularity

- (NSSelectionGranularity) selectionGranularity;

Description forthcoming.

### selectionRangeForProposedRange:granularity:

- (NSRange) selectionRangeForProposedRange: (NSRange)proposedCharRange granularity: (NSSelectionGranularity)gr;

Return a range of text which encompasses proposedCharRange but is extended (if necessary) to match the type of selection specified by gr.

### setNeedsDisplayInRect:avoidAdditionalLayout:

- (void) setNeedsDisplayInRect: (NSRect)rect avoidAdditionalLayout: (BOOL)flag;

Description forthcoming.

### setSelectedRange:

- (void) setSelectedRange: (NSRange)charRange;

Description forthcoming.

### setSelectedRange:affinity:stillSelecting:

- (void) setSelectedRange: (NSRange)charRange affinity: (NSSelectionAffinity)affinity stillSelecting: (BOOL)stillSelectingFlag;

Description forthcoming.

### setSelectionGranularity:

- (void) setSelectionGranularity: (NSSelectionGranularity)granularity;

Description forthcoming.

### setTypingAttributes:

- (void) setTypingAttributes: (NSDictionary*)attrs;

Description forthcoming.

### shouldDrawInsertionPoint

- (BOOL) shouldDrawInsertionPoint;

Description forthcoming.

### smartDeleteRangeForProposedRange:

- (NSRange) smartDeleteRangeForProposedRange: (NSRange)proposedCharRange;

Description forthcoming.

### smartInsertForString:replacingRange:beforeString:afterString:

- (void) smartInsertForString: (NSString*)aString replacingRange: (NSRange)charRange beforeString: (NSString**)beforeString afterString: (NSString**)afterString;

Description forthcoming.

### spellCheckerDocumentTag

- (int) spellCheckerDocumentTag;

Description forthcoming.

### typingAttributes

- (NSDictionary*) typingAttributes;

TODO: categorize

### updateDragTypeRegistration

- (void) updateDragTypeRegistration;

Description forthcoming.

### updateFontPanel

- (void) updateFontPanel;

Description forthcoming.

### updateInsertionPointStateAndRestartTimer:

- (void) updateInsertionPointStateAndRestartTimer: (BOOL)restartFlag;

Description forthcoming.

### updateRuler

- (void) updateRuler;

Description forthcoming.

### validRequestorForSendType:returnType:

- (id) validRequestorForSendType: (NSString*)sendType returnType: (NSString*)returnType;

Description forthcoming.

### writablePasteboardTypes

- (NSArray*) writablePasteboardTypes;

Description forthcoming.

### writeSelectionToPasteboard:type:

- (BOOL) writeSelectionToPasteboard: (NSPasteboard*)pboard type: (NSString*)type;

Description forthcoming.

### writeSelectionToPasteboard:types:

- (BOOL) writeSelectionToPasteboard: (NSPasteboard*)pboard types: (NSArray*)types;

Description forthcoming.

# Software documentation for the NSTextView(user_actions) category

## NSTextView(user_actions)

> Declared in:
>   AppKit/NSTextView.h

> Standards:
> - MacOS-X
> - OpenStep
> - GNUstep

Description forthcoming.

Method summary

- -alignJustified:
- -loosenKerning:
- -lowerBaseline:
- -raiseBaseline:
- -tightenKerning:
- -toggleContinuousSpellChecking:
- -toggleTraditionalCharacterShape:
- -transpose:
- -turnOffKerning:
- -turnOffLigatures:
- -useAllLigatures:
- -useStandardKerning:
- -useStandardLigatures:

### alignJustified:

- (void) alignJustified: (id)sender;

Description forthcoming.

### loosenKerning:

- (void) loosenKerning: (id)sender;

Description forthcoming.

### lowerBaseline:

- (void) lowerBaseline: (id)sender;

Description forthcoming.

### raiseBaseline:

- (void) raiseBaseline: (id)sender;

Description forthcoming.

### tightenKerning:

- (void) tightenKerning: (id)sender;

Description forthcoming.

### toggleContinuousSpellChecking:

- (void) toggleContinuousSpellChecking: (id)sender;

Description forthcoming.

### toggleTraditionalCharacterShape:

- (void) toggleTraditionalCharacterShape: (id)sender;

Description forthcoming.

### transpose:

- (void) transpose: (id)sender;

Description forthcoming.

### turnOffKerning:

- (void) turnOffKerning: (id)sender;

Description forthcoming.

### turnOffLigatures:

- (void) turnOffLigatures: (id)sender;

Description forthcoming.

### useAllLigatures:

- (void) useAllLigatures: (id)sender;

Description forthcoming.

### useStandardKerning:

- (void) useStandardKerning: (id)sender;

Description forthcoming.

### useStandardLigatures:

- (void) useStandardLigatures: (id)sender;

Description forthcoming.

Up