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

* font style

This commit is contained in:
ad 2018-04-27 14:32:07 +03:00
parent cc1332dd02
commit 5f02bb2962
2 changed files with 3 additions and 2 deletions

View File

@ -25,6 +25,7 @@ class CustomButtonTouchBarItem: NSCustomTouchBarItem, NSGestureRecognizerDelegat
button.cell = CustomButtonCell(backgroundColor: bezelColor!) button.cell = CustomButtonCell(backgroundColor: bezelColor!)
button.cell?.title = title button.cell?.title = title
button.title = title
button.bezelColor = bezelColor button.bezelColor = bezelColor
self.view = button self.view = button
@ -105,7 +106,7 @@ class CustomButtonCell: NSButtonCell {
extension NSButton { extension NSButton {
var title: String { var title: String {
get { get {
return "" return (self.cell?.title)!
} }
set (newTitle) { set (newTitle) {

View File

@ -109,7 +109,7 @@ class CurrencyBarItem: CustomButtonTouchBarItem {
let title = String(format: "%@%.2f", self.prefix, value) let title = String(format: "%@%.2f", self.prefix, value)
let newTitle = NSMutableAttributedString(string: title as String, attributes: [NSAttributedStringKey.foregroundColor: color, NSAttributedStringKey.font: NSFont.systemFont(ofSize: 15, weight: .regular)]) let newTitle = NSMutableAttributedString(string: title as String, attributes: [NSAttributedStringKey.foregroundColor: color, NSAttributedStringKey.font: button.attributedTitle.attribute(NSAttributedStringKey.font, at: 0, effectiveRange: nil)])
newTitle.setAlignment(.center, range: NSRange(location: 0, length: title.count)) newTitle.setAlignment(.center, range: NSRange(location: 0, length: title.count))
button.attributedTitle = newTitle button.attributedTitle = newTitle
} }