mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 11:37:32 +03:00
GH-264 Refactor slightly
This commit is contained in:
parent
be88e129d7
commit
c7fcab1358
@ -8,8 +8,28 @@ import PureLayout
|
||||
|
||||
class ImageAndTextTableCell: NSView {
|
||||
|
||||
let textField: NSTextField = NSTextField(forAutoLayout: ())
|
||||
let imageView: NSImageView = NSImageView(forAutoLayout: ())
|
||||
var text: NSAttributedString {
|
||||
get {
|
||||
return self.textField.attributedStringValue
|
||||
}
|
||||
|
||||
set {
|
||||
self.textField.attributedStringValue = newValue
|
||||
}
|
||||
}
|
||||
|
||||
var image: NSImage? {
|
||||
get {
|
||||
return self.imageView.image
|
||||
}
|
||||
|
||||
set {
|
||||
self.imageView.image = newValue
|
||||
}
|
||||
}
|
||||
|
||||
private let textField: NSTextField = NSTextField(forAutoLayout: ())
|
||||
private let imageView: NSImageView = NSImageView(forAutoLayout: ())
|
||||
|
||||
init(withIdentifier identifier: String) {
|
||||
super.init(frame: CGRect.zero)
|
||||
@ -32,7 +52,6 @@ class ImageAndTextTableCell: NSView {
|
||||
imageView.autoSetDimension(.Width, toSize: 16)
|
||||
imageView.autoSetDimension(.Height, toSize: 16)
|
||||
|
||||
// textField.autoSetDimension(.Height, toSize: 23)
|
||||
textField.autoPinEdgeToSuperviewEdge(.Top, withInset: 2)
|
||||
textField.autoPinEdgeToSuperviewEdge(.Right, withInset: 2)
|
||||
textField.autoPinEdgeToSuperviewEdge(.Bottom, withInset: 2)
|
||||
|
@ -184,8 +184,8 @@ extension OpenQuicklyWindowComponent {
|
||||
let cell = cachedCell as? ImageAndTextTableCell ?? ImageAndTextTableCell(withIdentifier: "file-view-row")
|
||||
|
||||
let url = self.fileViewItems[row].url
|
||||
cell.textField.attributedStringValue = self.rowText(forUrl: url)
|
||||
cell.imageView.image = self.fileItemService.icon(forUrl: url)
|
||||
cell.text = self.rowText(forUrl: url)
|
||||
cell.image = self.fileItemService.icon(forUrl: url)
|
||||
|
||||
return cell
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user