NSTextContainer Mac OS X 10.0

This class is responsible for defining a region in which text will be laid out. The class NSLayoutManager manages a set of NSTextContainer objects and controls how text should fill these text containers. An NSTextContainer object, in turn, owns an instance of NSTextView that is responsible for putting the text up on screen. The default implementation of NSTextContainer defines a rectangular region of text; however, subclasses may be implemented to provide irregular shaped regions for text. In terms of the Model-View-Controller pattern, NSTextStorage is the model, NSTextView is the view, and NSLayoutManager and NSTextContainer serve as controllers between the data layer and the view layer. For more information on Cocoa's text layout engine, see Chapter 5.


@interface NSTextContainer : NSObject <NSCoding>
 // Initializers
   - (id)initWithContainerSize:(NSSize)size;
 // Accessor Methods
   - (void)setLineFragmentPadding:(float)pad;
   - (float)lineFragmentPadding;
   - (void)setLayoutManager:(NSLayoutManager *)layoutManager;
   - (NSLayoutManager *)layoutManager;
   - (void)setHeightTracksTextView:(BOOL)flag;
   - (BOOL)heightTracksTextView;
   - (void)setWidthTracksTextView:(BOOL)flag;
   - (BOOL)widthTracksTextView;
   - (void)setTextView:(NSTextView *)textView;
   - (NSTextView *)textView;
   - (void)setContainerSize:(NSSize)size;
   - (NSSize)containerSize;
 // Instance Methods
   - (BOOL)containsPoint:(NSPoint)point;
   - (BOOL)isSimpleRectangularTextContainer;
   - (NSRect)lineFragmentRectForProposedRect:(NSRect)proposedRect
        movementDirection:(NSLineMovementDirection)movementDirection remainingRect:(NSRectPointer)remainingRect;
   - (void)replaceLayoutManager:(NSLayoutManager *)newLayoutManager;
 // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;

    Part II: API Quick Reference
    Chapter 13. Foundation Classes