12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- //
- // KMPageEditExtractSettingView.swift
- // PDF Reader Pro
- //
- // Created by tangchao on 2023/1/12.
- //
- class KMPageEditExtractSettingView: KMPageEditSettingBaseView {
- @IBOutlet weak var independentPerPageCheck: NSButton!
- @IBOutlet weak var extractAfterDeletePageCheck: NSButton!
-
- private var independentPerPageVC: KMDesignButton?
- private var _extractAfterDeletePageVC: KMDesignButton?
- var extractAfterDeletePageVC: KMDesignButton? {
- get {
- return self._extractAfterDeletePageVC
- }
- }
-
- var independentPerPageValue: Bool {
- get {
- if let state = self.independentPerPageVC?.state {
- return state == .Checked
- }
- return false
- }
- }
- var extractAfterDeletePageValue: Bool {
- get {
- if let state = self.extractAfterDeletePageVC?.state {
- return state == .Checked
- }
- return false
- }
- }
-
- override func awakeFromNib() {
- super.awakeFromNib()
-
- self.independentPerPageVC = KMDesignButton(withType: .CheckBox)
- self.independentPerPageCheck.addSubview(self.independentPerPageVC!.view)
- self.independentPerPageVC?.view.frame = self.independentPerPageCheck.bounds
- self.independentPerPageVC?.view.autoresizingMask = [.width, .height]
- self.independentPerPageVC?.target = self
- self.independentPerPageVC?.action = #selector(independentPerPageAction)
- self.independentPerPageVC?.stringValue = NSLocalizedString("Each page in a separate file", comment: "")
- self.independentPerPageVC?.checkbox_radio()
-
- self._extractAfterDeletePageVC = KMDesignButton(withType: .CheckBox)
- self.extractAfterDeletePageCheck.addSubview(self.extractAfterDeletePageVC!.view)
- self.extractAfterDeletePageVC?.view.frame = self.extractAfterDeletePageCheck.bounds
- self.extractAfterDeletePageVC?.view.autoresizingMask = [.width, .height]
- self.extractAfterDeletePageVC?.target = self
- self.extractAfterDeletePageVC?.action = #selector(extractAfterDeletePageAction)
- self.extractAfterDeletePageVC?.stringValue = NSLocalizedString("Delete pages after extraction", comment: "")
- self.extractAfterDeletePageVC?.checkbox_radio()
- }
-
- @objc private func independentPerPageAction() {
- if let state = self.independentPerPageVC?.state {
- self.independentPerPageVC?.state = state == .Checked ? .Norm : .Checked
- } else {
- self.independentPerPageVC?.state = .Norm
- }
-
- guard let callback = self.itemClick else {
- return
- }
-
- var value = false
- if let state = self.independentPerPageVC?.state {
- value = state == .Checked
- }
- callback(1, value)
- }
-
- @objc private func extractAfterDeletePageAction() {
- if let state = self.extractAfterDeletePageVC?.state {
- self.extractAfterDeletePageVC?.state = state == .Checked ? .Norm : .Checked
- } else {
- self.extractAfterDeletePageVC?.state = .Norm
- }
-
- guard let callback = self.itemClick else {
- return
- }
-
- var value = false
- if let state = self.extractAfterDeletePageVC?.state {
- value = state == .Checked
- }
- callback(2, value)
- }
- }
|