1   /************************************************************************
  2           Copy Handler 1.x - program for copying data     in Microsoft Windows
  3                                                    systems.
  4           Copyright (C) 2001-2004 Ixen Gerthannes (copyhandler@o2.pl)
  5  
  6           This program is free software; you can redistribute it and/or modify
  7           it under the terms of the GNU General Public License as published by
  8           the Free Software Foundation; either version 2 of the License, or
  9           (at your option) any later version.
  10  
  11           This program is distributed in the hope that it will be useful,
  12           but WITHOUT ANY WARRANTY; without even the implied warranty of
  13           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14           GNU General Public License for more details.
  15  
  16           You should have received a copy of the GNU General Public License
  17           along with this program; if not, write to the Free Software
  18           Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19   *************************************************************************/
  20   #ifndef __THEME_SUPPORT__
  21   #define __THEME_SUPPORT__
  22  
  23   // definicja HTHEME - podobna do tej z UxTheme...h
  24   #ifndef HTHEME
  25   #define HTHEME HANDLE
  26   #endif
  27  
  28   typedef HTHEME(_stdcall *PFNOPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
  29   typedef HRESULT(_stdcall *PFNCLOSETHEMEDATA)(HTHEME hTheme);
  30   typedef HRESULT(_stdcall *PFNDRAWTHEMEEDGE)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pDestRect, UINT uEdge, UINT uFlags, RECT* pContentRect);
  31   typedef HRESULT(_stdcall *PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pRect, const RECT* pClipRect);
  32   typedef HRESULT(_stdcall *PFNDRAWTHEMEPARENTBACKGROUND)(HWND hwnd, HDC hdc, RECT* prc);
  33   typedef BOOL(_stdcall *PFNISAPPTHEMED)();
  34  
  35   class CUxThemeSupport
  36   {
  37   public:
  38           CUxThemeSupport();
  39           ~CUxThemeSupport();
  40  
  41           HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList);
  42           HRESULT CloseThemeData(HTHEME hTheme);
  43  
  44           bool IsThemeSupported() { return m_hThemesDll != NULL; };
  45           BOOL IsAppThemed();
  46  
  47           HRESULT DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT* pDestRect, UINT uEdge, UINT uFlags, RECT* pContentRect);
  48  
  49           HRESULT DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);
  50           HRESULT DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT* prc);
  51  
  52   /*      HRESULT DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect);
  53  
  54   THEMEAPI GetThemeBackgroundContentRect(HTHEME hTheme, OPTIONAL HDC hdc,
  55       int iPartId, int iStateId,  const RECT *pBoundingRect,
  56       OUT RECT *pContentRect);
  57  
  58   THEMEAPI GetThemeBackgroundExtent(HTHEME hTheme, OPTIONAL HDC hdc,
  59       int iPartId, int iStateId, const RECT *pContentRect,
  60       OUT RECT *pExtentRect);
  61  
  62   THEMEAPI GetThemeTextMetrics(HTHEME hTheme, OPTIONAL HDC hdc,
  63       int iPartId, int iStateId, OUT TEXTMETRIC* ptm);
  64  
  65   THEMEAPI GetThemeBackgroundRegion(HTHEME hTheme, OPTIONAL HDC hdc, 
  66       int iPartId, int iStateId, const RECT *pRect, OUT HRGN *pRegion);
  67  
  68   THEMEAPI HitTestThemeBackground(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId,
  69       int iStateId, DWORD dwOptions, const RECT *pRect, OPTIONAL HRGN hrgn,
  70       POINT ptTest, OUT WORD *pwHitTestCode);
  71  
  72   THEMEAPI DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
  73                          const RECT *pDestRect, UINT uEdge, UINT uFlags, OPTIONAL OUT RECT *pContentRect);
  74  
  75   THEMEAPI DrawThemeIcon(HTHEME hTheme, HDC hdc, int iPartId,
  76       int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex);
  77  
  78   THEMEAPI_(BOOL) IsThemePartDefined(HTHEME hTheme, int iPartId,
  79       int iStateId);
  80  
  81   THEMEAPI_(BOOL) IsThemeBackgroundPartiallyTransparent(HTHEME hTheme,
  82       int iPartId, int iStateId);
  83  
  84   THEMEAPI GetThemeColor(HTHEME hTheme, int iPartId,
  85       int iStateId, int iPropId, OUT COLORREF *pColor);
  86  
  87   THEMEAPI GetThemeMetric(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId,
  88       int iStateId, int iPropId, OUT int *piVal);
  89  
  90   THEMEAPI GetThemeString(HTHEME hTheme, int iPartId,
  91       int iStateId, int iPropId, OUT LPWSTR pszBuff, int cchMaxBuffChars);
  92  
  93   THEMEAPI GetThemeBool(HTHEME hTheme, int iPartId,
  94       int iStateId, int iPropId, OUT BOOL *pfVal);
  95  
  96   THEMEAPI GetThemeInt(HTHEME hTheme, int iPartId,
  97       int iStateId, int iPropId, OUT int *piVal);
  98  
  99   THEMEAPI GetThemeEnumValue(HTHEME hTheme, int iPartId,
  100       int iStateId, int iPropId, OUT int *piVal);
  101  
  102   THEMEAPI GetThemePosition(HTHEME hTheme, int iPartId,
  103       int iStateId, int iPropId, OUT POINT *pPoint);
  104  
  105   THEMEAPI GetThemeFont(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId,
  106       int iStateId, int iPropId, OUT LOGFONT *pFont);
  107  
  108   THEMEAPI GetThemeRect(HTHEME hTheme, int iPartId,
  109       int iStateId, int iPropId, OUT RECT *pRect);
  110  
  111   THEMEAPI GetThemeMargins(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId,
  112       int iStateId, int iPropId, OPTIONAL RECT *prc, OUT MARGINS *pMargins);
  113  
  114   THEMEAPI GetThemeIntList(HTHEME hTheme, int iPartId,
  115       int iStateId, int iPropId, OUT INTLIST *pIntList);
  116  
  117   THEMEAPI GetThemePropertyOrigin(HTHEME hTheme, int iPartId,
  118       int iStateId, int iPropId, OUT enum PROPERTYORIGIN *pOrigin);
  119  
  120   THEMEAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName,
  121       LPCWSTR pszSubIdList);
  122  
  123   THEMEAPI GetThemeFilename(HTHEME hTheme, int iPartId,
  124       int iStateId, int iPropId, OUT LPWSTR pszThemeFileName, int cchMaxBuffChars);
  125  
  126   THEMEAPI_(COLORREF) GetThemeSysColor(HTHEME hTheme, int iColorId);
  127  
  128   THEMEAPI_(HBRUSH) GetThemeSysColorBrush(HTHEME hTheme, int iColorId);
  129  
  130   THEMEAPI_(BOOL) GetThemeSysBool(HTHEME hTheme, int iBoolId);
  131  
  132   THEMEAPI_(int) GetThemeSysSize(HTHEME hTheme, int iSizeId);
  133  
  134   THEMEAPI GetThemeSysFont(HTHEME hTheme, int iFontId, OUT LOGFONT *plf);
  135  
  136   THEMEAPI GetThemeSysString(HTHEME hTheme, int iStringId,
  137       OUT LPWSTR pszStringBuff, int cchMaxStringChars);
  138  
  139   THEMEAPI GetThemeSysInt(HTHEME hTheme, int iIntId, int *piValue);
  140  
  141   THEMEAPI_(BOOL) IsThemeActive();
  142  
  143  
  144   THEMEAPI_(HTHEME) GetWindowTheme(HWND hwnd);
  145  
  146  
  147   THEMEAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags);
  148  
  149  
  150   THEMEAPI_(BOOL) IsThemeDialogTextureEnabled(HWND hwnd);
  151  
  152   THEMEAPI_(DWORD) GetThemeAppProperties();
  153  
  154   THEMEAPI_(void) SetThemeAppProperties(DWORD dwFlags);
  155  
  156   THEMEAPI GetCurrentThemeName(
  157       OUT LPWSTR pszThemeFileName, int cchMaxNameChars,
  158       OUT OPTIONAL LPWSTR pszColorBuff, int cchMaxColorChars,
  159       OUT OPTIONAL LPWSTR pszSizeBuff, int cchMaxSizeChars);
  160  
  161   THEMEAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
  162       LPCWSTR pszPropertyName, OUT LPWSTR pszValueBuff, int cchMaxValChars);
  163  
  164   THEMEAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, OPTIONAL RECT* prc);
  165  
  166   THEMEAPI EnableTheming(BOOL fEnable);
  167   */
  168   protected:
  169  
  170           HMODULE m_hThemesDll;
  171   };
  172  
  173   #endif