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.

33 lines
606B

  1. #include "app/SVGButton.hpp"
  2. namespace rack {
  3. SVGButton::SVGButton() {
  4. sw = new SVGWidget;
  5. addChild(sw);
  6. }
  7. void SVGButton::setSVGs(std::shared_ptr<SVG> defaultSVG, std::shared_ptr<SVG> activeSVG) {
  8. sw->setSVG(defaultSVG);
  9. box.size = sw->box.size;
  10. this->defaultSVG = defaultSVG;
  11. this->activeSVG = activeSVG ? activeSVG : defaultSVG;
  12. }
  13. void SVGButton::onDragStart(const event::DragStart &e) {
  14. event::Action eAction;
  15. onAction(eAction);
  16. sw->setSVG(activeSVG);
  17. dirty = true;
  18. }
  19. void SVGButton::onDragEnd(const event::DragEnd &e) {
  20. sw->setSVG(defaultSVG);
  21. dirty = true;
  22. }
  23. } // namespace rack