Last change
on this file since 507 was 153, checked in by Nicholas Riley, 21 years ago |
Integrates SCPatch and mach_inject; unfinished, buggy.
|
File size:
1.3 KB
|
Rev | Line | |
---|
[7] | 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 |
|
---|
[153] | 11 | #ifndef NSAppKitVersionNumber10_2
|
---|
| 12 | #define NSAppKitVersionNumber10_2 663
|
---|
| 13 | #endif
|
---|
[7] | 14 |
|
---|
| 15 | @implementation NJRScrollView
|
---|
| 16 |
|
---|
| 17 | - (BOOL)needsDisplay;
|
---|
| 18 | {
|
---|
[153] | 19 | // Mac OS X 10.3 and later have support for external focus rings
|
---|
| 20 | if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_2)
|
---|
| 21 | return [super needsDisplay];
|
---|
[7] | 22 | NSResponder *resp = nil;
|
---|
| 23 | if ([[self window] isKeyWindow]) {
|
---|
| 24 | resp = [[self window] firstResponder];
|
---|
| 25 | if (resp == lastResp) return [super needsDisplay];
|
---|
| 26 | } else if (lastResp == nil) {
|
---|
| 27 | return [super needsDisplay];
|
---|
| 28 | }
|
---|
| 29 | shouldDrawFocusRing = (resp != nil && [resp isKindOfClass: [NSView class]] &&
|
---|
| 30 | [(NSView *)resp isDescendantOf: self]); // [sic]
|
---|
| 31 | lastResp = resp;
|
---|
| 32 | [self setKeyboardFocusRingNeedsDisplayInRect: [self bounds]];
|
---|
| 33 | return YES;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | - (void)drawRect:(NSRect)rect {
|
---|
| 37 | [super drawRect: rect];
|
---|
[153] | 38 | // Mac OS X 10.3 and later have support for external focus rings
|
---|
| 39 | if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_2)
|
---|
| 40 | return;
|
---|
[7] | 41 | if (shouldDrawFocusRing) {
|
---|
| 42 | NSSetFocusRingStyle(NSFocusRingOnly);
|
---|
| 43 | NSRectFill([self bounds]);
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | @end |
---|
Note:
See
TracBrowser
for help on using the repository browser.