KMCancellationSuccessView.swift 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // KMCancellationSuccessView.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lizhe on 2023/4/20.
  6. //
  7. import Cocoa
  8. typealias KMCancellationSuccessViewCancelAction = (_ view: KMCancellationSuccessView) -> Void
  9. class KMCancellationSuccessView: BaseXibView {
  10. @IBOutlet weak var closeBox: KMBox!
  11. @IBOutlet weak var closeButton: NSButton!
  12. @IBOutlet weak var titleLabel: NSTextField!
  13. @IBOutlet weak var subTitleLabel: NSTextField!
  14. @IBOutlet weak var doneView: NSView!
  15. var doneButtonVC: KMDesignButton!
  16. var cancelAction: KMCancellationSuccessViewCancelAction?
  17. override func draw(_ dirtyRect: NSRect) {
  18. super.draw(dirtyRect)
  19. // Drawing code here.
  20. }
  21. func setup() {
  22. self.closeBox.moveCallback = { [weak self] (mouseEntered, mouseBox) in
  23. if mouseEntered {
  24. self?.closeButton?.image = NSImage(named: "control_btn_icon_close_hov")
  25. } else {
  26. self?.closeButton?.image = NSImage(named: "control_btn_icon_close")
  27. }
  28. }
  29. self.titleLabel.font = NSFont.SFProTextSemiboldFont(19.0)
  30. self.titleLabel.textColor = NSColor.km_init(hex: "#252629")
  31. self.subTitleLabel.font = NSFont.SFProTextRegularFont(14.0)
  32. self.subTitleLabel.textColor = NSColor.km_init(hex: "#616469")
  33. self.subTitleLabel.maximumNumberOfLines = 0
  34. self.doneButtonVC = KMDesignButton(withType: .Text)
  35. self.doneView.addSubview(self.doneButtonVC.view)
  36. self.doneButtonVC?.view.frame = self.doneView.bounds
  37. self.doneButtonVC.target = self
  38. self.doneButtonVC.action = #selector(closeButtonAction)
  39. self.doneButtonVC.button(type: .Cta, size: .m)
  40. self.doneButtonVC.button.keyEquivalent = KMKeyEquivalent.enter
  41. self.doneButtonVC.stringValue = NSLocalizedString("OK", comment: "")
  42. self.doneButtonVC.updateUI()
  43. }
  44. func reloadData() {
  45. }
  46. func updateLanguage() {
  47. self.titleLabel.stringValue = NSLocalizedString("Cancellation Submitted", comment: "")
  48. self.subTitleLabel.stringValue = NSLocalizedString("Your account will be canceled within 3 working days and there is no need to submit the application for cancellation again", comment: "")
  49. self.doneButtonVC.stringValue = NSLocalizedString("OK", comment: "")
  50. }
  51. }
  52. extension KMCancellationSuccessView {
  53. @IBAction func closeButtonAction(_ sender: Any) {
  54. guard let callBack = cancelAction else { return }
  55. callBack(self)
  56. }
  57. }