KMEditPDFCropComfirmWindowController.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // KMEditPDFCropComfirmWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2024/6/26.
  6. //
  7. import Cocoa
  8. class KMEditPDFCropComfirmWindowController: NSWindowController {
  9. @IBOutlet weak var leftBox: NSBox!
  10. @IBOutlet weak var rightBox: NSBox!
  11. private var leftVc_: KMDesignButton?
  12. private var rightVc_: KMDesignButton?
  13. var itemAction: KMCommonClickBlock?
  14. static let shared = KMEditPDFCropComfirmWindowController(windowNibName: "KMEditPDFCropComfirmWindowController")
  15. override func windowDidLoad() {
  16. super.windowDidLoad()
  17. self.window?.backgroundColor = .white
  18. self.window?.contentView?.wantsLayer = true
  19. self.window?.contentView?.layer?.cornerRadius = 4
  20. self.leftVc_ = KMDesignButton(withType: .Image)
  21. self.leftBox.contentView = self.leftVc_!.view
  22. self.leftBox.borderWidth = 0
  23. self.leftVc_?.pagination()
  24. self.leftVc_?.target = self
  25. self.leftVc_?.action = #selector(_itemClick)
  26. self.leftVc_?.image = NSImage(named: "KMImageNameEditPDFCropComfirm")!
  27. self.leftVc_?.tag = 0
  28. self.rightVc_ = KMDesignButton(withType: .Image)
  29. self.rightBox.contentView = self.rightVc_!.view
  30. self.rightBox.borderWidth = 0
  31. self.rightVc_?.pagination()
  32. self.rightVc_?.target = self
  33. self.rightVc_?.action = #selector(_itemClick)
  34. self.rightVc_?.image = NSImage(named: "KMImageNameEditPDFCropCancel")!
  35. self.rightVc_?.tag = 1
  36. }
  37. @objc private func _itemClick(_ sender: NSButton) {
  38. self.itemAction?(sender.tag)
  39. }
  40. }