// // KMBatchCompressView.swift // PDF Master // // Created by lizhe on 2023/1/16. // import Cocoa import KMComponentLibrary class KMBatchCompressView: KMBatchSettingItemView { @IBOutlet weak var titleLabel: NSTextField! @IBOutlet weak var titleContentView: NSView! @IBOutlet weak var applyButton: ComponentButton! @IBOutlet weak var compressView: KMCompressContentView! var data: KMCompressSettingModel = KMCompressSettingModel(modelsType: .standard) override func draw(_ dirtyRect: NSRect) { super.draw(dirtyRect) // Drawing code here. } override func setup() { titleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/1") titleLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-m-medium") self.titleContentView.border(ComponentLibrary.shared.getComponentColorFromKey("colorBorder/divider"), 0.5, 0) self.applyButton.properties = ComponentButtonProperty(type: .primary, size: .m, state: .normal, buttonText: KMLocalizedString("Apply"), keepPressState: false) self.applyButton.setTarget(self, action: #selector(compressButtonAction(_:))) self.applyButton.reloadData() self.compressView.selectTypeAction = {[unowned self] view, tModel in self.data = tModel } } override func reloadData() { } override func bacthProcessingNotification() { self.compressView.isDisable = self.isDisable self.applyButton.properties.isDisabled = self.isDisable self.applyButton.reloadData() } } protocol KMBatchCompressViewAction {} extension KMBatchCompressView: KMBatchCompressViewAction { func compressButtonAction(_ sender: Any) { self.data = self.compressView.model if self.batchExport != nil { self.batchExport!(self, self.data) } } }