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.

36 lines
643B

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