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.

52 lines
1.1KB

  1. #pragma once
  2. #include <app/common.hpp>
  3. #include <widget/TransparentWidget.hpp>
  4. #include <widget/FramebufferWidget.hpp>
  5. #include <widget/SvgWidget.hpp>
  6. #include <settings.hpp>
  7. namespace rack {
  8. namespace app {
  9. struct PanelBorder : widget::TransparentWidget {
  10. void draw(const DrawArgs& args) override;
  11. };
  12. struct SvgPanel : widget::Widget {
  13. widget::FramebufferWidget* fb;
  14. widget::SvgWidget* sw;
  15. PanelBorder* panelBorder;
  16. std::shared_ptr<window::Svg> svg;
  17. SvgPanel();
  18. void step() override;
  19. void setBackground(std::shared_ptr<window::Svg> svg);
  20. };
  21. DEPRECATED typedef SvgPanel SVGPanel;
  22. struct ThemedSvgPanel : SvgPanel {
  23. std::shared_ptr<window::Svg> lightSvg;
  24. std::shared_ptr<window::Svg> darkSvg;
  25. void setBackground(std::shared_ptr<window::Svg> lightSvg, std::shared_ptr<window::Svg> darkSvg) {
  26. this->lightSvg = lightSvg;
  27. this->darkSvg = darkSvg;
  28. SvgPanel::setBackground(settings::preferDarkPanels ? darkSvg : lightSvg);
  29. }
  30. void step() override {
  31. SvgPanel::setBackground(settings::preferDarkPanels ? darkSvg : lightSvg);
  32. SvgPanel::step();
  33. }
  34. };
  35. } // namespace app
  36. } // namespace rack