本文整理汇总了C++中CTreeNode类的典型用法代码示例。如果您正苦于以下问题:C++ CTreeNode类的具体用法?C++ CTreeNode怎么用?C++ CTreeNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TraverseTree
CTreeNode* CTreeBuilder::TraverseTree(CTreeNode* parent, string nodePath, CTreeNode* pTempNode)
{
CTreeNode* n = NULL;
if (parent != NULL)
{
if ( parent->GetParent() == NULL && parent->GetNodePath() == nodePath)
{
pTempNode = parent;
}
else if(!parent->IsLeaf())
{
for (n = parent->GetChild(); n != NULL; n = n->GetSibling())
{
if(nodePath==n->GetNodePath())
{
pTempNode=n;
return n;
}
if (pTempNode==NULL && ! n->IsLeaf())
{
pTempNode=TraverseTree(n, nodePath,pTempNode);
}
}
}
}
return pTempNode; //parent;
}
示例2: CTreeNode
CTreeNode* CTreeWnd::AddNode(LPCTSTR name,CTreeNode* pParent,short it /* = itDefault */)
{
if (!m_pTree)
return NULL;
mtNode* mtParent = pParent ? pParent->getmtNode() : NULL;
mtNode* pNode = m_pTree->newItem(name,mtParent);
if (pNode)
{
CTreeNode* pTreeNode = new CTreeNode();
pTreeNode->setTree(this);
pNode->setData((unsigned long)pTreeNode);
pTreeNode->setmtNode(pNode);
pTreeNode->setIconType( it );
//ForceLayout();
//Invalidate();
return pTreeNode;
}
else
return NULL;
}
示例3: MouseDoubleClicked
bool CTree::MouseDoubleClicked(int code, int mx, int my)
{
if (CPanel::MouseDoubleClicked(code, mx, my))
return true;
m_iSelected = ~0;
for (size_t i = 0; i < m_ahAllNodes.size(); i++)
{
CBaseControl* pNode = m_ahAllNodes[i];
if (!pNode->IsVisible())
continue;
float x, y, w, h;
pNode->GetAbsDimensions(x, y, w, h);
if (mx >= x && my >= y && mx < x+w && my < y+h)
{
m_iSelected = i;
CTreeNode* pTreeNode = dynamic_cast<CTreeNode*>(pNode);
pTreeNode->Selected();
if (m_pfnConfirmedCallback)
m_pfnConfirmedCallback(m_pConfirmedListener, sprintf("%d", GetSelectedNodeId()));
return true;
}
}
return false;
}
示例4: MousePressed
bool CTree::MousePressed(int code, int mx, int my)
{
m_bMouseDown = true;
m_iMouseDownX = mx;
m_iMouseDownY = my;
if (CPanel::MousePressed(code, mx, my))
return true;
m_iSelected = ~0;
for (size_t i = 0; i < m_ahAllNodes.size(); i++)
{
CBaseControl* pNode = m_ahAllNodes[i];
if (!pNode->IsVisible())
continue;
float x, y, w, h;
pNode->GetAbsDimensions(x, y, w, h);
if (mx >= x && my >= y && mx < x+w && my < y+h)
{
m_iSelected = i;
CTreeNode* pTreeNode = dynamic_cast<CTreeNode*>(pNode);
pTreeNode->Selected();
return true;
}
}
if (m_pSelectedListener)
m_pfnSelectedCallback(m_pSelectedListener, "-1");
return false;
}
示例5: f
void CSoliDire::insert_file(CString filename)
{
CFile f(filename, CFile::modeRead);
if (f)
{
CInode tmp(f.GetFilePath(), 0, f.GetLength());
if (!m_DirTree->m_pRoot)
{
m_DirTree->m_pRoot = new CTreeNode;
m_DirTree->m_pRoot->set_inode(tmp);
}
else
{
CTreeNode * p = m_DirTree->m_pRoot;
while (p->has_rchild())
p = p->get_rchild();
p->new_rchild(tmp);
}
SetModifiedFlag(TRUE);
f.Close();
}
}
示例6: if
long CTreeWnd::GetScrollExtent(int nBar)
{
int extent = 0;
if (nBar == SB_HORZ)
{
for (int i = 0; i < m_pHeader->GetNumPanes(); i++)
{
extent += m_pHeader->GetPaneWidth(i);
}
}
else if (nBar == SB_VERT)
{
// vertical scroll size is total height of all expanded nodes...
CTreeNode* pNode = GetRootNode();
if (pNode && (!(m_style & MTS_SHOWROOT)))
pNode = pNode->FirstChild();
bool done = false;
while (pNode && !done)
{
//extent += DEF_NODE_HEIGHT;
extent++;
CTreeNode* pNext = pNode->NextNode();
if (pNext == pNode)
done = true;
else
pNode = pNext;
}
}
return extent;
}
示例7: GetScrollPos32
void CTreeWnd::SetFirstVisibleNode()
{
m_firstVisibleIdx = 0;
int index = GetScrollPos32(SB_VERT);
CTreeNode* pNode = GetRootNode();
if (!pNode)
return;
if (!(m_style & MTS_SHOWROOT))
pNode = pNode->FirstChild();
m_firstVisible = pNode;
int pos = 0;
while (pNode && pos < index)
{
pos ++;//= DEF_NODE_HEIGHT;
pNode = pNode->NextNode();
if (pNode)
{
m_firstVisible = pNode;
m_firstVisibleIdx++;
}
}
}
示例8: GetParentNode
unsigned int CTreeNode::GetDepth() const
{
CTreeNode * parent = GetParentNode();
if (parent)
return parent->GetDepth() + 1;
return 0;
}
示例9: CTreeNode
CTreeNode* CTreeBuilder::BuildNode(NodeDetails nodeDetails)
{
CTreeNode* tempNode = new CTreeNode();
tempNode->SetNodeName(nodeDetails.name);
tempNode->SetNodeValue(nodeDetails.value);
tempNode->SetType(nodeDetails.type);
return tempNode;
}
示例10: NodeFind
string CTreeBuilder::GetAsString(string sSectionPath, string sDefaultValue)
{
string sNodeValue = sDefaultValue;
CTreeNode* pCurrentNode = NodeFind(sSectionPath);
if ( pCurrentNode!= NULL)
{
sNodeValue = pCurrentNode->GetNodeValue();
}
return sNodeValue;
}
示例11: RefreshChildren
bool RefreshChildren(const std::_tstring & qualifiedLabel, CTreeNode * startingNode)
{
CTreeNode * found = Locate(qualifiedLabel, startingNode, 0);
if (found)
{
found->Expand(TVE_COLLAPSE | TVE_COLLAPSERESET);
found->Expand();
return true;
}
return false;
}
示例12: AddControl
CControlHandle CTree::AddControl(CBaseControl* pControl, bool bToTail)
{
CControlHandle hControl = BaseClass::AddControl(pControl, bToTail);
if (pControl != m_hVerticalScrollBar && pControl != m_hHorizontalScrollBar)
{
CTreeNode* pTreeNode = dynamic_cast<CTreeNode*>(pControl);
if (pTreeNode)
m_ahAllNodes.push_back(CControl<CTreeNode>(pTreeNode->GetHandle()));
}
return hControl;
}
示例13: Select
bool Select(const std::_tstring & qualifiedLabel, CTreeNode * startingNode, bool bExpand)
{
CTreeNode * found = Locate(qualifiedLabel, startingNode, 0);
if (found)
{
found->Select();
if (bExpand)
found->Expand();
found->EnsureVisible();
return true;
}
return false;
}
示例14: NodeFromShape
CTreeNode* CTreeWnd::HitTestExpandBox(CPoint pt)
{
vector<CShape*>::iterator pos;
for (pos = m_shapes.begin(); pos != m_shapes.end(); ++pos)
{
CShape *pShape = *pos;
CTreeNode* pNode = NodeFromShape(pShape);
if (pNode && pNode->HitExpandBox(pt))
{
return pNode;
}
}
return NULL;
}
示例15: GetNodeIndex
int GetNodeIndex(CTreeNode *node)
{
int index = 0;
CTreeNode *parent = node->GetParentNode();
if ( parent )
{
for (WTL::CTreeItem ti = parent->GetChild(); ti != NULL; ti = ti.GetNextSibling())
{
if ( ti == *node )
return index;
index++;
}
}
return -1;
}