feat: added calendar to the Clock module that could be hidden in the settings (#2170)

This commit is contained in:
Serhiy Mytrovtsiy
2024-10-15 18:25:41 +02:00
parent 11b34498c4
commit 8d677d0e77
3 changed files with 344 additions and 12 deletions

View File

@@ -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)
}
}