win32visualstyleswrapper.h

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

H
861
字号
	static HRESULT GetThemePositionFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  POINT *pPoint)	{return E_FAIL;}	static HRESULT GetThemeFontFail(HTHEME hTheme,  HDC hdc, int iPartId,		int iStateId, int iPropId,  LOGFONT *pFont)	{return E_FAIL;}	static HRESULT GetThemeRectFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  RECT *pRect)	{return E_FAIL;}	static HRESULT GetThemeMarginsFail(HTHEME hTheme,  HDC hdc, int iPartId,		int iStateId, int iPropId,  RECT *prc,  MARGINS *pMargins)	{return E_FAIL;}	static HRESULT GetThemeIntListFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  INTLIST *pIntList)	{return E_FAIL;}	static HRESULT GetThemePropertyOriginFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId, PROPERTYORIGIN *pOrigin)	{return E_FAIL;}	static HRESULT SetWindowThemeFail(HWND hwnd, LPCWSTR pszSubAppName,		LPCWSTR pszSubIdList)	{return E_FAIL;}	static HRESULT GetThemeFilenameFail(HTHEME hTheme, int iPartId,		int iStateId, int iPropId,  LPWSTR pszThemeFileName, int cchMaxBuffChars)	{return E_FAIL;}	static COLORREF GetThemeSysColorFail(HTHEME hTheme, int iColorId)	{return RGB(255,255,255);}	static HBRUSH GetThemeSysColorBrushFail(HTHEME hTheme, int iColorId)	{return NULL;}	static BOOL GetThemeSysBoolFail(HTHEME hTheme, int iBoolId)	{return FALSE;}	static int GetThemeSysSizeFail(HTHEME hTheme, int iSizeId)	{return 0;}	static HRESULT GetThemeSysFontFail(HTHEME hTheme, int iFontId,  LOGFONT *plf)	{return E_FAIL;}	static HRESULT GetThemeSysStringFail(HTHEME hTheme, int iStringId,		LPWSTR pszStringBuff, int cchMaxStringChars)	{return E_FAIL;}	static HRESULT GetThemeSysIntFail(HTHEME hTheme, int iIntId, int *piValue)	{return E_FAIL;}	static BOOL IsThemeActiveFail()	{return FALSE;}	static BOOL IsAppThemedFail()	{return FALSE;}	static HTHEME GetWindowThemeFail(HWND hwnd)	{return NULL;}	static HRESULT EnableThemeDialogTextureFail(HWND hwnd, DWORD dwFlags)	{return E_FAIL;}	static BOOL IsThemeDialogTextureEnabledFail(HWND hwnd)	{return FALSE;}	static DWORD GetThemeAppPropertiesFail()	{return 0;}	static void SetThemeAppPropertiesFail(DWORD dwFlags)	{return;}	static HRESULT GetCurrentThemeNameFail(		LPWSTR pszThemeFileName, int cchMaxNameChars,		LPWSTR pszColorBuff, int cchMaxColorChars,		LPWSTR pszSizeBuff, int cchMaxSizeChars)	{return E_FAIL;}	static HRESULT GetThemeDocumentationPropertyFail(LPCWSTR pszThemeName,		LPCWSTR pszPropertyName,  LPWSTR pszValueBuff, int cchMaxValChars)	{return E_FAIL;}	static HRESULT DrawThemeParentBackgroundFail(HWND hwnd, HDC hdc,  RECT* prc)	{return E_FAIL;}	static HRESULT EnableThemingFail(BOOL fEnable)	{return E_FAIL;}	HMODULE themeDllHandle_;	FARPROC getProc( LPCSTR szProcName, FARPROC failFunction) {		FARPROC result = failFunction;		if (themeDllHandle_ != NULL)			result = ::GetProcAddress(themeDllHandle_, szProcName);		return result;	}	ThemeFuncs funcs_;protected:	static Win32VisualStylesWrapper Instance;public:	Win32VisualStylesWrapper(): themeDllHandle_(NULL) {		themeDllHandle_ = ::LoadLibrary( "UxTheme.dll" );		memset( &funcs_, 0, sizeof(funcs_) );	}	~Win32VisualStylesWrapper() {		if (themeDllHandle_!=NULL) {			::FreeLibrary(themeDllHandle_);		}		themeDllHandle_ = NULL;	}	static HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList)	{		if ( NULL == Instance.funcs_.openThemeDataFunc ) {			Instance.funcs_.openThemeDataFunc = (PFNOPENTHEMEDATA)Instance.getProc("OpenThemeData", (FARPROC)OpenThemeDataFail);		}		return (*Instance.funcs_.openThemeDataFunc)(hwnd, pszClassList);	}	static HRESULT CloseThemeData(HTHEME hTheme)	{		if ( NULL == Instance.funcs_.closeThemeDataFunc ) {			Instance.funcs_.closeThemeDataFunc = (PFNCLOSETHEMEDATA)Instance.getProc("CloseThemeData", (FARPROC)CloseThemeDataFail);		}		return (*Instance.funcs_.closeThemeDataFunc)(hTheme);	}	static HRESULT DrawThemeBackground(HTHEME hTheme, HDC hdc,		int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)	{		if ( NULL == Instance.funcs_.drawThemeBackgroundFunc ) {			Instance.funcs_.drawThemeBackgroundFunc =			(PFNDRAWTHEMEBACKGROUND)Instance.getProc("DrawThemeBackground", (FARPROC)DrawThemeBackgroundFail);		}		return (*Instance.funcs_.drawThemeBackgroundFunc)(hTheme, hdc, iPartId, iStateId, pRect, pClipRect);	}	static HRESULT DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId,		int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,		DWORD dwTextFlags2, const RECT *pRect)	{		if ( NULL == Instance.funcs_.drawThemeTextFunc ) {			Instance.funcs_.drawThemeTextFunc = (PFNDRAWTHEMETEXT)Instance.getProc("DrawThemeText", (FARPROC)DrawThemeTextFail);		}		return (*Instance.funcs_.drawThemeTextFunc)(hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, dwTextFlags2, pRect);	}	static HRESULT GetThemeBackgroundContentRect(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId,  const RECT *pBoundingRect,		RECT *pContentRect)	{		if ( NULL == Instance.funcs_.getThemeBackgroundContentRectFunc ) {			Instance.funcs_.getThemeBackgroundContentRectFunc = (PFNGETTHEMEBACKGROUNDCONTENTRECT)Instance.getProc("GetThemeBackgroundContentRect", (FARPROC)GetThemeBackgroundContentRectFail);		}		return (*Instance.funcs_.getThemeBackgroundContentRectFunc)(hTheme,  hdc, iPartId, iStateId,  pBoundingRect, pContentRect);	}	static HRESULT GetThemeBackgroundExtent(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId, const RECT *pContentRect,		RECT *pExtentRect)	{		if ( NULL == Instance.funcs_.getThemeBackgroundExtentFunc ) {			Instance.funcs_.getThemeBackgroundExtentFunc = (PFNGETTHEMEBACKGROUNDEXTENT)Instance.getProc("GetThemeBackgroundExtent", (FARPROC)GetThemeBackgroundExtentFail);		}		return (*Instance.funcs_.getThemeBackgroundExtentFunc)(hTheme, hdc, iPartId, iStateId, pContentRect, pExtentRect);	}	static HRESULT GetThemePartSize(HTHEME hTheme, HDC hdc,		int iPartId, int iStateId, RECT * pRect, THEMESIZE eSize, SIZE *psz)	{		if ( NULL == Instance.funcs_.getThemePartSizeFunc ) {			Instance.funcs_.getThemePartSizeFunc =				(PFNGETTHEMEPARTSIZE)Instance.getProc("GetThemePartSize", (FARPROC)GetThemePartSizeFail);		}		return (*Instance.funcs_.getThemePartSizeFunc)(hTheme, hdc, iPartId, iStateId, pRect, eSize, psz);	}	static HRESULT GetThemeTextExtent(HTHEME hTheme, HDC hdc,		int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,		DWORD dwTextFlags,  const RECT *pBoundingRect,		RECT *pExtentRect)	{		if ( NULL == Instance.funcs_.getThemeTextExtentFunc ) {			Instance.funcs_.getThemeTextExtentFunc = (PFNGETTHEMETEXTEXTENT)Instance.getProc("GetThemeTextExtent", (FARPROC)GetThemeTextExtentFail);		}		return (*Instance.funcs_.getThemeTextExtentFunc)(hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags,  pBoundingRect, pExtentRect);	}	static HRESULT GetThemeTextMetrics(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId,  TEXTMETRIC* ptm)	{		if ( NULL == Instance.funcs_.getThemeTextMetricsFunc ) {			Instance.funcs_.getThemeTextMetricsFunc = (PFNGETTHEMETEXTMETRICS)Instance.getProc("GetThemeTextMetrics", (FARPROC)GetThemeTextMetricsFail);		}		return (*Instance.funcs_.getThemeTextMetricsFunc)(hTheme, hdc, iPartId, iStateId,  ptm);	}	static HRESULT GetThemeBackgroundRegion(HTHEME hTheme,  HDC hdc,		int iPartId, int iStateId, const RECT *pRect,  HRGN *pRegion)	{		if ( NULL == Instance.funcs_.getThemeBackgroundRegionFunc ) {			Instance.funcs_.getThemeBackgroundRegionFunc = (PFNGETTHEMEBACKGROUNDREGION)Instance.getProc("GetThemeBackgroundRegion", (FARPROC)GetThemeBackgroundRegionFail);		}		return (*Instance.funcs_.getThemeBackgroundRegionFunc)(hTheme, hdc, iPartId, iStateId, pRect, pRegion);	}	static HRESULT HitTestThemeBackground(HTHEME hTheme,  HDC hdc, int iPartId,		int iStateId, DWORD dwOptions, const RECT *pRect,  HRGN hrgn,		POINT ptTest,  WORD *pwHitTestCode)	{		if ( NULL == Instance.funcs_.hitTestThemeBackgroundFunc ) {			Instance.funcs_.hitTestThemeBackgroundFunc = (PFNHITTESTTHEMEBACKGROUND)Instance.getProc("HitTestThemeBackground", (FARPROC)HitTestThemeBackgroundFail);		}		return (*Instance.funcs_.hitTestThemeBackgroundFunc)(hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode);	}	static HRESULT DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,		const RECT *pDestRect, UINT uEdge, UINT uFlags,   RECT *pContentRect)	{		if ( NULL == Instance.funcs_.drawThemeEdgeFunc ) {			Instance.funcs_.drawThemeEdgeFunc = (PFNDRAWTHEMEEDGE)Instance.getProc("DrawThemeEdge", (FARPROC)DrawThemeEdgeFail);		}		return (*Instance.funcs_.drawThemeEdgeFunc)(hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect);	}	static HRESULT DrawThemeIcon(HTHEME hTheme, HDC hdc, int iPartId,		int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex)	{		if ( NULL == Instance.funcs_.drawThemeIconFunc ) {			Instance.funcs_.drawThemeIconFunc = (PFNDRAWTHEMEICON)Instance.getProc("DrawThemeIcon", (FARPROC)DrawThemeIconFail);		}		return (*Instance.funcs_.drawThemeIconFunc)(hTheme, hdc, iPartId, iStateId, pRect, himl, iImageIndex);	}	static BOOL IsThemePartDefined(HTHEME hTheme, int iPartId,		int iStateId)	{		if ( NULL == Instance.funcs_.isThemePartDefinedFunc ) {			Instance.funcs_.isThemePartDefinedFunc = (PFNISTHEMEPARTDEFINED)Instance.getProc("IsThemePartDefined", (FARPROC)IsThemePartDefinedFail);		}		return (*Instance.funcs_.isThemePartDefinedFunc)(hTheme, iPartId, iStateId);	}	static BOOL IsThemeBackgroundPartiallyTransparent(HTHEME hTheme,		int iPartId, int iStateId)	{		if ( NULL == Instance.funcs_.isThemeBackgroundPartiallyTransparentFunc ) {

⌨️ 快捷键说明

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