CipherTextView.swift 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // CipherTextView.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by Niehaoyu on 2022/10/25.
  6. //
  7. import Cocoa
  8. class CipherTextView: NSView,NibLoadable {
  9. @IBOutlet var cipherTextBtn: NSButton!
  10. @IBOutlet var pageCipherTextBtn: NSButton!
  11. @IBOutlet var settingBtn: NSButton!
  12. let cipherTextDelegate:CipherTextViewDelegate! = nil
  13. override func draw(_ dirtyRect: NSRect) {
  14. super.draw(dirtyRect)
  15. // Drawing code here.
  16. }
  17. func setUp() {
  18. self.wantsLayer = true
  19. // self.layer?.backgroundColor = NSColor.red.cgColor
  20. }
  21. @IBAction func buttonAction(_ sender: NSButton) {
  22. if sender == self.settingBtn {
  23. KMPrint("setting")
  24. // if self.cipherTextDelegate && self.cipherTextDelegate resp
  25. if self.cipherTextDelegate != nil {
  26. self.cipherTextDelegate.cipherTextViewButtonClicked(textView: self, buttonIndex: 0)
  27. }
  28. }
  29. }
  30. }
  31. protocol CipherTextViewDelegate {
  32. func cipherTextViewButtonClicked(textView:CipherTextView,buttonIndex:Int)
  33. }