1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- //
- // KMConvertCSVSettingView.swift
- // PDF Reader Pro
- //
- // 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()
- }
-
- 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
- }
- }
-
- @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.selectedSettingIndex = 1
- } else {
- self.selectedSettingIndex = 0
- }
- }
- }
|