//
//  CipherTextView.swift
//  PDF Reader Pro
//
//  Created by Niehaoyu on 2022/10/25.
//

import Cocoa

class CipherTextView: NSView,NibLoadable {

    @IBOutlet var cipherTextBtn: NSButton!
    @IBOutlet var pageCipherTextBtn: NSButton!
    @IBOutlet var settingBtn: NSButton!
    
    let cipherTextDelegate:CipherTextViewDelegate! = nil
    
    override func draw(_ dirtyRect: NSRect) {
        super.draw(dirtyRect)

        // Drawing code here.
    }
    
    func setUp() {
        self.wantsLayer = true
//        self.layer?.backgroundColor = NSColor.red.cgColor
    }
      
    @IBAction func buttonAction(_ sender: NSButton) {
        if sender == self.settingBtn {
            KMPrint("setting")
//            if self.cipherTextDelegate && self.cipherTextDelegate resp
            if self.cipherTextDelegate != nil {
                self.cipherTextDelegate.cipherTextViewButtonClicked(textView: self, buttonIndex: 0)
                
            }
        }
    }
    
    
}

protocol CipherTextViewDelegate {
    func cipherTextViewButtonClicked(textView:CipherTextView,buttonIndex:Int)
}