PaginationVC.swift 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // PaginationVC.swift
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by Niehaoyu on 2024/9/19.
  6. //
  7. import Cocoa
  8. import KMComponentLibrary
  9. class PaginationVC: NSViewController {
  10. @IBOutlet weak var paginationItemA: ComponentPaginationItem!
  11. @IBOutlet weak var paginationItemB: ComponentPaginationItem!
  12. @IBOutlet weak var paginationItemC: ComponentPaginationItem!
  13. @IBOutlet weak var paginationItemD: ComponentPaginationItem!
  14. @IBOutlet weak var paginationItemE: ComponentPaginationItem!
  15. @IBOutlet weak var itemDisableBtn: NSButton!
  16. @IBOutlet weak var pagenationView: ComponentPagination!
  17. @IBOutlet weak var paginationDoubleArrow: NSButton!
  18. override func viewDidLoad() {
  19. super.viewDidLoad()
  20. // Do view setup here.
  21. self.reloadData()
  22. }
  23. func reloadData() {
  24. let propertyA: ComponentPaginationItemProperty = ComponentPaginationItemProperty(type: .arrowLeft, state: .normal, isDisabled: self.itemDisableBtn.state == .on)
  25. self.paginationItemA.properties = propertyA
  26. let propertyB: ComponentPaginationItemProperty = ComponentPaginationItemProperty(type: .arrowRight, state: .normal, isDisabled: self.itemDisableBtn.state == .on)
  27. self.paginationItemB.properties = propertyB
  28. let propertyC: ComponentPaginationItemProperty = ComponentPaginationItemProperty(type: .doubleArrowLeft, state: .normal, isDisabled: self.itemDisableBtn.state == .on)
  29. self.paginationItemC.properties = propertyC
  30. let propertyD: ComponentPaginationItemProperty = ComponentPaginationItemProperty(type: .doubleArrowRight, state: .normal, isDisabled: self.itemDisableBtn.state == .on)
  31. self.paginationItemD.properties = propertyD
  32. let propertyE: ComponentPaginationItemProperty = ComponentPaginationItemProperty(type: .more, state: .normal, isDisabled: self.itemDisableBtn.state == .on)
  33. self.paginationItemE.properties = propertyE
  34. let paginationProperty: ComponentPaginationProperty = ComponentPaginationProperty(doubleArrow_show: self.paginationDoubleArrow.state == .on,
  35. currentIndex: 1,
  36. totalCount: 100)
  37. self.pagenationView.properties = paginationProperty
  38. }
  39. @IBAction func itemAction(_ sender: Any) {
  40. self.reloadData()
  41. }
  42. }