-
Notifications
You must be signed in to change notification settings - Fork 0
/
MultiCardPrintableView-Letter.swift
146 lines (128 loc) · 2.78 KB
/
MultiCardPrintableView-Letter.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//
// MultiCardPrintableView-Letter.swift
// Artifice
//
// Created by Kyle Cardoza on 2016-08-18.
// Copyright © 2016 Kyle Cardoza. All rights reserved.
//
import Foundation
//
// StandardTemplateCardView.swift
// Artifice
//
// Created by Kyle Cardoza on 2016-07-31.
// Copyright © 2016 Kyle Cardoza. All rights reserved.
//
import Cocoa
class MultiCardPrintableViewLetter: NSView {
@IBOutlet weak var contentView: NSView!
@IBOutlet weak var topLeftView: NSImageView!
@IBOutlet weak var topRightView: NSImageView!
@IBOutlet weak var middleLeftView: NSImageView!
@IBOutlet weak var middleRightView: NSImageView!
@IBOutlet weak var bottomLeftView: NSImageView!
@IBOutlet weak var bottomRightView: NSImageView!
@IBOutlet weak var setName: NSTextField!
@IBOutlet weak var pageNumber: NSTextField!
@IBOutlet weak var expansionSymbol: NSImageView!
var topLeft: NSImage? {
get {
return topLeftView.image
}
set {
topLeftView.image = newValue
}
}
var topRight: NSImage? {
get {
return topRightView.image
}
set {
topRightView.image = newValue
}
}
var middleLeft: NSImage? {
get {
return middleLeftView.image
}
set {
middleLeftView.image = newValue
}
}
var middleRight: NSImage? {
get {
return middleRightView.image
}
set {
middleRightView.image = newValue
}
}
var bottomLeft: NSImage? {
get {
return bottomLeftView.image
}
set {
bottomLeftView.image = newValue
}
}
var bottomRight: NSImage? {
get {
return bottomRightView.image
}
set {
bottomRightView.image = newValue
}
}
subscript(index: Int) -> NSImage? {
get {
switch index {
case 0:
return bottomLeft
case 1:
return middleLeft
case 2:
return topLeft
case 3:
return bottomRight
case 4:
return middleRight
case 5:
return topRight
default:
return nil
}
}
set {
switch index {
case 0:
bottomLeft = newValue
case 1:
middleLeft = newValue
case 2:
topLeft = newValue
case 3:
bottomRight = newValue
case 4:
middleRight = newValue
case 5:
topRight = newValue
default:
return
}
}
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initSubviews()
}
override init(frame: CGRect) {
super.init(frame: frame)
initSubviews()
}
func initSubviews() {
Bundle(for: type(of: self))
.loadNibNamed(NSNib.Name(rawValue: "MultiCardPrintableView-Letter"), owner: self, topLevelObjects: nil)
contentView.frame = bounds
addSubview(contentView)
}
}