KMCompareCoveringWindowController.swift 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // KMCompareCoveringWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lizhe on 2023/11/20.
  6. //
  7. import Cocoa
  8. class KMCompareCoveringWindowController: NSWindowController {
  9. @IBOutlet weak var coveringView: KMCompareCoveringView!
  10. var pdfDocument: CPDFDocument? {
  11. didSet {
  12. self.coveringView.pdfDocument = pdfDocument
  13. }
  14. }
  15. var hideCloseInfo: Bool = false
  16. var saveHandle: ((KMCompareCoveringWindowController) -> Void)?
  17. var closeHandle: ((KMCompareCoveringWindowController) -> Void)?
  18. convenience init(document: CPDFDocument) {
  19. self.init(windowNibName: "KMCompareCoveringWindowController")
  20. self.pdfDocument = document
  21. }
  22. override func windowDidLoad() {
  23. super.windowDidLoad()
  24. self.coveringView.pdfDocument = pdfDocument
  25. self.coveringView.closeHandle = { [unowned self] view in
  26. self.closeHandle?(self)
  27. }
  28. self.coveringView.saveHandle = { [unowned self] view in
  29. self.saveHandle?(self)
  30. }
  31. }
  32. }