123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // KMConvertCSVSettingView.swift
- // PDF Master
- //
- // Created by tangchao on 2022/12/6.
- //
- import Cocoa
- class KMConvertCSVSettingView: KMConvertSettingView {
- @IBOutlet weak var oneFileForPageComboBox: NSButton!
- @IBOutlet weak var onlyGetTableBox: NSBox!
- @IBOutlet weak var tableSheetComboBox: NSComboBox!
-
- @IBOutlet weak var pageRangeBox: NSBox!
-
- var selectedSettingIndex: Int = 0
- var selectedTableFormatIndex: Int = 0
-
- var onlyGetTableVC: KMDesignButton?
-
- override func awakeFromNib() {
- super.awakeFromNib()
- // tableSheetComboBox.removeAllItems()
- // tableSheetComboBox.addItems(withObjectValues: ["支持一个表格提取到单独的工作表","支持按页面提取表格到单独的工作表","支持将所有表格提取到一个工作表"])
- // tableSheetComboBox.selectItem(at: 0)
- // tableSheetComboBox.delegate = self
- }
-
- override func initSubViews() {
- super.initSubViews()
-
- self.oneFileForPageComboBox.title = NSLocalizedString("Excel Worksheet Settings", comment: "")
- self.oneFileForPageComboBox.font = .SFProTextSemiboldFont(12)
- self.oneFileForPageComboBox.setTitleColor(color: NSColor.km_init(hex: "#616469"))
-
- self.onlyGetTableVC = KMDesignButton.init(withType: .CheckBox)
- self.onlyGetTableBox.contentView = self.onlyGetTableVC!.view
- self.onlyGetTableVC?.target = self
- self.onlyGetTableVC?.action = #selector(self.radioAction(sender:))
- self.onlyGetTableVC?.checkbox_radio()
-
- self.tipView?.km_add_left_constraint(constant: 8)
- self.tipView?.km_add_top_constraint(equalTo: self.pageRangeBox, attribute: .bottom, constant: -5)
- self.tipView?.km_add_right_constraint()
- self.tipView?.km_add_height_constraint(constant: 16+20+16)
- }
-
- override func initDefaultVlaue() {
- super.initDefaultVlaue()
-
- self.onlyGetTableBox.fillColor = .clear
- self.onlyGetTableVC?.stringValue = NSLocalizedString("Only Table", comment: "")
- self.onlyGetTableVC?.checkbox_radio()
- }
-
- override func viewDidMoveToWindow() {
- super.viewDidMoveToWindow()
-
- if (self.pageRangeItemView == nil) {
- self.pageRangeItemView = KMConvertPageRangeSettingItemView.createFromNib()
- self.pageRangeBox.contentView = self.pageRangeItemView
-
- // self.tipView?.km_add_left_constraint(constant: 8)
- // self.tipView?.km_add_top_constraint(equalTo: self.pageRangeBox, attribute: .bottom, constant: -5)
- // self.tipView?.km_add_right_constraint()
- // self.tipView?.km_add_height_constraint(constant: 16+20+16)
- }
- }
-
- @objc func radioAction(sender: NSButton) {
- for radio in [self.onlyGetTableVC] {
- if ((radio?.button.isEqual(to: sender))!) {
- if radio?.state == .Checked {
- radio?.state = .Norm
- } else {
- radio?.state = .Checked
- }
- }
- }
-
- // if let state = self.onlyGetTableVC?.state, state == .Checked {
- // self.tableSheetComboBox.isEnabled = true
- // } else {
- // self.tableSheetComboBox.isEnabled = false
- // }
-
- if let state = self.onlyGetTableVC?.state, state == .Checked {
- self.selectedSettingIndex = 1
- } else {
- self.selectedSettingIndex = 0
- }
- }
- }
- //extension KMConvertCSVSettingView: NSComboBoxDelegate {
- // func comboBoxSelectionDidChange(_ notification: Notification) {
- // if (tableSheetComboBox.isEqual(to: notification.object)) {
- // if tableSheetComboBox.indexOfSelectedItem < 0 {
- // selectedTableFormatIndex = 0
- // return
- // }
- //
- // selectedTableFormatIndex = tableSheetComboBox.indexOfSelectedItem
- // }
- // }
- //}
|