12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- //
- // ListVC.swift
- // PDF Reader Pro Edition
- //
- // Created by Niehaoyu on 2024/9/23.
- //
- import Cocoa
- import KMComponentLibrary
- class ListVC: NSViewController {
- @IBOutlet weak var listBasicItem: ComponentListBasicItem!
-
- @IBOutlet weak var showSortBtn: NSButton!
- @IBOutlet weak var showLefticon: NSButton!
- @IBOutlet weak var showRightIconBtn: NSButton!
- @IBOutlet weak var disableBtn: NSButton!
-
- @IBOutlet weak var floatingToolbarShowBtn: NSButton!
- var basicProperty: ComponentListBasicItemProperty = ComponentListBasicItemProperty()
- var floatingToolbar: ComponentFloatingToolbar = ComponentFloatingToolbar()
-
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do view setup here.
-
- self.listBasicItem.properties = basicProperty
-
- self.reloadData()
- }
-
- func reloadData() {
-
- self.listBasicItem.properties.showSort = self.showSortBtn.state == .on
- if self.showLefticon.state == .on {
- self.listBasicItem.properties.leftIcon = ComponentLibrary.shared.image(forResource: "segmented_active")
- } else {
- self.listBasicItem.properties.leftIcon = nil
- }
-
- if self.showRightIconBtn.state == .on {
- self.listBasicItem.properties.rightIcon = ComponentLibrary.shared.image(forResource: "segmented_active")
- } else {
- self.listBasicItem.properties.rightIcon = nil
- }
- self.listBasicItem.properties.text = "XXXX XXXX"
- self.listBasicItem.properties.isDisable = self.disableBtn.state == .on
-
- self.listBasicItem.reloadData()
- }
-
- @IBAction func buttonClicked(_ sender: Any) {
- self.reloadData()
- }
-
- @IBAction func showFloatingToolbar(_ sender: Any) {
- self.floatingToolbar.frame = CGRectMake(0, 0, 200, 40)
-
- self.floatingToolbar.showWithPoint(CGPoint(x: self.floatingToolbarShowBtn.frame.origin.x + 40, y: self.floatingToolbarShowBtn.frame.origin.y + 80), inView: self.view)
- }
-
-
-
- }
|