source: trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEInvertingTextFieldCell.m@ 428

Last change on this file since 428 was 428, checked in by Nicholas Riley, 16 years ago

Compiler fixes; first pass at menu-style highlighting

File size: 1.1 KB
Line 
1//
2// ICeCoffEEInvertingTextFieldCell.m
3// ICeCoffEE
4//
5// Created by Nicholas Riley on 2/29/08.
6// Copyright 2008 Nicholas Riley. All rights reserved.
7//
8
9#import "ICeCoffEEInvertingTextFieldCell.h"
10
11
12@implementation ICeCoffEEInvertingTextFieldCell
13
14- (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
15{
16 return nil;
17}
18
19- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
20{
21 if ([self isHighlighted] && [[controlView window] firstResponder] == controlView && [[controlView window] isKeyWindow]) {
22 NSMutableAttributedString *astr = [[self attributedStringValue] mutableCopy];
23 unsigned location = 0, length = [astr length];
24 NSRange range;
25 while (location < length) {
26 if ([astr attribute: NSForegroundColorAttributeName atIndex: location effectiveRange: &range] == nil) {
27 [astr addAttribute: NSForegroundColorAttributeName value: [NSColor whiteColor]
28 range: range];
29 }
30 location += range.length;
31 }
32 [self setAttributedStringValue: astr];
33 [astr release];
34 }
35 [super drawWithFrame: cellFrame inView: controlView];
36}
37
38@end
Note: See TracBrowser for help on using the repository browser.