Beispiel #1
0
Control* Container::getById(const std::string& id) {
	// Enumerate all child controls to see if we can find the control.
	ControlVector childControls = getChildControls();
	ControlVector::iterator control = childControls.begin();
	for(;control != childControls.end();++control) {
		if(!control->valid()) {
			continue;
		}
		if((*control)->getId() == id) {
			return control->get();
		}
		
		// If the child control is a container of new controls we
		// need to check those child controls also.
		Container* childContainer = dynamic_cast<Container*>(control->get());
		if(childContainer != NULL) {
			// Yes. The child control is a container. Check if the control is found
			// there.
			Control* childControl = childContainer->getById(id);
			if(childControl != NULL) {
				// Yes the child control is found. Lets return it to the 
				// caller.
				return childControl;
			}
		}
	}
	// No control is found. 
	return NULL;
}
void geTextureDlgInfoWindow::onDraw()
{
	std::vector<geGUIBase*>* childList=getChildControls();
	for(std::vector<geGUIBase*>::iterator it = childList->begin(); it != childList->end(); ++it)
	{
		geGUIBase* tvnode = *it;
		tvnode->draw();
	}
}
void TableControlContainer::performLayout() {
	Container::performLayout();
	
	osg::Group* group = getNode();
	ControlVector childControls = getChildControls();
	ControlVector::iterator childControl = childControls.begin();
	for(;childControl != childControls.end();++childControl) {
		(*childControl)->performLayout();
		group->addChild((*childControl)->getNode());
	}
}
void geTextureDlgMainWindow::onDraw()
{
	std::vector<geGUIBase*>* childList=getChildControls();
	for(std::vector<geGUIBase*>::iterator it = childList->begin(); it != childList->end(); ++it)
	{
		geGUIBase* tvnode = *it;
		tvnode->draw();
		geTextureThumbnail* thumb=(geTextureThumbnail*)tvnode;
        if(thumb->getTexturePtr())
        {
            geFontManager::g_pFontArial10_80Ptr->drawString(gxUtil::getFileNameFromPath(thumb->getTexturePtr()->getTextureName()), tvnode->getPos().x, tvnode->getPos().y+ tvnode->getSize().y +geFontManager::g_pFontArial10_80Ptr->getLineHeight(), m_cSize.x);
        }
		if(tvnode->getPos().y>m_cSize.y)
			break;
	}
}