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
1.0KB

  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. /** Drag horizontally instead of vertically. */
  12. bool horizontal = false;
  13. /** Enables per-sample value smoothing while dragging. */
  14. bool smooth = true;
  15. /** DEPRECATED. Use `ParamQuantity::snapEnabled`. */
  16. bool snap = false;
  17. /** Value of the knob before dragging. */
  18. float oldValue = 0.f;
  19. /** Fractional value between the param's value and the dragged knob position. */
  20. float snapDelta = 0.f;
  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