1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-03 05:25:52 +00:00

#5109 Show expansion tooltip for abbreviated file names in the File table

This commit is contained in:
Mitchell Livingston 2012-10-29 22:17:08 +00:00
parent 8e0a157531
commit a5971d289a

View file

@ -38,6 +38,7 @@
#define PADDING_ABOVE_TITLE_FILE 2.0
#define PADDING_BELOW_STATUS_FILE 2.0
#define PADDING_BETWEEN_NAME_AND_FOLDER_STATUS 4.0
#define PADDING_EXPANSION_FRAME 2.0
@interface FileNameCell (Private)
@ -142,6 +143,31 @@
[statusString drawInRect: statusRect];
}
- (NSRect) expansionFrameWithFrame: (NSRect) cellFrame inView: (NSView *) view
{
NSAttributedString * titleString = [self attributedTitle];
NSRect realRect = [self rectForTitleWithString: titleString inBounds: cellFrame];
if ([titleString size].width > NSWidth(realRect)
&& NSMouseInRect([view convertPoint: [[view window] convertScreenToBase: [NSEvent mouseLocation]] fromView: nil], realRect, [view isFlipped]))
{
realRect.size.width = [titleString size].width;
return NSInsetRect(realRect, -PADDING_EXPANSION_FRAME, -PADDING_EXPANSION_FRAME);
}
return NSZeroRect;
}
- (void) drawWithExpansionFrame: (NSRect) cellFrame inView: (NSView *)view
{
cellFrame.origin.x += PADDING_EXPANSION_FRAME;
cellFrame.origin.y += PADDING_EXPANSION_FRAME;
[fTitleAttributes setObject: [NSColor controlTextColor] forKey: NSForegroundColorAttributeName];
NSAttributedString * titleString = [self attributedTitle];
[titleString drawInRect: cellFrame];
}
@end
@implementation FileNameCell (Private)