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

Function getFirstDescendantOfTypeWithCondition

src/app/ModuleWidget.cpp:130–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128
129template <class T, typename F>
130T* getFirstDescendantOfTypeWithCondition(widget::Widget* w, F f) {
131 T* t = dynamic_cast<T*>(w);
132 if (t && f(t))
133 return t;
134
135 for (widget::Widget* child : w->children) {
136 T* foundT = getFirstDescendantOfTypeWithCondition<T>(child, f);
137 if (foundT)
138 return foundT;
139 }
140 return NULL;
141}
142
143ParamWidget* ModuleWidget::getParam(int paramId) {
144 return getFirstDescendantOfTypeWithCondition<ParamWidget>(this, [&](ParamWidget* pw) -> bool {

Callers

nothing calls this directly

Calls 1

fFunction · 0.50

Tested by

no test coverage detected