Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item
Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item
- Subject: Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item
- From: Seth Willits <email@hidden>
- Date: Tue, 26 Feb 2008 22:21:38 -0800
On Feb 26, 2008, at 3:13 PM, John Stiles wrote:
Trying to simulate the drawing behavior of NSCell seems error-prone
to me. Since I don't have access to the original code, it would be
hard to match its behavior. I'd much rather inherit as much as I can
and only customize around the edges.
You're not replicating a whole lot here, however. If you're already
setting the multi-colored text color in willDisplayCell: for every
cell, then the minimal amount of work you need should be to call
setTextColor before calling the super class's implementation of
drawInteriorWithFrame if the cell is highlighted and active.
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView;
{
BOOL isWindowActive = [[[self controlView] window] isKeyWindow] &&
[[NSApplication sharedApplication] isActive];
BOOL isControlActive = isWindowActive && ([[[self controlView]
window] firstResponder] == [self controlView]);
if (isControlActive && [self isHighlighted]) {
[self setTextColor:[NSColor whiteColor]];
}
[super drawInteriorWithFrame:cellFrame inView:controlView];
}
You can of course get more involved, but this as a minimum should
work. The only thing happening here is what you want: to override the
higlight color.
--
Seth Willits
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden