Table cell: Use highlight color for key equivalent / tab trigger

Previously we would use highlight color if the table view was first responder. Now we use the highlight color if the cell’s background is set to NSBackgroundStyleDark, which then works when we use the cell in a table view which “shares focus” with a text or key equivalent field.
This commit is contained in:
Allan Odgaard
2014-08-14 16:26:10 +02:00
parent 44aece5a07
commit 4a20bfebaa

View File

@@ -50,7 +50,7 @@
HIRect bounds = { { NSMinX(podRect) - 5, NSMinY(podRect) }, { NSWidth(podRect), NSHeight(podRect) } };
[[NSColor textColor] set];
if([self isHighlighted] && ([[controlView window] firstResponder] == controlView || ([[[controlView window] firstResponder] respondsToSelector:@selector(delegate)] && [[[controlView window] firstResponder] performSelector:@selector(delegate)] == controlView)) && [[controlView window] isKeyWindow])
if(self.backgroundStyle == NSBackgroundStyleDark)
[[NSColor alternateSelectedControlTextColor] set];
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
@@ -73,7 +73,7 @@
[pStyle setTabStops:@[ [[NSTextTab alloc] initWithType:NSRightTabStopType location:width], [[NSTextTab alloc] initWithType:NSLeftTabStopType location:width + 1] ]];
[aStr addAttributes:@{ NSParagraphStyleAttributeName : pStyle } range:NSMakeRange(0, [aStr length])];
if([self isHighlighted] && ([[controlView window] firstResponder] == controlView || ([[[controlView window] firstResponder] respondsToSelector:@selector(delegate)] && [[[controlView window] firstResponder] performSelector:@selector(delegate)] == controlView)) && [[controlView window] isKeyWindow])
if(self.backgroundStyle == NSBackgroundStyleDark)
[aStr addAttributes:@{ NSForegroundColorAttributeName : [NSColor alternateSelectedControlTextColor] } range:NSMakeRange(0, [aStr length])];
NSRect triggerFrame;