12345678910111213141516171819202122232425262728293031323334353637 |
- //
- // KMToolbarCustomWindowController.swift
- // PDF Reader Pro
- //
- // Created by tangchao on 2023/10/26.
- //
- import Cocoa
- class KMToolbarCustomWindowController: NSWindowController {
- weak var toolbar: KMToolbarView?
- var toolbarCustomViewController: KMToolbarCustomViewController?
-
- deinit {
- Swift.debugPrint("KMToolbarCustomWindowController deinit")
- }
-
- convenience init() {
- self.init(windowNibName: "KMToolbarCustomWindowController")
- }
-
- override func windowDidLoad() {
- super.windowDidLoad()
-
- self.toolbarCustomViewController = KMToolbarCustomViewController()
- self.toolbarCustomViewController?.toolbar = self.toolbar
- if self.responds(to: NSSelectorFromString("setContentViewController:")) {
- self.contentViewController = self.toolbarCustomViewController
- } else {
- self.toolbarCustomViewController?.view.frame = self.window?.contentView?.bounds ?? .zero
- if let sview = self.toolbarCustomViewController?.view {
- self.window?.contentView?.addSubview(sview)
- }
- }
- }
- }
|