1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //
- // 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)
- }
- }
- }
|