KMToolbarMainItemView.swift 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // KMToolbarMainItemView.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2023/12/14.
  6. //
  7. import Cocoa
  8. class KMToolbarMainItemView: KMToolbarItemView {
  9. override class var textFont: NSFont {
  10. get {
  11. .systemFont(ofSize: 11)
  12. }
  13. }
  14. override class func fetchTextNormalColor() -> NSColor {
  15. return KMAppearance.subtitleColor()
  16. }
  17. override class func fetchTextSelectedColor() -> NSColor {
  18. return KMAppearance.subtitleColor()
  19. }
  20. override func draw(_ dirtyRect: NSRect) {
  21. super.draw(dirtyRect)
  22. // Drawing code here.
  23. }
  24. override func layout() {
  25. super.layout()
  26. if let view = self.promptView, view.superview != nil {
  27. let wh: CGFloat = 6
  28. let y: CGFloat = 1
  29. let centenX: CGFloat = NSWidth(self.bounds) * 0.5
  30. // let imgW = NS /Width(self.imageViewBtn.frame)
  31. let imgW: CGFloat = 24
  32. view.frame = NSMakeRect(centenX+imgW*0.5-wh-1, NSHeight(self.bounds)-wh-y, wh, wh)
  33. }
  34. }
  35. }