get the icon placement from TorrentCell instead of generating it in the tableview

This commit is contained in:
Mitchell Livingston 2007-08-11 03:09:31 +00:00
parent c6c1f90996
commit 7b9e4c8eda
3 changed files with 11 additions and 9 deletions

View File

@ -37,7 +37,7 @@
int8_t * fPieces;
}
- (NSRect) imageRectForBounds: (NSRect) bounds;
- (NSRect) iconRectForBounds: (NSRect) bounds;
- (NSRect) titleRectForBounds: (NSRect) bounds;
- (NSRect) progressRectForBounds: (NSRect) bounds;
- (NSRect) barRectForBounds: (NSRect) bounds;

View File

@ -115,7 +115,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[super dealloc];
}
- (NSRect) imageRectForBounds: (NSRect) bounds
- (NSRect) iconRectForBounds: (NSRect) bounds
{
NSRect result = bounds;
@ -192,7 +192,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
//icon
NSImage * icon = minimal ? (error ? fErrorImage : [torrent iconSmall]) : [torrent iconFlipped];
NSRect iconRect = [self imageRectForBounds: cellFrame];
NSRect iconRect = [self iconRectForBounds: cellFrame];
[icon drawInRect: iconRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
if (error && !minimal)

View File

@ -34,8 +34,6 @@
@interface TorrentTableView (Private)
- (NSRect) iconRectForRow: (int) row;
- (NSRect) pauseRectForRow: (int) row;
- (NSRect) revealRectForRow: (int) row;
- (NSRect) actionRectForRow: (int) row;
@ -487,10 +485,13 @@
- (NSRect) actionRectForRow: (int) row
{
if ([fDefaults boolForKey: @"SmallView"])
return [self iconRectForRow: row];
else if (row < 0)
if (row < 0)
return NSZeroRect;
else if ([fDefaults boolForKey: @"SmallView"])
{
TorrentCell * cell = [[self tableColumnWithIdentifier: @"Torrent"] dataCell];
return [cell iconRectForBounds: [self frameOfCellAtColumn: 0 row: row]];
}
else;
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
@ -506,7 +507,8 @@
if (row < 0)
return NO;
return NSPointInRect(point, [self iconRectForRow: row]);
TorrentCell * cell = [[self tableColumnWithIdentifier: @"Torrent"] dataCell];
return NSPointInRect(point, [cell iconRectForBounds: [self frameOfCellAtColumn: 0 row: row]]);
}
- (BOOL) pointInMinimalStatusRect: (NSPoint) point