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.

45 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) {
  22. setBackgroundSvg(svg);
  23. }
  24. DEPRECATED void setHandleSVG(std::shared_ptr<Svg> svg) {
  25. setBackgroundSvg(svg);
  26. }
  27. DEPRECATED void setSVGs(std::shared_ptr<Svg> backgroundSvg, std::shared_ptr<Svg> handleSvg) {
  28. setBackgroundSvg(backgroundSvg);
  29. setHandleSvg(handleSvg);
  30. }
  31. };
  32. DEPRECATED typedef SvgSlider SVGSlider;
  33. } // namespace app
  34. } // namespace rack