2001-12-17 16:51:51 +00:00
|
|
|
/** <title>NSScrollView</title>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
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
|
2001-12-17 16:51:51 +00:00
|
|
|
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
1998-10-15 12:04:53 +00:00
|
|
|
Date: October 1998
|
2001-12-17 16:51:51 +00:00
|
|
|
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
1999-03-08 09:32:09 +00:00
|
|
|
Date: February 1999
|
2000-03-18 00:29:34 +00:00
|
|
|
Table View Support: Nicola Pero <n.pero@mi.flashnet.it>
|
|
|
|
Date: March 2000
|
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
|
2006-11-17 08:54:20 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
1997-08-05 21:50:10 +00:00
|
|
|
*/
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2002-04-11 23:17:42 +00:00
|
|
|
#include <Foundation/NSDebug.h>
|
1999-06-12 08:36:38 +00:00
|
|
|
#include <Foundation/NSException.h>
|
2006-11-17 08:54:20 +00:00
|
|
|
#include <Foundation/NSNotification.h>
|
2003-06-13 15:01:12 +00:00
|
|
|
#include "AppKit/NSScroller.h"
|
|
|
|
#include "AppKit/NSColor.h"
|
|
|
|
#include "AppKit/NSCell.h"
|
|
|
|
#include "AppKit/NSClipView.h"
|
2006-11-17 08:54:20 +00:00
|
|
|
#include "AppKit/NSInterfaceStyle.h"
|
2003-06-13 15:01:12 +00:00
|
|
|
#include "AppKit/NSScrollView.h"
|
|
|
|
#include "AppKit/NSRulerView.h"
|
|
|
|
#include "AppKit/NSTableHeaderView.h"
|
|
|
|
#include "AppKit/NSTableView.h"
|
|
|
|
#include "AppKit/NSWindow.h"
|
|
|
|
#include "AppKit/PSOperators.h"
|
2006-09-22 11:53:40 +00:00
|
|
|
#include "GNUstepGUI/GSTheme.h"
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
2006-05-20 22:12:46 +00:00
|
|
|
//
|
|
|
|
// For nib compatibility, this is used to properly
|
|
|
|
// initialize the object from a OS X nib file in initWithCoder:.
|
|
|
|
//
|
|
|
|
typedef struct _scrollViewFlags
|
|
|
|
{
|
|
|
|
#ifdef WORDS_BIGENDIAN
|
|
|
|
unsigned int __unused4:26;
|
|
|
|
unsigned int hasHScroller:1; // 16
|
|
|
|
unsigned int hasVScroller:1; // 32
|
|
|
|
unsigned int __unused0:2;
|
|
|
|
NSBorderType border:2;
|
|
|
|
#else
|
|
|
|
NSBorderType border:2;
|
|
|
|
unsigned int __unused0:2;
|
|
|
|
unsigned int hasVScroller:1; // 32
|
|
|
|
unsigned int hasHScroller:1; // 16
|
|
|
|
unsigned int __unused4:26;
|
|
|
|
#endif
|
|
|
|
} GSScrollViewFlags;
|
|
|
|
|
2006-11-17 08:54:20 +00:00
|
|
|
@interface NSScrollView (GSPrivate)
|
|
|
|
- (void) _themeDidActivate: (NSNotification*)notification;
|
|
|
|
@end
|
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
@implementation NSScrollView
|
|
|
|
|
1999-06-06 08:19:19 +00:00
|
|
|
/*
|
|
|
|
* Class variables
|
|
|
|
*/
|
1997-08-05 21:50:10 +00:00
|
|
|
static Class rulerViewClass = nil;
|
2001-10-21 23:29:29 +00:00
|
|
|
static float scrollerWidth;
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-06-06 08:19:19 +00:00
|
|
|
/*
|
|
|
|
* Class methods
|
|
|
|
*/
|
1999-02-03 21:53:29 +00:00
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (self == [NSScrollView class])
|
|
|
|
{
|
2001-10-21 23:29:29 +00:00
|
|
|
[self setRulerViewClass: [NSRulerView class]];
|
|
|
|
scrollerWidth = [NSScroller scrollerWidth];
|
2002-03-26 16:24:42 +00:00
|
|
|
[self setVersion: 2];
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (void) setRulerViewClass: (Class)aClass
|
|
|
|
{
|
|
|
|
rulerViewClass = aClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (Class) rulerViewClass
|
|
|
|
{
|
|
|
|
return rulerViewClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSSize) contentSizeForFrameSize: (NSSize)frameSize
|
|
|
|
hasHorizontalScroller: (BOOL)hFlag
|
|
|
|
hasVerticalScroller: (BOOL)vFlag
|
|
|
|
borderType: (NSBorderType)borderType
|
|
|
|
{
|
|
|
|
NSSize size = frameSize;
|
2001-10-21 23:29:29 +00:00
|
|
|
NSSize border = _sizeForBorderType(borderType);
|
1999-02-03 21:53:29 +00:00
|
|
|
|
1999-06-06 08:19:19 +00:00
|
|
|
/*
|
|
|
|
* Substract 1 from the width and height of
|
|
|
|
* the line that separates the horizontal
|
|
|
|
* and vertical scroller from the clip view
|
|
|
|
*/
|
1999-02-03 21:53:29 +00:00
|
|
|
if (hFlag)
|
|
|
|
{
|
2001-10-21 23:29:29 +00:00
|
|
|
size.height -= scrollerWidth + 1;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
if (vFlag)
|
|
|
|
{
|
2001-10-21 23:29:29 +00:00
|
|
|
size.width -= scrollerWidth + 1;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
size.width -= 2 * border.width;
|
|
|
|
size.height -= 2 * border.height;
|
1999-02-03 21:53:29 +00:00
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSSize) frameSizeForContentSize: (NSSize)contentSize
|
|
|
|
hasHorizontalScroller: (BOOL)hFlag
|
|
|
|
hasVerticalScroller: (BOOL)vFlag
|
|
|
|
borderType: (NSBorderType)borderType
|
|
|
|
{
|
|
|
|
NSSize size = contentSize;
|
2001-10-21 23:29:29 +00:00
|
|
|
NSSize border = _sizeForBorderType(borderType);
|
1999-02-03 21:53:29 +00:00
|
|
|
|
1999-06-06 08:19:19 +00:00
|
|
|
/*
|
|
|
|
* Add 1 to the width and height for the line that separates the
|
|
|
|
* horizontal and vertical scroller from the clip view.
|
|
|
|
*/
|
1999-02-03 21:53:29 +00:00
|
|
|
if (hFlag)
|
|
|
|
{
|
2001-10-21 23:29:29 +00:00
|
|
|
size.height += scrollerWidth + 1;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
if (vFlag)
|
|
|
|
{
|
2001-10-21 23:29:29 +00:00
|
|
|
size.width += scrollerWidth + 1;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
size.width += 2 * border.width;
|
|
|
|
size.height += 2 * border.height;
|
1999-02-03 21:53:29 +00:00
|
|
|
|
|
|
|
return size;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-06-06 08:19:19 +00:00
|
|
|
/*
|
|
|
|
* Instance methods
|
|
|
|
*/
|
1999-03-30 13:59:35 +00:00
|
|
|
- (id) initWithFrame: (NSRect)rect
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
2001-10-21 23:29:29 +00:00
|
|
|
NSClipView *clipView = [NSClipView new];
|
|
|
|
|
|
|
|
self = [super initWithFrame: rect];
|
|
|
|
[self setContentView: clipView];
|
|
|
|
RELEASE(clipView);
|
1999-06-12 08:36:38 +00:00
|
|
|
_hLineScroll = 10;
|
|
|
|
_hPageScroll = 10;
|
|
|
|
_vLineScroll = 10;
|
|
|
|
_vPageScroll = 10;
|
2003-02-20 03:12:29 +00:00
|
|
|
_borderType = NSNoBorder;
|
1999-02-03 21:53:29 +00:00
|
|
|
_scrollsDynamically = YES;
|
2005-06-28 10:09:14 +00:00
|
|
|
// For compatibility the ruler should be present but not visible.
|
|
|
|
[self setHasHorizontalRuler: YES];
|
1999-02-03 21:53:29 +00:00
|
|
|
[self tile];
|
|
|
|
|
2006-11-17 08:54:20 +00:00
|
|
|
[[NSNotificationCenter defaultCenter]
|
|
|
|
addObserver: self
|
|
|
|
selector: @selector(_themeDidActivate:)
|
|
|
|
name: GSThemeDidActivateNotification
|
|
|
|
object: nil];
|
1999-02-03 21:53:29 +00:00
|
|
|
return self;
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-03-30 13:59:35 +00:00
|
|
|
- (id) init
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
return [self initWithFrame: NSZeroRect];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) dealloc
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
2006-11-17 08:54:20 +00:00
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
|
|
|
|
2002-03-07 10:41:36 +00:00
|
|
|
DESTROY(_horizScroller);
|
|
|
|
DESTROY(_vertScroller);
|
|
|
|
DESTROY(_horizRuler);
|
|
|
|
DESTROY(_vertRuler);
|
1999-02-03 21:53:29 +00:00
|
|
|
|
|
|
|
[super dealloc];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-03-30 13:59:35 +00:00
|
|
|
- (BOOL) isFlipped
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
- (void) setContentView: (NSClipView *)aView
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-09-07 05:31:44 +00:00
|
|
|
if (aView == nil)
|
|
|
|
[NSException raise: NSInvalidArgumentException
|
|
|
|
format: @"Attempt to set nil content view"];
|
|
|
|
if ([aView isKindOfClass: [NSView class]] == NO)
|
|
|
|
[NSException raise: NSInvalidArgumentException
|
|
|
|
format: @"Attempt to set non-view object as content view"];
|
2001-10-21 23:29:29 +00:00
|
|
|
|
2000-03-10 10:34:58 +00:00
|
|
|
if (aView != _contentView)
|
|
|
|
{
|
2000-11-05 16:28:50 +00:00
|
|
|
NSView *docView = [aView documentView];
|
|
|
|
|
2000-03-10 10:34:58 +00:00
|
|
|
[_contentView removeFromSuperview];
|
|
|
|
_contentView = aView;
|
|
|
|
[self addSubview: _contentView];
|
2000-11-05 16:28:50 +00:00
|
|
|
|
|
|
|
if (docView != nil)
|
2002-03-08 17:38:23 +00:00
|
|
|
{
|
|
|
|
[self setDocumentView: docView];
|
|
|
|
}
|
2000-03-10 10:34:58 +00:00
|
|
|
}
|
1999-01-19 10:35:43 +00:00
|
|
|
[_contentView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
|
|
|
[self tile];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
- (void) removeSubview: (NSView *)aView
|
2000-03-10 07:48:29 +00:00
|
|
|
{
|
|
|
|
if (aView == _contentView)
|
|
|
|
{
|
|
|
|
_contentView = nil;
|
|
|
|
}
|
2002-03-08 17:38:23 +00:00
|
|
|
[super removeSubview: aView];
|
2000-03-10 07:48:29 +00:00
|
|
|
}
|
|
|
|
|
1999-01-19 10:35:43 +00:00
|
|
|
- (void) setHorizontalScroller: (NSScroller*)aScroller
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-01-19 10:35:43 +00:00
|
|
|
[_horizScroller removeFromSuperview];
|
|
|
|
|
1999-06-06 08:19:19 +00:00
|
|
|
/*
|
|
|
|
* Do not add the scroller view to the subviews array yet;
|
|
|
|
* -setHasHorizontalScroller must be invoked first
|
|
|
|
*/
|
1999-01-19 10:35:43 +00:00
|
|
|
ASSIGN(_horizScroller, aScroller);
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_horizScroller)
|
1999-01-19 10:35:43 +00:00
|
|
|
{
|
|
|
|
[_horizScroller setAutoresizingMask: NSViewWidthSizable];
|
1999-02-03 21:53:29 +00:00
|
|
|
[_horizScroller setTarget: self];
|
|
|
|
[_horizScroller setAction: @selector(_doScroll:)];
|
1999-01-19 10:35:43 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setHasHorizontalScroller: (BOOL)flag
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasHorizScroller == flag)
|
|
|
|
return;
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
_hasHorizScroller = flag;
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasHorizScroller)
|
|
|
|
{
|
|
|
|
if (!_horizScroller)
|
2001-10-21 23:29:29 +00:00
|
|
|
{
|
|
|
|
NSScroller *scroller = [NSScroller new];
|
|
|
|
|
|
|
|
[self setHorizontalScroller: scroller];
|
|
|
|
RELEASE(scroller);
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
[self addSubview: _horizScroller];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
[_horizScroller removeFromSuperview];
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
[self tile];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
|
|
|
|
1999-01-19 10:35:43 +00:00
|
|
|
- (void) setVerticalScroller: (NSScroller*)aScroller
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-01-19 10:35:43 +00:00
|
|
|
[_vertScroller removeFromSuperview];
|
|
|
|
|
1999-06-06 08:19:19 +00:00
|
|
|
/*
|
|
|
|
* Do not add the scroller view to the subviews array yet;
|
|
|
|
* -setHasVerticalScroller must be invoked first
|
|
|
|
*/
|
1999-01-19 10:35:43 +00:00
|
|
|
ASSIGN(_vertScroller, aScroller);
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_vertScroller)
|
1999-01-19 10:35:43 +00:00
|
|
|
{
|
|
|
|
[_vertScroller setAutoresizingMask: NSViewHeightSizable];
|
1999-02-03 21:53:29 +00:00
|
|
|
[_vertScroller setTarget: self];
|
|
|
|
[_vertScroller setAction: @selector(_doScroll:)];
|
1999-01-19 10:35:43 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setHasVerticalScroller: (BOOL)flag
|
|
|
|
{
|
|
|
|
if (_hasVertScroller == flag)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_hasVertScroller = flag;
|
|
|
|
|
|
|
|
if (_hasVertScroller)
|
|
|
|
{
|
|
|
|
if (!_vertScroller)
|
|
|
|
{
|
2001-10-21 23:29:29 +00:00
|
|
|
NSScroller *scroller = [NSScroller new];
|
|
|
|
|
|
|
|
[self setVerticalScroller: scroller];
|
|
|
|
RELEASE(scroller);
|
1999-05-07 20:08:51 +00:00
|
|
|
if (_contentView && !_contentView->_rFlags.flipped_view)
|
1999-02-03 21:53:29 +00:00
|
|
|
[_vertScroller setFloatValue: 1];
|
|
|
|
}
|
|
|
|
[self addSubview: _vertScroller];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
[_vertScroller removeFromSuperview];
|
|
|
|
|
|
|
|
[self tile];
|
|
|
|
}
|
|
|
|
|
2001-10-21 23:29:29 +00:00
|
|
|
- (void) scrollWheel: (NSEvent *)theEvent
|
|
|
|
{
|
2002-03-08 17:38:23 +00:00
|
|
|
NSRect clipViewBounds;
|
2003-04-30 05:03:50 +00:00
|
|
|
float delta = [theEvent deltaY];
|
2002-03-08 17:38:23 +00:00
|
|
|
float amount;
|
|
|
|
NSPoint point;
|
2002-02-28 21:45:38 +00:00
|
|
|
|
2002-03-08 17:38:23 +00:00
|
|
|
if (_contentView == nil)
|
|
|
|
{
|
|
|
|
clipViewBounds = NSZeroRect;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
clipViewBounds = [_contentView bounds];
|
|
|
|
}
|
|
|
|
point = clipViewBounds.origin;
|
2003-04-30 05:03:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (_hasHorizScroller == YES
|
|
|
|
&& ([theEvent modifierFlags] & NSShiftKeyMask) == NSShiftKeyMask)
|
2002-02-28 21:45:38 +00:00
|
|
|
{
|
2003-04-30 05:03:50 +00:00
|
|
|
if (([theEvent modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask)
|
|
|
|
{
|
|
|
|
amount = - (clipViewBounds.size.width - _hPageScroll) * delta;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
amount = - _hLineScroll * delta;
|
|
|
|
}
|
|
|
|
NSDebugLLog (@"NSScrollView",
|
|
|
|
@"increment/decrement: amount = %f, horizontal", amount);
|
|
|
|
|
|
|
|
point.x = clipViewBounds.origin.x + amount;
|
2002-02-28 21:45:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-04-30 05:03:50 +00:00
|
|
|
if (([theEvent modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask)
|
|
|
|
{
|
|
|
|
amount = - (clipViewBounds.size.height - _vPageScroll) * delta;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
amount = - _vLineScroll * delta;
|
|
|
|
}
|
2002-02-28 21:45:38 +00:00
|
|
|
|
2003-04-30 05:03:50 +00:00
|
|
|
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
|
|
|
{
|
|
|
|
/* If view is flipped reverse the scroll direction */
|
|
|
|
amount = -amount;
|
|
|
|
}
|
|
|
|
NSDebugLLog (@"NSScrollView",
|
|
|
|
@"increment/decrement: amount = %f, flipped = %d",
|
|
|
|
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
2002-03-08 17:38:23 +00:00
|
|
|
|
2003-04-30 05:03:50 +00:00
|
|
|
point.y = clipViewBounds.origin.y + amount;
|
|
|
|
}
|
2002-02-28 21:45:38 +00:00
|
|
|
|
2003-01-30 02:15:02 +00:00
|
|
|
/* scrollToPoint: will call reflectScrolledClipView:, which will
|
|
|
|
* update rules, headers, and scrollers. */
|
2002-02-28 21:45:38 +00:00
|
|
|
[_contentView scrollToPoint: point];
|
2002-10-10 19:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Scrolls the receiver by simply invoking scrollPageUp:
|
|
|
|
*/
|
|
|
|
- (void) pageUp: (id)sender
|
|
|
|
{
|
|
|
|
[self scrollPageUp: sender];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on _doScroll: and still may need some tuning.
|
|
|
|
*/
|
|
|
|
- (void) scrollPageUp: (id)sender
|
|
|
|
{
|
|
|
|
NSRect clipViewBounds;
|
|
|
|
NSPoint point;
|
|
|
|
float amount;
|
|
|
|
|
|
|
|
if (_contentView == nil)
|
|
|
|
{
|
|
|
|
clipViewBounds = NSZeroRect;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
clipViewBounds = [_contentView bounds];
|
|
|
|
}
|
|
|
|
point = clipViewBounds.origin;
|
|
|
|
/*
|
|
|
|
* Take verticalPageScroll into accout, but try to make sure
|
|
|
|
* that amount is never negative (ie do not scroll backwards.)
|
|
|
|
*
|
|
|
|
* FIXME: It seems _doScroll and scrollWheel: should also take
|
|
|
|
* care not to do negative scrolling.
|
|
|
|
*/
|
|
|
|
amount = clipViewBounds.size.height - _vPageScroll;
|
|
|
|
amount = (amount < 0) ? 0 : amount;
|
|
|
|
|
|
|
|
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
|
|
|
{
|
|
|
|
amount = -amount;
|
|
|
|
}
|
|
|
|
point.y = clipViewBounds.origin.y - amount;
|
|
|
|
[_contentView scrollToPoint: point];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Scrolls the receiver by simply invoking scrollPageUp:
|
|
|
|
*/
|
|
|
|
- (void) pageDown: (id)sender
|
|
|
|
{
|
|
|
|
[self scrollPageDown: sender];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on _doScroll:. and still may need some tuning.
|
|
|
|
*/
|
|
|
|
- (void) scrollPageDown: (id)sender
|
|
|
|
{
|
|
|
|
NSRect clipViewBounds;
|
|
|
|
NSPoint point;
|
|
|
|
float amount;
|
|
|
|
|
|
|
|
if (_contentView == nil)
|
|
|
|
{
|
|
|
|
clipViewBounds = NSZeroRect;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
clipViewBounds = [_contentView bounds];
|
|
|
|
}
|
|
|
|
point = clipViewBounds.origin;
|
|
|
|
/*
|
|
|
|
* Take verticalPageScroll into accout, but try to make sure
|
|
|
|
* that amount is never negativ (ie do not scroll backwards.)
|
|
|
|
*
|
|
|
|
* FIXME: It seems _doScroll and scrollWheel: should also take
|
|
|
|
* care not to do negative scrolling.
|
|
|
|
*/
|
|
|
|
amount = clipViewBounds.size.height - _vPageScroll;
|
|
|
|
amount = (amount < 0) ? 0 : amount;
|
|
|
|
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
|
|
|
{
|
|
|
|
amount = -amount;
|
|
|
|
}
|
|
|
|
point.y = clipViewBounds.origin.y + amount;
|
|
|
|
[_contentView scrollToPoint: point];
|
2001-10-21 23:29:29 +00:00
|
|
|
}
|
|
|
|
|
1999-02-19 20:31:07 +00:00
|
|
|
- (void) _doScroll: (NSScroller*)scroller
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
1999-06-06 08:19:19 +00:00
|
|
|
float floatValue = [scroller floatValue];
|
1999-02-03 21:53:29 +00:00
|
|
|
NSScrollerPart hitPart = [scroller hitPart];
|
2002-03-08 17:38:23 +00:00
|
|
|
NSRect clipViewBounds;
|
|
|
|
NSRect documentRect;
|
1999-06-06 08:19:19 +00:00
|
|
|
float amount = 0;
|
2002-03-08 17:38:23 +00:00
|
|
|
NSPoint point;
|
|
|
|
|
|
|
|
if (_contentView == nil)
|
|
|
|
{
|
|
|
|
clipViewBounds = NSZeroRect;
|
|
|
|
documentRect = NSZeroRect;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
clipViewBounds = [_contentView bounds];
|
|
|
|
documentRect = [_contentView documentRect];
|
|
|
|
}
|
|
|
|
point = clipViewBounds.origin;
|
1999-02-03 21:53:29 +00:00
|
|
|
|
2002-10-12 03:14:22 +00:00
|
|
|
NSDebugLLog (@"NSScrollView", @"_doScroll: float value = %f", floatValue);
|
1999-02-03 21:53:29 +00:00
|
|
|
|
1999-06-06 08:19:19 +00:00
|
|
|
/* do nothing if scroller is unknown */
|
1999-02-03 21:53:29 +00:00
|
|
|
if (scroller != _horizScroller && scroller != _vertScroller)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_knobMoved = NO;
|
|
|
|
|
|
|
|
if (hitPart == NSScrollerKnob || hitPart == NSScrollerKnobSlot)
|
|
|
|
_knobMoved = YES;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (hitPart == NSScrollerIncrementLine)
|
1999-06-11 07:22:37 +00:00
|
|
|
{
|
1999-06-12 08:36:38 +00:00
|
|
|
if (scroller == _horizScroller)
|
|
|
|
amount = _hLineScroll;
|
|
|
|
else
|
|
|
|
amount = _vLineScroll;
|
1999-06-11 07:22:37 +00:00
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
else if (hitPart == NSScrollerDecrementLine)
|
1999-06-11 07:22:37 +00:00
|
|
|
{
|
1999-06-12 08:36:38 +00:00
|
|
|
if (scroller == _horizScroller)
|
|
|
|
amount = -_hLineScroll;
|
|
|
|
else
|
|
|
|
amount = -_vLineScroll;
|
1999-06-11 07:22:37 +00:00
|
|
|
}
|
|
|
|
else if (hitPart == NSScrollerIncrementPage)
|
|
|
|
{
|
|
|
|
if (scroller == _horizScroller)
|
1999-06-12 08:36:38 +00:00
|
|
|
amount = clipViewBounds.size.width - _hPageScroll;
|
1999-06-11 07:22:37 +00:00
|
|
|
else
|
1999-06-12 08:36:38 +00:00
|
|
|
amount = clipViewBounds.size.height - _vPageScroll;
|
1999-06-11 07:22:37 +00:00
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
else if (hitPart == NSScrollerDecrementPage)
|
1999-06-11 07:22:37 +00:00
|
|
|
{
|
|
|
|
if (scroller == _horizScroller)
|
1999-06-12 08:36:38 +00:00
|
|
|
amount = _hPageScroll - clipViewBounds.size.width;
|
1999-06-11 07:22:37 +00:00
|
|
|
else
|
1999-06-12 08:36:38 +00:00
|
|
|
amount = _vPageScroll - clipViewBounds.size.height;
|
1999-06-11 07:22:37 +00:00
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
else
|
1999-06-11 07:22:37 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
1999-06-06 08:19:19 +00:00
|
|
|
if (!_knobMoved) /* button scrolling */
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
if (scroller == _horizScroller)
|
|
|
|
{
|
|
|
|
point.x = clipViewBounds.origin.x + amount;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-08 17:38:23 +00:00
|
|
|
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
1999-06-06 08:19:19 +00:00
|
|
|
/* If view is flipped reverse the scroll direction */
|
1999-02-03 21:53:29 +00:00
|
|
|
amount = -amount;
|
|
|
|
}
|
2002-10-12 03:14:22 +00:00
|
|
|
NSDebugLLog (@"NSScrollView",
|
|
|
|
@"increment/decrement: amount = %f, flipped = %d",
|
2002-03-08 17:38:23 +00:00
|
|
|
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
1999-02-03 21:53:29 +00:00
|
|
|
point.y = clipViewBounds.origin.y + amount;
|
|
|
|
}
|
|
|
|
}
|
1999-06-06 08:19:19 +00:00
|
|
|
else /* knob scolling */
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
if (scroller == _horizScroller)
|
|
|
|
{
|
|
|
|
point.x = floatValue * (documentRect.size.width
|
1998-10-15 12:04:53 +00:00
|
|
|
- clipViewBounds.size.width);
|
1999-03-08 09:32:09 +00:00
|
|
|
point.x += documentRect.origin.x;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-08 17:38:23 +00:00
|
|
|
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
1999-02-03 21:53:29 +00:00
|
|
|
floatValue = 1 - floatValue;
|
|
|
|
point.y = floatValue * (documentRect.size.height
|
2002-03-08 17:38:23 +00:00
|
|
|
- clipViewBounds.size.height);
|
1999-03-08 09:32:09 +00:00
|
|
|
point.y += documentRect.origin.y;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-30 02:15:02 +00:00
|
|
|
/* scrollToPoint will call reflectScrollerClipView, and that will
|
|
|
|
* update scrollers, rulers and headers */
|
1999-02-03 21:53:29 +00:00
|
|
|
[_contentView scrollToPoint: point];
|
|
|
|
}
|
|
|
|
|
2006-05-20 22:12:46 +00:00
|
|
|
//
|
|
|
|
// This method is here purely for nib compatibility. This is the action
|
|
|
|
// connected to by NSScrollers in IB when building a scrollview.
|
|
|
|
//
|
|
|
|
- (void) _doScroller: (NSScroller *)scroller
|
|
|
|
{
|
|
|
|
[self _doScroll: scroller];
|
|
|
|
}
|
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
- (void) reflectScrolledClipView: (NSClipView *)aClipView
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
NSRect documentFrame = NSZeroRect;
|
|
|
|
NSRect clipViewBounds = NSZeroRect;
|
|
|
|
float floatValue;
|
|
|
|
float knobProportion;
|
|
|
|
id documentView;
|
|
|
|
|
|
|
|
if (aClipView != _contentView)
|
2000-03-18 00:29:34 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
|
2002-10-12 03:14:22 +00:00
|
|
|
NSDebugLLog (@"NSScrollView", @"reflectScrolledClipView:");
|
1999-02-03 21:53:29 +00:00
|
|
|
|
2000-11-15 05:02:06 +00:00
|
|
|
if (_contentView)
|
2001-01-21 14:55:07 +00:00
|
|
|
{
|
|
|
|
clipViewBounds = [_contentView bounds];
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
if ((documentView = [_contentView documentView]))
|
2001-01-21 14:55:07 +00:00
|
|
|
{
|
|
|
|
documentFrame = [documentView frame];
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
|
|
|
|
if (_hasVertScroller)
|
|
|
|
{
|
|
|
|
if (documentFrame.size.height <= clipViewBounds.size.height)
|
2001-01-21 14:55:07 +00:00
|
|
|
{
|
|
|
|
[_vertScroller setEnabled: NO];
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
[_vertScroller setEnabled: YES];
|
2001-01-21 14:55:07 +00:00
|
|
|
|
1999-03-08 09:32:09 +00:00
|
|
|
knobProportion = clipViewBounds.size.height
|
|
|
|
/ documentFrame.size.height;
|
2001-01-21 14:55:07 +00:00
|
|
|
|
1999-03-08 09:32:09 +00:00
|
|
|
floatValue = (clipViewBounds.origin.y - documentFrame.origin.y)
|
|
|
|
/ (documentFrame.size.height - clipViewBounds.size.height);
|
2001-01-21 14:55:07 +00:00
|
|
|
|
1999-05-07 20:08:51 +00:00
|
|
|
if (!_contentView->_rFlags.flipped_view)
|
2001-01-21 14:55:07 +00:00
|
|
|
{
|
|
|
|
floatValue = 1 - floatValue;
|
|
|
|
}
|
|
|
|
[_vertScroller setFloatValue: floatValue
|
|
|
|
knobProportion: knobProportion];
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_hasHorizScroller)
|
|
|
|
{
|
|
|
|
if (documentFrame.size.width <= clipViewBounds.size.width)
|
2001-01-21 14:55:07 +00:00
|
|
|
{
|
|
|
|
[_horizScroller setEnabled: NO];
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
[_horizScroller setEnabled: YES];
|
2001-01-21 14:55:07 +00:00
|
|
|
|
1999-03-08 09:32:09 +00:00
|
|
|
knobProportion = clipViewBounds.size.width
|
|
|
|
/ documentFrame.size.width;
|
2001-01-21 14:55:07 +00:00
|
|
|
|
1999-03-08 09:32:09 +00:00
|
|
|
floatValue = (clipViewBounds.origin.x - documentFrame.origin.x)
|
|
|
|
/ (documentFrame.size.width - clipViewBounds.size.width);
|
2001-01-21 14:55:07 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
[_horizScroller setFloatValue: floatValue
|
|
|
|
knobProportion: knobProportion];
|
|
|
|
}
|
|
|
|
}
|
2000-06-15 18:03:53 +00:00
|
|
|
|
|
|
|
if (_hasHeaderView)
|
|
|
|
{
|
|
|
|
NSPoint headerClipViewOrigin;
|
|
|
|
|
|
|
|
headerClipViewOrigin = [_headerClipView bounds].origin;
|
|
|
|
|
2003-01-30 02:15:02 +00:00
|
|
|
/* If needed, scroll the headerview too. */
|
2000-06-15 18:03:53 +00:00
|
|
|
if (headerClipViewOrigin.x != clipViewBounds.origin.x)
|
|
|
|
{
|
|
|
|
headerClipViewOrigin.x = clipViewBounds.origin.x;
|
|
|
|
[_headerClipView scrollToPoint: headerClipViewOrigin];
|
|
|
|
}
|
|
|
|
}
|
2003-01-30 02:15:02 +00:00
|
|
|
|
|
|
|
if (_rulersVisible == YES)
|
|
|
|
{
|
|
|
|
if (_hasHorizRuler)
|
|
|
|
{
|
|
|
|
[_horizRuler setNeedsDisplay: YES];
|
|
|
|
}
|
|
|
|
if (_hasVertRuler)
|
|
|
|
{
|
|
|
|
[_vertRuler setNeedsDisplay: YES];
|
|
|
|
}
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
- (void) setHorizontalRulerView: (NSRulerView *)aRulerView
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
2001-12-25 14:03:06 +00:00
|
|
|
if (_rulersVisible && _horizRuler != nil)
|
|
|
|
{
|
|
|
|
[_horizRuler removeFromSuperview];
|
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
ASSIGN(_horizRuler, aRulerView);
|
2001-12-25 14:03:06 +00:00
|
|
|
|
|
|
|
if (_horizRuler == nil)
|
|
|
|
{
|
|
|
|
_hasHorizRuler = NO;
|
|
|
|
}
|
|
|
|
else if (_rulersVisible)
|
|
|
|
{
|
|
|
|
[self addSubview:_horizRuler];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_rulersVisible)
|
|
|
|
{
|
|
|
|
[self tile];
|
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2001-10-21 23:29:29 +00:00
|
|
|
- (void) setHasHorizontalRuler: (BOOL)flag
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasHorizRuler == flag)
|
|
|
|
return;
|
1998-10-15 12:04:53 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
_hasHorizRuler = flag;
|
2001-12-25 14:03:06 +00:00
|
|
|
if (_hasHorizRuler && _horizRuler == nil)
|
2001-10-21 23:29:29 +00:00
|
|
|
{
|
2001-12-25 14:03:06 +00:00
|
|
|
_horizRuler = [[isa rulerViewClass] alloc];
|
|
|
|
_horizRuler = [_horizRuler initWithScrollView: self
|
|
|
|
orientation: NSHorizontalRuler];
|
|
|
|
}
|
2001-10-21 23:29:29 +00:00
|
|
|
|
2001-12-25 14:03:06 +00:00
|
|
|
if (_rulersVisible)
|
|
|
|
{
|
|
|
|
if (_hasHorizRuler)
|
|
|
|
{
|
|
|
|
[self addSubview: _horizRuler];
|
2001-10-21 23:29:29 +00:00
|
|
|
}
|
2001-12-25 14:03:06 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
[_horizRuler removeFromSuperview];
|
|
|
|
}
|
|
|
|
[self tile];
|
2001-10-21 23:29:29 +00:00
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
1998-10-15 12:04:53 +00:00
|
|
|
|
2001-12-25 14:03:06 +00:00
|
|
|
- (void) setVerticalRulerView: (NSRulerView *)aRulerView
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
2001-12-25 14:03:06 +00:00
|
|
|
if (_rulersVisible && _vertRuler != nil)
|
|
|
|
{
|
|
|
|
[_vertRuler removeFromSuperview];
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSIGN(_vertRuler, aRulerView);
|
|
|
|
|
|
|
|
if (_vertRuler == nil)
|
|
|
|
{
|
|
|
|
_hasVertRuler = NO;
|
|
|
|
}
|
|
|
|
else if (_rulersVisible)
|
|
|
|
{
|
|
|
|
[self addSubview:_vertRuler];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_rulersVisible)
|
|
|
|
{
|
|
|
|
[self tile];
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
1998-10-15 12:04:53 +00:00
|
|
|
|
2001-10-21 23:29:29 +00:00
|
|
|
- (void) setHasVerticalRuler: (BOOL)flag
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
if (_hasVertRuler == flag)
|
|
|
|
return;
|
1998-10-15 12:04:53 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
_hasVertRuler = flag;
|
2001-12-25 14:03:06 +00:00
|
|
|
if (_hasVertRuler && _vertRuler == nil)
|
2001-10-21 23:29:29 +00:00
|
|
|
{
|
2001-12-25 14:03:06 +00:00
|
|
|
_vertRuler = [[isa rulerViewClass] alloc];
|
|
|
|
_vertRuler = [_vertRuler initWithScrollView: self
|
|
|
|
orientation: NSVerticalRuler];
|
|
|
|
}
|
2001-10-21 23:29:29 +00:00
|
|
|
|
2001-12-25 14:03:06 +00:00
|
|
|
if (_rulersVisible)
|
|
|
|
{
|
|
|
|
if (_hasVertRuler)
|
|
|
|
{
|
|
|
|
[self addSubview: _vertRuler];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[_vertRuler removeFromSuperview];
|
2001-10-21 23:29:29 +00:00
|
|
|
}
|
2001-12-25 14:03:06 +00:00
|
|
|
[self tile];
|
2001-10-21 23:29:29 +00:00
|
|
|
}
|
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) setRulersVisible: (BOOL)flag
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
2001-10-21 23:29:29 +00:00
|
|
|
if (_rulersVisible == flag)
|
|
|
|
return;
|
|
|
|
|
2000-11-05 16:28:50 +00:00
|
|
|
_rulersVisible = flag;
|
2001-10-21 23:29:29 +00:00
|
|
|
if (flag)
|
|
|
|
{
|
|
|
|
if (_hasVertRuler)
|
|
|
|
[self addSubview: _vertRuler];
|
|
|
|
if (_hasHorizRuler)
|
|
|
|
[self addSubview: _horizRuler];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_hasVertRuler)
|
|
|
|
[_vertRuler removeFromSuperview];
|
|
|
|
if (_hasHorizRuler)
|
|
|
|
[_horizRuler removeFromSuperview];
|
|
|
|
}
|
|
|
|
[self tile];
|
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-02-03 21:53:29 +00:00
|
|
|
[super setFrame: rect];
|
|
|
|
[self tile];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setFrameSize: (NSSize)size
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[super setFrameSize: size];
|
|
|
|
[self tile];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) tile
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
2002-01-01 23:06:01 +00:00
|
|
|
NSRect headerRect, contentRect;
|
2001-10-21 23:29:29 +00:00
|
|
|
NSSize border = _sizeForBorderType(_borderType);
|
2002-01-01 23:06:01 +00:00
|
|
|
NSRectEdge bottomEdge, topEdge;
|
2000-03-18 00:29:34 +00:00
|
|
|
float headerViewHeight = 0;
|
2006-11-18 14:56:09 +00:00
|
|
|
NSRectEdge verticalScrollerEdge = NSMinXEdge;
|
|
|
|
NSInterfaceStyle style;
|
|
|
|
|
|
|
|
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
|
|
|
|
if (style == NSMacintoshInterfaceStyle
|
|
|
|
|| style == NSWindows95InterfaceStyle)
|
|
|
|
{
|
|
|
|
verticalScrollerEdge = NSMaxXEdge;
|
|
|
|
}
|
2000-03-18 00:29:34 +00:00
|
|
|
|
2002-01-01 23:06:01 +00:00
|
|
|
/* Determine edge positions. */
|
|
|
|
if (_rFlags.flipped_view)
|
|
|
|
{
|
|
|
|
topEdge = NSMinYEdge;
|
|
|
|
bottomEdge = NSMaxYEdge;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
topEdge = NSMaxYEdge;
|
|
|
|
bottomEdge = NSMinYEdge;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Prepare the contentRect by the insetting the borders. */
|
|
|
|
contentRect = NSInsetRect (_bounds, border.width, border.height);
|
|
|
|
|
2004-09-13 19:57:44 +00:00
|
|
|
[self _synchronizeHeaderAndCornerView];
|
|
|
|
|
2002-01-01 23:06:01 +00:00
|
|
|
/* First, allocate vertical space for the headerView / cornerView
|
|
|
|
(but - NB - the headerView needs to be placed above the clipview
|
|
|
|
later on, we can't place it now). */
|
2004-09-13 19:57:44 +00:00
|
|
|
|
2000-03-18 00:29:34 +00:00
|
|
|
if (_hasHeaderView == YES)
|
|
|
|
{
|
|
|
|
headerViewHeight = [[_headerClipView documentView] frame].size.height;
|
|
|
|
}
|
|
|
|
|
2000-06-01 19:57:54 +00:00
|
|
|
if (_hasCornerView == YES)
|
2000-03-18 00:29:34 +00:00
|
|
|
{
|
|
|
|
if (headerViewHeight == 0)
|
2002-01-01 23:06:01 +00:00
|
|
|
{
|
2004-09-13 19:57:44 +00:00
|
|
|
headerViewHeight = [_cornerView frame].size.height;
|
2002-01-01 23:06:01 +00:00
|
|
|
}
|
2000-06-01 19:57:54 +00:00
|
|
|
}
|
|
|
|
|
2002-01-01 23:06:01 +00:00
|
|
|
/* Remove the vertical slice used by the header/corner view. Save
|
|
|
|
the height and y position of headerRect for later reuse. */
|
|
|
|
NSDivideRect (contentRect, &headerRect, &contentRect, headerViewHeight,
|
|
|
|
topEdge);
|
|
|
|
|
|
|
|
/* Ok - now go on with drawing the actual scrollview in the
|
|
|
|
remaining space. Just consider contentRect to be the area in
|
|
|
|
which we draw, ignoring header/corner view. */
|
|
|
|
|
|
|
|
/* Prepare the vertical scroller. */
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasVertScroller)
|
|
|
|
{
|
2002-01-01 23:06:01 +00:00
|
|
|
NSRect vertScrollerRect;
|
2001-10-21 23:29:29 +00:00
|
|
|
|
2002-01-01 23:06:01 +00:00
|
|
|
NSDivideRect (contentRect, &vertScrollerRect, &contentRect,
|
2006-11-18 14:56:09 +00:00
|
|
|
scrollerWidth, verticalScrollerEdge);
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
2001-10-21 23:29:29 +00:00
|
|
|
[_vertScroller setFrame: vertScrollerRect];
|
2002-01-01 23:06:01 +00:00
|
|
|
|
|
|
|
/* Substract 1 for the line that separates the vertical scroller
|
|
|
|
* from the clip view (and eventually the horizontal scroller). */
|
2006-11-18 14:56:09 +00:00
|
|
|
NSDivideRect (contentRect, NULL, &contentRect, 1, verticalScrollerEdge);
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
2002-01-01 23:06:01 +00:00
|
|
|
/* Prepare the horizontal scroller. */
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasHorizScroller)
|
|
|
|
{
|
2002-01-01 23:06:01 +00:00
|
|
|
NSRect horizScrollerRect;
|
|
|
|
|
|
|
|
NSDivideRect (contentRect, &horizScrollerRect, &contentRect,
|
2006-11-17 08:54:20 +00:00
|
|
|
scrollerWidth, bottomEdge);
|
1999-02-03 21:53:29 +00:00
|
|
|
|
2001-10-21 23:29:29 +00:00
|
|
|
[_horizScroller setFrame: horizScrollerRect];
|
2002-01-01 23:06:01 +00:00
|
|
|
|
|
|
|
/* Substract 1 for the width for the line that separates the
|
|
|
|
* horizontal scroller from the clip view. */
|
|
|
|
NSDivideRect (contentRect, NULL, &contentRect, 1, bottomEdge);
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
2002-01-01 23:06:01 +00:00
|
|
|
/* Now place and size the header view to be exactly above the
|
|
|
|
resulting clipview. */
|
2000-03-18 00:29:34 +00:00
|
|
|
if (_hasHeaderView)
|
|
|
|
{
|
2002-01-01 23:06:01 +00:00
|
|
|
NSRect rect = headerRect;
|
2000-03-18 00:29:34 +00:00
|
|
|
|
|
|
|
rect.origin.x = contentRect.origin.x;
|
|
|
|
rect.size.width = contentRect.size.width;
|
2002-01-01 23:06:01 +00:00
|
|
|
|
2000-03-18 00:29:34 +00:00
|
|
|
[_headerClipView setFrame: rect];
|
|
|
|
}
|
|
|
|
|
2002-01-01 23:06:01 +00:00
|
|
|
/* Now place the corner view. */
|
2000-03-18 00:29:34 +00:00
|
|
|
if (_hasCornerView)
|
|
|
|
{
|
2006-11-18 14:56:09 +00:00
|
|
|
NSPoint p = headerRect.origin;
|
|
|
|
|
|
|
|
if (verticalScrollerEdge == NSMaxXEdge)
|
|
|
|
{
|
|
|
|
p.x += contentRect.size.width;
|
|
|
|
}
|
|
|
|
[_cornerView setFrameOrigin: p];
|
2000-03-18 00:29:34 +00:00
|
|
|
}
|
|
|
|
|
2002-01-01 23:20:37 +00:00
|
|
|
/* Now place the rulers. */
|
|
|
|
if (_rulersVisible)
|
|
|
|
{
|
|
|
|
if (_hasHorizRuler)
|
|
|
|
{
|
|
|
|
NSRect horizRulerRect;
|
|
|
|
|
|
|
|
NSDivideRect (contentRect, &horizRulerRect, &contentRect,
|
2006-11-17 08:54:20 +00:00
|
|
|
[_horizRuler requiredThickness], topEdge);
|
2002-01-01 23:20:37 +00:00
|
|
|
[_horizRuler setFrame: horizRulerRect];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_hasVertRuler)
|
|
|
|
{
|
|
|
|
NSRect vertRulerRect;
|
|
|
|
|
|
|
|
NSDivideRect (contentRect, &vertRulerRect, &contentRect,
|
2006-11-17 08:54:20 +00:00
|
|
|
[_vertRuler requiredThickness], NSMinXEdge);
|
2002-01-01 23:20:37 +00:00
|
|
|
[_vertRuler setFrame: vertRulerRect];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
[_contentView setFrame: contentRect];
|
2002-11-02 23:17:23 +00:00
|
|
|
[self setNeedsDisplay: YES];
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) drawRect: (NSRect)rect
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
{
|
2003-11-22 16:14:01 +00:00
|
|
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
2000-03-18 00:29:34 +00:00
|
|
|
|
1999-12-16 03:11:21 +00:00
|
|
|
switch (_borderType)
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
case NSNoBorder:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSLineBorder:
|
1999-08-26 04:13:43 +00:00
|
|
|
[[NSColor controlDarkShadowColor] set];
|
2000-03-18 00:29:34 +00:00
|
|
|
NSFrameRect(_bounds);
|
1999-02-03 21:53:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NSBezelBorder:
|
2006-09-22 13:38:12 +00:00
|
|
|
[[GSTheme theme] drawGrayBezel: _bounds withClip: rect];
|
1999-02-03 21:53:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NSGrooveBorder:
|
2006-09-22 13:38:12 +00:00
|
|
|
[[GSTheme theme] drawGroove: _bounds withClip: rect];
|
1999-02-03 21:53:29 +00:00
|
|
|
break;
|
|
|
|
}
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
2003-11-22 16:14:01 +00:00
|
|
|
[[NSColor controlDarkShadowColor] set];
|
1999-03-30 13:59:35 +00:00
|
|
|
DPSsetlinewidth(ctxt, 1);
|
2004-01-09 11:26:41 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasVertScroller)
|
|
|
|
{
|
2006-11-17 08:54:20 +00:00
|
|
|
NSInterfaceStyle style;
|
|
|
|
|
|
|
|
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
|
|
|
|
if (style == NSMacintoshInterfaceStyle
|
|
|
|
|| style == NSWindows95InterfaceStyle)
|
|
|
|
{
|
|
|
|
DPSmoveto(ctxt, [_vertScroller frame].origin.x - 1,
|
|
|
|
[_vertScroller frame].origin.y - 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DPSmoveto(ctxt, [_vertScroller frame].origin.x + scrollerWidth,
|
|
|
|
[_vertScroller frame].origin.y - 1);
|
|
|
|
}
|
2004-01-10 15:39:30 +00:00
|
|
|
DPSrlineto(ctxt, 0, [_vertScroller frame].size.height + 1);
|
|
|
|
DPSstroke(ctxt);
|
|
|
|
}
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
if (_hasHorizScroller)
|
|
|
|
{
|
2004-01-09 11:26:41 +00:00
|
|
|
float ypos;
|
|
|
|
float scrollerY = [_horizScroller frame].origin.y;
|
1999-03-30 13:59:35 +00:00
|
|
|
|
1999-05-07 20:08:51 +00:00
|
|
|
if (_rFlags.flipped_view)
|
2004-01-09 11:26:41 +00:00
|
|
|
{
|
|
|
|
ypos = scrollerY - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ypos = scrollerY + scrollerWidth + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
DPSmoveto(ctxt, [_horizScroller frame].origin.x - 1, ypos);
|
|
|
|
DPSrlineto(ctxt, [_horizScroller frame].size.width + 1, 0);
|
1999-03-30 13:59:35 +00:00
|
|
|
DPSstroke(ctxt);
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (NSRect) documentVisibleRect
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
return [_contentView documentVisibleRect];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setBackgroundColor: (NSColor*)aColor
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[_contentView setBackgroundColor: aColor];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (NSColor*) backgroundColor
|
|
|
|
{
|
|
|
|
return [_contentView backgroundColor];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2006-11-18 14:56:09 +00:00
|
|
|
- (void) setDrawsBackground: (BOOL)flag
|
2000-11-05 16:28:50 +00:00
|
|
|
{
|
|
|
|
[_contentView setDrawsBackground: flag];
|
|
|
|
}
|
|
|
|
|
2006-11-18 14:56:09 +00:00
|
|
|
- (BOOL) drawsBackground
|
2000-11-05 16:28:50 +00:00
|
|
|
{
|
|
|
|
return [_contentView drawsBackground];
|
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (void) setBorderType: (NSBorderType)borderType
|
|
|
|
{
|
|
|
|
_borderType = borderType;
|
2003-02-11 16:56:54 +00:00
|
|
|
[self tile];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
- (void) setDocumentView: (NSView *)aView
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[_contentView setDocumentView: aView];
|
2004-09-13 19:57:44 +00:00
|
|
|
|
1999-05-07 20:08:51 +00:00
|
|
|
if (_contentView && !_contentView->_rFlags.flipped_view)
|
2001-01-28 23:01:25 +00:00
|
|
|
{
|
|
|
|
[_vertScroller setFloatValue: 1];
|
|
|
|
}
|
1999-02-03 21:53:29 +00:00
|
|
|
[self tile];
|
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) resizeSubviewsWithOldSize: (NSSize)oldSize
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-03 21:53:29 +00:00
|
|
|
[super resizeSubviewsWithOldSize: oldSize];
|
|
|
|
[self tile];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-02-03 21:53:29 +00:00
|
|
|
- (id) documentView
|
|
|
|
{
|
|
|
|
return [_contentView documentView];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSCursor*) documentCursor
|
|
|
|
{
|
|
|
|
return [_contentView documentCursor];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setDocumentCursor: (NSCursor*)aCursor
|
|
|
|
{
|
|
|
|
[_contentView setDocumentCursor: aCursor];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isOpaque
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSBorderType) borderType
|
|
|
|
{
|
|
|
|
return _borderType;
|
|
|
|
}
|
|
|
|
|
2005-11-24 10:49:32 +00:00
|
|
|
/** <p>Returns whether the NSScrollView has a horizontal ruler</p>
|
|
|
|
<p>See Also: -setHasHorizontalRuler:</p>
|
|
|
|
*/
|
1999-03-08 09:32:09 +00:00
|
|
|
- (BOOL) hasHorizontalRuler
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
1999-03-08 09:32:09 +00:00
|
|
|
return _hasHorizRuler;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
2005-11-24 10:49:32 +00:00
|
|
|
/** <p>Returns whether the NSScrollView has a horizontal scroller</p>
|
|
|
|
<p>See Also: -setHasHorizontalScroller:</p>
|
|
|
|
*/
|
1999-03-08 09:32:09 +00:00
|
|
|
- (BOOL) hasHorizontalScroller
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
1999-03-08 09:32:09 +00:00
|
|
|
return _hasHorizScroller;
|
|
|
|
}
|
|
|
|
|
2005-11-24 10:49:32 +00:00
|
|
|
/** <p>Returns whether the NSScrollView has a vertical ruler</p>
|
|
|
|
<p>See Also: -setHasVerticalRuler:</p>
|
|
|
|
*/
|
1999-03-08 09:32:09 +00:00
|
|
|
- (BOOL) hasVerticalRuler
|
|
|
|
{
|
|
|
|
return _hasVertRuler;
|
|
|
|
}
|
|
|
|
|
2005-11-24 10:49:32 +00:00
|
|
|
/** <p>Returns whether the NSScrollView has a vertical scroller</p>
|
|
|
|
<p>See Also: -setHasVerticalScroller:</p>
|
|
|
|
*/
|
1999-03-08 09:32:09 +00:00
|
|
|
- (BOOL) hasVerticalScroller
|
|
|
|
{
|
|
|
|
return _hasVertScroller;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
2005-11-24 10:49:32 +00:00
|
|
|
/**<p>Returns the size of the NSScrollView's content view</p>
|
|
|
|
*/
|
1999-02-03 21:53:29 +00:00
|
|
|
- (NSSize) contentSize
|
|
|
|
{
|
|
|
|
return [_contentView bounds].size;
|
|
|
|
}
|
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
- (NSClipView *) contentView
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
return _contentView;
|
|
|
|
}
|
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
- (NSRulerView *) horizontalRulerView
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
return _horizRuler;
|
|
|
|
}
|
|
|
|
|
2001-12-24 01:25:04 +00:00
|
|
|
- (NSRulerView *) verticalRulerView
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
|
|
|
return _vertRuler;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) rulersVisible
|
|
|
|
{
|
|
|
|
return _rulersVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setLineScroll: (float)aFloat
|
|
|
|
{
|
1999-06-12 08:36:38 +00:00
|
|
|
_hLineScroll = aFloat;
|
|
|
|
_vLineScroll = aFloat;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setHorizontalLineScroll: (float)aFloat
|
|
|
|
{
|
|
|
|
_hLineScroll = aFloat;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setVerticalLineScroll: (float)aFloat
|
|
|
|
{
|
|
|
|
_vLineScroll = aFloat;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (float) lineScroll
|
|
|
|
{
|
1999-06-12 08:36:38 +00:00
|
|
|
if (_hLineScroll != _vLineScroll)
|
|
|
|
[NSException raise: NSInternalInconsistencyException
|
|
|
|
format: @"horizontal and vertical values not same"];
|
|
|
|
return _vLineScroll;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (float) horizontalLineScroll
|
|
|
|
{
|
|
|
|
return _hLineScroll;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (float) verticalLineScroll
|
|
|
|
{
|
|
|
|
return _vLineScroll;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setPageScroll: (float)aFloat
|
|
|
|
{
|
1999-06-12 08:36:38 +00:00
|
|
|
_hPageScroll = aFloat;
|
|
|
|
_vPageScroll = aFloat;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setHorizontalPageScroll: (float)aFloat
|
|
|
|
{
|
|
|
|
_hPageScroll = aFloat;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setVerticalPageScroll: (float)aFloat
|
|
|
|
{
|
|
|
|
_vPageScroll = aFloat;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (float) pageScroll
|
|
|
|
{
|
1999-06-12 08:36:38 +00:00
|
|
|
if (_hPageScroll != _vPageScroll)
|
|
|
|
[NSException raise: NSInternalInconsistencyException
|
|
|
|
format: @"horizontal and vertical values not same"];
|
|
|
|
return _vPageScroll;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (float) horizontalPageScroll
|
|
|
|
{
|
|
|
|
return _hPageScroll;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (float) verticalPageScroll
|
|
|
|
{
|
|
|
|
return _vPageScroll;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setScrollsDynamically: (BOOL)flag
|
|
|
|
{
|
2000-11-05 16:28:50 +00:00
|
|
|
// FIX ME: This should change the behaviour of the scrollers
|
1999-02-03 21:53:29 +00:00
|
|
|
_scrollsDynamically = flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) scrollsDynamically
|
|
|
|
{
|
|
|
|
return _scrollsDynamically;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSScroller*) horizontalScroller
|
|
|
|
{
|
|
|
|
return _horizScroller;
|
|
|
|
}
|
|
|
|
|
1999-03-08 09:32:09 +00:00
|
|
|
- (NSScroller*) verticalScroller
|
1999-02-03 21:53:29 +00:00
|
|
|
{
|
1999-03-08 09:32:09 +00:00
|
|
|
return _vertScroller;
|
1999-02-03 21:53:29 +00:00
|
|
|
}
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1999-09-07 05:31:44 +00:00
|
|
|
/*
|
|
|
|
* NSCoding protocol
|
|
|
|
*/
|
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
|
|
|
{
|
|
|
|
[super encodeWithCoder: aCoder];
|
2002-03-26 16:24:42 +00:00
|
|
|
|
2006-10-15 08:34:47 +00:00
|
|
|
if ([aCoder allowsKeyedCoding])
|
2006-05-20 22:12:46 +00:00
|
|
|
{
|
2006-08-09 05:48:54 +00:00
|
|
|
unsigned long flags = 0;
|
|
|
|
GSScrollViewFlags scrollViewFlags;
|
|
|
|
|
|
|
|
[aCoder encodeObject: _horizScroller forKey: @"NSHScroller"];
|
|
|
|
[aCoder encodeObject: _vertScroller forKey: @"NSVScroller"];
|
|
|
|
[aCoder encodeObject: _contentView forKey: @"NSContentView"];
|
|
|
|
|
|
|
|
// only encode this, if it's not null...
|
2006-10-15 08:34:47 +00:00
|
|
|
if (_headerClipView != nil)
|
2006-08-09 05:48:54 +00:00
|
|
|
{
|
|
|
|
[aCoder encodeObject: _headerClipView forKey: @"NSHeaderClipView"];
|
|
|
|
}
|
|
|
|
|
|
|
|
scrollViewFlags.hasVScroller = _hasVertScroller;
|
|
|
|
scrollViewFlags.hasHScroller = _hasHorizScroller;
|
|
|
|
scrollViewFlags.border = _borderType;
|
2006-08-19 14:34:52 +00:00
|
|
|
scrollViewFlags.__unused4 = 0;
|
|
|
|
scrollViewFlags.__unused0 = 0;
|
2006-08-09 05:48:54 +00:00
|
|
|
memcpy((void *)&flags, (void *)&scrollViewFlags,sizeof(unsigned long));
|
|
|
|
|
|
|
|
[aCoder encodeInt: flags forKey: @"NSsFlags"];
|
2006-05-20 22:12:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[aCoder encodeObject: _contentView];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_hLineScroll];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_hPageScroll];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_vLineScroll];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_vPageScroll];
|
|
|
|
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizScroller];
|
|
|
|
if (_hasHorizScroller)
|
|
|
|
[aCoder encodeObject: _horizScroller];
|
|
|
|
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertScroller];
|
|
|
|
if (_hasVertScroller)
|
|
|
|
[aCoder encodeObject: _vertScroller];
|
|
|
|
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizRuler];
|
|
|
|
if (_hasHorizRuler)
|
|
|
|
[aCoder encodeObject: _horizRuler];
|
|
|
|
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertRuler];
|
|
|
|
if (_hasVertRuler)
|
|
|
|
[aCoder encodeObject: _vertRuler];
|
|
|
|
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
|
|
|
if (_hasHeaderView)
|
|
|
|
[aCoder encodeObject: _headerClipView];
|
|
|
|
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
|
|
|
|
|
|
|
/* We do not need to encode headerview, cornerview stuff */
|
|
|
|
}
|
1999-09-07 05:31:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
|
|
|
{
|
2004-01-30 19:49:00 +00:00
|
|
|
self = [super initWithCoder: aDecoder];
|
1999-09-07 05:31:44 +00:00
|
|
|
|
2004-01-30 19:49:00 +00:00
|
|
|
if ([aDecoder allowsKeyedCoding])
|
|
|
|
{
|
|
|
|
NSScroller *hScroller = [aDecoder decodeObjectForKey: @"NSHScroller"];
|
|
|
|
NSScroller *vScroller = [aDecoder decodeObjectForKey: @"NSVScroller"];
|
2006-05-20 22:12:46 +00:00
|
|
|
NSClipView *content = [aDecoder decodeObjectForKey: @"NSContentView"];
|
|
|
|
|
2006-07-07 01:39:16 +00:00
|
|
|
_hLineScroll = 10;
|
|
|
|
_hPageScroll = 10;
|
|
|
|
_vLineScroll = 10;
|
|
|
|
_vPageScroll = 10;
|
|
|
|
_scrollsDynamically = YES;
|
|
|
|
|
2006-05-20 22:12:46 +00:00
|
|
|
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
|
|
|
{
|
|
|
|
unsigned long flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
|
|
|
GSScrollViewFlags scrollViewFlags;
|
|
|
|
memcpy((void *)&scrollViewFlags,(void *)&flags,sizeof(struct _scrollViewFlags));
|
|
|
|
|
|
|
|
_hasVertScroller = scrollViewFlags.hasVScroller;
|
|
|
|
_hasHorizScroller = scrollViewFlags.hasHScroller;
|
|
|
|
// _scrollsDynamically = (!scrollViewFlags.notDynamic);
|
|
|
|
// _rulersVisible = scrollViewFlags.rulersVisible;
|
|
|
|
// _hasHorizRuler = scrollViewFlags.hasHRuler;
|
|
|
|
// _hasVertRuler = scrollViewFlags.hasVRuler;
|
|
|
|
// [self setDrawsBackground: (!scrollViewFlags.doesNotDrawBack)];
|
|
|
|
_borderType = scrollViewFlags.border;
|
|
|
|
}
|
|
|
|
|
2004-01-30 19:49:00 +00:00
|
|
|
if (content != nil)
|
|
|
|
{
|
2006-05-20 22:12:46 +00:00
|
|
|
NSRect frame = [content frame];
|
|
|
|
float w = [vScroller frame].size.width;
|
|
|
|
|
2006-10-15 08:34:47 +00:00
|
|
|
if (_hasVertScroller)
|
2006-05-20 22:12:46 +00:00
|
|
|
{
|
|
|
|
//
|
|
|
|
// Slide the content view over, since on Mac OS X the scroller is on the
|
|
|
|
// right, the content view is not properly positioned since our scroller
|
|
|
|
// is on the left.
|
|
|
|
//
|
|
|
|
frame.origin.x += w;
|
|
|
|
[content setFrame: frame];
|
|
|
|
}
|
|
|
|
|
|
|
|
// retain the view and reset the content view...
|
|
|
|
RETAIN(content);
|
2004-01-30 19:49:00 +00:00
|
|
|
[self setContentView: content];
|
2006-05-20 22:12:46 +00:00
|
|
|
RELEASE(content);
|
2006-08-26 14:10:18 +00:00
|
|
|
ASSIGN(_contentView, content);
|
2004-01-30 19:49:00 +00:00
|
|
|
}
|
2006-05-20 22:12:46 +00:00
|
|
|
|
|
|
|
if (hScroller != nil && _hasHorizScroller)
|
2004-01-30 19:49:00 +00:00
|
|
|
{
|
|
|
|
[self setHorizontalScroller: hScroller];
|
|
|
|
}
|
2006-05-20 22:12:46 +00:00
|
|
|
|
|
|
|
if (vScroller != nil && _hasVertScroller)
|
2004-01-30 19:49:00 +00:00
|
|
|
{
|
|
|
|
[self setVerticalScroller: vScroller];
|
|
|
|
}
|
2006-05-20 22:12:46 +00:00
|
|
|
|
|
|
|
if ([aDecoder containsValueForKey: @"NSHeaderClipView"])
|
|
|
|
{
|
|
|
|
_hasHeaderView = YES;
|
|
|
|
_hasCornerView = YES;
|
2006-11-17 08:54:20 +00:00
|
|
|
ASSIGN(_headerClipView,
|
|
|
|
[aDecoder decodeObjectForKey: @"NSHeaderClipView"]);
|
2004-01-30 19:49:00 +00:00
|
|
|
}
|
2006-05-20 22:12:46 +00:00
|
|
|
|
|
|
|
[self tile];
|
2002-03-26 16:24:42 +00:00
|
|
|
}
|
2004-01-30 19:49:00 +00:00
|
|
|
else
|
2002-03-26 16:24:42 +00:00
|
|
|
{
|
2006-05-20 22:12:46 +00:00
|
|
|
int version = [aDecoder versionForClassName: @"NSScrollView"];
|
2002-03-26 16:24:42 +00:00
|
|
|
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_hLineScroll];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_hPageScroll];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_vLineScroll];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_vPageScroll];
|
|
|
|
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHorizScroller];
|
|
|
|
if (_hasHorizScroller)
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_horizScroller];
|
|
|
|
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasVertScroller];
|
|
|
|
if (_hasVertScroller)
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_vertScroller];
|
|
|
|
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHorizRuler];
|
|
|
|
if (_hasHorizRuler)
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_horizRuler];
|
|
|
|
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasVertRuler];
|
|
|
|
if (_hasVertRuler)
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_vertRuler];
|
|
|
|
|
2004-01-30 19:49:00 +00:00
|
|
|
if (version == 2)
|
|
|
|
{
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
|
|
|
if (_hasHeaderView)
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_headerClipView];
|
|
|
|
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
|
|
|
}
|
|
|
|
else if (version == 1)
|
|
|
|
{
|
|
|
|
/* This recreates all the info about headerView, cornerView, etc */
|
|
|
|
[self setDocumentView: [_contentView documentView]];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NSLog(@"unknown NSScrollView version (%d)", version);
|
|
|
|
DESTROY(self);
|
|
|
|
}
|
2002-03-26 16:24:42 +00:00
|
|
|
[self tile];
|
|
|
|
|
|
|
|
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
|
|
|
|
}
|
2004-01-30 19:49:00 +00:00
|
|
|
|
|
|
|
return self;
|
1999-09-07 05:31:44 +00:00
|
|
|
}
|
|
|
|
|
2004-09-13 19:57:44 +00:00
|
|
|
/* GNUstep private method */
|
|
|
|
|
|
|
|
/* we update both of these at the same time during -tile
|
|
|
|
so there is no reason in seperating them that'd just add
|
|
|
|
message passing */
|
|
|
|
- (void) _synchronizeHeaderAndCornerView
|
|
|
|
{
|
|
|
|
BOOL hadHeaderView = _hasHeaderView;
|
|
|
|
BOOL hadCornerView = _hasCornerView;
|
|
|
|
NSView *aView = nil;
|
2006-11-18 14:56:09 +00:00
|
|
|
|
2004-09-13 19:57:44 +00:00
|
|
|
_hasHeaderView = ([[self documentView]
|
|
|
|
respondsToSelector: @selector(headerView)]
|
|
|
|
&& (aView=[(NSTableView *)[self documentView] headerView]));
|
|
|
|
if (_hasHeaderView == YES)
|
|
|
|
{
|
|
|
|
if (hadHeaderView == NO)
|
|
|
|
{
|
|
|
|
_headerClipView = [NSClipView new];
|
|
|
|
[self addSubview: _headerClipView];
|
|
|
|
RELEASE (_headerClipView);
|
|
|
|
}
|
|
|
|
[_headerClipView setDocumentView: aView];
|
|
|
|
}
|
|
|
|
else if (hadHeaderView == YES)
|
|
|
|
{
|
|
|
|
[self removeSubview: _headerClipView];
|
|
|
|
}
|
|
|
|
if (_hasVertScroller == YES)
|
|
|
|
{
|
|
|
|
aView = nil;
|
|
|
|
_hasCornerView =
|
2006-11-18 14:56:09 +00:00
|
|
|
([[self documentView] respondsToSelector: @selector(cornerView)]
|
|
|
|
&& (aView=[(NSTableView *)[self documentView] cornerView]));
|
2004-09-13 19:57:44 +00:00
|
|
|
|
|
|
|
if (aView == _cornerView)
|
|
|
|
return;
|
|
|
|
if (_hasCornerView == YES)
|
|
|
|
{
|
|
|
|
if (hadCornerView == NO)
|
|
|
|
{
|
2006-11-18 14:56:09 +00:00
|
|
|
[self addSubview: aView];
|
2004-09-13 19:57:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[self replaceSubview: _cornerView with: aView];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (hadCornerView == YES)
|
|
|
|
{
|
|
|
|
[self removeSubview: _cornerView];
|
|
|
|
}
|
|
|
|
_cornerView = aView;
|
|
|
|
}
|
2004-09-26 12:49:32 +00:00
|
|
|
else if (_cornerView != nil)
|
|
|
|
{
|
|
|
|
[self removeSubview: _cornerView];
|
|
|
|
_cornerView = nil;
|
|
|
|
_hasCornerView = NO;
|
|
|
|
}
|
2004-09-13 19:57:44 +00:00
|
|
|
}
|
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
@end
|
2006-11-17 08:54:20 +00:00
|
|
|
|
|
|
|
@implementation NSScrollView (GSPrivate)
|
|
|
|
- (void) _themeDidActivate: (NSNotification*)notification
|
|
|
|
{
|
|
|
|
[self tile];
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|