instead of displaying a tooltip for the buttons, when hovered over, display the "tip" where the status string usually is

This commit is contained in:
Mitchell Livingston 2008-01-15 21:09:51 +00:00
parent 5cfe65531f
commit 2cda37ab07
2 changed files with 29 additions and 5 deletions

View File

@ -76,6 +76,8 @@
- (NSAttributedString *) attributedTitleWithColor: (NSColor *) color;
- (NSAttributedString *) attributedStatusString: (NSString *) string withColor: (NSColor *) color;
- (NSString *) statusString;
@end
@implementation TorrentCell
@ -214,8 +216,7 @@
- (NSRect) statusRectForBounds: (NSRect) bounds
{
return [self rectForStatusWithString: [self attributedStatusString: [[self representedObject] statusString] withColor: nil]
inBounds: bounds];
return [self rectForStatusWithString: [self attributedStatusString: [self statusString] withColor: nil] inBounds: bounds];
}
- (NSRect) controlButtonRectForBounds: (NSRect) bounds
@ -542,7 +543,7 @@
//status
if (!minimal)
{
NSAttributedString * statusString = [self attributedStatusString: [torrent statusString] withColor: statusColor];
NSAttributedString * statusString = [self attributedStatusString: [self statusString] withColor: statusColor];
[statusString drawInRect: [self rectForStatusWithString: statusString inBounds: cellFrame]];
}
}
@ -839,4 +840,27 @@
return [[[NSAttributedString alloc] initWithString: string attributes: fStatusAttributes] autorelease];
}
- (NSString *) statusString
{
if (fMouseDownRevealButton || (!fTracking && fHoverReveal))
return NSLocalizedString(@"Reveal the data file in Finder", "Torrent cell -> button info");
else if (fMouseDownControlButton || (!fTracking && fHoverControl))
{
Torrent * torrent = [self representedObject];
if ([torrent isActive])
return NSLocalizedString(@"Pause the transfer.", "Torrent Table -> tooltip");
else
{
if ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask && [fDefaults boolForKey: @"Queue"])
return NSLocalizedString(@"Resume the transfer right away", "Torrent cell -> button info");
else if ([torrent waitingToStart])
return NSLocalizedString(@"Stop waiting to start", "Torrent cell -> button info");
else
return NSLocalizedString(@"Resume the transfer", "Torrent cell -> button info");
}
}
else
return [[self representedObject] statusString];
}
@end

View File

@ -331,7 +331,7 @@
}
#warning get rect to actually change
- (NSString *) tableView: (NSTableView *) tableView toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect
/*- (NSString *) tableView: (NSTableView *) tableView toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect
tableColumn: (NSTableColumn *) tableColumn row: (NSInteger) row mouseLocation: (NSPoint) mousePoint
{
if ([self pointInActionRect: mousePoint])
@ -365,7 +365,7 @@
}
return nil;
}
}*/
- (void) toggleControlForTorrent: (Torrent *) torrent
{