KMThumbnailTableviewCell.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // KMThumbnailTableviewCell.swift
  3. // PDF Master
  4. //
  5. // Created by tangchao on 2023/11/16.
  6. //
  7. import Cocoa
  8. class KMThumbnailTableviewCell: NSTableCellView {
  9. @IBOutlet var thumBox: KMBox!
  10. @IBOutlet var thumImage: NSImageView!
  11. @IBOutlet var pageNumLabel: NSTextField!
  12. @IBOutlet var sizeLabel: NSTextField!
  13. @IBOutlet var labelView: NSView!
  14. @IBOutlet var sizeTopConstant: NSLayoutConstraint!
  15. @IBOutlet var imageAspectRatioLayout: NSLayoutConstraint!
  16. var isSelectCell = false {
  17. didSet {
  18. if (self.isSelectCell) {
  19. self.thumImage.layer?.borderColor = KMAppearance.Interactive.a0Color().cgColor
  20. self.thumImage.layer?.borderWidth = 1.0
  21. self.labelView.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
  22. self.pageNumLabel.textColor = KMAppearance.Layout.w0Color()
  23. self.sizeLabel.textColor = KMAppearance.Layout.w0Color()
  24. } else {
  25. self.thumImage.layer?.borderColor = KMAppearance.Layout.h2Color().cgColor
  26. self.thumImage.layer?.borderWidth = 1.0
  27. self.labelView.layer?.backgroundColor = .clear
  28. self.pageNumLabel.textColor = KMAppearance.Layout.h0Color()
  29. self.sizeLabel.textColor = KMAppearance.Layout.h0Color()
  30. }
  31. }
  32. }
  33. override func awakeFromNib() {
  34. super.awakeFromNib()
  35. self.wantsLayer = true
  36. self.layer?.backgroundColor = .clear
  37. self.layer?.cornerRadius = 0.0
  38. self.thumImage.wantsLayer = true
  39. self.labelView.wantsLayer = true
  40. }
  41. }