#pragma once #include #include #include #include namespace rack { namespace app { /** Behaves like a knob but linearly moves an widget::SvgWidget between two points. Can be used for horizontal or vertical linear faders. */ struct SvgSlider : app::SliderKnob { widget::FramebufferWidget* fb; widget::SvgWidget* background; widget::SvgWidget* handle; /** Intermediate positions will be interpolated between these positions */ math::Vec minHandlePos, maxHandlePos; SvgSlider(); void setBackgroundSvg(std::shared_ptr svg); void setHandleSvg(std::shared_ptr svg); void setHandlePos(math::Vec minHandlePos, math::Vec maxHandlePos); void setHandlePosCentered(math::Vec minHandlePosCentered, math::Vec maxHandlePosCentered); void onChange(const ChangeEvent& e) override; DEPRECATED void setBackgroundSVG(std::shared_ptr svg) { setBackgroundSvg(svg); } DEPRECATED void setHandleSVG(std::shared_ptr svg) { setHandleSvg(svg); } DEPRECATED void setSVGs(std::shared_ptr backgroundSvg, std::shared_ptr handleSvg) { setBackgroundSvg(backgroundSvg); setHandleSvg(handleSvg); } }; DEPRECATED typedef SvgSlider SVGSlider; } // namespace app } // namespace rack