bool NFrameBase::AddChild(NFrameBase* child) { NAssertError(child != NULL, _T("wrong type")); if(child == NULL) return FALSE; // check if exists size_t zorder; NAssertError(GetChildHelper(child, zorder) == childs_.end(), _T("child already exists")); if(GetChildHelper(child, zorder) != childs_.end()) return true; childs_.push_back(child); SetParentHelper(child, this); return true; }
bool NFrameBase::RemoveChild(NFrameBase* child) { NAssertError(child != NULL, _T("wrong type")); if(child == NULL) return FALSE; size_t zorder; FrameList::const_iterator ite = GetChildHelper(child, zorder); if(ite == childs_.end()) return false; if(zorder < topMostCount_) -- topMostCount_; if(zorder >= childs_.size() - bottomMostCount_) -- bottomMostCount_; childs_.erase(ite); SetParentHelper(child, NULL); return true; }
bool NFrameBase::AddChild(NFrameBase* child) { NAssertError(child != NULL, _T("wrong type")); if(child == NULL) return FALSE; // check if exists size_t zorder; NAssertError(GetChildHelper(child, zorder) == childs_.end(), _T("child already exists")); FrameList::const_iterator ite = GetChildHelper(child, zorder); for(int i=topMostCount_; i>0; --i) { -- ite; } childs_.insert(ite, child); SetParentHelper(child, this); return true; }