Add isDisplayingSheet calculated readonly property to NSWindow and NSWindowController.
This commit is contained in:
parent
95268db09b
commit
8e7863c66d
|
@ -94,6 +94,7 @@
|
||||||
849A339E1AC90A0A0015BA09 /* NSTableView+RSCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 849A339C1AC90A0A0015BA09 /* NSTableView+RSCore.m */; };
|
849A339E1AC90A0A0015BA09 /* NSTableView+RSCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 849A339C1AC90A0A0015BA09 /* NSTableView+RSCore.m */; };
|
||||||
849B08971BF7BCE30090CEE4 /* NSPasteboard+RSCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 849B08951BF7BCE30090CEE4 /* NSPasteboard+RSCore.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
849B08971BF7BCE30090CEE4 /* NSPasteboard+RSCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 849B08951BF7BCE30090CEE4 /* NSPasteboard+RSCore.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
849B08981BF7BCE30090CEE4 /* NSPasteboard+RSCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 849B08961BF7BCE30090CEE4 /* NSPasteboard+RSCore.m */; };
|
849B08981BF7BCE30090CEE4 /* NSPasteboard+RSCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 849B08961BF7BCE30090CEE4 /* NSPasteboard+RSCore.m */; };
|
||||||
|
849EE70D2039187D0082A1EA /* NSWindowController+RSCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849EE70C2039187D0082A1EA /* NSWindowController+RSCore.swift */; };
|
||||||
84A8358A1D4EC7B80004C598 /* PlistProviderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A835891D4EC7B80004C598 /* PlistProviderProtocol.swift */; };
|
84A8358A1D4EC7B80004C598 /* PlistProviderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A835891D4EC7B80004C598 /* PlistProviderProtocol.swift */; };
|
||||||
84AD1EA520315A8800BC20B7 /* PasteboardWriterOwner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AD1EA420315A8700BC20B7 /* PasteboardWriterOwner.swift */; };
|
84AD1EA520315A8800BC20B7 /* PasteboardWriterOwner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AD1EA420315A8700BC20B7 /* PasteboardWriterOwner.swift */; };
|
||||||
84AD1EA820315BA900BC20B7 /* NSPasteboard+RSCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AD1EA720315BA900BC20B7 /* NSPasteboard+RSCore.swift */; };
|
84AD1EA820315BA900BC20B7 /* NSPasteboard+RSCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AD1EA720315BA900BC20B7 /* NSPasteboard+RSCore.swift */; };
|
||||||
|
@ -216,6 +217,7 @@
|
||||||
849A339C1AC90A0A0015BA09 /* NSTableView+RSCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTableView+RSCore.m"; sourceTree = "<group>"; };
|
849A339C1AC90A0A0015BA09 /* NSTableView+RSCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTableView+RSCore.m"; sourceTree = "<group>"; };
|
||||||
849B08951BF7BCE30090CEE4 /* NSPasteboard+RSCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSPasteboard+RSCore.h"; sourceTree = "<group>"; };
|
849B08951BF7BCE30090CEE4 /* NSPasteboard+RSCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSPasteboard+RSCore.h"; sourceTree = "<group>"; };
|
||||||
849B08961BF7BCE30090CEE4 /* NSPasteboard+RSCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSPasteboard+RSCore.m"; sourceTree = "<group>"; };
|
849B08961BF7BCE30090CEE4 /* NSPasteboard+RSCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSPasteboard+RSCore.m"; sourceTree = "<group>"; };
|
||||||
|
849EE70C2039187D0082A1EA /* NSWindowController+RSCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "NSWindowController+RSCore.swift"; path = "AppKit/NSWindowController+RSCore.swift"; sourceTree = "<group>"; };
|
||||||
84A835891D4EC7B80004C598 /* PlistProviderProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PlistProviderProtocol.swift; path = RSCore/PlistProviderProtocol.swift; sourceTree = "<group>"; };
|
84A835891D4EC7B80004C598 /* PlistProviderProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PlistProviderProtocol.swift; path = RSCore/PlistProviderProtocol.swift; sourceTree = "<group>"; };
|
||||||
84AD1EA420315A8700BC20B7 /* PasteboardWriterOwner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PasteboardWriterOwner.swift; path = RSCore/PasteboardWriterOwner.swift; sourceTree = "<group>"; };
|
84AD1EA420315A8700BC20B7 /* PasteboardWriterOwner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PasteboardWriterOwner.swift; path = RSCore/PasteboardWriterOwner.swift; sourceTree = "<group>"; };
|
||||||
84AD1EA720315BA900BC20B7 /* NSPasteboard+RSCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "NSPasteboard+RSCore.swift"; path = "AppKit/NSPasteboard+RSCore.swift"; sourceTree = "<group>"; };
|
84AD1EA720315BA900BC20B7 /* NSPasteboard+RSCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "NSPasteboard+RSCore.swift"; path = "AppKit/NSPasteboard+RSCore.swift"; sourceTree = "<group>"; };
|
||||||
|
@ -473,6 +475,7 @@
|
||||||
84CFF5561AC3CF9100CEA6C8 /* NSView+RSCore.h */,
|
84CFF5561AC3CF9100CEA6C8 /* NSView+RSCore.h */,
|
||||||
84CFF5571AC3CF9100CEA6C8 /* NSView+RSCore.m */,
|
84CFF5571AC3CF9100CEA6C8 /* NSView+RSCore.m */,
|
||||||
8432B1871DACA2060057D6DF /* NSWindow-Extensions.swift */,
|
8432B1871DACA2060057D6DF /* NSWindow-Extensions.swift */,
|
||||||
|
849EE70C2039187D0082A1EA /* NSWindowController+RSCore.swift */,
|
||||||
8414CBA91C95F8F700333C12 /* RSGeometry.h */,
|
8414CBA91C95F8F700333C12 /* RSGeometry.h */,
|
||||||
8414CBAA1C95F8F700333C12 /* RSGeometry.m */,
|
8414CBAA1C95F8F700333C12 /* RSGeometry.m */,
|
||||||
8461387E1DB3F5BE00048B83 /* RSToolbarItem.swift */,
|
8461387E1DB3F5BE00048B83 /* RSToolbarItem.swift */,
|
||||||
|
@ -783,6 +786,7 @@
|
||||||
8414CBAC1C95F8F700333C12 /* RSGeometry.m in Sources */,
|
8414CBAC1C95F8F700333C12 /* RSGeometry.m in Sources */,
|
||||||
84134D201C59D5450063FD24 /* NSCalendar+RSCore.m in Sources */,
|
84134D201C59D5450063FD24 /* NSCalendar+RSCore.m in Sources */,
|
||||||
84CFF5651AC3D13C00CEA6C8 /* RSImageRenderer.m in Sources */,
|
84CFF5651AC3D13C00CEA6C8 /* RSImageRenderer.m in Sources */,
|
||||||
|
849EE70D2039187D0082A1EA /* NSWindowController+RSCore.swift in Sources */,
|
||||||
84CFF5381AC3CBB200CEA6C8 /* NSMutableArray+RSCore.m in Sources */,
|
84CFF5381AC3CBB200CEA6C8 /* NSMutableArray+RSCore.m in Sources */,
|
||||||
84CFF5401AC3CD0100CEA6C8 /* NSMutableSet+RSCore.m in Sources */,
|
84CFF5401AC3CD0100CEA6C8 /* NSMutableSet+RSCore.m in Sources */,
|
||||||
84CFF5441AC3CD3500CEA6C8 /* NSNotificationCenter+RSCore.m in Sources */,
|
84CFF5441AC3CD3500CEA6C8 /* NSNotificationCenter+RSCore.m in Sources */,
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
//
|
||||||
|
// NSWindowController+RSCore.swift
|
||||||
|
// RSCore
|
||||||
|
//
|
||||||
|
// Created by Brent Simmons on 2/17/18.
|
||||||
|
// Copyright © 2018 Ranchero Software, LLC. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import AppKit
|
||||||
|
|
||||||
|
public extension NSWindowController {
|
||||||
|
|
||||||
|
public var isDisplayingSheet: Bool {
|
||||||
|
|
||||||
|
return window?.isDisplayingSheet ?? false
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,11 @@ import AppKit
|
||||||
|
|
||||||
public extension NSWindow {
|
public extension NSWindow {
|
||||||
|
|
||||||
|
public var isDisplayingSheet: Bool {
|
||||||
|
|
||||||
|
return attachedSheet != nil
|
||||||
|
}
|
||||||
|
|
||||||
public func makeFirstResponderUnlessDescendantIsFirstResponder(_ responder: NSResponder) {
|
public func makeFirstResponderUnlessDescendantIsFirstResponder(_ responder: NSResponder) {
|
||||||
|
|
||||||
if let fr = firstResponder, fr.hasAncestor(responder) {
|
if let fr = firstResponder, fr.hasAncestor(responder) {
|
||||||
|
|
Loading…
Reference in New Issue