Changeset 13600


Ignore:
Timestamp:
Oct 29, 2012, 10:17:08 PM (10 years ago)
Author:
livings124
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileNameCell.m

    r13597 r13600  
    3939#define PADDING_BELOW_STATUS_FILE 2.0
    4040#define PADDING_BETWEEN_NAME_AND_FOLDER_STATUS 4.0
     41#define PADDING_EXPANSION_FRAME 2.0
    4142
    4243@interface FileNameCell (Private)
     
    143144}
    144145
     146- (NSRect) expansionFrameWithFrame: (NSRect) cellFrame inView: (NSView *) view
     147{
     148    NSAttributedString * titleString = [self attributedTitle];
     149    NSRect realRect = [self rectForTitleWithString: titleString inBounds: cellFrame];
     150   
     151    if ([titleString size].width > NSWidth(realRect)
     152        && NSMouseInRect([view convertPoint: [[view window] convertScreenToBase: [NSEvent mouseLocation]] fromView: nil], realRect, [view isFlipped]))
     153    {
     154        realRect.size.width = [titleString size].width;
     155        return NSInsetRect(realRect, -PADDING_EXPANSION_FRAME, -PADDING_EXPANSION_FRAME);
     156    }
     157   
     158    return NSZeroRect;
     159}
     160
     161- (void) drawWithExpansionFrame: (NSRect) cellFrame inView: (NSView *)view
     162{
     163    cellFrame.origin.x += PADDING_EXPANSION_FRAME;
     164    cellFrame.origin.y += PADDING_EXPANSION_FRAME;
     165   
     166    [fTitleAttributes setObject: [NSColor controlTextColor] forKey: NSForegroundColorAttributeName];
     167    NSAttributedString * titleString = [self attributedTitle];
     168    [titleString drawInRect: cellFrame];
     169}
     170
    145171@end
    146172
Note: See TracChangeset for help on using the changeset viewer.