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.

83 lines
4.1 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: Services.h
  3. //
  4. // Copyright (c) 2000, Microsoft Corporation
  5. //
  6. // APIs to communicate with the theme service.
  7. //
  8. // History: 2000-08-10 vtan created
  9. // 2000-10-11 vtan rewrite for LPC
  10. // --------------------------------------------------------------------------
  11. #ifndef _UxThemeServices_
  12. #define _UxThemeServices_
  13. // --------------------------------------------------------------------------
  14. // CThemeServices
  15. //
  16. // Purpose: Class to implement APIs to communicate with the theme service.
  17. //
  18. // History: 2000-08-10 vtan created
  19. // 2000-10-11 vtan rewrite for LPC
  20. // --------------------------------------------------------------------------
  21. class CThemeServices
  22. {
  23. private:
  24. CThemeServices (void);
  25. ~CThemeServices (void);
  26. public:
  27. static void StaticInitialize (void);
  28. static void StaticTerminate (void);
  29. // These are calls to the server.
  30. static HRESULT ThemeHooksOn (HWND hwndTarget);
  31. static HRESULT ThemeHooksOff (void);
  32. static HRESULT GetStatusFlags (DWORD *pdwFlags);
  33. static HRESULT GetCurrentChangeNumber (int *piValue);
  34. static HRESULT GetNewChangeNumber (int *piValue);
  35. static HRESULT SetGlobalTheme (HANDLE hSection);
  36. static HRESULT GetGlobalTheme (HANDLE *phSection);
  37. static HRESULT CheckThemeSignature (const WCHAR *pszThemeName);
  38. static HRESULT LoadTheme (HANDLE *phSection, const WCHAR *pszThemeName, const WCHAR *pszColor, const WCHAR *pszSize, BOOL fGlobal);
  39. // These are calls implemented on the client side
  40. // that may make calls to the server.
  41. static HRESULT ApplyTheme (CUxThemeFile *pThemeFile, DWORD dwFlags, HWND hwndTarget);
  42. static HRESULT InitUserTheme (BOOL fPolicyCheckOnly = FALSE);
  43. static HRESULT AdjustTheme(BOOL fEnable);
  44. static HRESULT InitUserRegistry (void);
  45. // These are special private APIs
  46. static HRESULT ReestablishServerConnection (void);
  47. static HRESULT ClearStockObjects (HANDLE hSection, BOOL fForce = FALSE);
  48. private:
  49. static void ApplyDefaultMetrics(void);
  50. static void LockAcquire (void);
  51. static void LockRelease (void);
  52. static bool ConnectedToService (void);
  53. static void ReleaseConnection (void);
  54. static void CheckForDisconnectedPort (NTSTATUS status);
  55. static bool CurrentThemeMatch (LPCWSTR pszThemeName, LPCWSTR pszColor, LPCWSTR pszSize, LANGID wLangID, bool fLoadMetricsOnMatch);
  56. static HRESULT LoadCurrentTheme (void);
  57. static int SectionProcessType (const BYTE *pbThemeData, MIXEDPTRS& u);
  58. static void SectionWalkData (const BYTE *pbThemeData, int iIndex);
  59. static bool ThemeSettingsModified (void);
  60. static bool ThemeEnforcedByPolicy (bool fActive);
  61. static HRESULT CheckColorDepth(CUxThemeFile *pThemeFile);
  62. static HRESULT UpdateThemeRegistry(BOOL fNewTheme, LPCWSTR pszThemeFileName,
  63. LPCWSTR pszColorParam, LPCWSTR pszSizeParam, BOOL fJustSetActive, BOOL fJustApplied);
  64. static void SendThemeChangedMsg(BOOL fNewTheme, HWND hwndTarget, DWORD dwFlags,
  65. int iLoadId);
  66. static int GetLoadId(HANDLE hSectionOld);
  67. private:
  68. static CRITICAL_SECTION s_lock;
  69. static HANDLE s_hAPIPort;
  70. static const WCHAR s_szDefault[];
  71. };
  72. #endif /* _UxThemeServices_ */