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.

SVGButton.hpp 705B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include "app/common.hpp"
  3. #include "widgets/FramebufferWidget.hpp"
  4. #include "widgets/SVGWidget.hpp"
  5. namespace rack {
  6. /** A Component with a default (up) and active (down) state when clicked.
  7. Does not modify a Param, simply calls onAction() of a subclass.
  8. */
  9. struct SVGButton : FramebufferWidget {
  10. std::shared_ptr<SVG> defaultSVG;
  11. std::shared_ptr<SVG> activeSVG;
  12. SVGWidget *sw;
  13. SVGButton();
  14. /** If `activeSVG` is NULL, `defaultSVG` is used as the active state instead. */
  15. void setSVGs(std::shared_ptr<SVG> defaultSVG, std::shared_ptr<SVG> activeSVG);
  16. void onDragStart(const event::DragStart &e) override;
  17. void onDragEnd(const event::DragEnd &e) override;
  18. };
  19. } // namespace rack