Up
Authors
- Ovidiu Predescu (
ovidiu@net-community.com)
-
- Richard Frith-Macdonald (
richard@brainstorm.co.uk)
-
Date: Generated at 2025-12-03
Copyright: (C) 1996 Free Software Foundation, Inc.
- Declared in:
- AppKit/NSClipView.h
Availability: OpenStep
NSClipView provides the clipping functionality for
scroll views by managing a document view within a
constrained visible area. This class serves as an
intermediary between the scroll view and the
content being displayed, handling the translation and
clipping of the document view to show only the
portion that should be visible within the scrollable
area. It manages scrolling operations, coordinate
transformations, and optimizations for
efficient redrawing during scroll operations.
NSClipView declares 6 Instance Variables
- (BOOL)
autoscroll: (
NSEvent*)theEvent;
Availability: OpenStep
Handles automatic scrolling during drag operations
or other continuous user interactions. When the event
location is near the edges of the clip view, this
method automatically scrolls in the appropriate
direction to reveal content beyond the current
visible area. Returns whether scrolling occurred as
a result of the event.
Scrolls in response to mouse-dragged events.
- (
NSColor*)
backgroundColor;
Availability: OpenStep
Returns the background color currently used for
areas not covered by the document view. The
background color fills empty space within the
clip view bounds, providing a consistent appearance
when the document is smaller than the visible area or
contains transparent regions that allow the
background to show through.
Returns the NSClipView's background color
See Also:
-setBackgroundColor:
- (
NSPoint)
constrainScrollPoint: (
NSPoint)proposedNewOrigin;
Availability: OpenStep
Adjusts the proposed scroll origin to ensure it
remains within valid bounds for the current
document and clip view configuration. This method
prevents scrolling beyond the document boundaries
and ensures that the visible area never extends outside
the document content when possible. Returns the
constrained point that should be used for
scrolling.
- (BOOL)
copiesOnScroll;
Availability: OpenStep
Returns whether the clip view is currently using
copying optimization for scroll operations. Copying
on scroll can significantly improve performance by
reusing existing pixel data for overlapping areas,
but may not be appropriate for all types of document
content or rendering situations that require
complete redrawing.
- (
NSCursor*)
documentCursor;
Availability: OpenStep
Returns the cursor that is currently set for
display over the document view. The document cursor
indicates the type of interaction available when
the mouse is positioned over the document content
within the clip view. Returns
nil if no
specific document cursor has been set, in which
case the default cursor behavior applies.
Returns the cursor of the document view
See Also:
-setDocumentCursor:
- (
NSRect)
documentRect;
Availability: OpenStep
Returns the rectangle that encompasses the entire
document view in the clip view's coordinate
system. This represents the full bounds of the
document content, which may extend beyond the
currently visible area. The rectangle indicates
the total scrollable area available within the clip
view for the document.
Returns the document rectangle.
See Also:
-documentVisibleRect
- (id)
documentView;
Availability: OpenStep
Returns the view that is currently set as the
document view being clipped and displayed. The
document view contains the actual content that
users interact with, while this clip view handles the
scrolling and visible area management. Returns
nil if no document view is currently
set for this clip view.
Returns the NSClipView's document view.
See Also:
-setDocumentView:
- (
NSRect)
documentVisibleRect;
Availability: OpenStep
Returns the rectangle representing the currently
visible portion of the document view in the
document's own coordinate system. This indicates
which part of the document content is actually
displayed within the clip view's bounds, useful
for determining what content needs to be drawn or
updated during scroll operations.
Returns the document visible rectangle in the
document views coordinate system.
See Also:
-documentRect
[NSView -convertRect:toView:]
- (BOOL)
drawsBackground;
Availability: MacOS-X 10.0.0
Returns whether the clip view is currently set to
draw its background color. When background drawing is
enabled, the clip view fills areas not occupied by
the document view with the background color. When
disabled, these areas remain transparent,
creating different visual effects depending on the
surrounding interface elements.
- (void)
scrollToPoint: (
NSPoint)aPoint;
Availability: OpenStep
Scrolls the document view so that the specified
point becomes the origin of the visible area within
the clip view. The point coordinates are in the
document view's coordinate system, allowing
precise control over which portion of the document
content is displayed. The actual scroll position
may be constrained by the document and clip view
bounds.
- (void)
setBackgroundColor: (
NSColor*)aColor;
Availability: OpenStep
Sets the background color that will be displayed in
areas of the clip view not covered by the document
view. This color is visible when the document is
smaller than the clip view bounds or when
transparent areas exist in the document
content. The background color provides visual
consistency for the scrollable area.
Sets the NSClipView's background color to
aColor and marks self for display. Sets
the opaque flag if needed (to YES if the
NSClipView does not draw its background, if
the background color is nil or if the
background color alpha component is less than
1.0, NO otherwise)
See Also:
-backgroundColor
[NSView -isOpaque]
- (void)
setCopiesOnScroll: (BOOL)flag;
Availability: OpenStep
Sets whether the clip view should use copying
optimization during scroll operations. When
enabled, the clip view copies pixel data from
overlapping areas during scrolling to reduce
the amount of redrawing required, improving performance
for large document views. When disabled, the entire
visible area is redrawn on each scroll.
- (void)
setDocumentCursor: (
NSCursor*)aCursor;
Availability: OpenStep
Sets the cursor that should be displayed when the
mouse is over the document view within this clip
view. The document cursor provides visual feedback to
users about the type of interaction available with
the document content, such as text editing, resizing,
or other context-specific operations. Pass
nil to use the default cursor.
Sets the cursor for the document view to
aCursor
See Also:
-documentCursor
- (void)
setDocumentView: (
NSView*)aView;
Availability: OpenStep
Sets the view that will be displayed and clipped
within this clip view. The document view is the
content that users scroll through, and this clip
view manages showing only the visible portion. The
document view can be larger than the clip view's
bounds, with scrolling revealing different portions
of the content. Pass
nil to remove the
current document view from the clip view.
Sets aView the NSClipView's document view
to aView
See Also:
-documentView
- (void)
setDrawsBackground: (BOOL)flag;
Availability: MacOS-X 10.0.0
Sets whether the clip view should draw its background
color in areas not covered by the document view. When
enabled, the background color fills empty space
within the clip view bounds. When disabled, those
areas remain transparent, allowing views behind the
clip view to show through, which can be useful for
layered interface designs.
Instance Variables for NSClipView Class
@protected NSColor*
_backgroundColor;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected BOOL
_copiesOnScroll;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected NSCursor*
_cursor;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected NSView*
_documentView;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected BOOL
_drawsBackground;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected BOOL
_isOpaque;
Availability: OpenStep
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
Up