1 Commits

Author SHA1 Message Date
Oskar Groth 2e199eed4d Initial coloring, IBVar reloads 2017-04-08 14:22:18 +02:00
4 changed files with 42 additions and 11 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = 'OGSwitch'
s.version = '1.4'
s.version = '1.5'
s.summary = 'Switch with icon'
s.homepage = 'https://github.com/OskarGroth/OGSwitch'
s.license = {
@@ -10,11 +10,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OGSwitch/OGSwitch.swift"
timestampString = "509792812.217359"
timestampString = "513346877.889494"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "69"
endingLineNumber = "69"
startingLineNumber = "77"
endingLineNumber = "77"
landmarkName = "setupIcon()"
landmarkType = "7">
<Locations>
+35 -7
View File
@@ -11,14 +11,42 @@ import QuartzCore
public class OGSwitch : NSControl {
@IBInspectable public var tintColor: NSColor = NSColor(calibratedRed:0.27, green: 0.86, blue: 0.36, alpha: 1.0)
@IBInspectable public var knobBackgroundColor: NSColor = NSColor(calibratedWhite:1.0, alpha: 1.0)
@IBInspectable public var disabledBorderColor: NSColor = NSColor(calibratedWhite: 0.0, alpha: 0.2)
@IBInspectable public var disabledBackgroundColor: NSColor = NSColor.clear
@IBInspectable public var inactiveBackgroundColor: NSColor = NSColor(calibratedWhite: 0.0, alpha:0.3)
@IBInspectable public var tintColor: NSColor = NSColor(calibratedRed:0.27, green: 0.86, blue: 0.36, alpha: 1.0) {
didSet {
reloadLayer()
}
}
@IBInspectable public var knobBackgroundColor: NSColor = NSColor(calibratedWhite:1.0, alpha: 1.0) {
didSet {
reloadLayer()
}
}
@IBInspectable public var disabledBorderColor: NSColor = NSColor(calibratedWhite: 0.0, alpha: 0.2) {
didSet {
reloadLayer()
}
}
@IBInspectable public var disabledBackgroundColor: NSColor = NSColor.clear {
didSet {
reloadLayer()
}
}
@IBInspectable public var inactiveBackgroundColor: NSColor = NSColor(calibratedWhite: 0.0, alpha:0.3) {
didSet {
reloadLayer()
}
}
@IBInspectable public var animationDuration: TimeInterval = 0.4
@IBInspectable public var inactiveIcon: NSImage?
@IBInspectable public var activeIcon: NSImage?
@IBInspectable public var inactiveIcon: NSImage? {
didSet {
reloadLayer()
}
}
@IBInspectable public var activeIcon: NSImage? {
didSet {
reloadLayer()
}
}
@IBInspectable public var ignoreRatio: Bool = false
let kBorderLineWidth:CGFloat = 1.0
+3
View File
@@ -697,6 +697,9 @@
<userDefinedRuntimeAttribute type="image" keyPath="inactiveIcon" value="NSEnterFullScreenTemplate"/>
<userDefinedRuntimeAttribute type="image" keyPath="activeIcon" value="NSBookmarksTemplate"/>
<userDefinedRuntimeAttribute type="boolean" keyPath="ignoreRatio" value="YES"/>
<userDefinedRuntimeAttribute type="color" keyPath="disabledBackgroundColor">
<color key="value" red="1" green="0.40000000600000002" blue="0.40000000600000002" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="switchPress:" target="Voe-Tx-rLC" id="Mqi-G6-fmv"/>