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.

Switch.hpp 662B

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. #include "app/common.hpp"
  3. #include "app/ParamWidget.hpp"
  4. namespace rack {
  5. namespace app {
  6. /** A ParamWidget that controls */
  7. struct Switch : ParamWidget {
  8. /** Return to original position when released */
  9. bool momentary = false;
  10. /** Hysteresis state for momentary switch */
  11. bool momentaryPressed = false;
  12. bool momentaryReleased = false;
  13. void step() override;
  14. void onDoubleClick(const widget::DoubleClickEvent &e) override;
  15. void onDragStart(const widget::DragStartEvent &e) override;
  16. void onDragEnd(const widget::DragEndEvent &e) override;
  17. void reset() override;
  18. void randomize() override;
  19. };
  20. } // namespace app
  21. } // namespace rack