//
//  ICeCoffEEInvertingTextFieldCell.m
//  ICeCoffEE
//
//  Created by Nicholas Riley on 2/29/08.
//  Copyright 2008 Nicholas Riley. All rights reserved.
//

#import "ICeCoffEEInvertingTextFieldCell.h"
#import "ICeCoffEEMenuOutlineView.h"


@implementation ICeCoffEEInvertingTextFieldCell

- (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
{
    return nil;
}

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
{
    if ([self isHighlighted] && ICCF_ViewHasKeyboardFocus(controlView)) {
	NSMutableAttributedString *astr = [[self attributedStringValue] mutableCopy];
	unsigned location = 0, length = [astr length];
	NSRange range;
	while (location < length) {
	    if ([astr attribute: NSForegroundColorAttributeName atIndex: location effectiveRange: &range] == nil) {
		[astr addAttribute: NSForegroundColorAttributeName value: [NSColor whiteColor]
			     range: range];
	    }
	    location += range.length;
	}
	[self setAttributedStringValue: astr];
	[astr release];
    }
    [super drawWithFrame: cellFrame inView: controlView];
}

@end
