Implement NSShowAllViews

This commit is contained in:
Sergey Bugaev 2019-05-09 17:09:59 +03:00
parent afde656ba5
commit e04c5af6a8
3 changed files with 25 additions and 5 deletions

View File

@ -250,6 +250,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
}
- (NSColor *) _borderColorForNSShowAllViews {
return [NSColor cyanColor];
}
@end
@implementation NSButton (BindingSupport)

View File

@ -35,6 +35,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
[self setNeedsDisplay:YES];
}
- (NSColor *) _borderColorForNSShowAllViews {
return [NSColor yellowColor];
}
-(void)drawRect:(NSRect)rect {
NSRect bounds=[self bounds];
CGFloat cheatSheet = 0;

View File

@ -47,10 +47,17 @@ NSString * const NSViewFocusDidChangeNotification=@"NSViewFocusDidChangeNotifica
@implementation NSView
static BOOL NSViewLayersEnabled=NO;
static BOOL NSViewLayersEnabled = NO;
static BOOL NSShowAllViews = NO;
+(void)initialize {
NSViewLayersEnabled=[[NSUserDefaults standardUserDefaults] boolForKey:@"NSViewLayersEnabled"];
+ (void) initialize {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSViewLayersEnabled = [defaults boolForKey: @"NSViewLayersEnabled"];
NSShowAllViews = [defaults boolForKey: @"NSShowAllViews"];
}
- (NSColor *) _borderColorForNSShowAllViews {
return [NSColor orangeColor];
}
+(NSView *)focusView {
@ -2049,8 +2056,13 @@ static NSGraphicsContext *graphicsContextForView(NSView *view){
[[NSColor yellowColor] set];
NSRectFill(rect);
}
else
[self drawRect:rect];
else {
[self drawRect:rect];
if (NSShowAllViews) {
[[self _borderColorForNSShowAllViews] set];
NSFrameRect(rect);
}
}
[self unlockFocus];