AccountUnsubscribeWindowController.swift 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // AccountUnsubscribeWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by User-Tangchao on 2024/10/31.
  6. //
  7. import Cocoa
  8. class AccountUnsubscribeWindowController: NSWindowController {
  9. @IBOutlet weak var contentBox: NSBox!
  10. @IBOutlet weak var iconIv: NSImageView!
  11. @IBOutlet weak var titleLabel: NSTextField!
  12. @IBOutlet weak var despLabel: NSTextField!
  13. @IBOutlet weak var cancelButton: NSButton!
  14. @IBOutlet weak var okButton: NSButton!
  15. var itemClick: KMCommonClickBlock?
  16. convenience init() {
  17. self.init(windowNibName: "AccountUnsubscribeWindowController")
  18. }
  19. override func windowDidLoad() {
  20. super.windowDidLoad()
  21. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
  22. self.window?.appearance = NSAppearance(named: .aqua)
  23. self.window?.backgroundColor = .clear
  24. self.window?.contentView?.wantsLayer = true
  25. self.window?.contentView?.layer?.backgroundColor = .clear
  26. // self.window?.contentView?.layer?.cornerRadius = 8
  27. // self.window?.contentView?.layer?.borderWidth = 1
  28. // self.window?.contentView?.layer?.borderColor = KMAppearance.themeColor().cgColor
  29. self.contentBox.borderWidth = 0
  30. self.contentBox.cornerRadius = 8
  31. self.contentBox.fillColor = .white
  32. self.iconIv.image = NSImage(named: "KMImageNameAccountUnSubcribeIcon")
  33. self.titleLabel.stringValue = NSLocalizedString("Are you sure you want to unsubscribe?", comment: "")
  34. self.titleLabel.font = .systemFont(ofSize: 16)
  35. self.despLabel.stringValue = NSLocalizedString("After canceling the subscription window, you will not be able toenjoy the membership benefits and VIP services provided by theproduct from the next cycle.", comment: "")
  36. self.despLabel.textColor = NSColor(hex: "#666666")
  37. self.cancelButton.title = NSLocalizedString("I'm Sure", comment: "")
  38. self.cancelButton.setTitleColor(KMAppearance.themeColor())
  39. self.cancelButton.wantsLayer = true
  40. self.cancelButton.layer?.cornerRadius = 4
  41. self.cancelButton.layer?.borderWidth = 1
  42. self.cancelButton.layer?.borderColor = KMAppearance.themeColor().cgColor
  43. self.cancelButton.target = self
  44. self.cancelButton.action = #selector(cancelAction)
  45. self.okButton.title = NSLocalizedString("I‘ll think about it", comment: "")
  46. self.okButton.setTitleColor(.white)
  47. self.okButton.wantsLayer = true
  48. self.okButton.layer?.cornerRadius = 4
  49. self.okButton.layer?.backgroundColor = KMAppearance.themeColor().cgColor
  50. self.okButton.target = self
  51. self.okButton.action = #selector(okAction)
  52. }
  53. @objc func cancelAction() {
  54. self.itemClick?(1)
  55. }
  56. @objc func okAction() {
  57. self.itemClick?(2)
  58. }
  59. }