MCPcopy Create free account
hub / github.com/VCVRack/Rack / step

Method step

src/ui/Menu.cpp:29–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29void Menu::step() {
30 Widget::step();
31
32 // Set positions of children
33 box.size = math::Vec(0, 0);
34 for (widget::Widget* child : children) {
35 if (!child->visible)
36 continue;
37 // Increment height, set position of child
38 child->box.pos = math::Vec(0, box.size.y);
39 box.size.y += child->box.size.y;
40 // Increase width based on maximum width of child
41 if (child->box.size.x > box.size.x) {
42 box.size.x = child->box.size.x;
43 }
44 }
45
46 // Set widths of all children to maximum width
47 for (widget::Widget* child : children) {
48 child->box.size.x = box.size.x;
49 }
50
51 // Fit inside parent
52 assert(parent);
53 box = box.nudge(parent->box.zeroPos());
54}
55
56void Menu::draw(const DrawArgs& args) {
57 bndMenuBackground(args.vg, 0.0, 0.0, box.size.x, box.size.y, cornerFlags);

Callers

nothing calls this directly

Calls 4

stepFunction · 0.85
VecClass · 0.85
nudgeMethod · 0.80
zeroPosMethod · 0.80

Tested by

no test coverage detected