本文整理汇总了C++中NodePtr::connectDisplay方法的典型用法代码示例。如果您正苦于以下问题:C++ NodePtr::connectDisplay方法的具体用法?C++ NodePtr::connectDisplay怎么用?C++ NodePtr::connectDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodePtr
的用法示例。
在下文中一共展示了NodePtr::connectDisplay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertChild
void DivNode::insertChild(NodePtr pChild, unsigned i)
{
if (!pChild) {
throw Exception(AVG_ERR_NO_NODE,
getID()+"::insertChild called without a node.");
}
if (pChild->getState() == NS_CONNECTED || pChild->getState() == NS_CANRENDER) {
throw(Exception(AVG_ERR_ALREADY_CONNECTED,
"Can't connect node with id "+pChild->getID()+
": already connected."));
}
if (getState() == NS_CONNECTED || getState() == NS_CANRENDER) {
getCanvas()->registerNode(pChild);
}
DivNodePtr ptr = dynamic_pointer_cast<DivNode>(shared_from_this());
pChild->checkSetParentError(ptr);
if (!isChildTypeAllowed(pChild->getTypeStr())) {
throw(Exception(AVG_ERR_ALREADY_CONNECTED,
"Can't insert a node of type "+pChild->getTypeStr()+
" into a node of type "+getTypeStr()+"."));
}
if (i > m_Children.size()) {
throw(Exception(AVG_ERR_OUT_OF_RANGE,
pChild->getID()+"::insertChild: index out of bounds."));
}
std::vector<NodePtr>::iterator pos = m_Children.begin()+i;
m_Children.insert(pos, pChild);
try {
pChild->setParent(ptr, getState(), getCanvas());
} catch (Exception&) {
m_Children.erase(m_Children.begin()+i);
throw;
}
if (getState() == NS_CANRENDER) {
pChild->connectDisplay();
}
}