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.

44 lines
1017B

  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. TODO change name
  19. */
  20. bool latch = false;
  21. SvgSwitch();
  22. ~SvgSwitch();
  23. /** Adds an SVG file to represent the next switch position */
  24. void addFrame(std::shared_ptr<window::Svg> svg);
  25. void onDragStart(const DragStartEvent& e) override;
  26. void onDragEnd(const DragEndEvent& e) override;
  27. void onChange(const ChangeEvent& e) override;
  28. };
  29. DEPRECATED typedef SvgSwitch SVGSwitch;
  30. } // namespace app
  31. } // namespace rack