diff --git a/macosx/FileNameCell.m b/macosx/FileNameCell.m index e95713f80..b9e5a68ba 100644 --- a/macosx/FileNameCell.m +++ b/macosx/FileNameCell.m @@ -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)