1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-11 17:38:38 +00:00

* input source widget image size

This commit is contained in:
ad 2018-04-27 12:55:54 +03:00
parent 76bdf12745
commit a0dbfca828

View File

@ -11,6 +11,7 @@ import Cocoa
class InputSourceBarItem: CustomButtonTouchBarItem { class InputSourceBarItem: CustomButtonTouchBarItem {
fileprivate var notificationCenter: CFNotificationCenter fileprivate var notificationCenter: CFNotificationCenter
let buttonSize = NSSize(width: 21, height: 21)
init(identifier: NSTouchBarItem.Identifier, onTap: @escaping () -> (), onLongTap: @escaping () -> ()) { init(identifier: NSTouchBarItem.Identifier, onTap: @escaping () -> (), onLongTap: @escaping () -> ()) {
notificationCenter = CFNotificationCenterGetDistributedCenter(); notificationCenter = CFNotificationCenterGetDistributedCenter();
@ -21,6 +22,9 @@ class InputSourceBarItem: CustomButtonTouchBarItem {
self.button.cell?.action = #selector(switchInputSource) self.button.cell?.action = #selector(switchInputSource)
self.button.action = #selector(switchInputSource) self.button.action = #selector(switchInputSource)
self.button.frame.size = buttonSize
self.button.bounds.size = buttonSize
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
@ -48,8 +52,8 @@ class InputSourceBarItem: CustomButtonTouchBarItem {
} }
if (iconImage != nil) { if (iconImage != nil) {
self.button.imageScaling = .scaleProportionallyUpOrDown
self.button.cell?.image = iconImage self.button.cell?.image = iconImage
self.button.cell?.image?.size = buttonSize
} else { } else {
self.button.title = currentSource.name self.button.title = currentSource.name
} }