Changeset 2710


Ignore:
Timestamp:
Aug 10, 2007, 5:46:02 PM (15 years ago)
Author:
livings124
Message:

declare methods in FileBrowserCell?, and make some private

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileBrowserCell.h

    r2709 r2710  
    3434- (void) setProgress: (float) progress;
    3535
     36- (NSRect) titleRectForBounds: (NSRect) bounds;
     37- (NSRect) statusRectForBounds: (NSRect) bounds;
     38- (NSRect) imageRectForBounds: (NSRect) bounds;
     39
    3640@end
  • trunk/macosx/FileBrowserCell.m

    r2709 r2710  
    3434#define PADDING_AFTER_TITLE 1.0
    3535
     36@interface FileBrowserCell (Private)
     37
     38- (NSAttributedString *) attributedTitleWithColor: (NSColor *) color;
     39- (NSAttributedString *) attributedStatusWithColor: (NSColor *) color;
     40
     41@end
     42
    3643@implementation FileBrowserCell
    3744
     
    5461{
    5562    fPercent = progress * 100.0;
    56 }
    57 
    58 - (NSAttributedString *) attributedTitleWithColor: (NSColor *) color
    59 {
    60     if (!fTitleAttributes)
    61     {
    62         NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
    63         [paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail];
    64        
    65         fTitleAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
    66                             [NSFont messageFontOfSize: 12.0], NSFontAttributeName,
    67                             paragraphStyle, NSParagraphStyleAttributeName, nil];
    68        
    69         [paragraphStyle release];
    70     }
    71    
    72     if (color)
    73         [fTitleAttributes setObject: color forKey: NSForegroundColorAttributeName];
    74        
    75     NSString * title = [[self objectValue] objectForKey: @"Name"];
    76     return [[[NSAttributedString alloc] initWithString: title attributes: fTitleAttributes] autorelease];
    7763}
    7864
     
    9884   
    9985    return result;
    100 }
    101 
    102 - (NSAttributedString *) attributedStatusWithColor: (NSColor *) color
    103 {
    104     if (!fStatusAttributes)
    105     {
    106         NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
    107         [paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail];
    108        
    109         fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
    110                                 [NSFont messageFontOfSize: 9.0], NSFontAttributeName,
    111                                 paragraphStyle, NSParagraphStyleAttributeName, nil];
    112        
    113         [paragraphStyle release];
    114     }
    115    
    116     if (color)
    117         [fStatusAttributes setObject: color forKey: NSForegroundColorAttributeName];
    118    
    119     #warning fPercent?
    120     NSString * status = [NSString stringWithFormat: NSLocalizedString(@"%.2f%% of %@",
    121                             "Inspector -> Files tab -> file status string"), fPercent,
    122                             [NSString stringForFileSize: [[[self objectValue] objectForKey: @"Size"] unsignedLongLongValue]]];
    123    
    124     return [[[NSAttributedString alloc] initWithString: status attributes: fStatusAttributes] autorelease];
    12586}
    12687
     
    177138
    178139@end
     140
     141@implementation FileBrowserCell (Private)
     142
     143- (NSAttributedString *) attributedTitleWithColor: (NSColor *) color
     144{
     145    if (!fTitleAttributes)
     146    {
     147        NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
     148        [paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail];
     149       
     150        fTitleAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
     151                            [NSFont messageFontOfSize: 12.0], NSFontAttributeName,
     152                            paragraphStyle, NSParagraphStyleAttributeName, nil];
     153       
     154        [paragraphStyle release];
     155    }
     156   
     157    if (color)
     158        [fTitleAttributes setObject: color forKey: NSForegroundColorAttributeName];
     159       
     160    NSString * title = [[self objectValue] objectForKey: @"Name"];
     161    return [[[NSAttributedString alloc] initWithString: title attributes: fTitleAttributes] autorelease];
     162}
     163
     164- (NSAttributedString *) attributedStatusWithColor: (NSColor *) color
     165{
     166    if (!fStatusAttributes)
     167    {
     168        NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
     169        [paragraphStyle setLineBreakMode: NSLineBreakByTruncatingTail];
     170       
     171        fStatusAttributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
     172                                [NSFont messageFontOfSize: 9.0], NSFontAttributeName,
     173                                paragraphStyle, NSParagraphStyleAttributeName, nil];
     174       
     175        [paragraphStyle release];
     176    }
     177   
     178    if (color)
     179        [fStatusAttributes setObject: color forKey: NSForegroundColorAttributeName];
     180   
     181    #warning fPercent?
     182    NSString * status = [NSString stringWithFormat: NSLocalizedString(@"%.2f%% of %@",
     183                            "Inspector -> Files tab -> file status string"), fPercent,
     184                            [NSString stringForFileSize: [[[self objectValue] objectForKey: @"Size"] unsignedLongLongValue]]];
     185   
     186    return [[[NSAttributedString alloc] initWithString: status attributes: fStatusAttributes] autorelease];
     187}
     188
     189@end
Note: See TracChangeset for help on using the changeset viewer.