CutBox.app

Coverage Report

Created: 2024-03-12 03:40

.../Source/App/SearchAndPreview/ClipItems/ItemTableRowImageView.swift
Line
Count
Source (jump to first uncovered line)
1
//
2
//  ItemTableRowImageView.swift
3
//  CutBox
4
//
5
//  Created by Jason Milkins on 17/5/18.
6
//  Copyright © 2018-2023 ocodo. All rights reserved.
7
//
8
9
import Cocoa
10
11
class ItemTableRowImageView: NSView {
12
13
    @IBOutlet weak var image: NSImageView!
14
15
75
    var internalColor: NSColor = .textColor {
16
74
        didSet {
17
74
            tintImage()
18
74
        }
19
    }
20
21
    var color: NSColor {
22
148
        get {
23
148
            return internalColor
24
148
        }
25
26
74
        set {
27
74
            internalColor = newValue
28
74
        }
29
    }
30
31
    var internalData: [String: String]? {
32
73
        didSet {
33
73
            setup()
34
73
        }
35
    }
36
37
    var data: [String: String]? {
38
73
        get {
39
73
            return internalData
40
73
        }
41
42
73
        set {
43
73
            internalData = newValue
44
73
        }
45
    }
46
47
0
    func setup() {
48
0
        fatalError("no default setup")
49
0
    }
50
51
148
    func tintImage() {
52
148
        guard let imageData = self.image.image else { fatalError("No image on clip") }
53
148
        let blended = imageData.tint(color: self.color)
54
148
        self.image.image = blended
55
148
    }
56
}