KMPageEditExtractSettingView.swift 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // KMPageEditExtractSettingView.swift
  3. // PDF Master
  4. //
  5. // Created by tangchao on 2023/1/12.
  6. //
  7. import Cocoa
  8. class KMPageEditExtractSettingView: KMPageEditSettingBaseView {
  9. @IBOutlet weak var independentPerPageCheck: NSButton!
  10. @IBOutlet weak var extractAfterDeletePageCheck: NSButton!
  11. override func awakeFromNib() {
  12. super.awakeFromNib()
  13. self.independentPerPageCheck.title = NSLocalizedString("Each page as a separate page", comment: "")
  14. self.extractAfterDeletePageCheck.title = NSLocalizedString("Delete page after extraction", comment: "")
  15. self.independentPerPageCheck.target = self
  16. self.independentPerPageCheck.action = #selector(checkAction)
  17. self.independentPerPageCheck.state = .off
  18. self.extractAfterDeletePageCheck.target = self
  19. self.extractAfterDeletePageCheck.action = #selector(checkAction)
  20. self.extractAfterDeletePageCheck.state = .off
  21. }
  22. @objc func checkAction(sender: NSButton) {
  23. guard let callback = self.itemClick else {
  24. return
  25. }
  26. var index: Int = 1
  27. if (sender.isEqual(to: self.extractAfterDeletePageCheck)) {
  28. index = 2
  29. }
  30. callback(index, sender.state == .on)
  31. }
  32. }