KMRedactPageRangeWindowController.swift 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // KMRedactPageRangeWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2023/1/19.
  6. //
  7. import Cocoa
  8. class KMRedactPageRangeWindowController: KMRedactBaseWindowController {
  9. var pageType: Int = 1
  10. var pageString: String = ""
  11. override func windowDidLoad() {
  12. super.windowDidLoad()
  13. self.setContentSize(NSSize(width: 404, height: 336))
  14. self.titleLabel.stringValue = NSLocalizedString("Mark Page Range", 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 = KMRedactPageRangeContentView.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!.pageType = 5
  35. } else if (index == 6) {
  36. self?.pageString = value as! String
  37. }
  38. }
  39. }
  40. }