diff options
Diffstat (limited to 'src/widgets/styles/qwindowsxpstyle.cpp')
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle.cpp | 298 |
1 files changed, 56 insertions, 242 deletions
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 3f38164c01..916210ad09 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -47,7 +47,6 @@ #include <qpa/qplatformnativeinterface.h> #include <private/qstylehelper_p.h> #include <private/qwidget_p.h> -#include <private/qsystemlibrary_p.h> #include <qpainter.h> #include <qpaintengine.h> #include <qwidget.h> @@ -76,78 +75,6 @@ QT_BEGIN_NAMESPACE -// Runtime resolved theme engine function calls - -QWindowsUxThemeLib::PtrIsAppThemed QWindowsUxThemeLib::pIsAppThemed = Q_NULLPTR; -QWindowsUxThemeLib::PtrIsThemeActive QWindowsUxThemeLib::pIsThemeActive = Q_NULLPTR; -QWindowsUxThemeLib::PtrOpenThemeData QWindowsUxThemeLib::pOpenThemeData = Q_NULLPTR; -QWindowsUxThemeLib::PtrCloseThemeData QWindowsUxThemeLib::pCloseThemeData = Q_NULLPTR; -QWindowsUxThemeLib::PtrDrawThemeBackground QWindowsUxThemeLib::pDrawThemeBackground = Q_NULLPTR; -QWindowsUxThemeLib::PtrDrawThemeBackgroundEx QWindowsUxThemeLib::pDrawThemeBackgroundEx = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetCurrentThemeName QWindowsUxThemeLib::pGetCurrentThemeName = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeBool QWindowsUxThemeLib::pGetThemeBool = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeColor QWindowsUxThemeLib::pGetThemeColor = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeEnumValue QWindowsUxThemeLib::pGetThemeEnumValue = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeFilename QWindowsUxThemeLib::pGetThemeFilename = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeFont QWindowsUxThemeLib::pGetThemeFont = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeInt QWindowsUxThemeLib::pGetThemeInt = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeIntList QWindowsUxThemeLib::pGetThemeIntList = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeMargins QWindowsUxThemeLib::pGetThemeMargins = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeMetric QWindowsUxThemeLib::pGetThemeMetric = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemePartSize QWindowsUxThemeLib::pGetThemePartSize = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemePosition QWindowsUxThemeLib::pGetThemePosition = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemePropertyOrigin QWindowsUxThemeLib::pGetThemePropertyOrigin = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeRect QWindowsUxThemeLib::pGetThemeRect = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeString QWindowsUxThemeLib::pGetThemeString = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeBackgroundRegion QWindowsUxThemeLib::pGetThemeBackgroundRegion = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeDocumentationProperty QWindowsUxThemeLib::pGetThemeDocumentationProperty = Q_NULLPTR; -QWindowsUxThemeLib::PtrIsThemeBackgroundPartiallyTransparent - QWindowsUxThemeLib::pIsThemeBackgroundPartiallyTransparent = Q_NULLPTR; -QWindowsUxThemeLib::PtrSetWindowTheme QWindowsUxThemeLib::pSetWindowTheme = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeTransitionDuration QWindowsUxThemeLib::pGetThemeTransitionDuration = Q_NULLPTR; - -bool QWindowsUxThemeLib::resolveSymbols() -{ - static bool tried = false; - if (tried) - return pIsAppThemed != Q_NULLPTR; - tried = true; - QSystemLibrary themeLib(QLatin1String("uxtheme")); - if (!themeLib.load()) - return false; - pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed"); - if (!pIsAppThemed) - return false; - pIsThemeActive = (PtrIsThemeActive )themeLib.resolve("IsThemeActive"); - pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize"); - pOpenThemeData = (PtrOpenThemeData )themeLib.resolve("OpenThemeData"); - pCloseThemeData = (PtrCloseThemeData )themeLib.resolve("CloseThemeData"); - pDrawThemeBackground = (PtrDrawThemeBackground )themeLib.resolve("DrawThemeBackground"); - pDrawThemeBackgroundEx = (PtrDrawThemeBackgroundEx )themeLib.resolve("DrawThemeBackgroundEx"); - pGetCurrentThemeName = (PtrGetCurrentThemeName )themeLib.resolve("GetCurrentThemeName"); - pGetThemeBool = (PtrGetThemeBool )themeLib.resolve("GetThemeBool"); - pGetThemeColor = (PtrGetThemeColor )themeLib.resolve("GetThemeColor"); - pGetThemeEnumValue = (PtrGetThemeEnumValue )themeLib.resolve("GetThemeEnumValue"); - pGetThemeFilename = (PtrGetThemeFilename )themeLib.resolve("GetThemeFilename"); - pGetThemeFont = (PtrGetThemeFont )themeLib.resolve("GetThemeFont"); - pGetThemeInt = (PtrGetThemeInt )themeLib.resolve("GetThemeInt"); - pGetThemeIntList = (PtrGetThemeIntList )themeLib.resolve("GetThemeIntList"); - pGetThemeMargins = (PtrGetThemeMargins )themeLib.resolve("GetThemeMargins"); - pGetThemeMetric = (PtrGetThemeMetric )themeLib.resolve("GetThemeMetric"); - pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize"); - pGetThemePosition = (PtrGetThemePosition )themeLib.resolve("GetThemePosition"); - pGetThemePropertyOrigin = (PtrGetThemePropertyOrigin)themeLib.resolve("GetThemePropertyOrigin"); - pGetThemeRect = (PtrGetThemeRect )themeLib.resolve("GetThemeRect"); - pGetThemeString = (PtrGetThemeString )themeLib.resolve("GetThemeString"); - pGetThemeBackgroundRegion = (PtrGetThemeBackgroundRegion )themeLib.resolve("GetThemeBackgroundRegion"); - pGetThemeDocumentationProperty = (PtrGetThemeDocumentationProperty )themeLib.resolve("GetThemeDocumentationProperty"); - pIsThemeBackgroundPartiallyTransparent = (PtrIsThemeBackgroundPartiallyTransparent)themeLib.resolve("IsThemeBackgroundPartiallyTransparent"); - pSetWindowTheme = (PtrSetWindowTheme )themeLib.resolve("SetWindowTheme"); - if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) - pGetThemeTransitionDuration = (PtrGetThemeTransitionDuration)themeLib.resolve("GetThemeTransitionDuration"); - return true; -} - // General const values static const int windowsItemFrame = 2; // menu item frame width static const int windowsItemHMargin = 3; // menu item hor text margin @@ -231,7 +158,7 @@ RECT XPThemeData::toRECT(const QRect &qr) */ HRGN XPThemeData::mask(QWidget *widget) { - if (!QWindowsXPStylePrivate::pIsThemeBackgroundPartiallyTransparent(handle(), partId, stateId)) + if (!IsThemeBackgroundPartiallyTransparent(handle(), partId, stateId)) return 0; HRGN hrgn; @@ -239,7 +166,7 @@ HRGN XPThemeData::mask(QWidget *widget) if (widget) dc = hdcForWidgetBackingStore(widget); RECT nativeRect = toRECT(rect); - QWindowsXPStylePrivate::pGetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn); + GetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn); return hrgn; } @@ -272,7 +199,7 @@ static HRGN qt_hrgn_from_qregion(const QRegion ®ion) qt_add_rect(hRegion, region.boundingRect()); return hRegion; } - foreach (const QRect &rect, region.rects()) + for (const QRect &rect : region) qt_add_rect(hRegion, rect); return hRegion; } @@ -285,8 +212,7 @@ bool QWindowsXPStylePrivate::useXP(bool update) { if (!update) return use_xp; - return (use_xp = QWindowsUxThemeLib::resolveSymbols() && pIsThemeActive() - && (pIsAppThemed() || !QApplication::instance())); + return use_xp = IsThemeActive() && (IsAppThemed() || !QApplication::instance()); } /* \internal @@ -366,7 +292,7 @@ bool QWindowsXPStylePrivate::initVistaTreeViewTheming() qWarning("Unable to create the treeview helper window."); return false; } - if (FAILED(QWindowsXPStylePrivate::pSetWindowTheme(m_vistaTreeViewHelper, L"explorer", NULL))) { + if (FAILED(SetWindowTheme(m_vistaTreeViewHelper, L"explorer", NULL))) { qErrnoWarning("SetWindowTheme() failed."); cleanupVistaTreeViewTheming(); return false; @@ -391,7 +317,7 @@ void QWindowsXPStylePrivate::cleanupHandleMap() { for (int i = 0; i < NThemes; ++i) if (m_themes[i]) { - pCloseThemeData(m_themes[i]); + CloseThemeData(m_themes[i]); m_themes[i] = 0; } QWindowsXPStylePrivate::cleanupVistaTreeViewTheming(); @@ -407,7 +333,7 @@ HTHEME QWindowsXPStylePrivate::createTheme(int theme, HWND hwnd) const wchar_t *name = themeNames[theme]; if (theme == VistaTreeViewTheme && QWindowsXPStylePrivate::initVistaTreeViewTheming()) hwnd = QWindowsXPStylePrivate::m_vistaTreeViewHelper; - m_themes[theme] = pOpenThemeData(hwnd, name); + m_themes[theme] = OpenThemeData(hwnd, name); if (Q_UNLIKELY(!m_themes[theme])) qErrnoWarning("OpenThemeData() failed for theme %d (%s).", theme, qPrintable(themeName(theme))); @@ -505,48 +431,6 @@ const QPixmap *QWindowsXPStylePrivate::tabBody(QWidget *widget) } /*! \internal - Returns \c true if all the necessary theme engine symbols were - resolved. -*/ -bool QWindowsXPStylePrivate::resolveSymbols() -{ - static bool tried = false; - if (!tried) { - tried = true; - QSystemLibrary themeLib(QLatin1String("uxtheme")); - pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed"); - if (pIsAppThemed) { - pIsThemeActive = (PtrIsThemeActive )themeLib.resolve("IsThemeActive"); - pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize"); - pOpenThemeData = (PtrOpenThemeData )themeLib.resolve("OpenThemeData"); - pCloseThemeData = (PtrCloseThemeData )themeLib.resolve("CloseThemeData"); - pDrawThemeBackground = (PtrDrawThemeBackground )themeLib.resolve("DrawThemeBackground"); - pDrawThemeBackgroundEx = (PtrDrawThemeBackgroundEx )themeLib.resolve("DrawThemeBackgroundEx"); - pGetCurrentThemeName = (PtrGetCurrentThemeName )themeLib.resolve("GetCurrentThemeName"); - pGetThemeBool = (PtrGetThemeBool )themeLib.resolve("GetThemeBool"); - pGetThemeColor = (PtrGetThemeColor )themeLib.resolve("GetThemeColor"); - pGetThemeEnumValue = (PtrGetThemeEnumValue )themeLib.resolve("GetThemeEnumValue"); - pGetThemeFilename = (PtrGetThemeFilename )themeLib.resolve("GetThemeFilename"); - pGetThemeFont = (PtrGetThemeFont )themeLib.resolve("GetThemeFont"); - pGetThemeInt = (PtrGetThemeInt )themeLib.resolve("GetThemeInt"); - pGetThemeIntList = (PtrGetThemeIntList )themeLib.resolve("GetThemeIntList"); - pGetThemeMargins = (PtrGetThemeMargins )themeLib.resolve("GetThemeMargins"); - pGetThemeMetric = (PtrGetThemeMetric )themeLib.resolve("GetThemeMetric"); - pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize"); - pGetThemePosition = (PtrGetThemePosition )themeLib.resolve("GetThemePosition"); - pGetThemePropertyOrigin = (PtrGetThemePropertyOrigin)themeLib.resolve("GetThemePropertyOrigin"); - pGetThemeRect = (PtrGetThemeRect )themeLib.resolve("GetThemeRect"); - pGetThemeString = (PtrGetThemeString )themeLib.resolve("GetThemeString"); - pGetThemeBackgroundRegion = (PtrGetThemeBackgroundRegion )themeLib.resolve("GetThemeBackgroundRegion"); - pGetThemeDocumentationProperty = (PtrGetThemeDocumentationProperty )themeLib.resolve("GetThemeDocumentationProperty"); - pIsThemeBackgroundPartiallyTransparent = (PtrIsThemeBackgroundPartiallyTransparent)themeLib.resolve("IsThemeBackgroundPartiallyTransparent"); - } - } - - return pIsAppThemed != 0; -} - -/*! \internal Returns a native buffer (DIB section) of at least the size of ( \a x , \a y ). The buffer has a 32 bit depth, to not lose the alpha values on proper alpha-pixmaps. @@ -614,8 +498,8 @@ HBITMAP QWindowsXPStylePrivate::buffer(int w, int h) */ bool QWindowsXPStylePrivate::isTransparent(XPThemeData &themeData) { - return pIsThemeBackgroundPartiallyTransparent(themeData.handle(), themeData.partId, - themeData.stateId); + return IsThemeBackgroundPartiallyTransparent(themeData.handle(), themeData.partId, + themeData.stateId); } @@ -626,9 +510,10 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData) { HRGN hRgn = 0; RECT rect = themeData.toRECT(themeData.rect); - if (!SUCCEEDED(pGetThemeBackgroundRegion(themeData.handle(), bufferHDC(), themeData.partId, - themeData.stateId, &rect, &hRgn))) + if (!SUCCEEDED(GetThemeBackgroundRegion(themeData.handle(), bufferHDC(), themeData.partId, + themeData.stateId, &rect, &hRgn))) { return QRegion(); + } HRGN dest = CreateRectRgn(0, 0, 0, 0); const bool success = CombineRgn(dest, hRgn, 0, RGN_COPY) != ERROR; @@ -822,7 +707,6 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) bool canDrawDirectly = false; if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate && tt != ComplexTransform && !themeData.mirrorVertically - && (!themeData.mirrorHorizontally || pDrawThemeBackgroundEx) && !translucentToplevel) { // Draw on backing store DC only for real widgets or backing store images. const QPaintDevice *enginePaintDevice = painter->paintEngine()->paintDevice(); @@ -904,44 +788,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa | (themeData.noContent ? DTBG_OMITCONTENT : 0) | (themeData.mirrorHorizontally ? DTBG_MIRRORDC : 0); - HRESULT result = S_FALSE; - if (pDrawThemeBackgroundEx != 0) { - result = pDrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &drawOptions); - } else { - // We are running on a system where the uxtheme.dll does not have - // the DrawThemeBackgroundEx function, so we need to clip away - // borders or contents manually. All flips and mirrors uses the - // fallback implementation - - int borderSize = 0; - PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin); - pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize); - - // Clip away border region - QRegion extraClip = sysRgn; - if ((origin == PO_CLASS || origin == PO_PART || origin == PO_STATE) && borderSize > 0) { - if (themeData.noBorder) { - // extraClip &= area is already done - drawRECT = themeData.toRECT(area.adjusted(-borderSize, -borderSize, borderSize, borderSize)); - } - - // Clip away content region - if (themeData.noContent) { - QRegion content = area.adjusted(borderSize, borderSize, -borderSize, -borderSize); - extraClip ^= content; - } - - // Set the clip region, if used.. - if (themeData.noBorder || themeData.noContent) { - DeleteObject(hrgn); - hrgn = qt_hrgn_from_qregion(extraClip); - SelectClipRgn(dc, hrgn); - } - } - - result = pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &(drawOptions.rcClip)); - } + const HRESULT result = DrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &drawOptions); SelectClipRgn(dc, 0); DeleteObject(hrgn); return SUCCEEDED(result); @@ -1020,17 +867,17 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa BOOL tmt_borderonly = false; COLORREF tmt_transparentcolor = 0x0; PROPERTYORIGIN proporigin = PO_NOTFOUND; - pGetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERONLY, &tmt_borderonly); - pGetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, TMT_TRANSPARENTCOLOR, &tmt_transparentcolor); - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_CAPTIONMARGINS, &proporigin); + GetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERONLY, &tmt_borderonly); + GetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, TMT_TRANSPARENTCOLOR, &tmt_transparentcolor); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_CAPTIONMARGINS, &proporigin); partIsTransparent = isTransparent(themeData); potentialInvalidAlpha = false; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &proporigin); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &proporigin); if (proporigin == PO_PART || proporigin == PO_STATE) { int tmt_glyphtype = GT_NONE; - pGetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &tmt_glyphtype); + GetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &tmt_glyphtype); potentialInvalidAlpha = partIsTransparent && tmt_glyphtype == GT_IMAGEGLYPH; } @@ -1060,8 +907,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa int borderSize = 0; PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin); - pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin); + GetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize); // Clip away border region if ((origin == PO_CLASS || origin == PO_PART || origin == PO_STATE) && borderSize > 0) { @@ -1094,8 +941,6 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa // Difference between area and rect int dx = area.x() - rect.x(); int dy = area.y() - rect.y(); - int dr = area.right() - rect.right(); - int db = area.bottom() - rect.bottom(); // Adjust so painting rect starts from Origo rect.moveTo(0,0); @@ -1108,24 +953,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa | (themeData.noContent ? DTBG_OMITCONTENT : 0); // Drawing the part into the backing store - if (pDrawThemeBackgroundEx != 0) { - RECT rect(themeData.toRECT(area)); - pDrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &rect, &drawOptions); - } else { - // Set the clip region, if used.. - if (addBorderContentClipping) { - HRGN hrgn = qt_hrgn_from_qregion(extraClip); - SelectClipRgn(dc, hrgn); - // Compensate for the noBorder area difference (noContent has the same area) - drawOptions.rcClip = themeData.toRECT(rect.adjusted(dx, dy, dr, db)); - DeleteObject(hrgn); - } - - pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawOptions.rcClip), 0); - - if (addBorderContentClipping) - SelectClipRgn(dc, 0); - } + RECT wRect(themeData.toRECT(area)); + DrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &wRect, &drawOptions); // If not cached, analyze the buffer data to figure // out alpha type, and if it contains data @@ -1183,11 +1012,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa painter->setClipRegion(newRegion); #if defined(DEBUG_XP_STYLE) && 0 printf("Using region:\n"); - QVector<QRect> rects = newRegion.rects(); - for (int i = 0; i < rects.count(); ++i) { - const QRect &r = rects.at(i); + for (const QRect &r : newRegion) printf(" (%d, %d, %d, %d)\n", r.x(), r.y(), r.right(), r.bottom()); - } #endif } @@ -1345,12 +1171,12 @@ void QWindowsXPStyle::polish(QWidget *widget) // Get text color for group box labels COLORREF cref; XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0); - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref); + GetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref); d->groupBoxTextColor = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref)); - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref); + GetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref); d->groupBoxTextColorDisabled = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref)); // Where does this color come from? - //pGetThemeColor(theme.handle(), TKP_TICS, TSS_NORMAL, TMT_COLOR, &cref); + //GetThemeColor(theme.handle(), TKP_TICS, TSS_NORMAL, TMT_COLOR, &cref); d->sliderTickColor = qRgb(165, 162, 148); d->hasInitColors = true; } @@ -1472,15 +1298,7 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option, int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget); rect = option->rect.adjusted(border, border, -border, -border); - int result = QWindowsXPStylePrivate::pGetThemeMargins(theme, - NULL, - BP_PUSHBUTTON, - stateId, - TMT_CONTENTMARGINS, - NULL, - &borderSize); - - if (result == S_OK) { + if (SUCCEEDED(GetThemeMargins(theme, NULL, BP_PUSHBUTTON, stateId, TMT_CONTENTMARGINS, NULL, &borderSize))) { rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight, -borderSize.cxRightWidth, -borderSize.cyBottomHeight); rect = visualRect(option->direction, option->rect, rect); @@ -1667,14 +1485,14 @@ case PE_Frame: else stateId = ETS_NORMAL; int fillType; - if (QWindowsXPStylePrivate::pGetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &fillType) == S_OK) { + if (GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &fillType) == S_OK) { if (fillType == BT_BORDERFILL) { COLORREF bcRef; - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &bcRef); + GetThemeColor(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &bcRef); QColor bordercolor(qRgb(GetRValue(bcRef), GetGValue(bcRef), GetBValue(bcRef))); QPen oldPen = p->pen(); // int borderSize = 1; - // pGetThemeInt(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &borderSize); + // GetThemeInt(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &borderSize); // Inner white border p->setPen(QPen(option->palette.base().color(), 1)); @@ -1733,11 +1551,7 @@ case PE_Frame: return; } int bgType; - QWindowsXPStylePrivate::pGetThemeEnumValue( theme.handle(), - partId, - stateId, - TMT_BGTYPE, - &bgType); + GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType); if( bgType == BT_IMAGEFILE ) { theme.mirrorHorizontally = hMirrored; theme.mirrorVertically = vMirrored; @@ -1750,11 +1564,11 @@ case PE_Frame: if (!isEnabled) { PROPERTYORIGIN origin = PO_NOTFOUND; - QWindowsXPStylePrivate::pGetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin); + GetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin); // Use only if the fill property comes from our part if ((origin == PO_PART || origin == PO_STATE)) { COLORREF bgRef; - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef); + GetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef); fillColor = QBrush(qRgb(GetRValue(bgRef), GetGValue(bgRef), GetBValue(bgRef))); } } @@ -1780,7 +1594,7 @@ case PE_Frame: wchar_t themeFileName[maxlength]; wchar_t themeColor[maxlength]; // Due to a a scaling issue with the XP Silver theme, tab gradients are not used with it - if (QWindowsXPStylePrivate::pGetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) { + if (GetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) { wchar_t *offset = 0; if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) { offset++; @@ -2567,10 +2381,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, titleRect.width()); int result = TST_NONE; - QWindowsXPStylePrivate::pGetThemeEnumValue(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result); + GetThemeEnumValue(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result); if (result != TST_NONE) { COLORREF textShadowRef; - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef); + GetThemeColor(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef); QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef)); p->setPen(textShadow); drawItemText(p, titleRect.adjusted(1, 1, 1, 1), @@ -3166,10 +2980,10 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo QRect ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget); int result = TST_NONE; - QWindowsXPStylePrivate::pGetThemeEnumValue(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result); + GetThemeEnumValue(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result); if (result != TST_NONE) { COLORREF textShadowRef; - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef); + GetThemeColor(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef); QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef)); p->setPen(textShadow); p->drawText(ir.x() + 3, ir.y() + 2, ir.width() - 1, ir.height(), @@ -4200,7 +4014,7 @@ void QWindowsXPStylePrivate::dumpNativeDIB(int w, int h) static void showProperty(XPThemeData &themeData, const PropPair &prop) { PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); const char *originStr; switch(origin) { case PO_STATE: @@ -4225,35 +4039,35 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) case TMT_STRING: { wchar_t buffer[512]; - pGetThemeString(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512); + GetThemeString(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512); printf(" (%sString) %-20S: %S\n", originStr, prop.propName, buffer); } break; case TMT_ENUM: { int result = -1; - pGetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sEnum) %-20S: %d\n", originStr, prop.propName, result); } break; case TMT_INT: { int result = -1; - pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sint) %-20S: %d\n", originStr, prop.propName, result); } break; case TMT_BOOL: { BOOL result = false; - pGetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sbool) %-20S: %d\n", originStr, prop.propName, result); } break; case TMT_COLOR: { COLORREF result = 0; - pGetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%scolor) %-20S: 0x%08X\n", originStr, prop.propName, result); } break; @@ -4261,7 +4075,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { MARGINS result; memset(&result, 0, sizeof(result)); - pGetThemeMargins(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, 0, &result); + GetThemeMargins(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, 0, &result); printf(" (%smargins) %-20S: (%d, %d, %d, %d)\n", originStr, prop.propName, result.cxLeftWidth, result.cyTopHeight, result.cxRightWidth, result.cyBottomHeight); } @@ -4269,7 +4083,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) case TMT_FILENAME: { wchar_t buffer[512]; - pGetThemeFilename(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512); + GetThemeFilename(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512); printf(" (%sfilename)%-20S: %S\n", originStr, prop.propName, buffer); } break; @@ -4281,9 +4095,9 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) memset(&result1, 0, sizeof(result1)); memset(&result2, 0, sizeof(result2)); memset(&result3, 0, sizeof(result3)); - pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_MIN, &result1); - pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_TRUE, &result2); - pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_DRAW, &result3); + GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_MIN, &result1); + GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_TRUE, &result2); + GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_DRAW, &result3); printf(" (%ssize) %-20S: Min (%d, %d), True(%d, %d), Draw(%d, %d)\n", originStr, prop.propName, result1.cx, result1.cy, result2.cx, result2.cy, result3.cx, result3.cy); } @@ -4292,7 +4106,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { POINT result; memset(&result, 0, sizeof(result)); - pGetThemePosition(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemePosition(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sPosition)%-20S: (%d, %d)\n", originStr, prop.propName, result.x, result.y); } break; @@ -4300,7 +4114,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { RECT result; memset(&result, 0, sizeof(result)); - pGetThemeRect(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeRect(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sRect) %-20S: (%d, %d, %d, %d)\n", originStr, prop.propName, result.left, result.top, result.right, result.bottom); } break; @@ -4308,7 +4122,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { LOGFONT result; memset(&result, 0, sizeof(result)); - pGetThemeFont(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeFont(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sFont) %-20S: %S height(%d) width(%d) weight(%d)\n", originStr, prop.propName, result.lfFaceName, result.lfHeight, result.lfWidth, result.lfWeight); } @@ -4317,7 +4131,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { INTLIST result; memset(&result, 0, sizeof(result)); - pGetThemeIntList(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeIntList(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sInt list)%-20S: { ", originStr, prop.propName); for (int i = 0; i < result.iValueCount; ++i) printf("%d ", result.iValues[i]); @@ -4369,7 +4183,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData) for (int j = 0; j < all_props.count(); ++j) { PropPair prop = all_props.at(j); wchar_t buf[500]; - pGetThemeDocumentationProperty(themeName, prop.propName, buf, 500); + GetThemeDocumentationProperty(themeName, prop.propName, buf, 500); printf("%3d: (%4d) %-20S %S\n", j, prop.propValue, prop.propName, buf); } } @@ -4379,7 +4193,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData) for (int j = 0; j < all_props.count(); ++j) { PropPair prop = all_props.at(j); PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); if (origin == PO_GLOBAL) { showProperty(themeData, prop); } @@ -4390,7 +4204,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData) for (int j = 0; j < all_props.count(); ++j) { PropPair prop = all_props.at(j); PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); if (origin != PO_NOTFOUND) { showProperty(themeData, prop); |