コード例 #1
0
ファイル: UIView.cpp プロジェクト: YurieCo/Nephilim
void UIView::applyPendingOperations()
{
	if(m_childrenLock > 0) return ;

	for(std::size_t i = 0; i < m_pendingOperations.size(); ++i)
	{
		switch(m_pendingOperations[i].type)
		{
		case UIControlOperation::Attachment:
			{
				m_children.push_back(m_pendingOperations[i].control);
			} break;

		case UIControlOperation::Destruction:
			{
				m_children.erase(std::find(m_children.begin(), m_children.end(), m_pendingOperations[i].control));
				onChildRemoved(m_pendingOperations[i].control);
				delete m_pendingOperations[i].control;
			} break;
		
		case UIControlOperation::Detachment:
			{
				m_children.erase(std::find(m_children.begin(), m_children.end(), m_pendingOperations[i].control));
				onChildRemoved(m_pendingOperations[i].control);
			} break;

		}
	}

	m_pendingOperations.clear();
}
コード例 #2
0
ファイル: Element.cpp プロジェクト: AjaxWang1989/cegui
//----------------------------------------------------------------------------//
void Element::removeChild(Element* element)
{
    if (!element)
        CEGUI_THROW(
                InvalidRequestException("NULL can't be a child of any Element, "
                                        "it makes little sense to ask for its "
                                        "removal"));

    removeChild_impl(element);
    ElementEventArgs args(element);
    onChildRemoved(args);
}
コード例 #3
0
ファイル: pnode.cpp プロジェクト: alonecat06/FutureInterface
void PNode::removeChild(const pchar *name)
{
    PStringMap<PNode *>::iterator it = m_children.find(const_cast<pchar*>(name));
    if (it != m_children.end())
    {
        m_children.erase(it);

        onChildRemoved(it.value());
    }
    else
    {
        PLOG_ERROR("Failed to find the child %s in node %s", name, m_name.toString().c_str());
    }
}