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.

41 lines
1.1KB

  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> svg);
  19. void setHandleSvg(std::shared_ptr<Svg> svg);
  20. void onChange(const event::Change &e) override;
  21. DEPRECATED void setBackgroundSVG(std::shared_ptr<Svg> svg) {setBackgroundSvg(svg);}
  22. DEPRECATED void setHandleSVG(std::shared_ptr<Svg> svg) {setBackgroundSvg(svg);}
  23. DEPRECATED void setSVGs(std::shared_ptr<Svg> backgroundSvg, std::shared_ptr<Svg> handleSvg) {
  24. setBackgroundSvg(backgroundSvg);
  25. setHandleSvg(handleSvg);
  26. }
  27. };
  28. DEPRECATED typedef SvgSlider SVGSlider;
  29. } // namespace app
  30. } // namespace rack