Last change
on this file since 432 was
432,
checked in by Nicholas Riley, 12 years ago
|
Fragile hack to determine whether we should draw the highlighted row as active.
|
File size:
1.2 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 | #import "ICeCoffEEMenuOutlineView.h" |
---|
11 | |
---|
12 | |
---|
13 | @implementation ICeCoffEEInvertingTextFieldCell |
---|
14 | |
---|
15 | - (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; |
---|
16 | { |
---|
17 | return nil; |
---|
18 | } |
---|
19 | |
---|
20 | - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; |
---|
21 | { |
---|
22 | // XXX note cast to ICeCoffEEMenuOutlineView *; this is not general-purpose |
---|
23 | if ([self isHighlighted] && [(ICeCoffEEMenuOutlineView *)controlView shouldUseActiveHighlight]) { |
---|
24 | NSMutableAttributedString *astr = [[self attributedStringValue] mutableCopy]; |
---|
25 | unsigned location = 0, length = [astr length]; |
---|
26 | NSRange range; |
---|
27 | while (location < length) { |
---|
28 | if ([astr attribute: NSForegroundColorAttributeName atIndex: location effectiveRange: &range] == nil) { |
---|
29 | [astr addAttribute: NSForegroundColorAttributeName value: [NSColor whiteColor] |
---|
30 | range: range]; |
---|
31 | } |
---|
32 | location += range.length; |
---|
33 | } |
---|
34 | [self setAttributedStringValue: astr]; |
---|
35 | [astr release]; |
---|
36 | } |
---|
37 | [super drawWithFrame: cellFrame inView: controlView]; |
---|
38 | } |
---|
39 | |
---|
40 | @end |
---|
Note: See
TracBrowser
for help on using the repository browser.