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.

28 lines
684B

  1. #pragma once
  2. #include "app/common.hpp"
  3. #include "app/Knob.hpp"
  4. #include "widgets/FramebufferWidget.hpp"
  5. #include "widgets/SVGWidget.hpp"
  6. namespace rack {
  7. /** Behaves like a knob but linearly moves an SVGWidget between two points.
  8. Can be used for horizontal or vertical linear faders.
  9. */
  10. struct SVGSlider : Knob, FramebufferWidget {
  11. SVGWidget *background;
  12. SVGWidget *handle;
  13. /** Intermediate positions will be interpolated between these positions */
  14. math::Vec minHandlePos, maxHandlePos;
  15. SVGSlider();
  16. void setSVGs(std::shared_ptr<SVG> backgroundSVG, std::shared_ptr<SVG> handleSVG);
  17. void step() override;
  18. void onChange(event::Change &e) override;
  19. };
  20. } // namespace rack