/* ===================== GameNode::RemoveChild ===================== */ void GameNode::RemoveChild(GameNode *ch, bool cleanup) { for (unsigned int i=0; i<children.size(); i++) { if (children[i] == ch) { children.erase(children.begin() + i); if (cleanup) { GameControl::GetSingleton()->AddNodeToDelete(ch); } ch->parent = NULL; ch->OnParentChange(NULL); OnChildRemove(ch); } } }
/* ===================== GameNode::RemoveAllChildren ===================== */ void GameNode::RemoveAllChildren(bool cleanup) { // Delete all if required for (unsigned i=0; i<children.size(); i++) { if (cleanup) { GameControl::GetSingleton()->AddNodeToDelete(children[i]); } children[i]->parent = NULL; children[i]->OnParentChange(NULL); OnChildRemove(children[i]); } // THEN clear the array children.clear(); }
InputTypeButton::~InputTypeButton() { // Call OnChildRemove(); in case our element is still attached to a document, this will detach // our listeners. OnChildRemove(); }