// // SliderVC.swift // KMComponentLibrary // // Created by Niehaoyu on 2024/8/29. // import Cocoa import KMComponentLibrary class SliderVC: NSViewController { @IBOutlet weak var slider: ComponentSlider! @IBOutlet weak var sizeBox: NSComboBox! @IBOutlet weak var disableButton: NSButton! @IBOutlet weak var inputButton: NSButton! @IBOutlet weak var leftIconBtn: NSButton! @IBOutlet weak var rightIconBtn: NSButton! @IBOutlet weak var sliderWidthConst: NSLayoutConstraint! @IBOutlet weak var sliderHeightConst: NSLayoutConstraint! override func viewDidLoad() { super.viewDidLoad() // Do view setup here. self.reloadData() } func reloadData() { let isDisable = self.disableButton.state == .on var size: ComponentSize = .m if self.sizeBox.indexOfSelectedItem == 0 { size = .m } else if self.sizeBox.indexOfSelectedItem == 1 { size = .s } let showInput = self.inputButton.state == .on } @IBAction func buttonAction(_ sender: Any) { self.reloadData() } override func mouseDown(with event: NSEvent) { super.mouseDown(with: event) self.view.window?.makeFirstResponder(nil) } }