TooltipUI // Auto-close out-of-date window instances.
This commit is contained in:
parent
e22941e8ae
commit
ff2df510d7
|
@ -20,6 +20,12 @@ public class TooltipUI: NSWindowController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static var currentWindow: NSWindow? {
|
||||||
|
willSet {
|
||||||
|
currentWindow?.orderOut(nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public var direction: NSAttributedTooltipTextView.writingDirection = .horizontal {
|
public var direction: NSAttributedTooltipTextView.writingDirection = .horizontal {
|
||||||
didSet {
|
didSet {
|
||||||
if #unavailable(macOS 10.13) { direction = .horizontal }
|
if #unavailable(macOS 10.13) { direction = .horizontal }
|
||||||
|
@ -47,6 +53,7 @@ public class TooltipUI: NSWindowController {
|
||||||
messageText.textColor = NSColor.textColor
|
messageText.textColor = NSColor.textColor
|
||||||
messageText.needsDisplay = true
|
messageText.needsDisplay = true
|
||||||
panel.contentView?.addSubview(messageText)
|
panel.contentView?.addSubview(messageText)
|
||||||
|
Self.currentWindow = panel
|
||||||
super.init(window: panel)
|
super.init(window: panel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue