Get titles of browser working for browser loaded from Gorm file.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25550 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-11-01 14:16:19 +00:00
parent eb23e9991d
commit aa25aa65c7
2 changed files with 457 additions and 455 deletions

View file

@ -1,3 +1,12 @@
2007-11-01 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBrowser.m (+initialize): Create titleCell here to have
it available for browsers loaded from Gorm files.
* Source/NSBrowser.m (GSBrowserTitleCell): Add method
drawingRectForBounds: and correct drawWithFrame:inView:.
* Source/NSBrowser.m (-displayAllColumns, -displayColumn:): Mark
for redraw.
2007-11-01 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (-draggingUpdated:): Use

View file

@ -201,16 +201,21 @@ static NSTextFieldCell *titleCell;
@end
@implementation GSBrowserTitleCell
- (NSRect) drawingRectForBounds: (NSRect)theRect
{
// This adjustment must match the drawn border
return NSInsetRect(theRect, 2, 2);
}
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
if (NSIsEmptyRect (cellFrame) || ![controlView window])
if (NSIsEmptyRect (cellFrame))
{
return;
}
[[GSTheme theme] drawGrayBezel: cellFrame withClip: NSZeroRect];
[self drawInteriorWithFrame: NSInsetRect(cellFrame, 1.0, 1.0)
inView: controlView];
[self drawInteriorWithFrame: cellFrame inView: controlView];
}
@end
@ -841,6 +846,7 @@ static NSTextFieldCell *titleCell;
- (void) displayAllColumns
{
[self tile];
[self setNeedsDisplay: YES];
}
/** <p>Updates the NSBrowser to display the column with the given index.</p>
@ -857,13 +863,10 @@ static NSTextFieldCell *titleCell;
[self tile];
// Update and display title of column
// Display title of column
if (_isTitled)
{
[self lockFocus];
[self drawTitleOfColumn: column
inRect: [self titleFrameOfColumn: column]];
[self unlockFocus];
[self setNeedsDisplayInRect: [self titleFrameOfColumn: column]];
}
// Display column
@ -1248,8 +1251,8 @@ static NSTextFieldCell *titleCell;
}
_separatesColumns = flag;
[self setNeedsDisplay:YES];
[self tile];
[self setNeedsDisplay:YES];
}
- (float) columnWidthForColumnContentWidth: (float)columnContentWidth
@ -2149,6 +2152,11 @@ static NSTextFieldCell *titleCell;
// Initial version
[self setVersion: 1];
scrollerWidth = [NSScroller scrollerWidth];
/* Create the shared titleCell if it hasn't been created already. */
if (!titleCell)
{
titleCell = [GSBrowserTitleCell new];
}
}
}
@ -2160,13 +2168,6 @@ static NSTextFieldCell *titleCell;
- (id) initWithFrame: (NSRect)rect
{
NSSize bs;
//NSScroller *hs;
/* Created the shared titleCell if it hasn't been created already. */
if (!titleCell)
{
titleCell = [GSBrowserTitleCell new];
}
if ((self = [super initWithFrame: rect]) == nil)
{
@ -2684,16 +2685,7 @@ static NSTextFieldCell *titleCell;
NSString *title = [aDecoder decodeObjectForKey: @"NSFirstColumnTitle"];
NSString *sep = [aDecoder decodeObjectForKey: @"NSPathSeparator"];
long flags;
// start //
NSSize bs;
//NSScroller *hs;
/* Created the shared titleCell if it hasn't been created already. */
if (!titleCell)
{
titleCell = [GSBrowserTitleCell new];
}
// Class setting
_browserCellPrototype = [[[NSBrowser cellClass] alloc] init];
@ -3086,7 +3078,6 @@ static NSTextFieldCell *titleCell;
inMatrix: matrix];
}
[sc setNeedsDisplay: YES];
[bc setIsLoaded: YES];
if (column > _lastColumnLoaded)
@ -3115,6 +3106,8 @@ static NSTextFieldCell *titleCell;
// Get the title even when untitled, as this may change later.
[self setTitle: [self _getTitleOfColumn: column] ofColumn: column];
// Mark for redisplay
[self displayColumn: column];
}
/* Get the title of a column. */