mirror of
https://github.com/transmission/transmission.git
synced 2025-12-25 04:45:56 +00:00
#5109 Show expansion tooltip for abbreviated file names in the File table
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user