12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- //
- // KMNoteReplyCellView.swift
- // PDF Reader Pro
- //
- // Created by User-Tangchao on 2024/9/20.
- //
- import Cocoa
- import KMComponentLibrary
- class KMNoteReplyCellView: NSTableCellView, NibLoadable {
- @IBOutlet weak var backgroundBox: KMBox!
- @IBOutlet weak var titleLabel: NSTextField!
- @IBOutlet weak var timeLabel: NSTextField!
-
- @IBOutlet weak var contentLabel: NSTextField!
-
- @IBOutlet weak var leftVorLineView: NSView!
-
- var itemClick: KMCommonClickBlock?
-
- var model: KMBotaAnnotationReplyModel?
-
- override func draw(_ dirtyRect: NSRect) {
- super.draw(dirtyRect)
- // Drawing code here.
- }
-
- override func awakeFromNib() {
- super.awakeFromNib()
- self.backgroundBox.borderWidth = 0
- self.backgroundBox.cornerRadius = 0
- self.backgroundBox.moveCallback = { enter, theBox in
- }
-
- NotificationCenter.default.addObserver(self, selector: #selector(updateUI), name: APPAppearanceChangedNotificationName, object: nil)
- self.updateUI()
- }
-
- @objc func moreAction(_ sender: NSButton) {
- self.itemClick?(1, sender)
- }
-
- override func mouseUp(with event: NSEvent) {
- super.mouseUp(with: event)
- }
-
- @objc func updateUI() {
- self.leftVorLineView.wantsLayer = true
- self.leftVorLineView.layer?.backgroundColor = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/border2").cgColor
- self.titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1")
- self.titleLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
-
- self.timeLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-xs-regular")
- self.timeLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/3")
- self.timeLabel.lineBreakMode = .byTruncatingTail
-
- self.contentLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-regular")
- self.contentLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
- }
-
- override func updateLayer() {
- super.updateLayer()
-
- self.updateUI()
- }
- }
|