Changeset 5014

Show
Ignore:
Timestamp:
10/26/07 14:00:31 (9 months ago)
Author:
morris
Message:

Fix highlighting

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/WCTransferCell.m

    r4799 r5014  
    111111 
    112112- (void)drawWithFrame:(NSRect)frame inView:(NSView *)view { 
    113         NSProgressIndicator     *progressIndicator; 
    114         NSAttributedString    *string; 
    115         NSString                        *name, *status; 
    116         NSImage                         *icon; 
    117         NSRect                          rect; 
    118         NSSize                          size; 
    119         CGFloat                         offset; 
     113        NSProgressIndicator                    *progressIndicator; 
     114        NSMutableAttributedString     *string; 
     115        NSString                                       *name, *status; 
     116        NSImage                                        *icon; 
     117        NSRect                                         rect; 
     118        NSSize                                         size; 
     119        CGFloat                                        offset; 
    120120         
    121121        name = [(NSDictionary *) [self objectValue] objectForKey:WCTransferCellNameKey]; 
     
    125125         
    126126        rect = NSMakeRect(frame.origin.x - 2.0, frame.origin.y, frame.size.width, 16.0); 
    127         string = [NSAttributedString attributedStringWithString:name attributes:_nameAttributes]; 
     127        string = [NSMutableAttributedString attributedStringWithString:name attributes:_nameAttributes]; 
     128         
     129        if([self isHighlighted] && [_nameCell highlightColorWithFrame:rect inView:view] == [NSColor alternateSelectedControlColor]) { 
     130                [string addAttribute:NSForegroundColorAttributeName 
     131                                           value:[NSColor whiteColor] 
     132                                           range:NSMakeRange(0, [string length])]; 
     133        } 
     134         
    128135        [_nameCell setAttributedStringValue:string]; 
    129         [_nameCell setHighlighted:[self isHighlighted]]; 
    130136        [_nameCell drawWithFrame:rect inView:view]; 
    131137 
     
    151157        offset = [self drawsProgressIndicator] ? 32.0 : 19.0; 
    152158        rect = NSMakeRect(frame.origin.x - 2.0, frame.origin.y + offset, frame.size.width, 14.0); 
    153         string = [NSAttributedString attributedStringWithString:status attributes:_statusAttributes]; 
     159        string = [NSMutableAttributedString attributedStringWithString:status attributes:_statusAttributes]; 
     160         
     161        if([self isHighlighted] && [_statusCell highlightColorWithFrame:rect inView:view] == [NSColor alternateSelectedControlColor]) { 
     162                [string addAttribute:NSForegroundColorAttributeName 
     163                                           value:[NSColor whiteColor] 
     164                                           range:NSMakeRange(0, [string length])]; 
     165        } 
     166         
    154167        [_statusCell setAttributedStringValue:string]; 
    155         [_statusCell setHighlighted:[self isHighlighted]]; 
    156168        [_statusCell drawWithFrame:rect inView:view]; 
    157169} 
  • WiredClient/trunk/WCUserCell.m

    r4439 r5014  
    3636        self = [super init]; 
    3737 
    38         _nickCell = [[NSCell alloc] init]; 
     38        _nickCell = [[NSTextFieldCell alloc] init]; 
    3939        _statusCell = [[NSCell alloc] init]; 
    4040         
     
    131131 
    132132- (void)drawWithFrame:(NSRect)frame inView:(NSView *)view { 
    133         NSAttributedString            *string; 
    134         NSString                                *nick, *status; 
    135         NSRect                                  rect; 
     133        NSMutableAttributedString             *string; 
     134        NSString                                               *nick, *status; 
     135        NSRect                                                 rect; 
    136136         
    137137        nick    = [(NSDictionary *) [self objectValue] objectForKey:WCUserCellNickKey]; 
     
    147147        } 
    148148         
    149         string = [NSAttributedString attributedStringWithString:nick attributes:_nickAttributes]; 
    150  
     149        string = [NSMutableAttributedString attributedStringWithString:nick attributes:_nickAttributes]; 
     150         
     151        if([self isHighlighted] && [_nickCell highlightColorWithFrame:rect inView:view] == [NSColor alternateSelectedControlColor]) { 
     152                [string addAttribute:NSForegroundColorAttributeName 
     153                                           value:[NSColor whiteColor] 
     154                                           range:NSMakeRange(0, [string length])]; 
     155        } 
     156                 
    151157        [_nickCell setAttributedStringValue:[string attributedStringByApplyingFilter:_filter]]; 
    152         [_nickCell setHighlighted:[self isHighlighted]]; 
    153158        [_nickCell drawWithFrame:rect inView:view]; 
    154159         
     
    158163                 
    159164                [_statusCell setAttributedStringValue:[string attributedStringByApplyingFilter:_filter]]; 
    160                 [_statusCell setHighlighted:[self isHighlighted]]; 
    161165                [_statusCell drawWithFrame:rect inView:view]; 
    162166        }