KMBatchBackgroundView.swift 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // KMBatchBackgroundView.swift
  3. // PDF Master
  4. //
  5. // Created by lizhe on 2023/1/16.
  6. //
  7. import Cocoa
  8. class KMBatchBackgroundView: KMBatchSettingItemView {
  9. @IBOutlet weak var applyButton: NSButton!
  10. @IBOutlet weak var itemContentView: NSView!
  11. override func setup() {
  12. super.setup()
  13. self.applyButton.wantsLayer = true
  14. self.applyButton.layer?.cornerRadius = 4
  15. self.applyButton.contentTintColor = NSColor.km_init(hex: "#FFFFFF")
  16. self.applyButton.stringValue = NSLocalizedString("Compress", comment: "")
  17. self.applyButton.font = NSFont.SFProTextRegularFont(14.0)
  18. self.applyButton.layer?.backgroundColor = NSColor.km_init(hex: "#BDDFFD").cgColor
  19. }
  20. override func reloadData() {
  21. if (self.filesData.count != 0) {
  22. self.applyButton.layer?.backgroundColor = NSColor.km_init(hex: "#1770F4").cgColor
  23. self.applyButton.isEnabled = true
  24. } else {
  25. self.applyButton.layer?.backgroundColor = NSColor.km_init(hex: "#BDDFFD").cgColor
  26. self.applyButton.isEnabled = false
  27. }
  28. }
  29. }
  30. protocol KMBatchBackgroundViewAction: KMBatchBackgroundView {}
  31. extension KMBatchBackgroundView: KMBatchBackgroundViewAction {
  32. @IBAction func applyButtonAction(_ sender: NSButton) {
  33. }
  34. }