AccountLogoutWindowController.swift 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // AccountLogoutWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by User-Tangchao on 2024/10/31.
  6. //
  7. import Cocoa
  8. class AccountLogoutWindowController: NSWindowController {
  9. @IBOutlet weak var titleLabel: NSTextField!
  10. @IBOutlet weak var cancelButton: NSButton!
  11. @IBOutlet weak var okButton: NSButton!
  12. var itemClick: KMCommonClickBlock?
  13. convenience init() {
  14. self.init(windowNibName: "AccountLogoutWindowController")
  15. }
  16. override func windowDidLoad() {
  17. super.windowDidLoad()
  18. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
  19. self.window?.appearance = NSAppearance(named: .aqua)
  20. self.window?.backgroundColor = .clear
  21. self.window?.contentView?.wantsLayer = true
  22. self.window?.contentView?.layer?.backgroundColor = .white
  23. self.window?.contentView?.layer?.cornerRadius = 8
  24. self.window?.contentView?.layer?.borderWidth = 0
  25. self.window?.contentView?.layer?.borderColor = KMAppearance.themeColor().cgColor
  26. self.titleLabel.stringValue = NSLocalizedString("Are you sure you want to log out?", comment: "")
  27. self.titleLabel.font = .systemFont(ofSize: 16)
  28. self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
  29. self.cancelButton.setTitleColor(KMAppearance.themeColor())
  30. self.cancelButton.wantsLayer = true
  31. self.cancelButton.layer?.cornerRadius = 4
  32. self.cancelButton.layer?.borderWidth = 1
  33. self.cancelButton.layer?.borderColor = KMAppearance.themeColor().cgColor
  34. self.cancelButton.target = self
  35. self.cancelButton.action = #selector(cancelAction)
  36. self.okButton.title = NSLocalizedString("Yes", comment: "")
  37. self.okButton.setTitleColor(.white)
  38. self.okButton.wantsLayer = true
  39. self.okButton.layer?.cornerRadius = 4
  40. self.okButton.layer?.backgroundColor = KMAppearance.themeColor().cgColor
  41. self.okButton.target = self
  42. self.okButton.action = #selector(okAction)
  43. }
  44. @objc func cancelAction() {
  45. self.itemClick?(1)
  46. }
  47. @objc func okAction() {
  48. self.itemClick?(2)
  49. }
  50. }