1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //
- // KMBookCellView.swift
- // PDF Master
- //
- // Created by lxy on 2022/11/14.
- //
- import Cocoa
- class KMLiftSideCellView: NSTableCellView {
-
- var box: KMBox?
- typealias selectClick = (_ index: Int) -> ()
- @IBOutlet weak var mothedImage: NSImageView!
- var buttonClick: selectClick?
- var index = 0
- var isSelect: Bool = false
-
- override func awakeFromNib() {
- super.awakeFromNib()
- self.addBox()
- }
- override func draw(_ dirtyRect: NSRect) {
- super.draw(dirtyRect)
-
- }
-
- @IBAction func updateLeftStyle(_ sender: Any) {
- self.buttonClick?(index)
- }
-
- func addBox() {
- if self.box == nil {
- self.box?.wantsLayer = true
- self.box = KMBox(frame: self.bounds)
- self.box?.borderWidth = 0
- self.box?.boxType = .custom
- self.addSubview(self.box!)
- self.box?.moveCallback = { [unowned self] (mouseEntered, mouseBox) in
- if mouseEntered {
- self.backgroundColor(NSColor(hex: "#DFE1E5"))
- } else {
- if !isSelect {
- self.backgroundColor(NSColor.clear)
- }
- }
- }
- self.box?.autoresizingMask = [.width, .height]
- } else {
- self.box!.frame = self.bounds
- }
- }
- }
|