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.

SVGSlider.hpp 874B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include "app/common.hpp"
  3. #include "app/SliderKnob.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 : SliderKnob {
  11. FramebufferWidget *fb;
  12. SVGWidget *background;
  13. SVGWidget *handle;
  14. /** Intermediate positions will be interpolated between these positions */
  15. math::Vec minHandlePos, maxHandlePos;
  16. SVGSlider();
  17. void setBackgroundSVG(std::shared_ptr<SVG> backgroundSVG);
  18. void setHandleSVG(std::shared_ptr<SVG> handleSVG);
  19. void onChange(const event::Change &e) override;
  20. DEPRECATED void setSVGs(std::shared_ptr<SVG> backgroundSVG, std::shared_ptr<SVG> handleSVG) {
  21. setBackgroundSVG(backgroundSVG);
  22. setHandleSVG(handleSVG);
  23. }
  24. };
  25. } // namespace rack