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

Method recursePositionEvent

include/widget/Widget.hpp:193–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 /** Recurses an event to all visible Widgets until it is consumed. */
192 template <typename TMethod, class TEvent>
193 void recursePositionEvent(TMethod f, const TEvent& e) {
194 for (auto it = children.rbegin(); it != children.rend(); it++) {
195 // Stop propagation if requested
196 if (!e.isPropagating())
197 break;
198 Widget* child = *it;
199 // Filter child by visibility and position
200 if (!child->visible)
201 continue;
202 if (!child->box.contains(e.pos))
203 continue;
204
205 // Clone event and adjust its position
206 TEvent e2 = e;
207 e2.pos = e.pos.minus(child->box.pos);
208 // Call child event handler
209 (child->*f)(e2);
210 }
211 }
212
213 using BaseEvent = widget::BaseEvent;
214

Callers

nothing calls this directly

Calls 3

isPropagatingMethod · 0.80
containsMethod · 0.80
minusMethod · 0.80

Tested by

no test coverage detected