Copyright ©1995 by NeXT Computer, Inc. All Rights Reserved.
ScrollView |
Inherits From: | View : Responder : Object | |
Declared In: | appkit/ScrollView.h |
Class Description |
A ScrollView object lets the user interact with a document that's too large to be shown in its entirety within a View and must therefore be scrolled. The responsibility of a ScrollView is to coordinate scrolling behavior between Scroller objects and a ClipView object. Thus, the user may drag the knob of a Scroller and the ScrollView will send a message to its ClipView 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 ScrollView will send a message to the Scrollers advising them of this change.
The ScrollView has at least one subview (a ClipView 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 a ScrollView is created, it has neither a vertical nor a horizontal scroller. If Scrollers are required, the application must send setVertScrollerRequired:YES and setHorizScrollerRequired:YES messages to the ScrollView; the content view is resized to fill the area of the ScrollView not occupied by the Scrollers. When the application modifies the scroll position within the document, it should send a reflectScroll: message to the ScrollView, which will then query the content view and set the Scroller(s) accordingly. The reflectScroll: message may also cause the ScrollView to enable or disable the Scrollers as required. |
Instance Variables |
id vScroller;
id hScroller; id contentView; float pageContext; float lineAmount; |
vScroller | The vertical scroller. | |
hScroller | The horizontal scroller. | |
contentView | The content view. | |
pageContext | The amount from the previous page remaining in the content view after a page scroll. | |
lineAmount | The number of units to scroll for a line scroll. |
Method Types |
Initializing a ScrollView | initFrame: | |
Determining component sizes | getContentSize: |
getDocVisibleRect: |
Laying out the ScrollView | + getContentSize:forFrameSize:horizScroller: vertScroller:borderType: |
+ getFrameSize:forContentSize:horizScroller: vertScroller:borderType: resizeSubviews: setHorizScrollerRequired: setVertScrollerRequired: tile |
Managing component Views | setDocView: |
docView setHorizScroller: horizScroller setVertScroller: vertScroller reflectScroll: |
Modifying graphic attributes | setBorderType: |
borderType setBackgroundGray: backgroundGray setBackgroundColor: backgroundColor |
Setting scrolling behavior | setCopyOnScroll: |
setDisplayOnScroll: setDynamicScrolling: setLineScroll: setPageScroll: |
Displaying | drawSelf:: | |
Managing the cursor | setDocCursor: | |
Archiving | read: |
write: |
Class Methods |
getContentSize:forFrameSize:horizScroller:vertScroller:borderType: |
+ getContentSize:(NXSize *)cSize |
forFrameSize:(const NXSize *)fSize horizScroller:(BOOL)hFlag vertScroller:(BOOL)vFlag borderType:(int)aType |
Calculates the size of a content view for a ScrollView with frame size fSize. hFlag is YES if the ScrollView has a horizontal scroller, and vFlag is YES if it has a vertical scroller. aType indicates whether there's a line, a bezel, or no border around the frame of the ScrollView, and is NX_LINE, NX_BEZEL, or NX_NOBORDER. The content view size is placed in the structure specified by csize. If the ScrollView object already exists, you can send it a getContentSize: message to get the size of its content view. Returns self.
See also: + getFrameSize:forContentSize:..., getContentSize: |
getFrameSize:forContentSize:horizScroller:vertScroller:borderType: |
+ getFrameSize:(NXSize *)fSize |
forContentSize:(const NXSize *)cSize horizScroller:(BOOL)hFlag vertScroller:(BOOL)vFlag borderType:(int)aType |
Calculates the size of the frame required for a ScrollView with a content view size cSize. The calculated frame size is placed in the structure specified by fSize. hFlag is YES if the ScrollView has a horizontal scroller, and vFlag is YES if it has a vertical scroller. aType indicates whether there's a line, a bezel, or no border around the frame of the ScrollView, and is NX_LINE, NX_BEZEL, or NX_NOBORDER. Returns self.
See also: + getContentSize:forFrameSize:..., getContentSize: |
Instance Methods |
backgroundColor |
(NXColor)backgroundColor |
Returns the color of the content view's background.
See also: setBackgroundColor:, backgroundGray, backgroundColor (ClipView) |
backgroundGray |
(float)backgroundGray |
Returns the gray value of the content view's background.
See also: setBackgroundGray:, backgroundColor, backgroundGray (ClipView) |
borderType |
(int)borderType |
Returns a value that represents the type of border surrounding the ScrollView, one of NX_NOBORDER, NX_LINE, NX_BEZEL, or NX_GROOVE.
See also: setBorderType: |
docView |
docView |
Returns the current document view.
See also: setDocView:, docView (ClipView) |
drawSelf:: |
drawSelf:(const NXRect *)rects :(int)rectCount |
Draws the ScrollView, but not its subviews. Returns self.
See also: borderType, display::: (View) |
getContentSize: |
getContentSize:(NXSize *)theSize |
Places the size of the ScrollView's content view in the structure specified by theSize. theSize is specified in the coordinates of the ScrollView's superview. Returns self.
See also: + getContentSize:forFrameSize:horizScroller:vertScroller:borderType: |
getDocVisibleRect: |
getDocVisibleRect:(NXRect *)aRect |
Gets the visible portion of the document view by forwarding this message to the content view. Returns the value returned by the forwarded message.
See also: getDocVisibleRect: (ClipView), getVisibleRect: (View) |
horizScroller |
horizScroller |
Returns the horizontal scroller, a Scroller object.
See also: vertScroller |
initFrame: |
initFrame:(const NXRect *)frameRect |
Initializes the ScrollView. The ScrollView's frame rectangle is made equivalent to that pointed to by frameRect, which is expressed in the ScrollView's superview's coordinates. This method installs a ClipView as the content view. Clipping is turned off (the ScrollView relies on the content view for clipping), opacity is set to YES, and autoresizing is set to YES. When created, the ScrollView has no Scrollers, and its content view fills its bounds rectangle. This method is the designated initializer for the ScrollView class, and can be used to initialize a ScrollView allocated from your own zone. Returns self.
See also: setHorizScrollerRequired:, setVertScrollerRequired:, setLineScroll:, setPageScroll: |
read: |
read:(NXTypedStream *)stream |
Reads the ScrollView from the typed stream stream. This method reads the ScrollView, its scrollers, and its content view, which in turn causes the content view's document view to be read. Returns self.
See also: write: |
reflectScroll: |
reflectScroll:cView |
Moves, resizes, or disables the Scrollers when the document is autoscrolled or changes size. Returns self. |
resizeSubviews: |
resizeSubviews:(const NXSize *)oldSize |
Overrides View's resizeSubviews: to retile the ScrollView. This method is invoked when the ScrollView receives a sizeTo:: message. Returns self.
See also: tile |
setBackgroundColor: |
setBackgroundColor:(NXColor)color |
Sets the color of the content view's background. This color is used to paint areas inside the content view that aren't covered by the document view. Returns the content view.
See also: backgroundColor, setBackgroundGray:, setBackgroundColor: (ClipView) |
setBackgroundGray: |
setBackgroundGray:(float)value |
Sets the gray value of the content view's background. This gray is used to paint areas inside of the content view that aren't covered by the document view. Returns the content view.
See also: backgroundGray, setBackgroundColor:, setBackgroundGray: (ClipView) |
setBorderType: |
setBorderType:(int)aType |
Determines the border type of the ScrollView. aType must be NX_NOBORDER, NX_LINE, or NX_BEZEL. The default is NX_NOBORDER. Returns self.
See also: borderType |
setCopyOnScroll: |
setCopyOnScroll:(BOOL)flag |
Determines whether the bits on the screen will be copied when scrolling occurs. This method simply invokes (and returns the value returned by) the content view's setCopyOnScroll: method.
See also: setCopyOnScroll: (ClipView) |
setDisplayOnScroll: |
setDisplayOnScroll:(BOOL)flag |
Determines whether the results of scrolling will be immediately displayed. This method simply invokes (and returns the value returned by) the content view's setDisplayOnScroll: method.
See also: setDisplayOnScroll: (ClipView), display (View), invalidate (View) |
setDocCursor: |
setDocCursor:anObj |
Sets the cursor to be used inside the content view. Returns the old cursor.
See also: setDocCursor: (ClipView) |
setDocView: |
setDocView:aView |
Attaches the document view. Returns the old document view, or nil if there was none.
See also: docView, setDocView: (ClipView) |
setDynamicScrolling: |
setDynamicScrolling:(BOOL)flag |
Determines whether dragging a scroller's knob will result in dynamic redisplay of the document. If flag is YES, scrolling will occur as the knob is dragged. If flag is NO, scrolling will occur only after the knob is released. By default, scrolling occurs as the knob is dragged. Returns self. |
setHorizScroller: |
setHorizScroller:anObject |
Sets the horizontal scroller to anObject (which should be an instance of a subclass of Scroller). This method sets the target of anObject to the ScrollView and sets anObject's action to the ScrollView's private method that responds to the Scrollers and invokes the appropriate scrolling behavior. To make the scroller visible, you must send a setHorizScrollerRequired:YES message to the ScrollView. Returns the old scroller.
See also: setVertScroller: |
setHorizScrollerRequired: |
setHorizScrollerRequired:(BOOL)flag |
Adds or removes a horizontal scroller for the ScrollView. If flag is YES, the ScrollView creates a new Scroller and shrinks its other subviews to accommodate it. If flag is NO, the Scroller is removed from the ScrollView and the other subviews are resized to fill the ScrollView. When a ScrollView is created, it doesn't have a horizontal scroller. Once a Scroller is added, it will be enabled and disabled automatically by the ScrollView. This method retiles and redisplays the ScrollView. Returns self.
See also: tile |
setLineScroll: |
setLineScroll:(float)value |
Sets the amount to scroll the document view when the ScrollView receives a message to scroll one line. value is expressed in the content view's coordinates. Returns self.
See also: setPageScroll: |
setPageScroll: |
setPageScroll:(float)value |
Sets the amount to scroll the document view when the ScrollView receives a message to scroll one page. value is the amount common to the content view before and after the page scroll and is expressed in the content view's coordinates. Therefore, setting value to 0.0 implies that the entire content view is replaced when a page scroll occurs. Returns self.
See also: setLineScroll: |
setVertScroller: |
setVertScroller:anObject |
Sets the vertical scroller to anObject (which should be an instance of a subclass of Scroller). This method sets the target of anObject to the ScrollView and sets anObject's action to the ScrollView's private method that responds to the Scrollers and invokes the appropriate scrolling behavior. To make the scroller visible, you must send a setVertScrollerRequired:YES message to the ScrollView. Returns the old scroller.
See also: setHorizScroller: |
setVertScrollerRequired: |
setVertScrollerRequired:(BOOL)flag |
Adds or removes a vertical scroller to the ScrollView. If flag is YES, the ScrollView creates a new Scroller and shrinks its other subviews to accommodate it. If flag is NO, the Scroller is removed from the ScrollView and the other subviews are resized to fill the ScrollView. When a ScrollView is created, it doesn't have a vertical scroller. Once a Scroller is added, it will be enabled and disabled automatically by the ScrollView. This method retiles and redisplays the ScrollView. Returns self.
See also: tile |
tile |
tile |
Determines the layout of the ScrollView by setting the sizes and locations of the object's subviews. You rarely send a tile message directly; you may override it if you need to have the ScrollView manage additional views. A tile message is sent whenever the ScrollView is resized, or a vertical or horizontal scroller is added or removed. This method doesn't redisplay the ScrollView. Returns self.
See also: setVertScrollerRequired:, setHorizScrollerRequired:, resizeSubviews: |
vertScroller |
vertScroller |
Returns the vertical scroller, a Scroller object.
See also: horizScroller |
write: |
write:(NXTypedStream *)stream |
Writes the ScrollView to the typed stream stream. This method writes the ScrollView, its scrollers, and its content view, which in turn causes the content view's document view to be written. Returns self.
See also: read: |