예제 #1
0
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;
}
예제 #2
0
//  CTreeNode Helper Functions  ---
CTreeNode * Locate(const CModuleHelper & modHelper, CTreeNode * root, unsigned int depth)
{
	if (depth >= modHelper.GetQualifiedDepth())
		return false;

	root->Expand();
	for (WTL::CTreeItem itr = root->GetChild(); itr != NULL; itr = itr.GetNextSibling())
	{
		CString text;
		itr.GetText(text);
		if (_tcsicmp(modHelper.GetQualifiedLabel(depth), text) == 0)
		{
			if (depth == modHelper.GetQualifiedDepth() - 1)
			{
				return reinterpret_cast<CTreeNode *>(itr.GetData());
			}
			return Locate(modHelper, reinterpret_cast<CTreeNode *>(itr.GetData()), depth + 1);
		}
	}
	return NULL;
}