当前位置: 首页>>代码示例>>C++>>正文


C++ CTreeNode类代码示例

本文整理汇总了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;
}
开发者ID:5dollartools,项目名称:CFGHelper,代码行数:28,代码来源:TreeBuilder.cpp

示例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;
}
开发者ID:mattcawley,项目名称:mnews,代码行数:25,代码来源:TreeWnd.cpp

示例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;
}
开发者ID:BSVino,项目名称:SMAK,代码行数:31,代码来源:tree.cpp

示例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;
}
开发者ID:BSVino,项目名称:SMAK,代码行数:34,代码来源:tree.cpp

示例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();
	}
}
开发者ID:jokerlee,项目名称:college,代码行数:25,代码来源:SoliDire.cpp

示例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;
}
开发者ID:mattcawley,项目名称:mnews,代码行数:33,代码来源:TreeWnd.cpp

示例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++;
		}
	}
}
开发者ID:mattcawley,项目名称:mnews,代码行数:27,代码来源:TreeWnd.cpp

示例8: GetParentNode

unsigned int CTreeNode::GetDepth() const
{
	CTreeNode * parent = GetParentNode();
	if (parent)
		return parent->GetDepth() + 1;
	return 0;
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:7,代码来源:TreeNode.cpp

示例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;
}
开发者ID:5dollartools,项目名称:CFGHelper,代码行数:8,代码来源:TreeBuilder.cpp

示例10: NodeFind

string CTreeBuilder::GetAsString(string sSectionPath, string sDefaultValue)
{
	string sNodeValue = sDefaultValue; 
	CTreeNode* pCurrentNode = NodeFind(sSectionPath); 
	if ( pCurrentNode!= NULL)
	{
		sNodeValue = pCurrentNode->GetNodeValue(); 
	}
	return sNodeValue;
}
开发者ID:5dollartools,项目名称:CFGHelper,代码行数:10,代码来源:TreeBuilder.cpp

示例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;
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:11,代码来源:TreeNode.cpp

示例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;
}
开发者ID:BSVino,项目名称:SMAK,代码行数:13,代码来源:tree.cpp

示例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;
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:13,代码来源:TreeNode.cpp

示例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;
}
开发者ID:mattcawley,项目名称:mnews,代码行数:15,代码来源:TreeWnd.cpp

示例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;
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:15,代码来源:TreeNode.cpp


注:本文中的CTreeNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。