UIResourceManager.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef __UIRESOURCEMANAGER_H__
  2. #define __UIRESOURCEMANAGER_H__
  3. #pragma once
  4. namespace DuiLib {
  5. // ¿Ø¼þÎÄ×Ö²éѯ½Ó¿Ú
  6. class UILIB_API IQueryControlText
  7. {
  8. public:
  9. virtual LPCTSTR QueryControlText(LPCTSTR lpstrId, LPCTSTR lpstrType) = 0;
  10. };
  11. class UILIB_API CResourceManager
  12. {
  13. private:
  14. CResourceManager(void);
  15. ~CResourceManager(void);
  16. public:
  17. static CResourceManager* GetInstance()
  18. {
  19. static CResourceManager * p = new CResourceManager;
  20. return p;
  21. };
  22. void Release(void) { delete this; }
  23. public:
  24. BOOL LoadResource(STRINGorID xml, LPCTSTR type = NULL);
  25. BOOL LoadResource(CMarkupNode Root);
  26. void ResetResourceMap();
  27. LPCTSTR GetImagePath(LPCTSTR lpstrId);
  28. LPCTSTR GetXmlPath(LPCTSTR lpstrId);
  29. public:
  30. void SetLanguage(LPCTSTR pstrLanguage) { m_sLauguage = pstrLanguage; }
  31. LPCTSTR GetLanguage() { return m_sLauguage; }
  32. BOOL LoadLanguage(LPCTSTR pstrXml);
  33. public:
  34. void SetTextQueryInterface(IQueryControlText* pInterface) { m_pQuerypInterface = pInterface; }
  35. CDuiString GetText(LPCTSTR lpstrId, LPCTSTR lpstrType = NULL);
  36. void ReloadText();
  37. void ResetTextMap();
  38. private:
  39. CStdStringPtrMap m_mTextResourceHashMap;
  40. IQueryControlText* m_pQuerypInterface;
  41. CStdStringPtrMap m_mImageHashMap;
  42. CStdStringPtrMap m_mXmlHashMap;
  43. CMarkup m_xml;
  44. CDuiString m_sLauguage;
  45. CStdStringPtrMap m_mTextHashMap;
  46. };
  47. } // namespace DuiLib
  48. #endif // __UIRESOURCEMANAGER_H__