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.

43 lines
999B

  1. #pragma once
  2. #include <app/common.hpp>
  3. #include <widget/FramebufferWidget.hpp>
  4. #include <widget/SvgWidget.hpp>
  5. #include <app/CircularShadow.hpp>
  6. #include <app/Switch.hpp>
  7. namespace rack {
  8. namespace app {
  9. /** A ParamWidget with multiple frames corresponding to its value */
  10. struct SvgSwitch : Switch {
  11. struct Internal;
  12. Internal* internal;
  13. widget::FramebufferWidget* fb;
  14. CircularShadow* shadow;
  15. widget::SvgWidget* sw;
  16. std::vector<std::shared_ptr<window::Svg>> frames;
  17. /** Use frames 0 and 1 when the mouse is pressed and released, instead of using the param value as the frame index.
  18. */
  19. bool latch = false;
  20. SvgSwitch();
  21. ~SvgSwitch();
  22. /** Adds an SVG file to represent the next switch position */
  23. void addFrame(std::shared_ptr<window::Svg> svg);
  24. void onDragStart(const DragStartEvent& e) override;
  25. void onDragEnd(const DragEndEvent& e) override;
  26. void onChange(const ChangeEvent& e) override;
  27. };
  28. DEPRECATED typedef SvgSwitch SVGSwitch;
  29. } // namespace app
  30. } // namespace rack