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.

81 lines
3.4 KiB

  1. //-------------------------------------------------------------------------
  2. // TmUtils.h - theme manager shared utilities
  3. //-------------------------------------------------------------------------
  4. #ifndef _TMUTILS_H_
  5. #define _TMUTILS_H_
  6. //-------------------------------------------------------------------------
  7. #include "themefile.h"
  8. //-------------------------------------------------------------------------
  9. #define DIBDATA(infohdr) (((BYTE *)(infohdr)) + infohdr->biSize + \
  10. infohdr->biClrUsed*sizeof(RGBQUAD))
  11. #define THEME_OFFSET(x) int(x - _LoadingThemeFile._pbThemeData)
  12. #define THEMEFILE_OFFSET(x) int(x - pThemeFile->_pbThemeData)
  13. //------------------------------------------------------------------------------------
  14. class CMemoryDC
  15. {
  16. public:
  17. CMemoryDC();
  18. ~CMemoryDC();
  19. HRESULT OpenDC(HDC hdcSource, int iWidth, int iHeight);
  20. void CloseDC();
  21. operator HDC() {return _hdc;}
  22. HBITMAP _hBitmap;
  23. protected:
  24. //---- private data ----
  25. HDC _hdc;
  26. HBITMAP _hOldBitmap;
  27. };
  28. //------------------------------------------------------------------------------------
  29. class CBitmapPixels
  30. {
  31. public:
  32. CBitmapPixels();
  33. ~CBitmapPixels();
  34. //---- "OpenBitmap()" returns a ptr to pixel values in bitmap. ----
  35. //---- Rows go from bottom to top; Colums go from left to right. ----
  36. //---- IMPORTANT: pixel DWORDS have RGB bytes reversed from COLORREF ----
  37. HRESULT OpenBitmap(HDC hdc, HBITMAP bitmap, BOOL fForceRGB32,
  38. DWORD OUT **pPixels, OPTIONAL OUT int *piWidth=NULL, OPTIONAL OUT int *piHeight=NULL,
  39. OPTIONAL OUT int *piBytesPerPixel=NULL, OPTIONAL OUT int *piBytesPerRow=NULL,
  40. OPTIONAL OUT int *piPreviousBytesPerPixel = NULL, OPTIONAL UINT cbBytesBefore = 0);
  41. void CloseBitmap(HDC hdc, HBITMAP hBitmap);
  42. //---- Pointer to the total buffer (including cbBytesBefore)
  43. BYTE *Buffer();
  44. //---- public data ----
  45. BITMAPINFOHEADER *_hdrBitmap;
  46. protected:
  47. //---- private data ----
  48. int _iWidth;
  49. int _iHeight;
  50. BYTE* _buffer;
  51. };
  52. //------------------------------------------------------------------------------------
  53. HRESULT LoadThemeLibrary(LPCWSTR pszThemeName, HINSTANCE *phInst);
  54. LPCWSTR ThemeString(CUxThemeFile *pThemeFile, int iOffset);
  55. HRESULT GetThemeNameId(CUxThemeFile *pThemeFile, LPWSTR pszFileNameBuff, UINT cchFileNameBuff,
  56. LPWSTR pszColorParam, UINT cchColorParam, LPWSTR pszSizeParam, UINT cchSizeParam, int *piSysMetricsIndex, LANGID *pwLangID);
  57. BOOL ThemeMatch (CUxThemeFile *pThemeFile, LPCWSTR pszThemeName, LPCWSTR pszColorName, LPCWSTR pszSizeName, LANGID wLangID);
  58. HRESULT _EnumThemeSizes(HINSTANCE hInst, LPCWSTR pszThemeName,
  59. OPTIONAL LPCWSTR pszColorScheme, DWORD dwSizeIndex, OUT THEMENAMEINFO *ptn, BOOL fCheckColorDepth);
  60. HRESULT _EnumThemeColors(HINSTANCE hInst, LPCWSTR pszThemeName,
  61. OPTIONAL LPCWSTR pszSizeName, DWORD dwColorIndex, OUT THEMENAMEINFO *ptn, BOOL fCheckColorDepth);
  62. HRESULT GetSizeIndex(HINSTANCE hInst, LPCWSTR pszSize, int *piIndex);
  63. HRESULT GetColorSchemeIndex(HINSTANCE hInst, LPCWSTR pszSize, int *piIndex);
  64. HRESULT FindComboData(HINSTANCE hDll, COLORSIZECOMBOS **ppCombos);
  65. HRESULT GetThemeSizeId(int iSysSizeId, int *piThemeSizeId);
  66. int GetLoadIdFromTheme(CUxThemeFile *pThemeFile);
  67. //---------------------------------------------------------------------------
  68. #endif // _TMUTILS_H_
  69. //-------------------------------------------------------------------------