Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSClipView

Inherits From:	NSView : NSResponder : NSObject

Conforms To:	NSCoding (NSResponder)
NSObject (NSObject)

Declared In:	AppKit/NSClipView.h

Class Description

An NSClipView object lets you scroll a document that may be larger than the NSClipView's frame rectangle, clipping the visible portion of the document to the frame. You don't normally use the NSClipView class directly; it's provided primarily as the scrolling machinery for the NSScrollView class. However, you might use the NSClipView class to implement a class similar to NSScrollView. 

The document, which must be an NSView, is called the NSClipView's document view. An NSClipView's document view, which is set through the setDocumentView: method, is the NSClipView's only subview. You can set the cursor that's displayed when the mouse enters an NSClipView's frame (in other words, when it's poised over the document view) through the setDocumentCursor: method. 

When the NSClipView is instructed to scroll its document view, it normally copies that portion of the document view that's visible both before and after the scrolling, so that this part won't need to be redrawn from scratch. However, you can turn off this behavior and force the entire visible area to be redrawn by sending the NSClipView a setCopiesOnScroll:NO message. 

After scrolling, the NSClipView sends itself a setNeedsDisplayInRect: message to indicate that some part of the document view should be displayed again. The argument to this message is the freshly exposed area of the document view, unless the NSClipView received a setCopiesOnScroll:NO message, in which case the argument is the entire visible area.

The NSClipView sends its superview (usually an NSScrollView) a reflectScrolledClipView: message whenever the relationship between the NSClipView and the document view has changed. This allows the superview to update itself to reflect the changeÐfor example, the NSScrollView class uses this method to change the position of its scrollers when the user causes the document to autoscroll. 

Managing the Document View 

- (NSRect)documentRect	Returns the document rectangle.

- (id)documentView	Returns the NSClipView's document view. 

- (NSRect)documentVisibleRect	Gets the visible portion of the document view.

- (void)setDocumentView:(NSView *)aView	Makes aView the NSClipView's document view.

Setting the Cursor 

-(NSCursor *)documentCursor	Returns the cursor for the document view. 

- (void)setDocumentCursor:(NSCursor *)anObject	Sets the cursor for the document view.

Setting the Background Color

- (NSColor *)backgroundColor	Returns the NSClipView's background color.

- (void)setBackgroundColor:(NSColor *)color	Sets the NSClipView's background color. 

Scrolling 

- (BOOL)autoscroll:(NSEvent *)theEvent	Scrolls in response to mouse-dragged events.

- (NSPoint)constrainScrollPoint:(NSPoint)newOrigin
	Prevents scrolling to an undesirable position.

- (BOOL)copiesOnScroll	Indicates whether the visible portions of the document view are copied when scrolling occurs. If not, the document view is responsible for redrawing the entire visible portion. The default is YES.

- (void)scrollToPoint:(NSPoint)newOrigin	Lowest-level unconstrained scrolling routine. 

- (void)setCopiesOnScroll:(BOOL)flag	Sets how the visible areas are redrawn.

Responding to a Changed Frame

- (void)viewFrameChanged:(NSNotification *)notification
	Notification that the document view's frame has changed.