| 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 |
nothing calls this directly
no test coverage detected