mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 17:38:38 +00:00
* button highlight on touch
This commit is contained in:
parent
5ed1790601
commit
207af6468e
@ -27,6 +27,7 @@ class CustomButtonTouchBarItem: NSCustomTouchBarItem, NSGestureRecognizerDelegat
|
|||||||
button.cell?.title = title
|
button.cell?.title = title
|
||||||
button.title = title
|
button.title = title
|
||||||
|
|
||||||
|
button.bezelStyle = .rounded
|
||||||
button.bezelColor = bezelColor
|
button.bezelColor = bezelColor
|
||||||
self.view = button
|
self.view = button
|
||||||
|
|
||||||
@ -91,13 +92,22 @@ class CustomButtonCell: NSButtonCell {
|
|||||||
super.init(textCell: "")
|
super.init(textCell: "")
|
||||||
if backgroundColor != .clear {
|
if backgroundColor != .clear {
|
||||||
self.isBordered = true
|
self.isBordered = true
|
||||||
self.bezelStyle = .rounded
|
|
||||||
self.backgroundColor = backgroundColor
|
self.backgroundColor = backgroundColor
|
||||||
} else {
|
} else {
|
||||||
self.isBordered = false
|
self.isBordered = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func highlight(_ flag: Bool, withFrame cellFrame: NSRect, in controlView: NSView) {
|
||||||
|
if flag {
|
||||||
|
controlView.layer?.masksToBounds = true
|
||||||
|
self.isBordered = true
|
||||||
|
} else {
|
||||||
|
self.isBordered = false
|
||||||
|
}
|
||||||
|
super.highlight(flag, withFrame: cellFrame, in: controlView)
|
||||||
|
}
|
||||||
|
|
||||||
required init(coder: NSCoder) {
|
required init(coder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,8 +26,12 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Copyright © 2018 Anton Palgunov. All rights reserved.</string>
|
<string>Copyright © 2018 Anton Palgunov. All rights reserved.</string>
|
||||||
|
<key>NSLocationAlwaysUsageDescription</key>
|
||||||
|
<string>Weather widget need your location for correct work</string>
|
||||||
<key>NSLocationUsageDescription</key>
|
<key>NSLocationUsageDescription</key>
|
||||||
<string>...</string>
|
<string>Weather widget need your location for correct work</string>
|
||||||
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
|
<string>Weather widget need your location for correct work</string>
|
||||||
<key>NSMainStoryboardFile</key>
|
<key>NSMainStoryboardFile</key>
|
||||||
<string>Main</string>
|
<string>Main</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
|
|||||||
@ -208,6 +208,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
|
|||||||
let button = item.button!
|
let button = item.button!
|
||||||
button.imageScaling = .scaleProportionallyDown
|
button.imageScaling = .scaleProportionallyDown
|
||||||
button.imagePosition = .imageLeading
|
button.imagePosition = .imageLeading
|
||||||
|
button.imageHugsTitle = true
|
||||||
button.cell?.image = source.image
|
button.cell?.image = source.image
|
||||||
button.bezelColor = .clear
|
button.bezelColor = .clear
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user