CutBox.app

Coverage Report

Created: 2024-03-12 03:40

.../Source/Base/CutBoxBaseClasses.swift
Line
Count
Source
1
//
2
//  CutBoxBaseClasses.swift
3
//  CutBox
4
//
5
//  Created by jason on 11/9/23.
6
//  Copyright © 2023 ocodo. All rights reserved.
7
//
8
9
import Foundation
10
import Cocoa
11
12
public class CutBoxBaseWindowController: NSWindowController {
13
    var initCoderWasCalled = false
14
    var initWindowWasCalled = false
15
16
2
    public required init?(coder: NSCoder) {
17
2
        super.init(coder: coder)
18
2
        self.initCoderWasCalled = true
19
2
    }
20
21
179
    public override init(window: NSWindow?) {
22
179
        super.init(window: window)
23
179
        self.initWindowWasCalled = true
24
179
    }
25
}
26
27
public class CutBoxBaseWindow: NSWindow {
28
    var initWithParamsCalled = false
29
    var awakeFromNibWasCalled = false
30
31
    public override init(contentRect: NSRect,
32
                         styleMask style: NSWindow.StyleMask,
33
                         backing backingStoreType: NSWindow.BackingStoreType,
34
51
                         defer flag: Bool) {
35
51
        super.init(contentRect: contentRect,
36
51
                   styleMask: style,
37
51
                   backing: backingStoreType,
38
51
                   defer: flag)
39
51
        self.initWithParamsCalled = true
40
51
    }
41
42
50
    public override func awakeFromNib() {
43
50
        super.awakeFromNib()
44
50
        self.awakeFromNibWasCalled = true
45
50
    }
46
}
47
48
public class CutBoxBaseViewController: NSViewController {
49
    var initCoderWasCalled = false
50
    var initWithParamsWasCalled = false
51
52
1
    public required init?(coder: NSCoder) {
53
1
        super.init(coder: coder)
54
1
        self.initCoderWasCalled = true
55
1
    }
56
57
    public override init(nibName nibNameOrNil: NSNib.Name?,
58
1
                         bundle nibBundleOrNil: Bundle?) {
59
1
        super.init(nibName: nibNameOrNil,
60
1
                   bundle: nibBundleOrNil)
61
1
        initWithParamsWasCalled = true
62
1
    }
63
}
64
65
public class CutBoxBaseView: NSView {
66
    var awakeFromNibWasCalled = false
67
    var initCoderWasCalled = false
68
    var initFrameWasCalled = false
69
70
270
    public required init?(coder: NSCoder) {
71
270
        super.init(coder: coder)
72
270
        self.initCoderWasCalled = true
73
270
    }
74
75
464
    public override init(frame frameRect: NSRect) {
76
464
        super.init(frame: frameRect)
77
464
        self.initFrameWasCalled = true
78
464
    }
79
80
1
    public override func awakeFromNib() {
81
1
        super.awakeFromNib()
82
1
        self.awakeFromNibWasCalled = true
83
1
    }
84
}
85
86
public class CutBoxBaseTextView: NSTextView {
87
    var initCoderWasCalled = false
88
    var initFrameWasCalled = false
89
    var keyDownWasCalled = false
90
    var doCommandWasCalled = false
91
92
8
    public override init(frame frameRect: NSRect, textContainer container: NSTextContainer?) {
93
8
        super.init(frame: frameRect, textContainer: container)
94
8
        self.initFrameWasCalled = true
95
8
    }
96
97
79
    public required init?(coder: NSCoder) {
98
79
        super.init(coder: coder)
99
79
        self.initCoderWasCalled = true
100
79
    }
101
102
5
    public override func keyDown(with event: NSEvent?) {
103
5
        if let event = event {
104
4
            super.keyDown(with: event)
105
5
        }
106
5
        self.keyDownWasCalled = true
107
5
    }
108
109
2
    public override func doCommand(by selector: Selector?) {
110
2
        if let selector = selector {
111
1
            super.doCommand(by: selector)
112
2
        }
113
2
        self.doCommandWasCalled = true
114
2
    }
115
}
116
117
class CutBoxBaseMenu: NSMenu {
118
22
    override func item(at index: Int) -> CutBoxBaseMenuItem? {
119
22
        return super.item(at: index) as? CutBoxBaseMenuItem
120
22
    }
121
}
122
123
class CutBoxBaseMenuItem: NSMenuItem {}
124
class CutBoxBaseTextField: NSTextField {}
125
class CutBoxBaseTextFieldCell: NSTextFieldCell {}
126
class CutBoxBaseButton: NSButton {}
127
class CutBoxBaseTabViewItem: NSTabViewItem {}
128
class CutBoxBaseTabView: NSTabView {}
129
class CutBoxBaseTabViewController: NSTabViewController {}
130
class CutBoxBaseTextContainer: NSTextContainer {}
131
class CutBoxBasePopUpButton: NSPopUpButton {}
132
class CutBoxBaseSegmentedControl: NSSegmentedControl {}
133
class CutBoxBaseBox: NSBox {}
134
class CutBoxBaseStackView: NSStackView {}