1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- //
- // KMBotaTableRowView.swift
- // PDF Reader Pro
- //
- // Created by tangchao on 2023/11/28.
- //
- import Cocoa
- class KMBotaTableRowView: NSTableRowView {
- var selectCallback: ((KMBotaTableRowView)->Void)?
-
- convenience init() {
- self.init(frame: .zero)
-
- self.addTrackingArea()
- }
- override func draw(_ dirtyRect: NSRect) {
- super.draw(dirtyRect)
- // Drawing code here.
- }
-
- func addTrackingArea() {
- let trackingArea = NSTrackingArea(rect: self.bounds, options: [.mouseEnteredAndExited, .inVisibleRect, .activeAlways, .mouseMoved], owner: self, userInfo: nil)
- self.addTrackingArea(trackingArea)
- }
-
- override func drawSelection(in dirtyRect: NSRect) {
- let selectionRect = self.bounds
- KMAppearance.Status.selColor().setFill()
- let selectionPath = NSBezierPath(roundedRect: selectionRect, xRadius: 0, yRadius: 0)
- selectionRect.fill()
- }
-
- override var isSelected: Bool {
- get {
- return super.isSelected
- }
- set {
- super.isSelected = newValue
-
- self.selectCallback?(self)
- }
- }
- }
|