Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
5.6 KiB

  1. /*****************************************************************************\
  2. FILE: ThemeFile.h
  3. DESCRIPTION:
  4. This is the Autmation Object to theme scheme object.
  5. BryanSt 4/3/2000 (Bryan Starbuck)
  6. Copyright (C) Microsoft Corp 2000-2000. All rights reserved.
  7. \*****************************************************************************/
  8. #ifndef _FILE_H_THEMEFILE
  9. #define _FILE_H_THEMEFILE
  10. #include <atlbase.h>
  11. #define THEMESETTING_NORMAL 0x00000000
  12. #define THEMESETTING_LOADINDIRECT 0x00000001
  13. #define SIZE_CURSOR_ARRAY 15
  14. #define SIZE_SOUNDS_ARRAY 30
  15. typedef struct
  16. {
  17. LPCTSTR pszRegKey;
  18. UINT nResourceID;
  19. } THEME_FALLBACK_VALUES;
  20. extern LPCTSTR s_pszCursorArray[SIZE_CURSOR_ARRAY];
  21. extern THEME_FALLBACK_VALUES s_ThemeSoundsValues[SIZE_SOUNDS_ARRAY];
  22. HRESULT CThemeFile_CreateInstance(IN LPCWSTR pszThemeFile, OUT ITheme ** ppTheme);
  23. class CThemeFile : public CImpIDispatch
  24. , public CObjectWithSite
  25. , public ITheme
  26. , public IPropertyBag
  27. {
  28. public:
  29. //////////////////////////////////////////////////////
  30. // Public Interfaces
  31. //////////////////////////////////////////////////////
  32. // *** IUnknown ***
  33. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  34. virtual STDMETHODIMP_(ULONG) AddRef(void);
  35. virtual STDMETHODIMP_(ULONG) Release(void);
  36. // *** IPropertyBag ***
  37. virtual STDMETHODIMP Read(IN LPCOLESTR pszPropName, IN VARIANT * pVar, IN IErrorLog *pErrorLog);
  38. virtual STDMETHODIMP Write(IN LPCOLESTR pszPropName, IN VARIANT *pVar);
  39. // *** ITheme ***
  40. virtual STDMETHODIMP get_DisplayName(OUT BSTR * pbstrDisplayName);
  41. virtual STDMETHODIMP put_DisplayName(IN BSTR bstrDisplayName);
  42. virtual STDMETHODIMP get_Background(OUT BSTR * pbstrPath);
  43. virtual STDMETHODIMP put_Background(IN BSTR bstrPath);
  44. virtual STDMETHODIMP get_BackgroundTile(OUT enumBkgdTile * pnTile);
  45. virtual STDMETHODIMP put_BackgroundTile(IN enumBkgdTile nTile);
  46. virtual STDMETHODIMP get_ScreenSaver(OUT BSTR * pbstrPath);
  47. virtual STDMETHODIMP put_ScreenSaver(IN BSTR bstrPath);
  48. virtual STDMETHODIMP get_VisualStyle(OUT BSTR * pbstrPath);
  49. virtual STDMETHODIMP put_VisualStyle(IN BSTR bstrPath);
  50. virtual STDMETHODIMP get_VisualStyleColor(OUT BSTR * pbstrPath);
  51. virtual STDMETHODIMP put_VisualStyleColor(IN BSTR bstrPath);
  52. virtual STDMETHODIMP get_VisualStyleSize(OUT BSTR * pbstrPath);
  53. virtual STDMETHODIMP put_VisualStyleSize(IN BSTR bstrPath);
  54. virtual STDMETHODIMP GetPath(IN VARIANT_BOOL fExpand, OUT BSTR * pbstrPath);
  55. virtual STDMETHODIMP SetPath(IN BSTR bstrPath);
  56. virtual STDMETHODIMP GetCursor(IN BSTR bstrCursor, OUT BSTR * pbstrPath);
  57. virtual STDMETHODIMP SetCursor(IN BSTR bstrCursor, IN BSTR bstrPath);
  58. virtual STDMETHODIMP GetSound(IN BSTR bstrSoundName, OUT BSTR * pbstrPath);
  59. virtual STDMETHODIMP SetSound(IN BSTR bstrSoundName, IN BSTR bstrPath);
  60. virtual STDMETHODIMP GetIcon(IN BSTR bstrIconName, OUT BSTR * pbstrIconPath);
  61. virtual STDMETHODIMP SetIcon(IN BSTR bstrIconName, IN BSTR bstrIconPath);
  62. // *** IDispatch ***
  63. virtual STDMETHODIMP GetTypeInfoCount(UINT *pctinfo) { return CImpIDispatch::GetTypeInfoCount(pctinfo); }
  64. virtual STDMETHODIMP GetTypeInfo(UINT itinfo,LCID lcid,ITypeInfo **pptinfo) { return CImpIDispatch::GetTypeInfo(itinfo, lcid, pptinfo); }
  65. virtual STDMETHODIMP GetIDsOfNames(REFIID riid,OLECHAR **rgszNames,UINT cNames, LCID lcid, DISPID * rgdispid) { return CImpIDispatch::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); }
  66. virtual STDMETHODIMP Invoke(DISPID dispidMember,REFIID riid,LCID lcid,WORD wFlags, DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,UINT * puArgErr) { return CImpIDispatch::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); }
  67. private:
  68. CThemeFile(LPCTSTR pszThemeFile);
  69. virtual ~CThemeFile(void);
  70. // Private Member Variables
  71. long m_cRef;
  72. LPTSTR m_pszThemeFile;
  73. DWORD m_dwCachedState; // Have we cached the state yet?
  74. SYSTEMMETRICSALL m_systemMetrics; // This is the system metrics attributes in the file
  75. // Private Member Functions
  76. HRESULT _getThemeSetting(IN LPCWSTR pszIniSection, IN LPCWSTR pszIniKey, DWORD dwFlags, OUT BSTR * pbstrPath);
  77. HRESULT _putThemeSetting(IN LPCWSTR pszIniSection, IN LPCWSTR pszIniKey, BOOL fUTF7, IN LPWSTR pszPath);
  78. HRESULT _getIntSetting(IN LPCWSTR pszIniSection, IN LPCWSTR pszIniKey, int nDefault, OUT int * pnValue);
  79. HRESULT _putIntSetting(IN LPCWSTR pszIniSection, IN LPCWSTR pszIniKey, IN int nValue);
  80. HRESULT _LoadLiveSettings(int * pnDPI); // Load the settings in memory
  81. HRESULT _LoadSettings(void); // Load the settings in the .theme file.
  82. HRESULT _ApplyThemeSettings(void);
  83. HRESULT _ApplySounds(void);
  84. HRESULT _ApplyCursors(void);
  85. HRESULT _ApplyWebview(void);
  86. HRESULT _GetSound(LPCWSTR pszSoundName, OUT BSTR * pbstrPath);
  87. HRESULT _SaveSystemMetrics(SYSTEMMETRICSALL * pSystemMetrics);
  88. HRESULT _LoadCustomFonts(void);
  89. HRESULT _GetCustomFont(LPCTSTR pszFontName, LOGFONT * pLogFont);
  90. HRESULT _getThemeSetting(IN LPCWSTR pszIniSection, IN LPCWSTR pszIniKey, OUT BSTR * pbstrPath);
  91. BOOL _IsFiltered(IN DWORD dwFilter);
  92. BOOL _IsCached(IN BOOL fLoading);
  93. // Friend Functions
  94. friend HRESULT CThemeFile_CreateInstance(IN LPCWSTR pszThemeFile, OUT ITheme ** ppTheme);
  95. };
  96. #endif // _FILE_H_THEMEFILE