macos: hook up paste protection delegate, cancel button

This commit is contained in:
Mitchell Hashimoto
2023-11-04 20:47:16 -07:00
parent 5f5f5a44ec
commit 04acaf8b20
4 changed files with 85 additions and 14 deletions

View File

@@ -6,10 +6,24 @@ import GhosttyKit
class PasteProtectionController: NSWindowController {
override var windowNibName: NSNib.Name? { "PasteProtection" }
weak private var delegate: PasteProtectionViewDelegate? = nil
init(delegate: PasteProtectionViewDelegate) {
self.delegate = delegate
super.init(window: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) is not supported for this view")
}
//MARK: - NSWindowController
override func windowDidLoad() {
guard let window = window else { return }
window.contentView = NSHostingView(rootView: PasteProtectionView())
window.contentView = NSHostingView(rootView: PasteProtectionView(
contents: "Hello",
delegate: delegate
))
}
}