nuiComboBox::~nuiComboBox() { UnparentTree(mpChoicesTree); if (mpChoicesTree) mpChoicesTree->Release(); }
void nuiComboBox::UnparentTree(nuiTreeNode* pTree) { NGL_ASSERT(pTree); pTree->Select(false); pTree->Open(false); nuiWidgetPtr pWidget = pTree->GetElement(); NGL_ASSERT(pWidget); if (pWidget->GetParent() == this) DelChild(pWidget); uint32 count = pTree->GetChildrenCount(); for (uint32 i = 0; i < count; i++) { nuiTreeNode* pNode = dynamic_cast<nuiTreeNode*>(pTree->GetChild(i)); NGL_ASSERT(pNode); UnparentTree(pNode); } }
void nuiPopupMenu::UnparentTree(nuiTreeNode* pTree) { NGL_ASSERT(pTree); nuiWidgetPtr pWidget = pTree->GetElement(); if (pWidget->GetParent() == this) { pTree->Select(false); pTree->Open(false); NGL_ASSERT(pWidget); DelChild(pWidget); } uint32 count = pTree->GetChildrenCount(); for (uint32 i = 0; i < count; i++) { nuiTreeNode* pNode = dynamic_cast<nuiTreeNode*>(pTree->GetChild(i)); NGL_ASSERT(pNode); UnparentTree(pNode); } NGL_ASSERT(mpTree); mPopupTreeSink.DisconnectSource(pTree->Changed); mPopupTreeSink.DisconnectSource(pTree->ChildAdded); mPopupTreeSink.DisconnectSource(pTree->ChildDeleted); }