1997-08-05 21:50:10 +00:00
|
|
|
/*
|
1996-05-30 20:03:15 +00:00
|
|
|
NSClipView.m
|
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
Author: Ovidiu Predescu <ovidiu@net-community.com>
|
|
|
|
Date: July 1997
|
1999-02-19 20:31:07 +00:00
|
|
|
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|
|
|
Date: January 1999
|
1999-02-03 21:53:29 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
1999-02-03 21:53:29 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
1997-08-05 21:50:10 +00:00
|
|
|
License along with this library; if not, write to the Free
|
1999-09-09 02:56:20 +00:00
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
1997-08-05 21:50:10 +00:00
|
|
|
*/
|
|
|
|
|
1997-09-23 22:43:24 +00:00
|
|
|
#include <gnustep/gui/config.h>
|
1997-08-05 21:50:10 +00:00
|
|
|
#include <Foundation/NSNotification.h>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1997-02-18 00:29:25 +00:00
|
|
|
#include <AppKit/NSClipView.h>
|
1997-08-05 21:50:10 +00:00
|
|
|
#include <AppKit/NSCursor.h>
|
|
|
|
#include <AppKit/NSColor.h>
|
|
|
|
#include <AppKit/NSWindow.h>
|
|
|
|
#include <AppKit/NSGraphics.h>
|
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
@implementation NSClipView
|
|
|
|
|
1999-08-31 09:19:39 +00:00
|
|
|
- (id) init
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1997-08-05 21:50:10 +00:00
|
|
|
[super init];
|
1999-03-04 13:21:46 +00:00
|
|
|
[self setAutoresizesSubviews: YES];
|
1999-08-31 09:19:39 +00:00
|
|
|
[self setBackgroundColor: [NSColor controlColor]];
|
1999-02-11 14:56:30 +00:00
|
|
|
_copiesOnScroll = YES;
|
1997-08-05 21:50:10 +00:00
|
|
|
return self;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setDocumentView: (NSView*)aView
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-08 09:32:09 +00:00
|
|
|
NSNotificationCenter *nc;
|
|
|
|
|
1998-11-22 16:12:42 +00:00
|
|
|
if (_documentView == aView)
|
|
|
|
return;
|
1999-03-08 09:32:09 +00:00
|
|
|
|
|
|
|
nc = [NSNotificationCenter defaultCenter];
|
1997-08-05 21:50:10 +00:00
|
|
|
if (_documentView)
|
1999-03-08 09:32:09 +00:00
|
|
|
{
|
|
|
|
[nc removeObserver: self name: nil object: _documentView];
|
|
|
|
[_documentView removeFromSuperview];
|
|
|
|
}
|
1997-08-05 21:50:10 +00:00
|
|
|
|
|
|
|
ASSIGN(_documentView, aView);
|
1998-01-30 00:34:25 +00:00
|
|
|
|
1999-01-19 10:58:51 +00:00
|
|
|
if (_documentView)
|
|
|
|
{
|
|
|
|
NSRect df;
|
|
|
|
|
|
|
|
[self addSubview: _documentView];
|
|
|
|
|
|
|
|
df = [_documentView frame];
|
|
|
|
[self setBoundsOrigin: df.origin];
|
|
|
|
if ([aView respondsToSelector: @selector(backgroundColor)])
|
|
|
|
[self setBackgroundColor: [(id)aView backgroundColor]];
|
1998-01-30 00:34:25 +00:00
|
|
|
|
1999-01-19 10:58:51 +00:00
|
|
|
/* Register for notifications sent by the document view */
|
1999-03-04 13:21:46 +00:00
|
|
|
[_documentView setPostsFrameChangedNotifications: YES];
|
|
|
|
[_documentView setPostsBoundsChangedNotifications: YES];
|
|
|
|
|
1999-03-08 09:32:09 +00:00
|
|
|
[nc addObserver: self
|
|
|
|
selector: @selector(viewFrameChanged:)
|
|
|
|
name: NSViewFrameDidChangeNotification
|
|
|
|
object: _documentView];
|
|
|
|
[nc addObserver: self
|
|
|
|
selector: @selector(viewBoundsChanged:)
|
|
|
|
name: NSViewBoundsDidChangeNotification
|
|
|
|
object: _documentView];
|
1999-01-19 10:58:51 +00:00
|
|
|
}
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-05-07 20:08:51 +00:00
|
|
|
_rFlags.flipped_view = [self isFlipped];
|
|
|
|
|
1999-03-04 13:21:46 +00:00
|
|
|
/* TODO: invoke superview's reflectScrolledClipView: ? */
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) resetCursorRects
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
2000-01-10 02:04:25 +00:00
|
|
|
[self addCursorRect: _bounds cursor: _cursor];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
|
|
|
|
- (void) scrollToPoint: (NSPoint)point
|
1999-02-11 14:56:30 +00:00
|
|
|
{
|
|
|
|
[self setBoundsOrigin: [self constrainScrollPoint: point]];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setBoundsOrigin: (NSPoint)point
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
2000-01-10 02:04:25 +00:00
|
|
|
NSRect originalBounds = _bounds;
|
1999-02-03 21:53:29 +00:00
|
|
|
NSRect newBounds = originalBounds;
|
|
|
|
NSRect intersection;
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-02-11 14:56:30 +00:00
|
|
|
newBounds.origin = point;
|
1999-02-03 21:53:29 +00:00
|
|
|
|
|
|
|
if (NSEqualPoints(originalBounds.origin, newBounds.origin))
|
|
|
|
return;
|
|
|
|
|
1999-03-04 13:21:46 +00:00
|
|
|
if (_documentView == nil)
|
|
|
|
return;
|
|
|
|
|
2000-09-27 22:18:34 +00:00
|
|
|
if (_copiesOnScroll && _window && [_window gState])
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
2000-06-13 17:34:13 +00:00
|
|
|
// copy the portion of the view that is common before
|
|
|
|
// and after scrolling.
|
1999-02-03 21:53:29 +00:00
|
|
|
// then tell docview to draw the exposed parts.
|
|
|
|
// intersection is the common rectangle
|
|
|
|
intersection = NSIntersectionRect(originalBounds, newBounds);
|
|
|
|
if (NSEqualRects(intersection, NSZeroRect))
|
|
|
|
{
|
1999-02-04 19:23:45 +00:00
|
|
|
// no intersection -- docview should draw everything
|
1999-02-11 14:56:30 +00:00
|
|
|
[super setBoundsOrigin: newBounds.origin];
|
1999-03-04 13:21:46 +00:00
|
|
|
[_documentView setNeedsDisplayInRect:
|
1999-09-01 08:35:16 +00:00
|
|
|
[self convertRect: newBounds toView: _documentView]];
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NSPoint destPoint = intersection.origin;
|
|
|
|
float dx = newBounds.origin.x - originalBounds.origin.x;
|
|
|
|
float dy = newBounds.origin.y - originalBounds.origin.y;
|
1999-03-16 16:38:26 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
destPoint.x -= dx;
|
|
|
|
destPoint.y -= dy;
|
|
|
|
[self lockFocus];
|
|
|
|
NSCopyBits(0, intersection, destPoint);
|
|
|
|
[self unlockFocus];
|
|
|
|
|
1999-02-11 14:56:30 +00:00
|
|
|
[super setBoundsOrigin: newBounds.origin];
|
1999-02-03 21:53:29 +00:00
|
|
|
if (dx != 0)
|
|
|
|
{
|
|
|
|
// moved in x -- redraw a full-height rectangle at
|
|
|
|
// side of intersection
|
|
|
|
NSRect redrawRect;
|
|
|
|
|
|
|
|
redrawRect.origin.y = newBounds.origin.y;
|
|
|
|
redrawRect.size.height = newBounds.size.height;
|
|
|
|
redrawRect.size.width = newBounds.size.width
|
|
|
|
- intersection.size.width;
|
|
|
|
if (dx < 0)
|
|
|
|
{
|
|
|
|
// moved to the left -- redraw at left of intersection
|
|
|
|
redrawRect.origin.x = newBounds.origin.x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// moved to the right -- redraw at right of intersection
|
|
|
|
redrawRect.origin.x = newBounds.origin.x
|
|
|
|
+ intersection.size.width;
|
|
|
|
}
|
1999-03-04 13:21:46 +00:00
|
|
|
[_documentView setNeedsDisplayInRect:
|
1999-09-01 08:35:16 +00:00
|
|
|
[self convertRect: redrawRect toView: _documentView]];
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dy != 0)
|
|
|
|
{
|
|
|
|
// moved in y
|
|
|
|
// -- redraw rectangle with intersection's width over or under it
|
|
|
|
NSRect redrawRect;
|
|
|
|
|
|
|
|
redrawRect.origin.x = intersection.origin.x;
|
|
|
|
redrawRect.size.width = intersection.size.width;
|
|
|
|
redrawRect.size.height = newBounds.size.height
|
|
|
|
- intersection.size.height;
|
|
|
|
if (dy < 0)
|
|
|
|
{
|
|
|
|
// moved down -- redraw under intersection
|
|
|
|
redrawRect.origin.y = newBounds.origin.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// moved up -- redraw over intersection
|
|
|
|
redrawRect.origin.y = newBounds.origin.y
|
|
|
|
+ intersection.size.height;
|
|
|
|
}
|
1999-03-04 13:21:46 +00:00
|
|
|
[_documentView setNeedsDisplayInRect:
|
1999-09-01 08:35:16 +00:00
|
|
|
[self convertRect: redrawRect toView: _documentView]];
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1997-10-22 01:47:30 +00:00
|
|
|
else
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
// dont copy anything -- docview draws it all
|
1999-02-11 14:56:30 +00:00
|
|
|
[super setBoundsOrigin: newBounds.origin];
|
1999-03-04 13:21:46 +00:00
|
|
|
[_documentView setNeedsDisplayInRect:
|
1999-09-01 08:35:16 +00:00
|
|
|
[self convertRect: newBounds toView: _documentView]];
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (NSPoint) constrainScrollPoint: (NSPoint)proposedNewOrigin
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
NSRect documentFrame;
|
1999-01-19 10:58:51 +00:00
|
|
|
NSPoint new = proposedNewOrigin;
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-03-04 13:21:46 +00:00
|
|
|
if (_documentView == nil)
|
2000-01-10 02:04:25 +00:00
|
|
|
return _bounds.origin;
|
1999-03-04 13:21:46 +00:00
|
|
|
|
|
|
|
documentFrame = [_documentView frame];
|
2000-01-10 02:04:25 +00:00
|
|
|
if (documentFrame.size.width <= _bounds.size.width)
|
1999-02-03 21:53:29 +00:00
|
|
|
new.x = documentFrame.origin.x;
|
1999-01-19 10:58:51 +00:00
|
|
|
else if (proposedNewOrigin.x <= documentFrame.origin.x)
|
1997-08-05 21:50:10 +00:00
|
|
|
new.x = documentFrame.origin.x;
|
|
|
|
else if (proposedNewOrigin.x
|
2000-01-10 02:04:25 +00:00
|
|
|
>= documentFrame.size.width - _bounds.size.width)
|
|
|
|
new.x = documentFrame.size.width - _bounds.size.width;
|
1997-08-05 21:50:10 +00:00
|
|
|
|
2000-01-10 02:04:25 +00:00
|
|
|
if (documentFrame.size.height <= _bounds.size.height)
|
1999-02-10 13:22:23 +00:00
|
|
|
new.y = documentFrame.origin.y;
|
|
|
|
else if (proposedNewOrigin.y <= documentFrame.origin.y)
|
|
|
|
new.y = documentFrame.origin.y;
|
|
|
|
else if (proposedNewOrigin.y
|
2000-01-10 02:04:25 +00:00
|
|
|
>= documentFrame.size.height - _bounds.size.height)
|
|
|
|
new.y = documentFrame.size.height - _bounds.size.height;
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-02-11 14:56:30 +00:00
|
|
|
// make it an integer coordinate in device space
|
|
|
|
// to avoid some nice effects when scrolling
|
1999-03-04 13:21:46 +00:00
|
|
|
new = [self convertPoint: new toView: nil];
|
1999-02-11 14:56:30 +00:00
|
|
|
new.x = (int)new.x;
|
|
|
|
new.y = (int)new.y;
|
1999-03-04 13:21:46 +00:00
|
|
|
new = [self convertPoint: new fromView: nil];
|
1999-02-11 14:56:30 +00:00
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
return new;
|
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (NSRect) documentRect
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
NSRect documentFrame;
|
|
|
|
NSRect clipViewBounds;
|
1997-08-05 21:50:10 +00:00
|
|
|
NSRect rect;
|
|
|
|
|
1999-03-04 13:21:46 +00:00
|
|
|
if (_documentView == nil)
|
2000-01-10 02:04:25 +00:00
|
|
|
return _bounds;
|
1999-03-04 13:21:46 +00:00
|
|
|
|
|
|
|
documentFrame = [_documentView frame];
|
2000-01-10 02:04:25 +00:00
|
|
|
clipViewBounds = _bounds;
|
1997-08-05 21:50:10 +00:00
|
|
|
rect.origin = documentFrame.origin;
|
|
|
|
rect.size.width = MAX(documentFrame.size.width, clipViewBounds.size.width);
|
1999-03-04 13:21:46 +00:00
|
|
|
rect.size.height = MAX(documentFrame.size.height, clipViewBounds.size.height);
|
1997-08-05 21:50:10 +00:00
|
|
|
|
|
|
|
return rect;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (NSRect) documentVisibleRect
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
NSRect documentBounds;
|
|
|
|
NSRect clipViewBounds;
|
1997-08-05 21:50:10 +00:00
|
|
|
NSRect rect;
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-03-04 13:21:46 +00:00
|
|
|
if (_documentView == nil)
|
|
|
|
return NSZeroRect;
|
|
|
|
|
|
|
|
documentBounds = [_documentView bounds];
|
2000-01-10 02:04:25 +00:00
|
|
|
clipViewBounds = [self convertRect: _bounds toView: _documentView];
|
1999-03-08 09:32:09 +00:00
|
|
|
rect = NSIntersectionRect(documentBounds, clipViewBounds);
|
1997-08-05 21:50:10 +00:00
|
|
|
|
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) drawRect: (NSRect)rect
|
1999-01-19 10:58:51 +00:00
|
|
|
{
|
1999-09-01 08:35:16 +00:00
|
|
|
[_backgroundColor set];
|
1999-01-19 10:58:51 +00:00
|
|
|
NSRectFill(rect);
|
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (BOOL) autoscroll: (NSEvent*)theEvent
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1997-08-05 21:50:10 +00:00
|
|
|
return 0;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) viewBoundsChanged: (NSNotification*)aNotification
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) viewFrameChanged: (NSNotification*)aNotification
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
2000-01-10 02:04:25 +00:00
|
|
|
[self setBoundsOrigin: [self constrainScrollPoint: _bounds.origin]];
|
2000-03-19 23:26:56 +00:00
|
|
|
|
2000-10-20 04:19:22 +00:00
|
|
|
/* If document frame does not completely cover _bounds */
|
|
|
|
if (NSContainsRect([_documentView frame], _bounds) == NO)
|
2000-03-19 23:26:56 +00:00
|
|
|
{
|
2000-10-20 04:19:22 +00:00
|
|
|
/*
|
|
|
|
* fill the area not covered by documentView with background color
|
|
|
|
*/
|
2000-03-19 23:26:56 +00:00
|
|
|
[self setNeedsDisplay: YES];
|
|
|
|
}
|
|
|
|
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) scaleUnitSquareToSize: (NSSize)newUnitSize
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
[super scaleUnitSquareToSize: newUnitSize];
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setBoundsSize: (NSSize)aSize
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
[super setBoundsSize: aSize];
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setFrameSize: (NSSize)aSize
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
[super setFrameSize: aSize];
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setFrameOrigin: (NSPoint)aPoint
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
[super setFrameOrigin: aPoint];
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setFrame: (NSRect)rect
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
[super setFrame: rect];
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) translateOriginToPoint: (NSPoint)aPoint
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
[super translateOriginToPoint: aPoint];
|
2000-01-10 02:04:25 +00:00
|
|
|
[_super_view reflectScrolledClipView: self];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (BOOL) isOpaque
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) documentView
|
|
|
|
{
|
|
|
|
return _documentView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setCopiesOnScroll: (BOOL)flag
|
|
|
|
{
|
|
|
|
_copiesOnScroll = flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) copiesOnScroll
|
|
|
|
{
|
|
|
|
return _copiesOnScroll;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setDocumentCursor: (NSCursor*)aCursor
|
|
|
|
{
|
|
|
|
ASSIGN(_cursor, aCursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSCursor*) documentCursor
|
|
|
|
{
|
|
|
|
return _cursor;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSColor*) backgroundColor
|
|
|
|
{
|
|
|
|
return _backgroundColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isFlipped
|
|
|
|
{
|
1999-05-07 20:08:51 +00:00
|
|
|
return (_documentView != nil) ? _documentView->_rFlags.flipped_view : NO;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) acceptsFirstResponder
|
|
|
|
{
|
|
|
|
return _documentView != nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setBackgroundColor: (NSColor*)aColor
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
|
|
|
ASSIGN(_backgroundColor, aColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable rotation of clip view */
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) rotateByAngle: (float)angle
|
1999-03-08 09:32:09 +00:00
|
|
|
{
|
|
|
|
}
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setBoundsRotation: (float)angle
|
1999-03-08 09:32:09 +00:00
|
|
|
{
|
|
|
|
}
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setFrameRotation: (float)angle
|
1999-03-08 09:32:09 +00:00
|
|
|
{
|
|
|
|
}
|
1997-08-05 21:50:10 +00:00
|
|
|
|
|
|
|
/* Managing responder chain */
|
1999-02-03 21:53:29 +00:00
|
|
|
- (BOOL) becomeFirstResponder
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-03-04 13:21:46 +00:00
|
|
|
return (_documentView != nil) ? [_documentView becomeFirstResponder] : NO;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2000-09-04 22:59:23 +00:00
|
|
|
/*
|
|
|
|
* NSCoding protocol
|
|
|
|
*/
|
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
|
|
|
{
|
|
|
|
[super encodeWithCoder: aCoder];
|
|
|
|
|
|
|
|
[aCoder encodeObject: _backgroundColor];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
|
|
|
[aCoder encodeObject: _cursor];
|
|
|
|
[aCoder encodeObject: _documentView];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
|
|
|
{
|
|
|
|
NSView *document;
|
|
|
|
|
|
|
|
self = [super initWithCoder: aDecoder];
|
|
|
|
[self setAutoresizesSubviews: YES];
|
|
|
|
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_backgroundColor];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cursor];
|
|
|
|
|
|
|
|
document = [aDecoder decodeObject];
|
|
|
|
[self setDocumentView: document];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
@end
|