12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //
- // KMCancellationSuccessView.swift
- // PDF Master
- //
- // Created by lizhe on 2023/4/20.
- //
- import Cocoa
- typealias KMCancellationSuccessViewCancelAction = (_ view: KMCancellationSuccessView) -> Void
- class KMCancellationSuccessView: KMBaseXibView {
- @IBOutlet weak var closeBox: KMBox!
- @IBOutlet weak var closeButton: NSButton!
- @IBOutlet weak var titleLabel: NSTextField!
- @IBOutlet weak var subTitleLabel: NSTextField!
- @IBOutlet weak var doneView: NSView!
- var doneButtonVC: KMDesignButton!
-
- var cancelAction: KMCancellationSuccessViewCancelAction?
- override func draw(_ dirtyRect: NSRect) {
- super.draw(dirtyRect)
- // Drawing code here.
- }
-
- override func setup() {
- super.setup()
-
- self.closeBox.moveCallback = { [weak self] (mouseEntered, mouseBox) in
- if mouseEntered {
- self?.closeButton?.image = NSImage(named: "control_btn_icon_close_hov")
- } else {
- self?.closeButton?.image = NSImage(named: "control_btn_icon_close")
- }
- }
-
- self.titleLabel.font = NSFont.SFProTextSemiboldFont(19.0)
- self.titleLabel.textColor = NSColor.km_init(hex: "#252629")
-
- self.subTitleLabel.font = NSFont.SFProTextRegularFont(14.0)
- self.subTitleLabel.textColor = NSColor.km_init(hex: "#616469")
- self.subTitleLabel.maximumNumberOfLines = 0
-
- self.doneButtonVC = KMDesignButton(withType: .Text)
- self.doneView.addSubview(self.doneButtonVC.view)
- self.doneButtonVC?.view.frame = self.doneView.bounds
- self.doneButtonVC.target = self
- self.doneButtonVC.action = #selector(closeButtonAction)
- self.doneButtonVC.button(type: .Cta, size: .m)
- self.doneButtonVC.button.keyEquivalent = KMKeyEquivalent.enter
- self.doneButtonVC.stringValue = NSLocalizedString("OK", comment: "")
- self.doneButtonVC.updateUI()
- }
-
- override func reloadData() {
- super.reloadData()
-
- }
-
- override func updateLanguage() {
- super.updateLanguage()
- self.titleLabel.stringValue = NSLocalizedString("Cancellation Submitted", comment: "")
- 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: "")
- self.doneButtonVC.stringValue = NSLocalizedString("OK", comment: "")
- }
- }
- extension KMCancellationSuccessView {
- @IBAction func closeButtonAction(_ sender: Any) {
- guard let callBack = cancelAction else { return }
-
- callBack(self)
- }
- }
|