source: trunk/Cocoa/Pester/Source/NJRScrollView.m @ 554

Last change on this file since 554 was 28, checked in by Nicholas Riley, 17 years ago

Pester 1.0

File size: 934 bytes
Line 
1//
2//  NJRScrollView.m
3//  HostLauncher
4//
5//  Created by nicholas on Tue Oct 30 2001.
6//  Copyright (c) 2001 Nicholas Riley. All rights reserved.
7//
8
9#import "NJRScrollView.h"
10
11
12@implementation NJRScrollView
13
14- (BOOL)needsDisplay;
15{
16    NSResponder *resp = nil;
17    if ([[self window] isKeyWindow]) {
18        resp = [[self window] firstResponder];
19        if (resp == lastResp) return [super needsDisplay];
20    } else if (lastResp == nil) {
21        return [super needsDisplay];
22    }
23    shouldDrawFocusRing = (resp != nil && [resp isKindOfClass: [NSView class]] &&
24                           [(NSView *)resp isDescendantOf: self]); // [sic]
25    lastResp = resp;
26    [self setKeyboardFocusRingNeedsDisplayInRect: [self bounds]];
27    return YES;
28}
29
30- (void)drawRect:(NSRect)rect {
31    [super drawRect: rect];
32    if (shouldDrawFocusRing) {
33        NSSetFocusRingStyle(NSFocusRingOnly);
34        NSRectFill([self bounds]);
35    }
36}
37
38@end
Note: See TracBrowser for help on using the repository browser.