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.

153 lines
5.6 KiB

  1. /*****************************************************************************\
  2. FILE: ThemePg.h
  3. DESCRIPTION:
  4. This code will display a "Theme" tab in the
  5. "Display Properties" dialog (the base dialog, not the advanced dlg).
  6. BryanSt 3/23/2000 Updated and Converted to C++
  7. Copyright (C) Microsoft Corp 1993-2000. All rights reserved.
  8. \*****************************************************************************/
  9. #ifndef _THEMEPG_H
  10. #define _THEMEPG_H
  11. #include <cowsite.h>
  12. #include "PreviewTh.h"
  13. #include "ThSettingsPg.h"
  14. #define SIZE_ICONS_ARRAY 5
  15. extern LPCWSTR s_Icons[SIZE_ICONS_ARRAY];
  16. enum eThemeType
  17. {
  18. eThemeFile = 0,
  19. eThemeURL,
  20. eThemeModified,
  21. eThemeOther,
  22. };
  23. typedef struct
  24. {
  25. eThemeType type;
  26. union
  27. {
  28. ITheme * pTheme;
  29. LPWSTR pszUrl;
  30. };
  31. } THEME_ITEM_BLOCK;
  32. class CThemePage : public CObjectWithSite
  33. , public CObjectWindow
  34. , public CObjectCLSID
  35. , public IPropertyBag
  36. , public IBasePropPage
  37. {
  38. public:
  39. //////////////////////////////////////////////////////
  40. // Public Interfaces
  41. //////////////////////////////////////////////////////
  42. // *** IUnknown ***
  43. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  44. virtual STDMETHODIMP_(ULONG) AddRef(void);
  45. virtual STDMETHODIMP_(ULONG) Release(void);
  46. // *** IShellPropSheetExt ***
  47. virtual STDMETHODIMP AddPages(IN LPFNSVADDPROPSHEETPAGE pfnAddPage, IN LPARAM lParam);
  48. virtual STDMETHODIMP ReplacePage(IN EXPPS uPageID, IN LPFNSVADDPROPSHEETPAGE pfnReplaceWith, IN LPARAM lParam) {return E_NOTIMPL;}
  49. // *** IObjectWithSite ***
  50. virtual STDMETHODIMP SetSite(IUnknown *punkSite);
  51. // *** IPropertyBag ***
  52. virtual STDMETHODIMP Read(IN LPCOLESTR pszPropName, IN VARIANT * pVar, IN IErrorLog *pErrorLog);
  53. virtual STDMETHODIMP Write(IN LPCOLESTR pszPropName, IN VARIANT *pVar);
  54. // *** IBasePropPage ***
  55. virtual STDMETHODIMP GetAdvancedDialog(OUT IAdvancedDialog ** ppAdvDialog);
  56. virtual STDMETHODIMP OnApply(IN PROPPAGEONAPPLY oaAction);
  57. CThemePage();
  58. protected:
  59. private:
  60. virtual ~CThemePage(void);
  61. // Private Member Variables
  62. long m_cRef;
  63. HWND m_hwndThemeCombo;
  64. HWND m_hwndDeleteButton;
  65. int m_nPreviousSelected; // Track the previously selected item so we can reset.
  66. HKEY m_hkeyFilter; // We cache this key because it will probably be used 16 times.
  67. BOOL m_fFilters[ARRAYSIZE(g_szCBNames)]; // These are the theme filters
  68. ITheme * m_pLastSelected; // Used to see if the user selected the same item.
  69. ITheme * m_pSelectedTheme;
  70. IThemePreview * m_pThemePreview;
  71. IPropertyBag * m_pScreenSaverUI;
  72. IPropertyBag * m_pBackgroundUI;
  73. IPropertyBag * m_pAppearanceUI; // Used to set the system metrics and visual style settings.
  74. LPWSTR m_pszThemeToApply; // When the apply button is pressed, we need to apply this theme.
  75. LPWSTR m_pszThemeLaunched; // When we open up, load this team because the caller wants that theme loaded when the dialog first opens.
  76. LPWSTR m_pszLastAppledTheme; // If NULL, then the theme is modified, otherwise the path to the last applied theme file.
  77. LPWSTR m_pszModifiedName; // This is the display name we use for the "xxx (Modified)" item.
  78. BOOL m_fInInit;
  79. BOOL m_fInited; // Have we loaded the settings yet?
  80. THEME_ITEM_BLOCK m_Modified;
  81. // Private Member Functions
  82. INT_PTR _ThemeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  83. HRESULT _OnInitThemesDlg(HWND hDlg);
  84. HRESULT _OnDestroy(HWND hDlg);
  85. INT_PTR _OnCommand(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  86. HRESULT _OnSetActive(HWND hDlg);
  87. HRESULT _OnApply(HWND hDlg, LPARAM lParam);
  88. HRESULT _OnSetSelection(IN int nIndex);
  89. HRESULT _OnSelectOther(void);
  90. HRESULT _OnThemeChange(HWND hDlg, BOOL fOnlySelect);
  91. HRESULT _OnOpenAdvSettingsDlg(HWND hDlg);
  92. HRESULT _FreeThemeDropdown(void);
  93. HRESULT _UpdatePreview(void);
  94. HRESULT _InitScreenSaver(void);
  95. HRESULT _InitFilterKey(void);
  96. HRESULT _LoadThemeFilterState(void);
  97. HRESULT _SaveThemeFilterState(void);
  98. HRESULT _RemoveTheme(int nIndex);
  99. HRESULT _SaveAs(void);
  100. HRESULT _DeleteTheme(void);
  101. HRESULT _EnableDeleteIfAppropriate(void);
  102. HRESULT _OnSetBackground(void);
  103. HRESULT _OnSetIcons(void);
  104. HRESULT _OnSetSystemMetrics(void);
  105. HRESULT _ApplyThemeFile(void);
  106. HRESULT _RemoveUserTheme(void);
  107. HRESULT _ChooseOtherThemeFile(IN LPCWSTR pszFile, BOOL fOnlySelect);
  108. HRESULT _LoadCustomizeValue(void);
  109. HRESULT _CustomizeTheme(void);
  110. HRESULT _HandleCustomizedEntre(void);
  111. HRESULT _PersistState(void);
  112. HRESULT _AddUrls(void);
  113. HRESULT _AddUrl(LPCTSTR pszDisplayName, LPCTSTR pszUrl);
  114. HRESULT _AddThemeFile(LPCTSTR pszDisplayName, int * pnIndex, ITheme * pTheme);
  115. ITheme * _GetThemeFile(int nIndex);
  116. LPCWSTR _GetThemeUrl(int nIndex);
  117. HRESULT _OnLoadThemeValues(ITheme * pTheme, BOOL fOnlySelect);
  118. HRESULT _DisplayThemeOpenErr(LPCTSTR pszOpenFile);
  119. BOOL _IsFiltered(IN DWORD dwFilter);
  120. BOOL _IsDirty(void);
  121. static INT_PTR CALLBACK ThemeDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
  122. };
  123. #endif // _THEMEPG_H