summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qwindowsxpstyle_p_p.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-08-29 16:53:31 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2014-09-02 10:26:13 +0200
commit552639c3590e793023539078bd97aa8b1ba2c2d3 (patch)
treebb1c82ff72a806af7335471ca5dbea24eee4f4fa /src/widgets/styles/qwindowsxpstyle_p_p.h
parent31938846aec24970e4a53771db201a7f0ac9ac3a (diff)
Windows XP, Vista styles: Share dynamically resolved theme functions.
Extract a struct containing the function pointers and derive QWindowsXPStylePrivate from it, so that both styles can use them. Remove duplicated variables. Task-number: QTBUG-38858 Change-Id: I7c2c665b5930c56ffdf33c5185720f71517d146c Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
Diffstat (limited to 'src/widgets/styles/qwindowsxpstyle_p_p.h')
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index 7327fa5581..190055b24b 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -282,7 +282,65 @@ struct ThemeMapData {
hasAlphaChannel(false), wasAlphaSwapped(false), hadInvalidAlpha(false) {}
};
-class QWindowsXPStylePrivate : public QWindowsStylePrivate
+struct QWindowsUxThemeLib {
+ typedef bool (WINAPI *PtrIsAppThemed)();
+ typedef bool (WINAPI *PtrIsThemeActive)();
+ typedef HTHEME (WINAPI *PtrOpenThemeData)(HWND hwnd, LPCWSTR pszClassList);
+ typedef HRESULT (WINAPI *PtrCloseThemeData)(HTHEME hTheme);
+ typedef HRESULT (WINAPI *PtrDrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);
+ typedef HRESULT (WINAPI *PtrDrawThemeBackgroundEx)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const DTBGOPTS *pOptions);
+ typedef HRESULT (WINAPI *PtrGetCurrentThemeName)(OUT LPWSTR pszThemeFileName, int cchMaxNameChars, OUT OPTIONAL LPWSTR pszColorBuff, int cchMaxColorChars, OUT OPTIONAL LPWSTR pszSizeBuff, int cchMaxSizeChars);
+ typedef HRESULT (WINAPI *PtrGetThemeDocumentationProperty)(LPCWSTR pszThemeName, LPCWSTR pszPropertyName, OUT LPWSTR pszValueBuff, int cchMaxValChars);
+ typedef HRESULT (WINAPI *PtrGetThemeBool)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT BOOL *pfVal);
+ typedef HRESULT (WINAPI *PtrGetThemeColor)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT COLORREF *pColor);
+ typedef HRESULT (WINAPI *PtrGetThemeEnumValue)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal);
+ typedef HRESULT (WINAPI *PtrGetThemeFilename)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszThemeFileName, int cchMaxBuffChars);
+ typedef HRESULT (WINAPI *PtrGetThemeFont)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT LOGFONT *pFont);
+ typedef HRESULT (WINAPI *PtrGetThemeInt)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal);
+ typedef HRESULT (WINAPI *PtrGetThemeIntList)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT INTLIST *pIntList);
+ typedef HRESULT (WINAPI *PtrGetThemeMargins)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OPTIONAL RECT *prc, OUT MARGINS *pMargins);
+ typedef HRESULT (WINAPI *PtrGetThemeMetric)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT int *piVal);
+ typedef HRESULT (WINAPI *PtrGetThemePartSize)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz);
+ typedef HRESULT (WINAPI *PtrGetThemePosition)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT POINT *pPoint);
+ typedef HRESULT (WINAPI *PtrGetThemePropertyOrigin)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT enum PROPERTYORIGIN *pOrigin);
+ typedef HRESULT (WINAPI *PtrGetThemeRect)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT RECT *pRect);
+ typedef HRESULT (WINAPI *PtrGetThemeString)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszBuff, int cchMaxBuffChars);
+ typedef HRESULT (WINAPI *PtrGetThemeBackgroundRegion)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pRect, OUT HRGN *pRegion);
+ typedef BOOL (WINAPI *PtrIsThemeBackgroundPartiallyTransparent)(HTHEME hTheme, int iPartId, int iStateId);
+ typedef HRESULT (WINAPI *PtrSetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList);
+ typedef HRESULT (WINAPI *PtrGetThemeTransitionDuration)(HTHEME hTheme, int iPartId, int iStateFromId, int iStateToId, int iPropId, int *pDuration);
+
+ static bool resolveSymbols();
+
+ static PtrIsAppThemed pIsAppThemed;
+ static PtrIsThemeActive pIsThemeActive;
+ static PtrOpenThemeData pOpenThemeData;
+ static PtrCloseThemeData pCloseThemeData;
+ static PtrDrawThemeBackground pDrawThemeBackground;
+ static PtrDrawThemeBackgroundEx pDrawThemeBackgroundEx;
+ static PtrGetCurrentThemeName pGetCurrentThemeName;
+ static PtrGetThemeBool pGetThemeBool;
+ static PtrGetThemeColor pGetThemeColor;
+ static PtrGetThemeEnumValue pGetThemeEnumValue;
+ static PtrGetThemeFilename pGetThemeFilename;
+ static PtrGetThemeFont pGetThemeFont;
+ static PtrGetThemeInt pGetThemeInt;
+ static PtrGetThemeIntList pGetThemeIntList;
+ static PtrGetThemeMargins pGetThemeMargins;
+ static PtrGetThemeMetric pGetThemeMetric;
+ static PtrGetThemePartSize pGetThemePartSize;
+ static PtrGetThemePosition pGetThemePosition;
+ static PtrGetThemePropertyOrigin pGetThemePropertyOrigin;
+ static PtrGetThemeRect pGetThemeRect;
+ static PtrGetThemeString pGetThemeString;
+ static PtrGetThemeBackgroundRegion pGetThemeBackgroundRegion;
+ static PtrGetThemeDocumentationProperty pGetThemeDocumentationProperty;
+ static PtrIsThemeBackgroundPartiallyTransparent pIsThemeBackgroundPartiallyTransparent;
+ static PtrSetWindowTheme pSetWindowTheme;
+ static PtrGetThemeTransitionDuration pGetThemeTransitionDuration; // Windows Vista onwards.
+};
+
+class QWindowsXPStylePrivate : public QWindowsStylePrivate, public QWindowsUxThemeLib
{
Q_DECLARE_PUBLIC(QWindowsXPStyle)
public: