diff options
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 27 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 62 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle.cpp | 291 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle_p_p.h | 163 |
4 files changed, 81 insertions, 462 deletions
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index e0e9d0f6f1..7ce9bbc273 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -42,7 +42,6 @@ #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) -#include <private/qsystemlibrary_p.h> #include "qapplication.h" #include "qbitmap.h" #include "qdrawutil.h" // for now @@ -87,26 +86,7 @@ QT_END_INCLUDE_NAMESPACE # define COLOR_GRADIENTINACTIVECAPTION 28 # endif - -typedef struct -{ - DWORD cbSize; - HICON hIcon; - int iSysImageIndex; - int iIcon; - WCHAR szPath[MAX_PATH]; -} QSHSTOCKICONINFO; - -#define _SHGFI_SMALLICON 0x000000001 -#define _SHGFI_LARGEICON 0x000000000 -#define _SHGFI_ICON 0x000000100 -#define _SIID_SHIELD 77 - -typedef HRESULT (WINAPI *PtrSHGetStockIconInfo)(int siid, int uFlags, QSHSTOCKICONINFO *psii); -static PtrSHGetStockIconInfo pSHGetStockIconInfo = 0; - Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &); -Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon); #endif //Q_OS_WIN QT_BEGIN_INCLUDE_NAMESPACE @@ -122,13 +102,6 @@ enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight }; QWindowsStylePrivate::QWindowsStylePrivate() : alt_down(false), menuBarTimer(0) { -#if defined(Q_OS_WIN) - if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { - QSystemLibrary shellLib(QLatin1String("shell32")); - pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo"); - } -#endif } qreal QWindowsStylePrivate::appDevicePixelRatio() diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index dce0a93e10..83820016aa 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -43,7 +43,6 @@ #include <qwindow.h> #include <private/qstyleanimation_p.h> #include <private/qstylehelper_p.h> -#include <private/qsystemlibrary_p.h> #include <private/qapplication_p.h> #include <qpa/qplatformnativeinterface.h> @@ -88,8 +87,7 @@ bool QWindowsVistaStylePrivate::useVista() { return (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) - && QWindowsVistaStylePrivate::useXP() - && QWindowsVistaStylePrivate::pGetThemeTransitionDuration != Q_NULLPTR; + && QWindowsVistaStylePrivate::useXP(); } /* \internal @@ -356,13 +354,13 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt HTHEME theme; int partId; - int duration; + DWORD duration; int fromState = 0; int toState = 0; //translate state flags to UXTHEME states : if (element == PE_FrameLineEdit) { - theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Edit"); + theme = OpenThemeData(0, L"Edit"); partId = EP_EDITBORDER_NOSCROLL; if (oldState & State_MouseOver) @@ -380,7 +378,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt toState = ETS_NORMAL; } else { - theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Button"); + theme = OpenThemeData(0, L"Button"); if (element == PE_IndicatorRadioButton) partId = BP_RADIOBUTTON; else if (element == PE_IndicatorCheckBox) @@ -393,9 +391,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt } // Retrieve the transition time between the states from the system. - if (theme && QWindowsXPStylePrivate::pGetThemeTransitionDuration(theme, partId, fromState, toState, - TMT_TRANSITIONDURATIONS, &duration) == S_OK) - { + if (theme + && SUCCEEDED(GetThemeTransitionDuration(theme, partId, fromState, toState, + TMT_TRANSITIONDURATIONS, &duration))) { t->setDuration(duration); } t->setStartTime(QTime::currentTime()); @@ -513,7 +511,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt EP_EDITBORDER_HVSCROLL, stateId, option->rect); // Since EP_EDITBORDER_HVSCROLL does not us borderfill, theme.noContent cannot be used for clipping int borderSize = 1; - QWindowsXPStylePrivate::pGetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize); + GetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize); QRegion clipRegion = option->rect; QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize); clipRegion ^= content; @@ -548,22 +546,18 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt return; } int bgType; - QWindowsXPStylePrivate::pGetThemeEnumValue( theme.handle(), - partId, - stateId, - TMT_BGTYPE, - &bgType); + GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType); if( bgType == BT_IMAGEFILE ) { d->drawBackground(theme); } else { QBrush fillColor = option->palette.brush(QPalette::Base); 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))); } } @@ -899,12 +893,12 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption t->setEndImage(endImage); - int duration = 0; - HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Button"); + DWORD duration = 0; + const HTHEME theme = OpenThemeData(0, L"Button"); int fromState = buttonStateId(oldState, BP_PUSHBUTTON); int toState = buttonStateId(option->state, BP_PUSHBUTTON); - if (QWindowsXPStylePrivate::pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, fromState, toState, TMT_TRANSITIONDURATIONS, &duration) == S_OK) + if (GetThemeTransitionDuration(theme, BP_PUSHBUTTON, fromState, toState, TMT_TRANSITIONDURATIONS, &duration) == S_OK) t->setDuration(duration); else t->setDuration(0); @@ -1456,7 +1450,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption // We cannot currently get the correct selection color for "explorer style" views COLORREF cref = 0; XPThemeData theme(d->treeViewHelper(), 0, QLatin1String("LISTVIEW"), 0, 0); - unsigned int res = pGetThemeColor(theme.handle(), LVP_LISTITEM, LISS_SELECTED, TMT_TEXTCOLOR, &cref); + unsigned int res = GetThemeColor(theme.handle(), LVP_LISTITEM, LISS_SELECTED, TMT_TEXTCOLOR, &cref); QColor textColor(GetRValue(cref), GetGValue(cref), GetBValue(cref)); */ QPalette palette = vopt->palette; @@ -1925,7 +1919,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption case SE_PushButtonContents: if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { MARGINS borderSize; - HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"Button"); + const HTHEME theme = OpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"Button"); if (theme) { int stateId = PBS_NORMAL; if (!(option->state & State_Enabled)) @@ -1940,15 +1934,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption 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); @@ -2318,14 +2304,12 @@ void QWindowsVistaStyle::polish(QWidget *widget) //we do not have to care about unpolishing widget->setContentsMargins(3, 0, 4, 0); COLORREF bgRef; - HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"TOOLTIP"); - if (theme) { - if (QWindowsXPStylePrivate::pGetThemeColor(theme, TTP_STANDARD, TTSS_NORMAL, TMT_TEXTCOLOR, &bgRef) == S_OK) { - QColor textColor = QColor::fromRgb(bgRef); - QPalette pal; - pal.setColor(QPalette::All, QPalette::ToolTipText, textColor); - widget->setPalette(pal); - } + HTHEME theme = OpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"TOOLTIP"); + if (theme && SUCCEEDED(GetThemeColor(theme, TTP_STANDARD, TTSS_NORMAL, TMT_TEXTCOLOR, &bgRef))) { + QColor textColor = QColor::fromRgb(bgRef); + QPalette pal; + pal.setColor(QPalette::All, QPalette::ToolTipText, textColor); + widget->setPalette(pal); } } else if (qobject_cast<QMessageBox *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground); diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index b39cecbd73..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; } @@ -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 @@ -1342,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; } @@ -1469,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); @@ -1664,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)); @@ -1730,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; @@ -1747,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))); } } @@ -1777,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++; @@ -2564,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), @@ -3163,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(), @@ -4197,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: @@ -4222,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; @@ -4258,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); } @@ -4266,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; @@ -4278,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); } @@ -4289,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; @@ -4297,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; @@ -4305,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); } @@ -4314,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]); @@ -4366,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); } } @@ -4376,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); } @@ -4387,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); diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 8ee4d1a641..91d60c8e82 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -57,101 +57,12 @@ #include <qt_windows.h> #include <uxtheme.h> - -#if WINVER >= 0x0600 #include <vssym32.h> -#else -#include <tmschema.h> -#endif #include <limits.h> QT_BEGIN_NAMESPACE -// Older Platform SDKs do not have the extended DrawThemeBackgroundEx -// function. We add the needed parts here, and use the extended -// function dynamically, if available in uxtheme.dll. Else, we revert -// back to using the DrawThemeBackground function. -#ifndef DTBG_OMITBORDER -# ifndef DTBG_CLIPRECT -# define DTBG_CLIPRECT 0x00000001 -# endif -# ifndef DTBG_DRAWSOLID -# define DTBG_DRAWSOLID 0x00000002 -# endif -# ifndef DTBG_OMITBORDER -# define DTBG_OMITBORDER 0x00000004 -# endif -# ifndef DTBG_OMITCONTENT -# define DTBG_OMITCONTENT 0x00000008 -# endif -# ifndef DTBG_COMPUTINGREGION -# define DTBG_COMPUTINGREGION 0x00000010 -# endif -# ifndef DTBG_MIRRORDC -# define DTBG_MIRRORDC 0x00000020 -# endif - typedef struct _DTBGOPTS - { - DWORD dwSize; - DWORD dwFlags; - RECT rcClip; - } DTBGOPTS, *PDTBGOPTS; -#endif // _DTBGOPTS - -// Undefined for some compile environments -#ifndef TMT_TEXTCOLOR -# define TMT_TEXTCOLOR 3803 -#endif -#ifndef TMT_BORDERCOLORHINT -# define TMT_BORDERCOLORHINT 3822 -#endif -#ifndef TMT_BORDERSIZE -# define TMT_BORDERSIZE 2403 -#endif -#ifndef TMT_BORDERONLY -# define TMT_BORDERONLY 2203 -#endif -#ifndef TMT_TRANSPARENTCOLOR -# define TMT_TRANSPARENTCOLOR 3809 -#endif -#ifndef TMT_CAPTIONMARGINS -# define TMT_CAPTIONMARGINS 3603 -#endif -#ifndef TMT_CONTENTMARGINS -# define TMT_CONTENTMARGINS 3602 -#endif -#ifndef TMT_SIZINGMARGINS -# define TMT_SIZINGMARGINS 3601 -#endif -#ifndef TMT_GLYPHTYPE -# define TMT_GLYPHTYPE 4012 -#endif -#ifndef TMT_BGTYPE -# define TMT_BGTYPE 4001 -#endif -#ifndef TMT_TEXTSHADOWTYPE -# define TMT_TEXTSHADOWTYPE 4010 -#endif -#ifndef TMT_BORDERCOLOR -# define TMT_BORDERCOLOR 3801 -#endif -#ifndef BT_IMAGEFILE -# define BT_IMAGEFILE 0 -#endif -#ifndef BT_BORDERFILL -# define BT_BORDERFILL 1 -#endif -#ifndef BT_NONE -# define BT_NONE 2 -#endif -#ifndef TMT_FILLCOLOR -# define TMT_FILLCOLOR 3802 -#endif -#ifndef TMT_PROGRESSCHUNKSIZE -# define TMT_PROGRESSCHUNKSIZE 2411 -#endif - // TMT_TEXTSHADOWCOLOR is wrongly defined in mingw #if TMT_TEXTSHADOWCOLOR != 3818 #undef TMT_TEXTSHADOWCOLOR @@ -161,13 +72,6 @@ QT_BEGIN_NAMESPACE # define TST_NONE 0 #endif -#ifndef GT_NONE -# define GT_NONE 0 -#endif -#ifndef GT_IMAGEGLYPH -# define GT_IMAGEGLYPH 1 -#endif - // These defines are missing from the tmschema, but still exist as // states for their parts #ifndef MINBS_INACTIVE @@ -278,65 +182,7 @@ struct ThemeMapData { hasAlphaChannel(false), wasAlphaSwapped(false), hadInvalidAlpha(false) {} }; -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 +class QWindowsXPStylePrivate : public QWindowsStylePrivate { Q_DECLARE_PUBLIC(QWindowsXPStyle) public: @@ -385,7 +231,6 @@ public: HDC bufferHDC() { return bufferDC;} - static bool resolveSymbols(); static bool useXP(bool update = false); static QRect scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme); @@ -443,7 +288,7 @@ inline QSizeF XPThemeData::size() QSizeF result(0, 0); if (isValid()) { SIZE size; - if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size))) + if (SUCCEEDED(GetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size))) result = QSize(size.cx, size.cy); } return result; @@ -455,7 +300,7 @@ inline QMarginsF XPThemeData::margins(const QRect &qRect, int propId) if (isValid()) { MARGINS margins; RECT rect = XPThemeData::toRECT(qRect); - if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, &rect, &margins))) + if (SUCCEEDED(GetThemeMargins(handle(), 0, partId, stateId, propId, &rect, &margins))) result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight); } return result; @@ -466,7 +311,7 @@ inline QMarginsF XPThemeData::margins(int propId) QMarginsF result(0, 0, 0 ,0); if (isValid()) { MARGINS margins; - if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins))) + if (SUCCEEDED(GetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins))) result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight); } return result; |