Leaked source code of windows server 2003
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.

122 lines
5.3 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 CObjectWithSite
  24. , public ITheme
  25. , public IPropertyBag
  26. {
  27. public:
  28. //////////////////////////////////////////////////////
  29. // Public Interfaces
  30. //////////////////////////////////////////////////////
  31. // *** IUnknown ***
  32. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  33. virtual STDMETHODIMP_(ULONG) AddRef(void);
  34. virtual STDMETHODIMP_(ULONG) Release(void);
  35. // *** IPropertyBag ***
  36. virtual STDMETHODIMP Read(IN LPCOLESTR pszPropName, IN VARIANT * pVar, IN IErrorLog *pErrorLog);
  37. virtual STDMETHODIMP Write(IN LPCOLESTR pszPropName, IN VARIANT *pVar);
  38. // *** ITheme ***
  39. virtual STDMETHODIMP get_DisplayName(OUT BSTR * pbstrDisplayName);
  40. virtual STDMETHODIMP put_DisplayName(IN BSTR bstrDisplayName);
  41. virtual STDMETHODIMP get_Background(OUT BSTR * pbstrPath);
  42. virtual STDMETHODIMP put_Background(IN BSTR bstrPath);
  43. virtual STDMETHODIMP get_BackgroundTile(OUT enumBkgdTile * pnTile);
  44. virtual STDMETHODIMP put_BackgroundTile(IN enumBkgdTile nTile);
  45. virtual STDMETHODIMP get_ScreenSaver(OUT BSTR * pbstrPath);
  46. virtual STDMETHODIMP put_ScreenSaver(IN BSTR bstrPath);
  47. virtual STDMETHODIMP get_VisualStyle(OUT BSTR * pbstrPath);
  48. virtual STDMETHODIMP put_VisualStyle(IN BSTR bstrPath);
  49. virtual STDMETHODIMP get_VisualStyleColor(OUT BSTR * pbstrPath);
  50. virtual STDMETHODIMP put_VisualStyleColor(IN BSTR bstrPath);
  51. virtual STDMETHODIMP get_VisualStyleSize(OUT BSTR * pbstrPath);
  52. virtual STDMETHODIMP put_VisualStyleSize(IN BSTR bstrPath);
  53. virtual STDMETHODIMP GetPath(IN VARIANT_BOOL fExpand, OUT BSTR * pbstrPath);
  54. virtual STDMETHODIMP SetPath(IN BSTR bstrPath);
  55. virtual STDMETHODIMP GetCursor(IN BSTR bstrCursor, OUT BSTR * pbstrPath);
  56. virtual STDMETHODIMP SetCursor(IN BSTR bstrCursor, IN BSTR bstrPath);
  57. virtual STDMETHODIMP GetSound(IN BSTR bstrSoundName, OUT BSTR * pbstrPath);
  58. virtual STDMETHODIMP SetSound(IN BSTR bstrSoundName, IN BSTR bstrPath);
  59. virtual STDMETHODIMP GetIcon(IN BSTR bstrIconName, OUT BSTR * pbstrIconPath);
  60. virtual STDMETHODIMP SetIcon(IN BSTR bstrIconName, IN BSTR bstrIconPath);
  61. // *** IDispatch ***
  62. virtual STDMETHODIMP GetTypeInfoCount(UINT *pctinfo) { return E_ACCESSDENIED; }
  63. virtual STDMETHODIMP GetTypeInfo(UINT itinfo,LCID lcid,ITypeInfo **pptinfo) { return E_ACCESSDENIED; }
  64. virtual STDMETHODIMP GetIDsOfNames(REFIID riid,OLECHAR **rgszNames,UINT cNames, LCID lcid, DISPID * rgdispid) { return E_ACCESSDENIED; }
  65. virtual STDMETHODIMP Invoke(DISPID dispidMember,REFIID riid,LCID lcid,WORD wFlags, DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,UINT * puArgErr) { return E_ACCESSDENIED; }
  66. private:
  67. CThemeFile(LPCTSTR pszThemeFile);
  68. virtual ~CThemeFile(void);
  69. // Private Member Variables
  70. long m_cRef;
  71. LPTSTR m_pszThemeFile;
  72. DWORD m_dwCachedState; // Have we cached the state yet?
  73. SYSTEMMETRICSALL m_systemMetrics; // This is the system metrics attributes in the file
  74. // Private Member Functions
  75. HRESULT _getThemeSetting(IN LPCWSTR pszIniSection, IN LPCWSTR pszIniKey, DWORD dwFlags, OUT BSTR * pbstrPath);
  76. HRESULT _putThemeSetting(IN LPCWSTR pszIniSection, IN LPCWSTR pszIniKey, BOOL fUTF7, IN LPWSTR pszPath);
  77. HRESULT _getIntSetting(IN LPCWSTR pszIniSection, IN LPCWSTR pszIniKey, int nDefault, OUT int * pnValue);
  78. HRESULT _LoadLiveSettings(int * pnDPI); // Load the settings in memory
  79. HRESULT _LoadSettings(void); // Load the settings in the .theme file.
  80. HRESULT _ApplyThemeSettings(void);
  81. HRESULT _ApplySounds(void);
  82. HRESULT _ApplyCursors(void);
  83. HRESULT _ApplyWebview(void);
  84. HRESULT _GetSound(LPCWSTR pszSoundName, OUT BSTR * pbstrPath);
  85. HRESULT _SaveSystemMetrics(SYSTEMMETRICSALL * pSystemMetrics);
  86. HRESULT _LoadCustomFonts(void);
  87. HRESULT _GetCustomFont(LPCTSTR pszFontName, LOGFONT * pLogFont);
  88. HRESULT _getThemeSetting(IN LPCWSTR pszIniSection, IN LPCWSTR pszIniKey, OUT BSTR * pbstrPath);
  89. BOOL _IsFiltered(IN DWORD dwFilter);
  90. // Friend Functions
  91. friend HRESULT CThemeFile_CreateInstance(IN LPCWSTR pszThemeFile, OUT ITheme ** ppTheme);
  92. };
  93. #endif // _FILE_H_THEMEFILE