Пример #1
0
Widget* Container::findChild(const char* childName)
	{
	/* Traverse all children in the container until the first name matches: */
	Widget* child;
	for(child=getFirstChild();child!=0&&strcmp(child->getName(),childName)!=0;child=getNextChild(child))
		;
	return child;
	}
Пример #2
0
LLXmlTreeNode*	LLXmlTreeNode::getFirstChild()
{
	mChildListIter = mChildList.begin();
	return getNextChild();
}
Пример #3
0
Widget* Container::findDescendant(const char* descendantPath)
	{
	/* Find the next forward slash in the descendant path: */
	const char* slashPtr;
	for(slashPtr=descendantPath;*slashPtr!='\0'&&*slashPtr!='/';++slashPtr)
		;
	
	/* Traverse all children in the container until the first name matches: */
	Widget* child;
	for(child=getFirstChild();child!=0&&!strsegequal(descendantPath,slashPtr,child->getName());child=getNextChild(child))
		;
	
	/* Check if there is another path segment: */
	if(*slashPtr=='/')
		{
		/* Check if the found child is a container: */
		Container* container=dynamic_cast<Container*>(child);
		if(container!=0)
			{
			/* Search the found container: */
			return container->findDescendant(slashPtr+1);
			}
		else
			{
			Misc::throwStdErr("GLMotif::Container::findDescendant: Path component not found");
			return 0; // Just to make compiler happy
			}
		}
	else
		return child;
	}