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.

38 lines
919B

  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. struct Internal;
  10. Internal* internal;
  11. /** Multiplier for mouse movement to adjust knob value */
  12. float speed = 1.0;
  13. /** Drag horizontally instead of vertically. */
  14. bool horizontal = false;
  15. /** Enables per-sample value smoothing while dragging. */
  16. bool smooth = true;
  17. /** DEPRECATED. Use `ParamQuantity::snapEnabled`. */
  18. bool snap = false;
  19. Knob();
  20. ~Knob();
  21. void initParamQuantity() override;
  22. void onHover(const event::Hover& e) override;
  23. void onButton(const event::Button& e) override;
  24. void onDragStart(const event::DragStart& e) override;
  25. void onDragEnd(const event::DragEnd& e) override;
  26. void onDragMove(const event::DragMove& e) override;
  27. };
  28. } // namespace app
  29. } // namespace rack