Inherits from: NSView : NSResponder : NSObject
Package: com.apple.yellow.application.NSClipView
Interface Builder | |
Constructor | Creates the NSClipView. |
setDocumentView | Sets the view scrolled within the NSClipView. |
setCopiesOnScroll: | Sets whether the NSClipView copies drawn portions of the document view during scrolling. |
An NSClipView holds the document view of an NSScrollView, clipping the document view to its frame, handling the details of scrolling in an efficient manner, and updating the NSScrollView when the document view's size or position changes. 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.
When an NSClipView is instructed to scroll its document view,
it copies as much of the already-drawn document view as possible.
This allows for efficient scrolling by obviating the need to redraw
large portions of the document view. The NSClipView then sends its
document view a setNeedsDisplayInRect: message to
mark as invalid the newly exposed region(s) of the document view.
If copying drawn areas is inappropriate for your needs, you can
turn it off by sending the NSClipView a setCopiesOnScroll: message with an
argument of false
.
In addition to performing the details of scrolling, an NSClipView monitors its document view and 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, an NSScrollView uses this method to change the position of its scrollers when the user causes the document view to autoscroll or when the document view's size changes.
- Setting the document view
- setDocumentView
- documentView
- Scrolling
- scrollToPoint
- autoscroll
- constrainScrollPoint
- Determining scrolling efficiency
- setCopiesOnScroll:
- copiesOnScroll
- Getting the visible portion
- documentRect
- documentVisibleRect
- Setting the document cursor
- setDocumentCursor
- documentCursor
- Setting the background color
- setBackgroundColor
- backgroundColor
- Overridden NSView methods
- acceptsFirstResponder
- becomeFirstResponder
- isFlipped
- rotateByAngle:
- scaleUnitSquareToSize:
- setBoundsOrigin:
- setBoundsRotation:
- setBoundsSize:
- setFrameSize:
- setFrameOrigin:
- setFrameRotation:
- setNextKeyView:
- translateOriginToPoint:
- viewBoundsChanged
- viewFrameChanged
public NSClipView(NSRect aRect)
public boolean autoscroll(NSEvent theEvent)
true
if
any scrolling is performed; otherwise returns false
.Never invoke this method directly; instead, the NSClipView's document view should repeatedly send itself autoscroll: messages when the mouse is dragged outside the NSClipView's frame during a modal event loop initiated by a mouse-down event. The NSView class implements autoscroll: to forward the message to the receiver's superview; thus the message is ultimately forwarded to the NSClipView.
public NSColor backgroundColor()
See Also: setBackgroundColor
public NSPoint constrainScrollPoint(NSPoint proposedNewOrigin)
See Also: scrollToPoint
public boolean copiesOnScroll()
true
if
the receiver copies its existing rendered image while scrolling (only
drawing exposed portions of its document view), false
if
it forces its contents to be redrawn each time.See Also: setCopiesOnScroll:
public NSCursor documentCursor()
See Also: setDocumentCursor
public NSRect documentRect()
The document rectangle is used in conjunction with an NSClipView's bounds rectangle to determine values for the indicators of relative position and size between the NSClipView and its document view. For example, NSScrollView uses these rectangles to set the size and position of the knobs in its scrollers. When the document view is much larger than the NSClipView, the knob is small; when the document view is near the same size, the knob is large; and when the document view is the same size or smaller, there is no knob.
See Also: - reflectScrolledClipView: (NSScrollView), documentVisibleRect
public NSView documentView()
See Also: setDocumentView
public NSRect documentVisibleRect()
See Also: documentRect
public void scrollToPoint(NSPoint newOrigin)
See Also: constrainScrollPoint
public void setBackgroundColor(NSColor aColor)
See Also: backgroundColor
public void setCopiesOnScroll(boolean flag)
true
,
the receiver copies the existing rendered image to its new location
while scrolling, and only draws exposed portions of its document
view. If flag is false
,
the receiver always forces its document view to draw itself on scrolling.See Also: copiesOnScroll
public void setDocumentCursor(NSCursor aCursor)
See Also: documentCursor
public void setDocumentView(NSView aView)
In the process of setting the document view, this method registers the receiver for the notifications NSViewFrameDidChangeNotification and NSViewBoundsDidChangeNotification, adjusts the key view loop to include the new document view, and updates a parent NSScrollView's display if needed using reflectScrolledClipView:.
See Also: documentView
public void viewBoundsChanged(NSNotification aNotification)
public void viewFrameChanged(NSNotification aNotification)