Source/NSTableView.m

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12971 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Pierre-Yves Rivaille 2002-03-04 17:37:35 +00:00
parent 4ceecb9cff
commit f3c167b917
2 changed files with 49 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2002-03-04 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
* Source/NSTableView.m ([NSTableView -superviewFrameChanged:]):
fix a bug when resizing a tableview with autoresizesAllColumnsToFit
set to YES.
Mon Mar 4 09:09:02 2002 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSSavePanel.m: Do not include AppKit/IMLoading.h.

View file

@ -6715,7 +6715,49 @@ byExtendingSelection: (BOOL)flag
{
if (_autoresizesAllColumnsToFit == YES)
{
[self sizeToFit];
float visible_width = [self convertRect: [_super_view bounds]
fromView: _super_view].size.width;
float table_width = 0;
if(_numberOfColumns > 0)
{
table_width =
_columnOrigins[_numberOfColumns - 1] +
[[_tableColumns objectAtIndex: _numberOfColumns - 1] width];
}
/*
NSLog(@"columnOrigins[0] %f", _columnOrigins[0]);
NSLog(@"superview.bounds %@",
NSStringFromRect([_super_view bounds]));
NSLog(@"superview.frame %@",
NSStringFromRect([_super_view frame]));
NSLog(@"table_width %f", table_width);
NSLog(@"width %f", visible_width);
NSLog(@"_superview_width %f", _superview_width);
*/
if ( table_width - _superview_width <= 0.001
&& table_width - _superview_width >= -0.001 )
{
// the last column had been sized to fit
[self sizeToFit];
}
else if ( table_width <= _superview_width
&& table_width >= visible_width )
{
// the tableView was too small and is now too large
[self sizeToFit];
}
else if (table_width >= _superview_width
&& table_width <= visible_width )
{
// the tableView was too large and is now too small
if (_numberOfColumns > 0)
[self scrollColumnToVisible: 0];
[self sizeToFit];
}
_superview_width = visible_width;
}
else
{