Exemple #1
0
CRefPtr<IDUIMenu> CDUIMenuBuilder::CreateFromResource(const CDUIString& strTemplateID)
{
	IDUIApp* pDUIApp = DUIGetAppInstance();
	if(pDUIApp == NULL) return NULL;
	
	IDUISkinMgr* pSkinMgr = pDUIApp->GetSkinMgr();
	if(pSkinMgr == NULL) return NULL;
	
	CDUIString strXML;
	if(!pSkinMgr->GetMenuTemplate(strTemplateID, strXML))
	{
		DUI_ASSERT(FALSE);
		return FALSE;
	}
	
	return CreateFromXML(strXML);
}
void CreateFromXMLFile( SPointer< IFile > fileInput )
{
    std::string ln,data;
    IFileStream desc_file( fileInput );

    while ( std::getline( desc_file, ln ) )
    {
        data += ln;
        data += "\n";
    }

    std::string name = fileInput->GetName();
    if ( ':' != name[1] )
    {
        char buffer[255] = {0,};
        memset( buffer, 0, 255);
        getcwd( buffer, 255);
        std::string cdir( buffer );
        name = cdir + "/" + name;
    }
    CreateFromXML( data, name );
}