KMHeaderFooterWindowController.swift 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // KMHeaderFooterWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lizhe on 2023/11/24.
  6. //
  7. import Cocoa
  8. typealias KMHeaderFooterWindowControllerOperateCallBack = (_ controller: NSWindowController, _ headerFooter: KMHeaderFooterObject) -> ()
  9. class KMHeaderFooterWindowController: KMBaseWindowController {
  10. @IBOutlet weak var headerFooterView: KMHeaderFooterView!
  11. var headerFooterObj: KMHeaderFooterObject = KMHeaderFooterObject()
  12. var type: KMBatchModifyTemplateType = .Use
  13. var operateCallBack: KMHeaderFooterWindowControllerOperateCallBack?
  14. override func windowDidLoad() {
  15. super.windowDidLoad()
  16. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
  17. if type == .Edit {
  18. headerFooterView.headerFooterObj = headerFooterObj
  19. headerFooterView.originalHeaderFooterObj = headerFooterObj
  20. }
  21. headerFooterView.isHiddenBatchBtn = isBatch
  22. headerFooterView.isBates = isBates
  23. headerFooterView.type = type
  24. headerFooterView.pdfDocument = pdfDocument
  25. headerFooterView.cancelAction = { [unowned self] view in
  26. cancelAction?(self)
  27. }
  28. headerFooterView.operateCallBack = { [unowned self] model in
  29. cancelAction?(self)
  30. operateCallBack?(self, model)
  31. }
  32. }
  33. }