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.

29 lines
538B

  1. #pragma once
  2. #include "ui/common.hpp"
  3. namespace rack {
  4. struct ProgressBar : VirtualWidget {
  5. Quantity *quantity = NULL;
  6. ProgressBar() {
  7. box.size.y = BND_WIDGET_HEIGHT;
  8. }
  9. ~ProgressBar() {
  10. if (quantity)
  11. delete quantity;
  12. }
  13. void draw(NVGcontext *vg) override {
  14. float progress = quantity ? quantity->getScaledValue() : 0.f;
  15. std::string text = quantity ? quantity->getString() : "";
  16. bndSlider(vg, 0.0, 0.0, box.size.x, box.size.y, BND_CORNER_ALL, BND_DEFAULT, progress, text.c_str(), NULL);
  17. }
  18. };
  19. } // namespace rack