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.

33 lines
799B

  1. #pragma once
  2. #include "app/common.hpp"
  3. #include "app/ParamWidget.hpp"
  4. #include "app.hpp"
  5. namespace rack {
  6. namespace app {
  7. /** Implements vertical dragging behavior for ParamWidgets */
  8. struct Knob : ParamWidget {
  9. /** Multiplier for mouse movement to adjust knob value */
  10. float speed = 1.0;
  11. float oldValue = 0.f;
  12. bool smooth = true;
  13. /** Enable snapping at integer values */
  14. bool snap = false;
  15. float snapValue = NAN;
  16. /** Drag horizontally instead of vertically */
  17. bool horizontal = false;
  18. void onHover(const event::Hover &e) override;
  19. void onButton(const event::Button &e) override;
  20. void onDragStart(const event::DragStart &e) override;
  21. void onDragEnd(const event::DragEnd &e) override;
  22. void onDragMove(const event::DragMove &e) override;
  23. };
  24. } // namespace app
  25. } // namespace rack