Convert some cells to Swift.

This commit is contained in:
Damiano Galassi committed 2017-10-20 09:59:25 +02:00
1 parent 0ce6c0a012
commit 23aa3fc7cd
25 files changed
+173 -288

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
//
// ComboBoxCell.swift
// Subler
//
// Created by Damiano Galassi on 20/10/2017.
//
import Cocoa
class ComboBoxCell : NSComboBoxCell {
private var originalBackgroundStyle: NSView.BackgroundStyle = NSView.BackgroundStyle.light
override var backgroundStyle: NSView.BackgroundStyle {
get {
return super.backgroundStyle
}
set (newBackgroundStyle) {
super.backgroundStyle = newBackgroundStyle
if newBackgroundStyle == NSView.BackgroundStyle.dark {
textColor = NSColor.controlHighlightColor
} else {
textColor = NSColor.controlTextColor
}
}
}
override func setUpFieldEditorAttributes(_ textObj: NSText) -> NSText {
originalBackgroundStyle = backgroundStyle
backgroundStyle = NSView.BackgroundStyle.light
drawsBackground = true
return super.setUpFieldEditorAttributes(textObj)
}
override func endEditing(_ textObj: NSText) {
super.endEditing(textObj)
drawsBackground = false
backgroundStyle = originalBackgroundStyle
}
}