KMToolbarMainItemView.swift 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 var textNormalColor: NSColor {
  15. get {
  16. KMAppearance.subtitleColor()
  17. }
  18. }
  19. override class var textSelectedColor: NSColor {
  20. get {
  21. KMAppearance.subtitleColor()
  22. }
  23. }
  24. override func draw(_ dirtyRect: NSRect) {
  25. super.draw(dirtyRect)
  26. // Drawing code here.
  27. }
  28. override func layout() {
  29. super.layout()
  30. if let view = self.promptView, view.superview != nil {
  31. let wh: CGFloat = 6
  32. let y: CGFloat = 1
  33. let centenX: CGFloat = NSWidth(self.bounds) * 0.5
  34. // let imgW = NS /Width(self.imageViewBtn.frame)
  35. let imgW: CGFloat = 24
  36. view.frame = NSMakeRect(centenX+imgW*0.5-wh-1, NSHeight(self.bounds)-wh-y, wh, wh)
  37. }
  38. }
  39. }