|
@@ -19,6 +19,11 @@ class KMHistoryFileCollectionViewItem: NSCollectionViewItem {
|
|
|
var filePathUrl: URL? = nil
|
|
|
var selectUrls: [URL] = []
|
|
|
var isSelect: Bool = false
|
|
|
+ var isHover: Bool = false {
|
|
|
+ didSet {
|
|
|
+ self.updateCellState()
|
|
|
+ }
|
|
|
+ }
|
|
|
var currentWindowController: NSWindowController?
|
|
|
|
|
|
// MARK: init
|
|
@@ -30,21 +35,21 @@ class KMHistoryFileCollectionViewItem: NSCollectionViewItem {
|
|
|
initializeUI()
|
|
|
mainBox.menu = tableCellMenu
|
|
|
documentName.maximumNumberOfLines = 2
|
|
|
- mainBox.moveCallback = { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
|
|
|
- if !self.isSelect {
|
|
|
- if mouseEntered {
|
|
|
- self.mainBox.fillColor = NSColor(hex: "#EDEEF0")
|
|
|
- self.mainBox.borderWidth = 0.0
|
|
|
- self.documentName.textColor = NSColor(hex: "#252629")
|
|
|
- self.mainBox.cornerRadius = 8.0
|
|
|
- } else {
|
|
|
- self.mainBox.fillColor = .clear
|
|
|
- self.mainBox.borderWidth = 0.0
|
|
|
- self.documentName.textColor = NSColor(hex: "#252629")
|
|
|
- self.mainBox.cornerRadius = 0.0
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// mainBox.moveCallback = { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
|
|
|
+// if !self.isSelect {
|
|
|
+// if mouseEntered {
|
|
|
+// self.mainBox.fillColor = NSColor(hex: "#EDEEF0")
|
|
|
+// self.mainBox.borderWidth = 0.0
|
|
|
+// self.documentName.textColor = NSColor(hex: "#252629")
|
|
|
+// self.mainBox.cornerRadius = 8.0
|
|
|
+// } else {
|
|
|
+// self.mainBox.fillColor = .clear
|
|
|
+// self.mainBox.borderWidth = 0.0
|
|
|
+// self.documentName.textColor = NSColor(hex: "#252629")
|
|
|
+// self.mainBox.cornerRadius = 0.0
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
func initializeUI() {
|
|
@@ -79,6 +84,25 @@ class KMHistoryFileCollectionViewItem: NSCollectionViewItem {
|
|
|
fileImageView.image = image
|
|
|
}
|
|
|
|
|
|
+ //MARK: update
|
|
|
+ func updateCellState() {
|
|
|
+ if fileImageView != nil {
|
|
|
+ if !self.isSelect {
|
|
|
+ if self.isHover {
|
|
|
+ self.mainBox.fillColor = NSColor(hex: "#EDEEF0")
|
|
|
+ self.mainBox.borderWidth = 0.0
|
|
|
+ self.documentName.textColor = NSColor(hex: "#252629")
|
|
|
+ self.mainBox.cornerRadius = 8.0
|
|
|
+ } else {
|
|
|
+ self.mainBox.fillColor = .clear
|
|
|
+ self.mainBox.borderWidth = 0.0
|
|
|
+ self.documentName.textColor = NSColor(hex: "#252629")
|
|
|
+ self.mainBox.cornerRadius = 0.0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// MARK: Menu
|
|
|
|
|
|
lazy var tableCellMenu: NSMenu = {
|