// // NJRScrollView.m // HostLauncher // // Created by nicholas on Tue Oct 30 2001. // Copyright (c) 2001 Nicholas Riley. All rights reserved. // #import "NJRScrollView.h" #ifndef NSAppKitVersionNumber10_2 #define NSAppKitVersionNumber10_2 663 #endif @implementation NJRScrollView - (BOOL)needsDisplay; { // Mac OS X 10.3 and later have support for external focus rings if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_2) return [super needsDisplay]; NSResponder *resp = nil; if ([[self window] isKeyWindow]) { resp = [[self window] firstResponder]; if (resp == lastResp) return [super needsDisplay]; } else if (lastResp == nil) { return [super needsDisplay]; } shouldDrawFocusRing = (resp != nil && [resp isKindOfClass: [NSView class]] && [(NSView *)resp isDescendantOf: self]); // [sic] lastResp = resp; [self setKeyboardFocusRingNeedsDisplayInRect: [self bounds]]; return YES; } - (void)drawRect:(NSRect)rect { [super drawRect: rect]; // Mac OS X 10.3 and later have support for external focus rings if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_2) return; if (shouldDrawFocusRing) { NSSetFocusRingStyle(NSFocusRingOnly); NSRectFill([self bounds]); } } @end