win32visualstyleswrapper.h

来自「这是VCF框架的代码」· C头文件 代码 · 共 861 行 · 第 1/3 页

H
861
字号
#ifndef _VCF_WIN32VISUALSTYLESWRAPPER_H__#define _VCF_WIN32VISUALSTYLESWRAPPER_H__//Win32VisualStylesWrapper.h/*Copyright 2000-2004 The VCF Project.Please see License.txt in the top level directorywhere you installed the VCF.*/#if _MSC_VER > 1000#   pragma once#endif#include "thirdparty/win32/Microsoft/uxtheme.h"#include "thirdparty/win32/Microsoft/tmschema.h"/**Based on the class CVisualStylesXP by David Yuheng Zhao.His original copyright notice:Copyright (C) 2001-2002 by David Yuheng ZhaoDistribute and change freely, except: don't remove my name from the sourceNo warrantee of any kind, express or implied, is included with thissoftware; use at your own risk, responsibility for damages (if any) toanyone resulting from the use of this software rests entirely with theuser.Partly based on the _ThemeHelper struct in MFC7.0 source code (winctrl3.cpp),and the difference is that this implementation wraps the full set ofvisual style APIs from the platform SDK August 2001If you have any questions, I can be reached as follows:	yuheng_zhao@yahoo.comChanges made by Jim Crafton to make things fit in better with VCF existing codeand to make it easier to read/understand what's going on.*/class GRAPHICSKIT_API Win32VisualStylesWrapper {private:	typedef HTHEME(__stdcall *PFNOPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);	typedef HRESULT(__stdcall *PFNCLOSETHEMEDATA)(HTHEME hTheme);	typedef HRESULT(__stdcall *PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc,		int iPartId, int iStateId, const RECT *pRect,  const RECT *pClipRect);	typedef HRESULT (__stdcall *PFNDRAWTHEMETEXT)(HTHEME hTheme, HDC hdc, int iPartId,		int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,		DWORD dwTextFlags2, const RECT *pRect);	typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId,  const RECT *pBoundingRect,		RECT *pContentRect);	typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDEXTENT)(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId, const RECT *pContentRect,		RECT *pExtentRect);	typedef HRESULT(__stdcall *PFNGETTHEMEPARTSIZE)(HTHEME hTheme, HDC hdc,		int iPartId, int iStateId, RECT * pRect, THEMESIZE eSize,  SIZE *psz);	typedef HRESULT (__stdcall *PFNGETTHEMETEXTEXTENT)(HTHEME hTheme, HDC hdc,		int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,		DWORD dwTextFlags,  const RECT *pBoundingRect,		RECT *pExtentRect);	typedef HRESULT (__stdcall *PFNGETTHEMETEXTMETRICS)(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId,  TEXTMETRIC* ptm);	typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDREGION)(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId, const RECT *pRect,  HRGN *pRegion);	typedef HRESULT (__stdcall *PFNHITTESTTHEMEBACKGROUND)(HTHEME hTheme,  HDC hdc, int iPartId,		int iStateId, DWORD dwOptions, const RECT *pRect,  HRGN hrgn,		POINT ptTest,  WORD *pwHitTestCode);	typedef HRESULT (__stdcall *PFNDRAWTHEMEEDGE)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,		const RECT *pDestRect, UINT uEdge, UINT uFlags,   RECT *pContentRect);	typedef HRESULT (__stdcall *PFNDRAWTHEMEICON)(HTHEME hTheme, HDC hdc, int iPartId,		int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex);	typedef BOOL (__stdcall *PFNISTHEMEPARTDEFINED)(HTHEME hTheme, int iPartId,		int iStateId);	typedef BOOL (__stdcall *PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(HTHEME hTheme,		int iPartId, int iStateId);	typedef HRESULT (__stdcall *PFNGETTHEMECOLOR)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  COLORREF *pColor);	typedef HRESULT (__stdcall *PFNGETTHEMEMETRIC)(HTHEME hTheme,  HDC hdc, int iPartId,		int iStateId, int iPropId,  int *piVal);	typedef HRESULT (__stdcall *PFNGETTHEMESTRING)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  LPWSTR pszBuff, int cchMaxBuffChars);	typedef HRESULT (__stdcall *PFNGETTHEMEBOOL)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  BOOL *pfVal);	typedef HRESULT (__stdcall *PFNGETTHEMEINT)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  int *piVal);	typedef HRESULT (__stdcall *PFNGETTHEMEENUMVALUE)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  int *piVal);	typedef HRESULT (__stdcall *PFNGETTHEMEPOSITION)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  POINT *pPoint);	typedef HRESULT (__stdcall *PFNGETTHEMEFONT)(HTHEME hTheme,  HDC hdc, int iPartId,		int iStateId, int iPropId,  LOGFONT *pFont);	typedef HRESULT (__stdcall *PFNGETTHEMERECT)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  RECT *pRect);	typedef HRESULT (__stdcall *PFNGETTHEMEMARGINS)(HTHEME hTheme,  HDC hdc, int iPartId,		int iStateId, int iPropId,  RECT *prc,  MARGINS *pMargins);	typedef HRESULT (__stdcall *PFNGETTHEMEINTLIST)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  INTLIST *pIntList);	typedef HRESULT (__stdcall *PFNGETTHEMEPROPERTYORIGIN)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId, PROPERTYORIGIN *pOrigin);	typedef HRESULT (__stdcall *PFNSETWINDOWTHEME)(HWND hwnd, LPCWSTR pszSubAppName,		LPCWSTR pszSubIdList);	typedef HRESULT (__stdcall *PFNGETTHEMEFILENAME)(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  LPWSTR pszThemeFileName, int cchMaxBuffChars);	typedef COLORREF (__stdcall *PFNGETTHEMESYSCOLOR)(HTHEME hTheme, int iColorId);	typedef HBRUSH (__stdcall *PFNGETTHEMESYSCOLORBRUSH)(HTHEME hTheme, int iColorId);	typedef BOOL (__stdcall *PFNGETTHEMESYSBOOL)(HTHEME hTheme, int iBoolId);	typedef int (__stdcall *PFNGETTHEMESYSSIZE)(HTHEME hTheme, int iSizeId);	typedef HRESULT (__stdcall *PFNGETTHEMESYSFONT)(HTHEME hTheme, int iFontId,  LOGFONT *plf);	typedef HRESULT (__stdcall *PFNGETTHEMESYSSTRING)(HTHEME hTheme, int iStringId,		LPWSTR pszStringBuff, int cchMaxStringChars);	typedef HRESULT (__stdcall *PFNGETTHEMESYSINT)(HTHEME hTheme, int iIntId, int *piValue);	typedef BOOL (__stdcall *PFNISTHEMEACTIVE)();	typedef BOOL(__stdcall *PFNISAPPTHEMED)();	typedef HTHEME (__stdcall *PFNGETWINDOWTHEME)(HWND hwnd);	typedef HRESULT (__stdcall *PFNENABLETHEMEDIALOGTEXTURE)(HWND hwnd, DWORD dwFlags);	typedef BOOL (__stdcall *PFNISTHEMEDIALOGTEXTUREENABLED)(HWND hwnd);	typedef DWORD (__stdcall *PFNGETTHEMEAPPPROPERTIES)();	typedef void (__stdcall *PFNSETTHEMEAPPPROPERTIES)(DWORD dwFlags);	typedef HRESULT (__stdcall *PFNGETCURRENTTHEMENAME)(		LPWSTR pszThemeFileName, int cchMaxNameChars,		LPWSTR pszColorBuff, int cchMaxColorChars,		LPWSTR pszSizeBuff, int cchMaxSizeChars);	typedef HRESULT (__stdcall *PFNGETTHEMEDOCUMENTATIONPROPERTY)(LPCWSTR pszThemeName,		LPCWSTR pszPropertyName,  LPWSTR pszValueBuff, int cchMaxValChars);	typedef HRESULT (__stdcall *PFNDRAWTHEMEPARENTBACKGROUND)(HWND hwnd, HDC hdc,  RECT* prc);	typedef HRESULT (__stdcall *PFNENABLETHEMING)(BOOL fEnable);private:	struct ThemeFuncs {		PFNOPENTHEMEDATA openThemeDataFunc;		PFNCLOSETHEMEDATA closeThemeDataFunc;		PFNDRAWTHEMEBACKGROUND drawThemeBackgroundFunc;		PFNDRAWTHEMETEXT drawThemeTextFunc;		PFNGETTHEMEBACKGROUNDCONTENTRECT getThemeBackgroundContentRectFunc;		PFNGETTHEMEBACKGROUNDEXTENT getThemeBackgroundExtentFunc;		PFNGETTHEMEPARTSIZE getThemePartSizeFunc;		PFNGETTHEMETEXTEXTENT getThemeTextExtentFunc;		PFNGETTHEMETEXTMETRICS getThemeTextMetricsFunc;		PFNGETTHEMEBACKGROUNDREGION getThemeBackgroundRegionFunc;		PFNHITTESTTHEMEBACKGROUND hitTestThemeBackgroundFunc;		PFNDRAWTHEMEEDGE drawThemeEdgeFunc;		PFNDRAWTHEMEICON drawThemeIconFunc;		PFNISTHEMEPARTDEFINED isThemePartDefinedFunc;		PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT isThemeBackgroundPartiallyTransparentFunc;		PFNGETTHEMECOLOR getThemeColorFunc;		PFNGETTHEMEMETRIC getThemeMetricFunc;		PFNGETTHEMESTRING getThemeStringFunc;		PFNGETTHEMEBOOL getThemeBoolFunc;		PFNGETTHEMEINT getThemeIntFunc;		PFNGETTHEMEENUMVALUE getThemeEnumValueFunc;		PFNGETTHEMEPOSITION getThemePositionFunc;		PFNGETTHEMEFONT getThemeFontFunc;		PFNGETTHEMERECT getThemeRectFunc;		PFNGETTHEMEMARGINS getThemeMarginsFunc;		PFNGETTHEMEINTLIST getThemeIntListFunc;		PFNGETTHEMEPROPERTYORIGIN getThemePropertyOriginFunc;		PFNSETWINDOWTHEME setWindowThemeFunc;		PFNGETTHEMEFILENAME getThemeFilenameFunc;		PFNGETTHEMESYSCOLOR getThemeSysColorFunc;		PFNGETTHEMESYSCOLORBRUSH getThemeSysColorBrushFunc;		PFNGETTHEMESYSBOOL getThemeSysBoolFunc;		PFNGETTHEMESYSSIZE getThemeSysSizeFunc;		PFNGETTHEMESYSFONT getThemeSysFontFunc;		PFNGETTHEMESYSSTRING getThemeSysStringFunc;		PFNGETTHEMESYSINT getThemeSysIntFunc;		PFNISTHEMEACTIVE isThemeActiveFunc;		PFNISAPPTHEMED isAppThemedFunc;		PFNGETWINDOWTHEME getWindowThemeFunc;		PFNENABLETHEMEDIALOGTEXTURE enableThemeDialogTextureFunc;		PFNISTHEMEDIALOGTEXTUREENABLED isThemeDialogTextureEnabledFunc;		PFNGETTHEMEAPPPROPERTIES getThemeAppPropertiesFunc;		PFNSETTHEMEAPPPROPERTIES setThemeAppPropertiesFunc;		PFNGETCURRENTTHEMENAME getCurrentThemeNameFunc;		PFNGETTHEMEDOCUMENTATIONPROPERTY getThemeDocumentationPropertyFunc;		PFNDRAWTHEMEPARENTBACKGROUND drawThemeParentBackgroundFunc;		PFNENABLETHEMING enableThemingFunc;	};	static HTHEME OpenThemeDataFail(HWND , LPCWSTR )	{return NULL;}	static HRESULT CloseThemeDataFail(HTHEME)	{return E_FAIL;}	static HRESULT DrawThemeBackgroundFail(HTHEME, HDC, int, int, const RECT *, const RECT *)	{return E_FAIL;}	static HRESULT DrawThemeTextFail(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT*)	{return E_FAIL;}	static HRESULT GetThemeBackgroundContentRectFail(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId,  const RECT *pBoundingRect,		RECT *pContentRect)	{return E_FAIL;}	static HRESULT GetThemeBackgroundExtentFail(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId, const RECT *pContentRect,		RECT *pExtentRect)	{return E_FAIL;}	static HRESULT GetThemePartSizeFail(HTHEME, HDC, int, int, RECT *, THEMESIZE, SIZE *)	{return E_FAIL;}	static HRESULT GetThemeTextExtentFail(HTHEME hTheme, HDC hdc,		int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,		DWORD dwTextFlags,  const RECT *pBoundingRect,		RECT *pExtentRect)	{return E_FAIL;}	static HRESULT GetThemeTextMetricsFail(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId,  TEXTMETRIC* ptm)	{return E_FAIL;}	static HRESULT GetThemeBackgroundRegionFail(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId, const RECT *pRect,  HRGN *pRegion)	{return E_FAIL;}	static HRESULT HitTestThemeBackgroundFail(HTHEME hTheme,  HDC hdc, int iPartId,		int iStateId, DWORD dwOptions, const RECT *pRect,  HRGN hrgn,		POINT ptTest,  WORD *pwHitTestCode)	{return E_FAIL;}	static HRESULT DrawThemeEdgeFail(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,		const RECT *pDestRect, UINT uEdge, UINT uFlags,   RECT *pContentRect)	{return E_FAIL;}	static HRESULT DrawThemeIconFail(HTHEME hTheme, HDC hdc, int iPartId,		int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex)	{return E_FAIL;}	static BOOL IsThemePartDefinedFail(HTHEME hTheme, int iPartId,		int iStateId)	{return FALSE;}	static BOOL IsThemeBackgroundPartiallyTransparentFail(HTHEME hTheme,		int iPartId, int iStateId)	{return FALSE;}	static HRESULT GetThemeColorFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  COLORREF *pColor)	{return E_FAIL;}	static HRESULT GetThemeMetricFail(HTHEME hTheme,  HDC hdc, int iPartId,		int iStateId, int iPropId,  int *piVal)	{return E_FAIL;}	static HRESULT GetThemeStringFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  LPWSTR pszBuff, int cchMaxBuffChars)	{return E_FAIL;}	static HRESULT GetThemeBoolFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  BOOL *pfVal)	{return E_FAIL;}	static HRESULT GetThemeIntFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  int *piVal)	{return E_FAIL;}	static HRESULT GetThemeEnumValueFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  int *piVal)	{return E_FAIL;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?