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.

36 lines
944B

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