mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: added calendar to the Clock module that could be hidden in the settings (#2170)
This commit is contained in:
@@ -1596,3 +1596,18 @@ public class HelpHUD: NSPanel {
|
||||
self.center()
|
||||
}
|
||||
}
|
||||
|
||||
public class VerticallyCenteredTextFieldCell: NSTextFieldCell {
|
||||
public override func titleRect(forBounds rect: NSRect) -> NSRect {
|
||||
var titleRect = super.titleRect(forBounds: rect)
|
||||
let textSize = self.attributedStringValue.size()
|
||||
let verticalOffset = (rect.size.height - textSize.height) / 2.0
|
||||
titleRect.origin.y += verticalOffset
|
||||
return titleRect
|
||||
}
|
||||
|
||||
public override func drawInterior(withFrame cellFrame: NSRect, in controlView: NSView) {
|
||||
let titleRect = self.titleRect(forBounds: cellFrame)
|
||||
self.attributedStringValue.draw(in: titleRect)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user