KMGuideInfoWindow.swift 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // KMGuideInfoWindow.swift
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by Niehaoyu on 2023/12/8.
  6. //
  7. import Cocoa
  8. class KMGuideInfoWindow: NSWindow {
  9. static var currentWindow: KMGuideInfoWindow!
  10. @objc static func currentWC() -> KMGuideInfoWindow {
  11. let nib = NSNib(nibNamed: NSNib.Name("KMGuideInfoWindow"), bundle: Bundle.main)
  12. var topLevelObjects: NSArray?
  13. if nib?.instantiate(withOwner: nil, topLevelObjects: &topLevelObjects) ?? false {
  14. for object in topLevelObjects ?? [] {
  15. if let window = object as? NSWindow {
  16. self.currentWindow = window as? KMGuideInfoWindow
  17. break
  18. }
  19. }
  20. }
  21. return currentWindow
  22. }
  23. override func awakeFromNib() {
  24. super.awakeFromNib()
  25. self.backgroundColor = NSColor.clear
  26. self.contentView?.wantsLayer = true
  27. self.contentView?.layer?.backgroundColor = NSColor.red.cgColor;
  28. self.isOpaque = false
  29. }
  30. }