KMPreferenceStepper.swift 866 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // KMPreferenceStepper.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2023/2/3.
  6. //
  7. import Cocoa
  8. class KMPreferenceStepper: KMWatermarkAdjectiveStepper {
  9. override func initSubViews() {
  10. super.initSubViews()
  11. self.textField.backgroundColor = NSColor.white
  12. self.textField.isBordered = false
  13. }
  14. override func layout() {
  15. super.layout()
  16. let width: CGFloat = NSWidth(self.bounds)
  17. let height: CGFloat = NSHeight(self.bounds)
  18. let stepperWidth: CGFloat = 15
  19. stepper.frame = NSMakeRect(width-stepperWidth,0, stepperWidth, height)
  20. let textFieldX: CGFloat = 4
  21. let textFieldHeight: CGFloat = 20
  22. textField.frame = NSMakeRect(textFieldX, (height-textFieldHeight)*0.5, width-stepperWidth-textFieldX, textFieldHeight)
  23. }
  24. }