| 216 | |
| 217 | |
| 218 | void Widget::removeChild(Widget* child) { |
| 219 | assert(child); |
| 220 | // Make sure `this` is the child's parent |
| 221 | assert(child->parent == this); |
| 222 | // Dispatch Remove event |
| 223 | RemoveEvent eRemove; |
| 224 | child->onRemove(eRemove); |
| 225 | // Prepare to remove widget from the event state |
| 226 | APP->event->finalizeWidget(child); |
| 227 | // Delete child from children list |
| 228 | auto it = std::find(children.begin(), children.end(), child); |
| 229 | assert(it != children.end()); |
| 230 | children.erase(it); |
| 231 | // Revoke child's parent |
| 232 | child->parent = NULL; |
| 233 | } |
| 234 | |
| 235 | |
| 236 | void Widget::clearChildren() { |
no test coverage detected