KMWatermarkFileView.swift 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // KMWatermarkFileView.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2022/12/18.
  6. //
  7. import Cocoa
  8. typealias KMWatermarkFileViewItemClick = (Int, Any) ->()
  9. class KMWatermarkFileView: KMWatermarkAdjectiveBaseView {
  10. @IBOutlet weak var tipLabel: NSTextField!
  11. @IBOutlet weak var addButton: NSButton!
  12. override func awakeFromNib() {
  13. super.awakeFromNib()
  14. tipLabel.stringValue = ""
  15. tipLabel.placeholderString = NSLocalizedString("Select File", comment: "")
  16. tipLabel.lineBreakMode = .byTruncatingTail
  17. addButton.wantsLayer = true
  18. addButton.layer?.borderWidth = 1
  19. addButton.layer?.borderColor = NSColor.black.cgColor
  20. addButton.layer?.cornerRadius = 2
  21. addButton.title = "+"
  22. addButton.target = self
  23. addButton.action = #selector(addButtonAction)
  24. }
  25. @objc func addButtonAction() {
  26. guard let callback = itemClick else {
  27. return
  28. }
  29. callback(0, "")
  30. }
  31. }