KMRedactMutilPageFlagWindowController.swift 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // KMRedactMutilPageFlagWindowController.swift
  3. // PDF Master
  4. //
  5. // Created by tangchao on 2023/1/19.
  6. //
  7. import Cocoa
  8. class KMRedactMutilPageFlagWindowController: KMRedactBaseWindowController {
  9. var pageType: Int = 1
  10. var pageString: String = ""
  11. override func windowDidLoad() {
  12. super.windowDidLoad()
  13. self.setContentSize(NSSize(width: 404, height: 266))
  14. self.titleLabel.stringValue = NSLocalizedString("Repeat Mark Across Pages", comment: "")
  15. self.funcButton.title = NSLocalizedString("Apply", comment: "")
  16. self.funcButton.layer?.backgroundColor = NSColor.black.cgColor
  17. self.funcButton.attributedTitle = NSMutableAttributedString(string: self.funcButton.title, attributes: [NSAttributedString.Key.foregroundColor : NSColor.white])
  18. let contentView = KMRedactMutilPageFlagContentView.createFromNib()
  19. contentView?.frame = self.contentBox.contentView!.bounds
  20. contentView?.autoresizingMask = [.width,.height]
  21. self.contentBox.contentView?.addSubview(contentView!)
  22. self.contentView = contentView
  23. contentView?.pageCount = self.pageCount
  24. contentView?.itemClick = {[weak self] index, value in
  25. if (index == 1) { /// 所有页面
  26. self!.pageType = 1
  27. } else if (index == 2) { /// 奇数页
  28. self!.pageType = 2
  29. } else if (index == 3) { /// 偶数页
  30. self!.pageType = 3
  31. } else if (index == 4) { /// 自定义页面范围
  32. self!.pageType = 4
  33. } else if (index == 5) { /// 自定义页面范围输入
  34. self?.pageString = value as! String
  35. }
  36. }
  37. }
  38. }