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.

IconButton.hpp 532B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include "widgets/FramebufferWidget.hpp"
  3. #include "widgets/SVGWidget.hpp"
  4. #include "ui/common.hpp"
  5. #include "ui/Button.hpp"
  6. namespace rack {
  7. struct IconButton : Button {
  8. FramebufferWidget *fw;
  9. SVGWidget *sw;
  10. IconButton() {
  11. box.size.x = BND_TOOL_WIDTH;
  12. fw = new FramebufferWidget;
  13. fw->oversample = 2;
  14. addChild(fw);
  15. sw = new SVGWidget;
  16. sw->box.pos = math::Vec(2, 2);
  17. fw->addChild(sw);
  18. }
  19. void setSVG(std::shared_ptr<SVG> svg) {
  20. sw->setSVG(svg);
  21. fw->dirty = true;
  22. }
  23. };
  24. } // namespace rack