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

NSScrollView 

Inherits From:	NSView : NSResponder : NSObject

Conforms To:	NSCoding (NSResponder)
NSObject (NSObject)

Declared In:	AppKit/NSScrollView.h 

Class Description

An NSScrollView object lets the user interact with a document that's too large to be shown in its entirety within an NSView and must therefore be scrolled. The responsibility of an NSScrollView is to coordinate scrolling behavior between NSScroller objects and a NSClipView object. Thus, the user may drag the knob of an NSScroller and the NSScrollView will send a message to its NSClipView to ensure that the viewed portion of the document reflects the position of the knob. Similarly, the application can change the viewed position within a document and the NSScrollView will send a message to the NSScrollers advising them of this change.

The NSScrollView has at least one subview (an NSClipView object), which is called the content view. The content view in turn has a subview called the document view, which is the view to be scrolled. When an NSScrollView is created, it has neither a vertical nor a horizontal scroller. If NSScrollers are required, the application must send setHasHorizontalScroller:YES and setHasVerticalScroller:YES messages to the NSScrollView; the content view is resized to fill the area of the NSScrollView not occupied by the NSScrollers. 

When the application modifies the scroll position within the document, it should send a reflectScrolledClipView: message to the NSScrollView, which will then query the content view and set the NSScroller(s) accordingly. The reflectScrolledClipView: message may also cause the NSScrollView to enable or disable the NSScrollers as required.

Determining Component Sizes 

- (NSSize)contentSize	Gets the content view's size. 

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

Laying Out the NSScrollView 

+ (NSSize)contentSizeForFrameSize:(NSSize)size	 Gets the content view size for the given NSScrollView 
hasHorizontalScroller:(BOOL)horizFlag	 	frame size.
hasVerticalScroller:(BOOL)vertFlag	 
borderType:(NSBorderType)aType	 

+ (NSSize)frameSizeForContentSize:(NSSize)size	 Gets the NSScrollView frame size for the given content 
hasHorizontalScroller:(BOOL)horizFlag	 	view size.
hasVerticalScroller:(BOOL)vertFlag	 
borderType:(NSBorderType)aType	 

- (void)setHasHorizontalScroller:(BOOL)flag	Instructs the NSScrollView whether to create and use a horizontal scroller. 

- (BOOL)hasHorizontalScroller	Returns YES if the NSScrollView object has a horizontal scroller.

- (void)setHasVerticalScroller:(BOOL)flag	Instructs the NSScrollView whether to create and use a vertical scroller. 

- (BOOL)hasVerticalScroller	Returns YES if the NSScrollView object has a vertical scroller.

- (void)tile	Retiles the scrollers and content view. 

- (void)toggleRuler:(id)sender	Makes the ruler visible or invisible, whichever is the opposite of its current state.

- (BOOL)isRulerVisible	Returns whether the ruler is visible in the NSScrollView.

Managing Component Views 

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

- (id)documentView	Returns the current document view. 

- (void)setHorizontalScroller:(NSScroller *)anObject	
	Sets the horizontal NSScroller object. 

- (NSScroller *)horizontalScroller	Returns the horizontal NSScroller object.

- (void)setVerticalScroller:(NSScroller *)anObject	Sets the vertical NSScroller object.

- (NSScroller *)verticalScroller	Returns the vertical NSScroller object.

- (void)reflectScrolledClipView:(NSClipView *)cView	 
	Moves the scrollers to reflect change in the coordinates of the clip view.

Modifying Graphic Attributes 

- (void)setBorderType:(NSBorderType)aType	Sets the border type of the NSScrollView. 

- (NSBorderType)borderType	Returns the border type. 

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

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

Setting Scrolling Behavior 

- (float)lineScroll	Returns the amount scrolled when scrolling a line. (The return value is expressed in units of the NSScrollView's coordinate system.)

- (float)pageScroll	Returns the amount scrolled when scrolling a page. (The return value is expressed in units of the NSScrollView's coordinate system.)

- (void)setScrollsDynamically:(BOOL)flag	Sets how the document view is displayed during scrolling.

- (BOOL)scrollsDynamically	Returns whether the NSScrollView scrolls dynamically.

- (void)setLineScroll:(float)value	Sets the amount to scroll when scrolling a line. 

- (void)setPageScroll:(float)value	Sets the amount of overlap for a page scroll. 

Managing the Cursor 

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