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
510B

  1. #pragma once
  2. #include "widgets/OpaqueWidget.hpp"
  3. #include "ui/common.hpp"
  4. namespace rack {
  5. struct List : OpaqueWidget {
  6. void step() override {
  7. Widget::step();
  8. // Set positions of children
  9. box.size.y = 0.0;
  10. for (Widget *child : children) {
  11. if (!child->visible)
  12. continue;
  13. // Increment height, set position of child
  14. child->box.pos = Vec(0.0, box.size.y);
  15. box.size.y += child->box.size.y;
  16. // Resize width of child
  17. child->box.size.x = box.size.x;
  18. }
  19. }
  20. };
  21. } // namespace rack