TooltipUI // Add round window corners.

* Note: This is not migratable to macOS 10.9 (plus that it is meaningless to test for macOS 10.10 - 10.12), hence the decision that this feature will be offered to the mainstream releases only.
This commit is contained in:
ShikiSuen 2023-03-06 18:04:19 +08:00
parent 04cb05ea34
commit ed84c613a0
1 changed files with 7 additions and 4 deletions

View File

@ -36,10 +36,14 @@ public class TooltipUI: NSWindowController {
)
panel.level = NSWindow.Level(Int(max(CGShieldingWindowLevel(), kCGPopUpMenuWindowLevel)) + 2)
panel.hasShadow = true
panel.backgroundColor = NSColor.controlBackgroundColor
panel.backgroundColor = NSColor.clear
panel.isOpaque = false
panel.isMovable = false
panel.contentView?.wantsLayer = true
panel.contentView?.layer?.cornerRadius = 7
panel.contentView?.layer?.backgroundColor = NSColor.controlBackgroundColor.cgColor
messageText = NSAttributedTooltipTextView()
messageText.backgroundColor = NSColor.controlBackgroundColor
messageText.backgroundColor = NSColor.clear
messageText.textColor = NSColor.textColor
messageText.needsDisplay = true
panel.contentView?.addSubview(messageText)
@ -118,8 +122,7 @@ public class TooltipUI: NSWindowController {
textColor = colorInterchange
}
}
window?.backgroundColor = backgroundColor
messageText.backgroundColor = backgroundColor
window?.contentView?.layer?.backgroundColor = backgroundColor.cgColor
messageText.textColor = textColor
}