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; int8_t * fPieces;
} }
- (NSRect) imageRectForBounds: (NSRect) bounds; - (NSRect) iconRectForBounds: (NSRect) bounds;
- (NSRect) titleRectForBounds: (NSRect) bounds; - (NSRect) titleRectForBounds: (NSRect) bounds;
- (NSRect) progressRectForBounds: (NSRect) bounds; - (NSRect) progressRectForBounds: (NSRect) bounds;
- (NSRect) barRectForBounds: (NSRect) bounds; - (NSRect) barRectForBounds: (NSRect) bounds;

View File

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

View File

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