Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights Reserved.


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

Laying Out the NSScrollView

Managing Component Views

Modifying Graphic Attributes

Setting Scrolling Behavior

Managing the Cursor