Changeset 2710
- Timestamp:
- Aug 10, 2007, 5:46:02 PM (15 years ago)
- Location:
- trunk/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/FileBrowserCell.h
r2709 r2710 34 34 - (void) setProgress: (float) progress; 35 35 36 - (NSRect) titleRectForBounds: (NSRect) bounds; 37 - (NSRect) statusRectForBounds: (NSRect) bounds; 38 - (NSRect) imageRectForBounds: (NSRect) bounds; 39 36 40 @end -
trunk/macosx/FileBrowserCell.m
r2709 r2710 34 34 #define PADDING_AFTER_TITLE 1.0 35 35 36 @interface FileBrowserCell (Private) 37 38 - (NSAttributedString *) attributedTitleWithColor: (NSColor *) color; 39 - (NSAttributedString *) attributedStatusWithColor: (NSColor *) color; 40 41 @end 42 36 43 @implementation FileBrowserCell 37 44 … … 54 61 { 55 62 fPercent = progress * 100.0; 56 }57 58 - (NSAttributedString *) attributedTitleWithColor: (NSColor *) color59 {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];77 63 } 78 64 … … 98 84 99 85 return result; 100 }101 102 - (NSAttributedString *) attributedStatusWithColor: (NSColor *) color103 {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];125 86 } 126 87 … … 177 138 178 139 @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.