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.

34 lines
600B

  1. #include "app.hpp"
  2. namespace rack {
  3. struct PanelBorder : TransparentWidget {
  4. void draw(NVGcontext *vg) override {
  5. NVGcolor borderColor = nvgRGBAf(0.5, 0.5, 0.5, 0.5);
  6. nvgBeginPath(vg);
  7. nvgRect(vg, 0.5, 0.5, box.size.x - 1.0, box.size.y - 1.0);
  8. nvgStrokeColor(vg, borderColor);
  9. nvgStrokeWidth(vg, 1.0);
  10. nvgStroke(vg);
  11. }
  12. };
  13. void SVGPanel::setBackground(std::shared_ptr<SVG> svg) {
  14. clearChildren();
  15. SVGWidget *sw = new SVGWidget();
  16. sw->wrap();
  17. sw->svg = svg;
  18. addChild(sw);
  19. PanelBorder *pb = new PanelBorder();
  20. pb->box.size = box.size;
  21. addChild(pb);
  22. }
  23. } // namespace rack