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

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