KMToolbarItemPopViewController.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // KMToolbarItemPopViewController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by liujiajie on 2023/11/10.
  6. //
  7. import Cocoa
  8. class KMToolbarItemPopViewController: NSViewController{
  9. @IBOutlet var toolbarHelpTipLabel: NSTextField!
  10. @IBOutlet weak var topConst: NSLayoutConstraint!
  11. @IBOutlet weak var leftConst: NSLayoutConstraint!
  12. @IBOutlet weak var rightConst: NSLayoutConstraint!
  13. @IBOutlet weak var bottomConst: NSLayoutConstraint!
  14. var contentInset: NSEdgeInsets = .init(top: 5, left: 5, bottom: 5, right: 5) {
  15. didSet {
  16. topConst.constant = contentInset.top
  17. leftConst.constant = contentInset.left
  18. rightConst.constant = contentInset.right
  19. bottomConst.constant = contentInset.bottom
  20. }
  21. }
  22. convenience init() {
  23. self.init(nibName: "KMToolbarItemPopViewController", bundle: nil)
  24. }
  25. @objc func updateWithHelpTip(helpTip: String) {
  26. self.toolbarHelpTipLabel.stringValue = helpTip.count > 0 ? helpTip : ""
  27. }
  28. override func viewDidLoad() {
  29. super.viewDidLoad()
  30. self.toolbarHelpTipLabel?.textColor = .labelColor
  31. }
  32. }