// // KMPageDisplayThemeCollectionViewItem.swift // PDF Master // // Created by lxy on 2023/1/29. // import Cocoa typealias KMThemesItemActionCallback = (_ index: Int) -> () class KMPageDisplayThemeCollectionViewItem: NSCollectionViewItem { @IBOutlet weak var itemImageView: NSImageView! @IBOutlet weak var itemLabel: NSTextField! @IBOutlet weak var themesBox: KMBox! @IBOutlet weak var vipImageView: NSImageView! @IBOutlet weak var closeButton: NSButton! var itemCallBack : KMThemesItemActionCallback! override func viewDidLoad() { super.viewDidLoad() self.closeButton.isHidden = true self.itemImageView.wantsLayer = true self.itemImageView.layer?.cornerRadius = 10 self.itemImageView.layer?.masksToBounds = true self.itemImageView.layer?.borderWidth = 0.5 self.itemImageView.layer?.borderColor = NSColor.gridColor.cgColor } private func swatchWithColor(color:NSColor,size:NSSize) -> NSImage { let image = NSImage(size: size) image.lockFocus() color.drawSwatch(in: NSRect(x: 0, y: 0, width: size.width, height: size.height)) image.unlockFocus() return image } func themesCollectionCellItem(item:NSInteger,itemData:[Any]) { } }