KMWatermarkWindowController.swift 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // KMWatermarkWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lizhe on 2023/11/14.
  6. //
  7. import Cocoa
  8. typealias KMWatermarkWindowControllerOperateCallBack = (_ controller: NSWindowController, _ watermark: KMWatermarkModel, _ countType: Int) -> ()
  9. class KMWatermarkWindowController: KMBaseWindowController {
  10. var currentType: Int = 0
  11. @IBOutlet weak var watermarkView: KMWatermarkView!
  12. var watermark: KMWatermarkModel = KMWatermarkModel()
  13. var operateCallBack:KMWatermarkWindowControllerOperateCallBack?
  14. var type: KMWatermarkManagerType = .use
  15. override func windowDidLoad() {
  16. super.windowDidLoad()
  17. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
  18. if type == .edit {
  19. watermarkView.watermark = watermark
  20. watermarkView.originalWatermark = watermark
  21. }
  22. watermarkView.isHiddenBatchBtn = isBatch
  23. watermarkView.type = type
  24. watermarkView.currentType = currentType
  25. watermarkView.pdfDocument = self.pdfDocument
  26. watermarkView.cancelAction = { [unowned self] view in
  27. cancelAction?(self)
  28. }
  29. watermarkView.operateCallBack = { [unowned self] watermark, countType in
  30. operateCallBack?(self, watermark, countType)
  31. }
  32. watermarkView.reloadData()
  33. }
  34. }