MultiLanguage.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // MultiLanguage.h: interface for the CMultiLanguage class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_MULTILANGUAGE_H__DA57BA64_C421_4368_9498_1EFCE49A5C52__INCLUDED_)
  5. #define AFX_MULTILANGUAGE_H__DA57BA64_C421_4368_9498_1EFCE49A5C52__INCLUDED_
  6. #include "tinyxml\Tinyxml.h"
  7. #include "tinyxml\tinystr.h"
  8. #if _MSC_VER > 1000
  9. #pragma once
  10. #endif // _MSC_VER > 1000
  11. class CLangItem
  12. {
  13. public:
  14. CLangItem()
  15. {
  16. m_nID = -1;
  17. m_csEnglishLang = "";
  18. m_csForeignLang = "";
  19. m_csID = "";
  20. }
  21. int m_nID;
  22. CString m_csID;
  23. CString m_csEnglishLang;
  24. CString m_csForeignLang;
  25. };
  26. typedef CArray<CLangItem*, CLangItem*> LANGUAGE_ARRAY;
  27. typedef CMap<CString, LPCTSTR, CLangItem*, CLangItem*> LANGUAGE_MAP;
  28. class CMultiLanguage
  29. {
  30. public:
  31. CMultiLanguage();
  32. virtual ~CMultiLanguage();
  33. bool LoadLanguageFile(CString csFile);
  34. bool UpdateRightClickMenu(CMenu *pMenu);
  35. bool UpdateTrayIconRightClickMenu(CMenu *pMenu);
  36. bool UpdateClipProperties(CWnd *pParent);
  37. bool UpdateOptionGeneral(CWnd *pParent);
  38. bool UpdateOptionSupportedTypes(CWnd *pParent);
  39. bool UpdateOptionShortcuts(CWnd *pParent);
  40. bool UpdateOptionQuickPaste(CWnd *pParent);
  41. bool UpdateOptionFriends(CWnd *pParent);
  42. bool UpdateOptionFriendsDetail(CWnd *pParent);
  43. bool UpdateOptionStats(CWnd *pParent);
  44. bool UpdateOptionSupportedTypesAdd(CWnd *pParent);
  45. bool UpdateMoveToGroups(CWnd *pParent);
  46. bool UpdateOptionsSheet(CWnd *pParent);
  47. bool UpdateOptionCopyBuffers(CWnd *pParent);
  48. bool UpdateGlobalHotKeys(CWnd *pParent);
  49. CString GetGlobalHotKeyString(CString csID, CString csDefault);
  50. CString GetString(CString csID, CString csDefault);
  51. CString GetAuthor() { return m_csAuthor; }
  52. long GetVersion(){ return m_lFileVersion; }
  53. CString GetNotes() { return m_csNotes; }
  54. CString GetLangCode() { return m_csLangCode; }
  55. void SetOnlyGetHeader(bool bVal) { m_bOnlyGetHeader = true; }
  56. static CMenu* GetMenuPos(CMenu *pMenu, const CString &csLookingForMenuText, int &nMenuPos);
  57. CString m_csLastError;
  58. protected:
  59. LANGUAGE_ARRAY m_RightClickMenu;
  60. LANGUAGE_ARRAY m_TrayIconRightClickMenu;
  61. LANGUAGE_ARRAY m_ClipProperties;
  62. LANGUAGE_ARRAY m_OptionsGeneral;
  63. LANGUAGE_ARRAY m_OptionsSupportedTypes;
  64. LANGUAGE_ARRAY m_OptionsShortcuts;
  65. LANGUAGE_ARRAY m_OptionsQuickPaste;
  66. LANGUAGE_ARRAY m_OptionsFriends;
  67. LANGUAGE_ARRAY m_OptionsFriendsDetail;
  68. LANGUAGE_ARRAY m_OptionsStats;
  69. LANGUAGE_ARRAY m_OptionsSupportedTypesAdd;
  70. LANGUAGE_ARRAY m_MoveToGroups;
  71. LANGUAGE_ARRAY m_OptionsSheet;
  72. LANGUAGE_ARRAY m_OptionsCopyBuffers;
  73. LANGUAGE_ARRAY m_GlobalHotKeys;
  74. LANGUAGE_MAP m_StringMap;
  75. CString m_csAuthor;
  76. CString m_csNotes;
  77. long m_lFileVersion;
  78. CString m_csLangCode;
  79. bool m_bOnlyGetHeader;
  80. protected:
  81. bool LoadSection(TiXmlNode &doc, LANGUAGE_ARRAY &Array, CString csSection);
  82. bool LoadStringTableSection(TiXmlNode &doc, LANGUAGE_MAP &Map, CString csSection);
  83. bool UpdateMenuToLanguage(CMenu *pMenu, LANGUAGE_ARRAY &Array);
  84. bool UpdateWindowToLanguage(CWnd *pParent, LANGUAGE_ARRAY &Array);
  85. void ClearArrays();
  86. void ClearArray(LANGUAGE_ARRAY &Array);
  87. void ClearMap(LANGUAGE_MAP &Map);
  88. };
  89. #endif // !defined(AFX_MULTILANGUAGE_H__DA57BA64_C421_4368_9498_1EFCE49A5C52__INCLUDED_)