Rewrite some class in swift.

This commit is contained in:
Damiano Galassi committed 2017-11-12 14:42:45 +01:00
1 parent eb5f700700
commit fd6473478d
21 files changed
+500 -508

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
}
}