示例#1
0
 HCURSOR SResProviderMgr::LoadCursor( LPCTSTR pszResName ,BOOL bFromFile /*= FALSE*/)
 {
     SAutoLock lock(m_cs);
     if(IS_INTRESOURCE(pszResName))
         return ::LoadCursor(NULL, pszResName);
     else 
     {
         LPCTSTR pszCursorID=SysCursorName2ID(pszResName);
         if(pszCursorID)
             return ::LoadCursor(NULL, pszCursorID);
     }
     const CURSORMAP::CPair * pPair  = m_mapCachedCursor.Lookup(pszResName);
     if(pPair) return pPair->m_value;
     
     HCURSOR hRet = NULL;
     if(bFromFile)
     {
         hRet = SResLoadFromFile::LoadCursor(pszResName);
     }else
     {
         IResProvider *pResProvider=GetMatchResProvider(KTypeCursor,pszResName);
         if(pResProvider)
             hRet =pResProvider->LoadCursor(pszResName);
     }
     if(hRet)
     {
         m_mapCachedCursor[pszResName]=hRet;
     }
     return hRet;
 }
示例#2
0
文件: SApp.cpp 项目: FuckGOV/soui
BOOL SApplication::_LoadXmlDocment( LPCTSTR pszXmlName ,LPCTSTR pszType ,pugi::xml_document & xmlDoc,IResProvider *pResProvider/* = NULL*/)
{
    if(!pResProvider) 
    {
        if(IsFileType(pszType))
        {
            pugi::xml_parse_result result= xmlDoc.load_file(pszXmlName,pugi::parse_default,pugi::encoding_utf8);
            SASSERT_FMTW(result,L"parse xml error! xmlName=%s,desc=%s,offset=%d",pszXmlName,result.description(),result.offset);
            return result;
        }else
        {
            pResProvider = GetMatchResProvider(pszType,pszXmlName);
        }
    }
    if(!pResProvider) return FALSE;
    
    DWORD dwSize=pResProvider->GetRawBufferSize(pszType,pszXmlName);
    if(dwSize==0) return FALSE;

    CMyBuffer<char> strXml;
    strXml.Allocate(dwSize);
    pResProvider->GetRawBuffer(pszType,pszXmlName,strXml,dwSize);

    pugi::xml_parse_result result= xmlDoc.load_buffer(strXml,strXml.size(),pugi::parse_default,pugi::encoding_utf8);
    SASSERT_FMTW(result,L"parse xml error! xmlName=%s,desc=%s,offset=%d",pszXmlName,result.description(),result.offset);
    return result;
}
示例#3
0
 BOOL SResProviderMgr::HasResource( LPCTSTR pszType,LPCTSTR pszResName )
 {
     SAutoLock lock(m_cs);
     if(IsFileType(pszType))
     {
         return ::GetFileAttributes(pszResName) != INVALID_FILE_ATTRIBUTES;
     }else
     {
         return NULL != GetMatchResProvider(pszType,pszResName);
     }
 }
示例#4
0
 BOOL SResProviderMgr::GetRawBuffer( LPCTSTR strType,LPCTSTR pszResName,LPVOID pBuf,size_t size )
 {
     SAutoLock lock(m_cs);
     if(IsFileType(strType))
     {
         return SResLoadFromFile::GetRawBuffer(pszResName,pBuf,size);
     }else
     {
         IResProvider *pResProvider=GetMatchResProvider(strType,pszResName);
         if(!pResProvider) return FALSE;
         return pResProvider->GetRawBuffer(strType,pszResName,pBuf,size);
     }
 }
示例#5
0
 HICON SResProviderMgr::LoadIcon( LPCTSTR pszResName,int cx/*=0*/,int cy/*=0*/ ,BOOL bFromFile /*= FALSE*/)
 {
     SAutoLock lock(m_cs);
     if(bFromFile)
     {
         return SResLoadFromFile::LoadIcon(pszResName,cx,cy);
     }else
     {
         IResProvider *pResProvider=GetMatchResProvider(KTypeIcon,pszResName);
         if(!pResProvider) return NULL;
         return pResProvider->LoadIcon(pszResName,cx,cy);
     }
 }
示例#6
0
 HBITMAP SResProviderMgr::LoadBitmap( LPCTSTR pszResName ,BOOL bFromFile /*= FALSE*/)
 {
     SAutoLock lock(m_cs);
     if(bFromFile)
     {
         return SResLoadFromFile::LoadBitmap(pszResName);
     }else
     {
         IResProvider *pResProvider=GetMatchResProvider(KTypeBitmap,pszResName);
         if(!pResProvider) return NULL;
         return pResProvider->LoadBitmap(pszResName);
     }
 }
示例#7
0
 IImgX * SResProviderMgr::LoadImgX( LPCTSTR strType,LPCTSTR pszResName )
 {
     SAutoLock lock(m_cs);
     if(IsFileType(strType))
     {
         return SResLoadFromFile::LoadImgX(pszResName);
     }else
     {
         IResProvider *pResProvider=GetMatchResProvider(strType,pszResName);
         if(!pResProvider) return NULL;
         return pResProvider->LoadImgX(strType,pszResName);
     }
 }
示例#8
0
 IBitmap * SResProviderMgr::LoadImage( LPCTSTR pszType,LPCTSTR pszResName )
 {
     if(!pszType) return NULL;
     SAutoLock lock(m_cs);
     if(IsFileType(pszType))
     {
         return SResLoadFromFile::LoadImage(pszResName);
     }else
     {
         IResProvider *pResProvider=GetMatchResProvider(pszType,pszResName);
         if(!pResProvider) return NULL;
         return pResProvider->LoadImage(pszType,pszResName);
     }
 }