mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 12:00:52 +00:00
2004-09-13 Matt Rice <ratmice@yahoo.com>
* NSScrollView.h: Declare new ivar _cornerView and private method -_synchronizeCornerAndHeaderView * NSScrollView.m (tile): Call _synchronizeCornerAndHeaderView method from here. Replace local cornerView variable with _cornerView. (-setDocumentView:): Remove code to set the corner and header views. (-_synchronizeCornerAndHeaderView): Implement new method. * NSTableView.m (-setHeaderView:, -setCornerView:): call tile on the scroll view we're in. Remove comments and warnings for cases which are now implemented. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20049 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
afaa68f9d5
commit
8b3d930318
4 changed files with 98 additions and 49 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2004-09-13 Matt Rice <ratmice@yahoo.com>
|
||||
* NSScrollView.h: Declare new ivar _cornerView and private method
|
||||
-_synchronizeCornerAndHeaderView
|
||||
* NSScrollView.m (tile): Call _synchronizeCornerAndHeaderView method
|
||||
from here. Replace local cornerView variable with _cornerView.
|
||||
(-setDocumentView:): Remove code to set the corner and header views.
|
||||
(-_synchronizeCornerAndHeaderView): Implement new method.
|
||||
* NSTableView.m (-setHeaderView:, -setCornerView:): call tile on the
|
||||
scroll view we're in. Remove comments and warnings for cases which are
|
||||
now implemented.
|
||||
|
||||
2004-09-12 Matt Rice <ratmice@yahoo.com>
|
||||
* Headers/AppKit/NSCell.h (-_sendsActionOn:): New method.
|
||||
* Source/NSCell.m (-_sendsActionOn:): Implement it.
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
BOOL _hasHeaderView;
|
||||
BOOL _hasCornerView;
|
||||
NSClipView *_headerClipView;
|
||||
NSView *_cornerView;
|
||||
}
|
||||
|
||||
/* Calculating layout */
|
||||
|
@ -140,6 +141,8 @@
|
|||
/* Arranging components */
|
||||
- (void)tile;
|
||||
|
||||
/* GNUstep private methods */
|
||||
- (void)_synchronizeHeaderAndCornerView;
|
||||
@end
|
||||
|
||||
#endif /* _GNUstep_H_NSScrollView */
|
||||
|
|
|
@ -786,7 +786,6 @@ static float scrollerWidth;
|
|||
NSSize border = _sizeForBorderType(_borderType);
|
||||
NSRectEdge bottomEdge, topEdge;
|
||||
float headerViewHeight = 0;
|
||||
NSView *cornerView = nil;
|
||||
|
||||
/* Determine edge positions. */
|
||||
if (_rFlags.flipped_view)
|
||||
|
@ -803,9 +802,12 @@ static float scrollerWidth;
|
|||
/* Prepare the contentRect by the insetting the borders. */
|
||||
contentRect = NSInsetRect (_bounds, border.width, border.height);
|
||||
|
||||
[self _synchronizeHeaderAndCornerView];
|
||||
|
||||
/* 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). */
|
||||
|
||||
if (_hasHeaderView == YES)
|
||||
{
|
||||
headerViewHeight = [[_headerClipView documentView] frame].size.height;
|
||||
|
@ -813,10 +815,9 @@ static float scrollerWidth;
|
|||
|
||||
if (_hasCornerView == YES)
|
||||
{
|
||||
cornerView = [(NSTableView *)[_contentView documentView] cornerView];
|
||||
if (headerViewHeight == 0)
|
||||
{
|
||||
headerViewHeight = [cornerView frame].size.height;
|
||||
headerViewHeight = [_cornerView frame].size.height;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -874,7 +875,7 @@ static float scrollerWidth;
|
|||
/* Now place the corner view. */
|
||||
if (_hasCornerView)
|
||||
{
|
||||
[cornerView setFrameOrigin: headerRect.origin];
|
||||
[_cornerView setFrameOrigin: headerRect.origin];
|
||||
}
|
||||
|
||||
/* Now place the rulers. */
|
||||
|
@ -990,39 +991,8 @@ static float scrollerWidth;
|
|||
|
||||
- (void) setDocumentView: (NSView *)aView
|
||||
{
|
||||
BOOL hadHeaderView = _hasHeaderView;
|
||||
|
||||
if (_hasCornerView == YES)
|
||||
{
|
||||
[self removeSubview:
|
||||
[(NSTableView *)[_contentView documentView] cornerView]];
|
||||
}
|
||||
_hasCornerView = ([aView respondsToSelector: @selector(cornerView)]
|
||||
&& ([(NSTableView *)aView cornerView] != nil));
|
||||
if (_hasCornerView == YES)
|
||||
{
|
||||
[self addSubview: [(NSTableView *)aView cornerView]];
|
||||
}
|
||||
//
|
||||
_hasHeaderView = ([aView respondsToSelector: @selector(headerView)]
|
||||
&& ([(NSTableView *)aView headerView] != nil));
|
||||
if (_hasHeaderView == YES)
|
||||
{
|
||||
if (hadHeaderView == NO)
|
||||
{
|
||||
_headerClipView = [NSClipView new];
|
||||
[self addSubview: _headerClipView];
|
||||
RELEASE (_headerClipView);
|
||||
}
|
||||
[_headerClipView setDocumentView:
|
||||
[(NSTableView *)aView headerView]];
|
||||
}
|
||||
else if (hadHeaderView == YES)
|
||||
{
|
||||
[self removeSubview: _headerClipView];
|
||||
}
|
||||
//
|
||||
[_contentView setDocumentView: aView];
|
||||
|
||||
if (_contentView && !_contentView->_rFlags.flipped_view)
|
||||
{
|
||||
[_vertScroller setFloatValue: 1];
|
||||
|
@ -1320,4 +1290,59 @@ static float scrollerWidth;
|
|||
return self;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
_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 =
|
||||
([[self documentView] respondsToSelector: @selector(cornerView)]
|
||||
&& (aView=[(NSTableView *)[self documentView] cornerView]));
|
||||
|
||||
if (aView == _cornerView)
|
||||
return;
|
||||
if (_hasCornerView == YES)
|
||||
{
|
||||
if (hadCornerView == NO)
|
||||
{
|
||||
[self addSubview:aView];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self replaceSubview: _cornerView with: aView];
|
||||
}
|
||||
}
|
||||
else if (hadCornerView == YES)
|
||||
{
|
||||
[self removeSubview: _cornerView];
|
||||
}
|
||||
_cornerView = aView;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "AppKit/NSImage.h"
|
||||
#include "AppKit/NSGraphics.h"
|
||||
#include "AppKit/NSScroller.h"
|
||||
#include "AppKit/NSScrollView.h"
|
||||
#include "AppKit/NSTableColumn.h"
|
||||
#include "AppKit/NSTableHeaderView.h"
|
||||
#include "AppKit/NSText.h"
|
||||
|
@ -3765,20 +3766,23 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
|||
|
||||
- (void) setHeaderView: (NSTableHeaderView*)aHeaderView
|
||||
{
|
||||
|
||||
if ([_headerView respondsToSelector:@selector(setTableView)])
|
||||
[_headerView setTableView: nil];
|
||||
|
||||
ASSIGN (_headerView, aHeaderView);
|
||||
|
||||
if ([_headerView respondsToSelector:@selector(setTableView)])
|
||||
[_headerView setTableView: self];
|
||||
|
||||
[self tile]; // resizes corner and header views, then displays
|
||||
|
||||
if (_super_view != nil)
|
||||
{
|
||||
/* Changing the headerView after the table has been linked to a
|
||||
scrollview is not yet supported - the doc is not clear
|
||||
whether it should be supported at all. If it is, perhaps
|
||||
it's going to be done through a private method between the
|
||||
tableview and the scrollview. */
|
||||
NSLog (@"setHeaderView: called after NSTableView has been put "
|
||||
@"in the view tree!");
|
||||
}
|
||||
[_headerView setTableView: nil];
|
||||
ASSIGN (_headerView, aHeaderView);
|
||||
[_headerView setTableView: self];
|
||||
[self tile];
|
||||
id ssv = [_super_view superview];
|
||||
if ([ssv isKindOfClass: [NSScrollView class]])
|
||||
[ssv tile]; // draws any border type over corner and header views
|
||||
}
|
||||
}
|
||||
|
||||
- (NSTableHeaderView*) headerView
|
||||
|
@ -3789,7 +3793,13 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
|||
- (void) setCornerView: (NSView*)aView
|
||||
{
|
||||
ASSIGN (_cornerView, aView);
|
||||
[self tile];
|
||||
[self tile]; // resizes corner and header views, then displays
|
||||
if (_super_view)
|
||||
{
|
||||
id ssv = [_super_view superview];
|
||||
if ([ssv isKindOfClass: [NSScrollView class]])
|
||||
[ssv tile]; // draws any border type over corner and header views
|
||||
}
|
||||
}
|
||||
|
||||
- (NSView*) cornerView
|
||||
|
|
Loading…
Reference in a new issue