You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
795B

  1. #pragma once
  2. #include <app/common.hpp>
  3. #include <app/ParamWidget.hpp>
  4. namespace rack {
  5. namespace app {
  6. /** A ParamWidget that represents an integer.
  7. Increases by 1 each time it is clicked.
  8. When maxValue is reached, the next click resets to minValue.
  9. In momentary mode, the value is instead set to maxValue when the mouse is held and minValue when released.
  10. */
  11. struct Switch : ParamWidget {
  12. struct Internal;
  13. Internal* internal;
  14. /** Return to original position when released */
  15. bool momentary = false;
  16. Switch();
  17. ~Switch();
  18. void initParamQuantity() override;
  19. void step() override;
  20. void onDoubleClick(const DoubleClickEvent& e) override;
  21. void onDragStart(const DragStartEvent& e) override;
  22. void onDragEnd(const DragEndEvent& e) override;
  23. };
  24. } // namespace app
  25. } // namespace rack