AIRedoConfirmView.swift 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // AIRedoConfirmView.swift
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by Niehaoyu on 2024/4/22.
  6. //
  7. import Cocoa
  8. class AIRedoConfirmView: NSView, NibLoadable {
  9. @IBOutlet weak var contendView: NSView!
  10. @IBOutlet weak var infoLabel: NSTextField!
  11. @IBOutlet weak var redoButton: NSButton!
  12. var redoHandle: ((_ view: AIRedoConfirmView) -> Void)?
  13. override func draw(_ dirtyRect: NSRect) {
  14. super.draw(dirtyRect)
  15. // Drawing code here.
  16. }
  17. override func awakeFromNib() {
  18. super.awakeFromNib()
  19. self.wantsLayer = true
  20. self.layer?.backgroundColor = NSColor.clear.cgColor
  21. self.infoLabel.font = NSFont.SFProTextRegularFont(13)
  22. self.infoLabel.stringValue = NSLocalizedString("Redoing will cost 1 credit. Do you want to redo it?", comment: "")
  23. self.redoButton.title = NSLocalizedString("Redo (1 credit)", comment: "")
  24. }
  25. @IBAction func redoAction(_ sender: Any) {
  26. guard let callBack = self.redoHandle else {
  27. return
  28. }
  29. callBack(self)
  30. }
  31. }