Inherits from: NSView : NSResponder : NSObject
Conforms to: NSCoding
(NSResponder)
NSObject (NSObject)
Declared in: AppKit/NSClipView.h
Interface Builder | |
- initWithFrame: | Initializes 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 NO
.
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:
- (BOOL)acceptsFirstResponder
NO
.See Also: - documentView, - acceptsFirstResponder (NSResponder)
- (BOOL)autoscroll:(NSEvent
*)theEvent
YES
if
any scrolling is performed; otherwise returns NO
.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.
- (NSColor *)backgroundColor
See Also: - setBackgroundColor:
- (BOOL)becomeFirstResponder
NSSelectingPrevious
,
attempts to make the document view the first responder. If the direction
is NSSelectingPrevious
, attempts
to make the receiver's previous key view (typically the containing
NSScrollView) the first responder. Returns YES
if
successful and NO
otherwiseSee Also: - becomeFirstResponder (NSResponder), - makeFirstResponder: (NSWindow) - keyViewSelectionDirection (NSWindow)
- (NSPoint)constrainScrollPoint:(NSPoint)proposedNewOrigin
See Also: - scrollToPoint:
- (BOOL)copiesOnScroll
YES
if
the receiver copies its existing rendered image while scrolling (only
drawing exposed portions of its document view), NO
if
it forces its contents to be redrawn each time.See Also: - setCopiesOnScroll:
- (NSCursor *)documentCursor
See Also: - setDocumentCursor:
- (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
- (id)documentView
See Also: - setDocumentView:
- (NSRect)documentVisibleRect
See Also: - documentRect
- (BOOL)isFlipped
YES
if
the document view is flipped, NO
if
it isn't.See Also: - isFlipped (NSView)
- (void)rotateByAngle:(float)angle
- (void)scaleUnitSquareToSize:(NSSize)newUnitSize
- (void)scrollToPoint:(NSPoint)newOrigin
See Also: - constrainScrollPoint:
- (void)setBackgroundColor:(NSColor
*)aColor
See Also: - backgroundColor
- (void)setBoundsOrigin:(NSPoint)aPoint
- (void)setBoundsRotation:(float)angle
- (void)setBoundsSize:(NSSize)aSize
- (void)setCopiesOnScroll:(BOOL)flag
YES
,
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 NO
, the
receiver always forces its document view to draw itself on scrolling.See Also: - copiesOnScroll
- (void)setDocumentCursor:(NSCursor
*)aCursor
See Also: - documentCursor
- (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
- (void)setFrameOrigin:(NSPoint)aPoint
- (void)setFrameRotation:(float)angle
- (void)setFrameSize:(NSSize)aSize
- (void)setNextKeyView:(NSView
*)aView
See Also: - setNextKeyView: (NSView)
- (void)translateOriginToPoint:(NSPoint)aPoint
- (void)viewBoundsChanged:(NSNotification
*)aNotification
- (void)viewFrameChanged:(NSNotification
*)aNotification