KMToolbarConfigWindowController.swift 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // KMToolbarConfigWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2024/5/28.
  6. //
  7. import Cocoa
  8. class KMToolbarConfigWindowController: NSWindowController {
  9. deinit {
  10. KMPrint("KMToolbarConfigWindowController deinit.")
  11. }
  12. var leftCellIdentifiers: [String]? {
  13. didSet {
  14. self.viewC_.model.leftCellIdentifiers = self.leftCellIdentifiers
  15. }
  16. }
  17. var centerCellIdentifiers: [String]? {
  18. didSet {
  19. self.viewC_.model.centerCellIdentifiers = self.centerCellIdentifiers
  20. }
  21. }
  22. var rightCellIdentifiers: [String]? {
  23. didSet {
  24. self.viewC_.model.rightCellIdentifiers = self.rightCellIdentifiers
  25. }
  26. }
  27. var defaultCellIdentifiers: [String]? {
  28. didSet {
  29. self.viewC_.model.defaultCellIdentifiers = self.defaultCellIdentifiers
  30. }
  31. }
  32. private let viewC_ = KMToolbarConfigViewController()
  33. override var windowNibName: NSNib.Name? {
  34. return "KMToolbarConfigWindowController"
  35. }
  36. override func windowDidLoad() {
  37. super.windowDidLoad()
  38. self.window?.styleMask.insert(.fullSizeContentView)
  39. self.window?.contentViewController = self.viewC_
  40. self.viewC_.callback = { [unowned self] resp in
  41. if resp == .OK {
  42. KMDataManager.toolbar_saveData(self.viewC_.model)
  43. }
  44. self.window?.sheetParent?.endSheet(self.window!, returnCode: resp)
  45. }
  46. }
  47. }