QtWidgets: Increase Windows API level to 0x600 (Windows Vista).
Define WINVER, _WIN32_WINNT for MinGW in win.pri. Directly link to uxtheme and dwmapi and remove dynamic loading of functions that are present in Windows Vista onwards. Remove duplicated declarations of constants that are now present in the SDKs. Task-number: QTBUG-51673 Change-Id: I695a6673d7250b2788fd2f20aebd222fcabb0d47 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
3eb3007e9c
commit
af6b700bb8
@ -41,7 +41,6 @@
|
|||||||
#ifndef QT_NO_STYLE_WINDOWSVISTA
|
#ifndef QT_NO_STYLE_WINDOWSVISTA
|
||||||
|
|
||||||
#include "qwizard_win_p.h"
|
#include "qwizard_win_p.h"
|
||||||
#include <private/qsystemlibrary_p.h>
|
|
||||||
#include <private/qapplication_p.h>
|
#include <private/qapplication_p.h>
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#include "qwizard.h"
|
#include "qwizard.h"
|
||||||
@ -54,112 +53,19 @@
|
|||||||
#include <QtWidgets/QDesktopWidget>
|
#include <QtWidgets/QDesktopWidget>
|
||||||
|
|
||||||
#include <uxtheme.h>
|
#include <uxtheme.h>
|
||||||
|
#include <vssym32.h>
|
||||||
|
#include <dwmapi.h>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMargins)
|
Q_DECLARE_METATYPE(QMargins)
|
||||||
|
|
||||||
|
#ifndef WM_DWMCOMPOSITIONCHANGED
|
||||||
|
# define WM_DWMCOMPOSITIONCHANGED 0x031E
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
//DWM related
|
|
||||||
typedef struct { //MARGINS
|
|
||||||
int cxLeftWidth; // width of left border that retains its size
|
|
||||||
int cxRightWidth; // width of right border that retains its size
|
|
||||||
int cyTopHeight; // height of top border that retains its size
|
|
||||||
int cyBottomHeight; // height of bottom border that retains its size
|
|
||||||
} WIZ_MARGINS;
|
|
||||||
typedef struct { //DTTOPTS
|
|
||||||
DWORD dwSize;
|
|
||||||
DWORD dwFlags;
|
|
||||||
COLORREF crText;
|
|
||||||
COLORREF crBorder;
|
|
||||||
COLORREF crShadow;
|
|
||||||
int eTextShadowType;
|
|
||||||
POINT ptShadowOffset;
|
|
||||||
int iBorderSize;
|
|
||||||
int iFontPropId;
|
|
||||||
int iColorPropId;
|
|
||||||
int iStateId;
|
|
||||||
BOOL fApplyOverlay;
|
|
||||||
int iGlowSize;
|
|
||||||
} WIZ_DTTOPTS;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DWORD dwFlags;
|
|
||||||
DWORD dwMask;
|
|
||||||
} WIZ_WTA_OPTIONS;
|
|
||||||
|
|
||||||
#define WIZ_WM_THEMECHANGED 0x031A
|
|
||||||
#define WIZ_WM_DWMCOMPOSITIONCHANGED 0x031E
|
|
||||||
|
|
||||||
enum WIZ_WINDOWTHEMEATTRIBUTETYPE {
|
|
||||||
WIZ_WTA_NONCLIENT = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
#define WIZ_WTNCA_NODRAWCAPTION 0x00000001
|
|
||||||
#define WIZ_WTNCA_NODRAWICON 0x00000002
|
|
||||||
|
|
||||||
#define WIZ_DT_CENTER 0x00000001 //DT_CENTER
|
|
||||||
#define WIZ_DT_VCENTER 0x00000004
|
|
||||||
#define WIZ_DT_SINGLELINE 0x00000020
|
|
||||||
#define WIZ_DT_NOPREFIX 0x00000800
|
|
||||||
|
|
||||||
enum WIZ_NAVIGATIONPARTS { //NAVIGATIONPARTS
|
|
||||||
WIZ_NAV_BACKBUTTON = 1,
|
|
||||||
WIZ_NAV_FORWARDBUTTON = 2,
|
|
||||||
WIZ_NAV_MENUBUTTON = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum WIZ_NAV_BACKBUTTONSTATES { //NAV_BACKBUTTONSTATES
|
|
||||||
WIZ_NAV_BB_NORMAL = 1,
|
|
||||||
WIZ_NAV_BB_HOT = 2,
|
|
||||||
WIZ_NAV_BB_PRESSED = 3,
|
|
||||||
WIZ_NAV_BB_DISABLED = 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define WIZ_TMT_CAPTIONFONT (801) //TMT_CAPTIONFONT
|
|
||||||
#define WIZ_DTT_COMPOSITED (1UL << 13) //DTT_COMPOSITED
|
|
||||||
#define WIZ_DTT_GLOWSIZE (1UL << 11) //DTT_GLOWSIZE
|
|
||||||
|
|
||||||
#define WIZ_WM_NCMOUSELEAVE 674 //WM_NCMOUSELEAVE
|
|
||||||
|
|
||||||
#define WIZ_WP_CAPTION 1 //WP_CAPTION
|
|
||||||
#define WIZ_CS_ACTIVE 1 //CS_ACTIVE
|
|
||||||
#define WIZ_TMT_FILLCOLORHINT 3821 //TMT_FILLCOLORHINT
|
|
||||||
#define WIZ_TMT_BORDERCOLORHINT 3822 //TMT_BORDERCOLORHINT
|
|
||||||
|
|
||||||
typedef BOOL (WINAPI *PtrDwmDefWindowProc)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult);
|
|
||||||
typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL* pfEnabled);
|
|
||||||
typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const WIZ_MARGINS* pMarInset);
|
|
||||||
typedef HRESULT (WINAPI *PtrSetWindowThemeAttribute)(HWND hwnd, enum WIZ_WINDOWTHEMEATTRIBUTETYPE eAttribute, PVOID pvAttribute, DWORD cbAttribute);
|
|
||||||
|
|
||||||
static PtrDwmDefWindowProc pDwmDefWindowProc = 0;
|
|
||||||
static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled = 0;
|
|
||||||
static PtrDwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea = 0;
|
|
||||||
static PtrSetWindowThemeAttribute pSetWindowThemeAttribute = 0;
|
|
||||||
|
|
||||||
//Theme related
|
|
||||||
typedef bool (WINAPI *PtrIsAppThemed)();
|
|
||||||
typedef bool (WINAPI *PtrIsThemeActive)();
|
|
||||||
typedef HANDLE (WINAPI *PtrOpenThemeData)(HWND hwnd, LPCWSTR pszClassList);
|
|
||||||
typedef HRESULT (WINAPI *PtrCloseThemeData)(HANDLE hTheme);
|
|
||||||
typedef HRESULT (WINAPI *PtrGetThemeSysFont)(HANDLE hTheme, int iFontId, LOGFONTW *plf);
|
|
||||||
typedef HRESULT (WINAPI *PtrDrawThemeTextEx)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT pRect, const WIZ_DTTOPTS *pOptions);
|
|
||||||
typedef HRESULT (WINAPI *PtrDrawThemeBackground)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);
|
|
||||||
typedef HRESULT (WINAPI *PtrGetThemePartSize)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz);
|
|
||||||
typedef HRESULT (WINAPI *PtrGetThemeColor)(HANDLE hTheme, int iPartId, int iStateId, int iPropId, OUT COLORREF *pColor);
|
|
||||||
|
|
||||||
static PtrIsAppThemed pIsAppThemed = 0;
|
|
||||||
static PtrIsThemeActive pIsThemeActive = 0;
|
|
||||||
static PtrOpenThemeData pOpenThemeData = 0;
|
|
||||||
static PtrCloseThemeData pCloseThemeData = 0;
|
|
||||||
static PtrGetThemeSysFont pGetThemeSysFont = 0;
|
|
||||||
static PtrDrawThemeTextEx pDrawThemeTextEx = 0;
|
|
||||||
static PtrDrawThemeBackground pDrawThemeBackground = 0;
|
|
||||||
static PtrGetThemePartSize pGetThemePartSize = 0;
|
|
||||||
static PtrGetThemeColor pGetThemeColor = 0;
|
|
||||||
|
|
||||||
int QVistaHelper::instanceCount = 0;
|
int QVistaHelper::instanceCount = 0;
|
||||||
int QVistaHelper::m_devicePixelRatio = 1;
|
int QVistaHelper::m_devicePixelRatio = 1;
|
||||||
bool QVistaHelper::is_vista = false;
|
|
||||||
QVistaHelper::VistaState QVistaHelper::cachedVistaState = QVistaHelper::Dirty;
|
QVistaHelper::VistaState QVistaHelper::cachedVistaState = QVistaHelper::Dirty;
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@ -179,14 +85,6 @@ QSize QVistaBackButton::sizeHint() const
|
|||||||
ensurePolished();
|
ensurePolished();
|
||||||
int size = int(QStyleHelper::dpiScaled(32));
|
int size = int(QStyleHelper::dpiScaled(32));
|
||||||
int width = size, height = size;
|
int width = size, height = size;
|
||||||
/*
|
|
||||||
HANDLE theme = pOpenThemeData(0, L"Navigation");
|
|
||||||
SIZE size;
|
|
||||||
if (pGetThemePartSize(theme, 0, WIZ_NAV_BACKBUTTON, WIZ_NAV_BB_NORMAL, 0, TS_TRUE, &size) == S_OK) {
|
|
||||||
width = size.cx;
|
|
||||||
height = size.cy;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return QSize(width, height);
|
return QSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +106,7 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
|
|||||||
{
|
{
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
QRect r = rect();
|
QRect r = rect();
|
||||||
HANDLE theme = pOpenThemeData(0, L"Navigation");
|
const HANDLE theme = OpenThemeData(0, L"Navigation");
|
||||||
//RECT rect;
|
//RECT rect;
|
||||||
QPoint origin;
|
QPoint origin;
|
||||||
const HDC hdc = QVistaHelper::backingStoreDC(parentWidget(), &origin);
|
const HDC hdc = QVistaHelper::backingStoreDC(parentWidget(), &origin);
|
||||||
@ -225,19 +123,17 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
|
|||||||
clipRect.left = rDp.left() + xoffsetDp;
|
clipRect.left = rDp.left() + xoffsetDp;
|
||||||
clipRect.right = rDp.right() + xoffsetDp;
|
clipRect.right = rDp.right() + xoffsetDp;
|
||||||
|
|
||||||
int state = WIZ_NAV_BB_NORMAL;
|
int state = NAV_BB_NORMAL;
|
||||||
if (!isEnabled())
|
if (!isEnabled())
|
||||||
state = WIZ_NAV_BB_DISABLED;
|
state = NAV_BB_DISABLED;
|
||||||
else if (isDown())
|
else if (isDown())
|
||||||
state = WIZ_NAV_BB_PRESSED;
|
state = NAV_BB_PRESSED;
|
||||||
else if (underMouse())
|
else if (underMouse())
|
||||||
state = WIZ_NAV_BB_HOT;
|
state = NAV_BB_HOT;
|
||||||
|
|
||||||
WIZ_NAVIGATIONPARTS buttonType = (layoutDirection() == Qt::LeftToRight
|
DrawThemeBackground(theme, hdc,
|
||||||
? WIZ_NAV_BACKBUTTON
|
layoutDirection() == Qt::LeftToRight ? NAV_BACKBUTTON : NAV_FORWARDBUTTON,
|
||||||
: WIZ_NAV_FORWARDBUTTON);
|
state, &clipRect, &clipRect);
|
||||||
|
|
||||||
pDrawThemeBackground(theme, hdc, buttonType, state, &clipRect, &clipRect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@ -251,13 +147,10 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
|
|||||||
, backButton_(0)
|
, backButton_(0)
|
||||||
{
|
{
|
||||||
QVistaHelper::m_devicePixelRatio = wizard->devicePixelRatio();
|
QVistaHelper::m_devicePixelRatio = wizard->devicePixelRatio();
|
||||||
is_vista = resolveSymbols();
|
|
||||||
if (instanceCount++ == 0)
|
if (instanceCount++ == 0)
|
||||||
cachedVistaState = Dirty;
|
cachedVistaState = Dirty;
|
||||||
if (is_vista) {
|
|
||||||
backButton_ = new QVistaBackButton(wizard);
|
backButton_ = new QVistaBackButton(wizard);
|
||||||
backButton_->hide();
|
backButton_->hide();
|
||||||
}
|
|
||||||
|
|
||||||
// Handle diff between Windows 7 and Vista
|
// Handle diff between Windows 7 and Vista
|
||||||
iconSpacing = QStyleHelper::dpiScaled(7);
|
iconSpacing = QStyleHelper::dpiScaled(7);
|
||||||
@ -292,20 +185,13 @@ void QVistaHelper::updateCustomMargins(bool vistaMargins)
|
|||||||
|
|
||||||
bool QVistaHelper::isCompositionEnabled()
|
bool QVistaHelper::isCompositionEnabled()
|
||||||
{
|
{
|
||||||
bool value = is_vista;
|
|
||||||
if (is_vista) {
|
|
||||||
HRESULT hr;
|
|
||||||
BOOL bEnabled;
|
BOOL bEnabled;
|
||||||
|
return SUCCEEDED(DwmIsCompositionEnabled(&bEnabled)) && bEnabled;
|
||||||
hr = pDwmIsCompositionEnabled(&bEnabled);
|
|
||||||
value = (SUCCEEDED(hr) && bEnabled);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QVistaHelper::isThemeActive()
|
bool QVistaHelper::isThemeActive()
|
||||||
{
|
{
|
||||||
return is_vista && pIsThemeActive();
|
return IsThemeActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVistaHelper::VistaState QVistaHelper::vistaState()
|
QVistaHelper::VistaState QVistaHelper::vistaState()
|
||||||
@ -326,11 +212,9 @@ QColor QVistaHelper::basicWindowFrameColor()
|
|||||||
{
|
{
|
||||||
DWORD rgb;
|
DWORD rgb;
|
||||||
HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
|
HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
|
||||||
HANDLE hTheme = pOpenThemeData(handle, L"WINDOW");
|
const HANDLE hTheme = OpenThemeData(handle, L"WINDOW");
|
||||||
pGetThemeColor(
|
GetThemeColor(hTheme, WP_CAPTION, CS_ACTIVE,
|
||||||
hTheme, WIZ_WP_CAPTION, WIZ_CS_ACTIVE,
|
wizard->isActiveWindow() ? TMT_FILLCOLORHINT : TMT_BORDERCOLORHINT, &rgb);
|
||||||
wizard->isActiveWindow() ? WIZ_TMT_FILLCOLORHINT : WIZ_TMT_BORDERCOLORHINT,
|
|
||||||
&rgb);
|
|
||||||
BYTE r = GetRValue(rgb);
|
BYTE r = GetRValue(rgb);
|
||||||
BYTE g = GetGValue(rgb);
|
BYTE g = GetGValue(rgb);
|
||||||
BYTE b = GetBValue(rgb);
|
BYTE b = GetBValue(rgb);
|
||||||
@ -341,13 +225,13 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
|
|||||||
{
|
{
|
||||||
bool value = false;
|
bool value = false;
|
||||||
if (vistaState() == VistaAero) {
|
if (vistaState() == VistaAero) {
|
||||||
WIZ_MARGINS mar = {0, 0, 0, 0};
|
MARGINS mar = {0, 0, 0, 0};
|
||||||
if (type == NormalTitleBar)
|
if (type == NormalTitleBar)
|
||||||
mar.cyTopHeight = 0;
|
mar.cyTopHeight = 0;
|
||||||
else
|
else
|
||||||
mar.cyTopHeight = (titleBarSize() + topOffset()) * QVistaHelper::m_devicePixelRatio;
|
mar.cyTopHeight = (titleBarSize() + topOffset()) * QVistaHelper::m_devicePixelRatio;
|
||||||
if (const HWND wizardHandle = wizardHWND())
|
if (const HWND wizardHandle = wizardHWND())
|
||||||
if (SUCCEEDED(pDwmExtendFrameIntoClientArea(wizardHandle, &mar)))
|
if (SUCCEEDED(DwmExtendFrameIntoClientArea(wizardHandle, &mar)))
|
||||||
value = true;
|
value = true;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
@ -359,7 +243,7 @@ static LOGFONT getCaptionLogFont(HANDLE hTheme)
|
|||||||
{
|
{
|
||||||
LOGFONT result = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0 } };
|
LOGFONT result = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0 } };
|
||||||
|
|
||||||
if (!hTheme || FAILED(pGetThemeSysFont(hTheme, WIZ_TMT_CAPTIONFONT, &result))) {
|
if (!hTheme || FAILED(GetThemeSysFont(hTheme, TMT_CAPTIONFONT, &result))) {
|
||||||
NONCLIENTMETRICS ncm;
|
NONCLIENTMETRICS ncm;
|
||||||
ncm.cbSize = sizeof(NONCLIENTMETRICS);
|
ncm.cbSize = sizeof(NONCLIENTMETRICS);
|
||||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, false);
|
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, false);
|
||||||
@ -370,10 +254,8 @@ static LOGFONT getCaptionLogFont(HANDLE hTheme)
|
|||||||
|
|
||||||
static bool getCaptionQFont(int dpi, QFont *result)
|
static bool getCaptionQFont(int dpi, QFont *result)
|
||||||
{
|
{
|
||||||
if (!pOpenThemeData)
|
|
||||||
return false;
|
|
||||||
const HANDLE hTheme =
|
const HANDLE hTheme =
|
||||||
pOpenThemeData(QApplicationPrivate::getHWNDForWidget(QApplication::desktop()), L"WINDOW");
|
OpenThemeData(QApplicationPrivate::getHWNDForWidget(QApplication::desktop()), L"WINDOW");
|
||||||
if (!hTheme)
|
if (!hTheme)
|
||||||
return false;
|
return false;
|
||||||
// Call into QWindowsNativeInterface to convert the LOGFONT into a QFont.
|
// Call into QWindowsNativeInterface to convert the LOGFONT into a QFont.
|
||||||
@ -448,16 +330,14 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
|
|||||||
|
|
||||||
void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
|
void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
|
||||||
{
|
{
|
||||||
if (is_vista) {
|
WTA_OPTIONS opt;
|
||||||
WIZ_WTA_OPTIONS opt;
|
opt.dwFlags = WTNCA_NODRAWICON | WTNCA_NODRAWCAPTION;
|
||||||
opt.dwFlags = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION;
|
|
||||||
if (visible)
|
if (visible)
|
||||||
opt.dwMask = 0;
|
opt.dwMask = 0;
|
||||||
else
|
else
|
||||||
opt.dwMask = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION;
|
opt.dwMask = WTNCA_NODRAWICON | WTNCA_NODRAWCAPTION;
|
||||||
if (const HWND handle = wizardHWND())
|
if (const HWND handle = wizardHWND())
|
||||||
pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS));
|
SetWindowThemeAttribute(handle, WTA_NONCLIENT, &opt, sizeof(WTA_OPTIONS));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QVistaHelper::winEvent(MSG* msg, long* result)
|
bool QVistaHelper::winEvent(MSG* msg, long* result)
|
||||||
@ -466,7 +346,7 @@ bool QVistaHelper::winEvent(MSG* msg, long* result)
|
|||||||
case WM_NCHITTEST: {
|
case WM_NCHITTEST: {
|
||||||
LRESULT lResult;
|
LRESULT lResult;
|
||||||
// Perform hit testing using DWM
|
// Perform hit testing using DWM
|
||||||
if (pDwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) {
|
if (DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) {
|
||||||
// DWM returned a hit, no further processing necessary
|
// DWM returned a hit, no further processing necessary
|
||||||
*result = lResult;
|
*result = lResult;
|
||||||
} else {
|
} else {
|
||||||
@ -485,7 +365,7 @@ bool QVistaHelper::winEvent(MSG* msg, long* result)
|
|||||||
default:
|
default:
|
||||||
LRESULT lResult;
|
LRESULT lResult;
|
||||||
// Pass to DWM to handle
|
// Pass to DWM to handle
|
||||||
if (pDwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult))
|
if (DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult))
|
||||||
*result = lResult;
|
*result = lResult;
|
||||||
// If the message wasn't handled by DWM, continue processing it as normal
|
// If the message wasn't handled by DWM, continue processing it as normal
|
||||||
else
|
else
|
||||||
@ -524,7 +404,7 @@ void QVistaHelper::mouseEvent(QEvent *event)
|
|||||||
|
|
||||||
bool QVistaHelper::handleWinEvent(MSG *message, long *result)
|
bool QVistaHelper::handleWinEvent(MSG *message, long *result)
|
||||||
{
|
{
|
||||||
if (message->message == WIZ_WM_THEMECHANGED || message->message == WIZ_WM_DWMCOMPOSITIONCHANGED)
|
if (message->message == WM_THEMECHANGED || message->message == WM_DWMCOMPOSITIONCHANGED)
|
||||||
cachedVistaState = Dirty;
|
cachedVistaState = Dirty;
|
||||||
|
|
||||||
bool status = false;
|
bool status = false;
|
||||||
@ -707,7 +587,7 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
|
|||||||
const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
|
const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
|
||||||
rect.size() * QVistaHelper::m_devicePixelRatio);
|
rect.size() * QVistaHelper::m_devicePixelRatio);
|
||||||
HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
|
HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
|
||||||
HANDLE hTheme = pOpenThemeData(handle, L"WINDOW");
|
const HANDLE hTheme = OpenThemeData(handle, L"WINDOW");
|
||||||
if (!hTheme) return false;
|
if (!hTheme) return false;
|
||||||
// Set up a memory DC and bitmap that we'll draw into
|
// Set up a memory DC and bitmap that we'll draw into
|
||||||
HDC dcMem;
|
HDC dcMem;
|
||||||
@ -732,15 +612,16 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
|
|||||||
HFONT hOldFont = (HFONT)SelectObject(dcMem, (HGDIOBJ) hCaptionFont);
|
HFONT hOldFont = (HFONT)SelectObject(dcMem, (HGDIOBJ) hCaptionFont);
|
||||||
|
|
||||||
// Draw the text!
|
// Draw the text!
|
||||||
WIZ_DTTOPTS dto;
|
DTTOPTS dto;
|
||||||
dto.dwSize = sizeof(WIZ_DTTOPTS);
|
memset(&dto, 0, sizeof(dto));
|
||||||
const UINT uFormat = WIZ_DT_SINGLELINE|WIZ_DT_CENTER|WIZ_DT_VCENTER|WIZ_DT_NOPREFIX;
|
dto.dwSize = sizeof(dto);
|
||||||
|
const UINT uFormat = DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX;
|
||||||
RECT rctext ={0,0, rectDp.width(), rectDp.height()};
|
RECT rctext ={0,0, rectDp.width(), rectDp.height()};
|
||||||
|
|
||||||
dto.dwFlags = WIZ_DTT_COMPOSITED|WIZ_DTT_GLOWSIZE;
|
dto.dwFlags = DTT_COMPOSITED|DTT_GLOWSIZE;
|
||||||
dto.iGlowSize = glowSize();
|
dto.iGlowSize = glowSize();
|
||||||
|
|
||||||
pDrawThemeTextEx(hTheme, dcMem, 0, 0, (LPCWSTR)text.utf16(), -1, uFormat, &rctext, &dto );
|
DrawThemeTextEx(hTheme, dcMem, 0, 0, reinterpret_cast<LPCWSTR>(text.utf16()), -1, uFormat, &rctext, &dto );
|
||||||
BitBlt(hdc, rectDp.left(), rectDp.top(), rectDp.width(), rectDp.height(), dcMem, 0, 0, SRCCOPY);
|
BitBlt(hdc, rectDp.left(), rectDp.top(), rectDp.width(), rectDp.height(), dcMem, 0, 0, SRCCOPY);
|
||||||
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
|
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
|
||||||
SelectObject(dcMem, (HGDIOBJ) hOldFont);
|
SelectObject(dcMem, (HGDIOBJ) hOldFont);
|
||||||
@ -813,51 +694,6 @@ int QVistaHelper::captionSizeDp()
|
|||||||
return GetSystemMetrics(SM_CYCAPTION);
|
return GetSystemMetrics(SM_CYCAPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QVistaHelper::resolveSymbols()
|
|
||||||
{
|
|
||||||
static bool tried = false;
|
|
||||||
if (!tried) {
|
|
||||||
tried = true;
|
|
||||||
QSystemLibrary dwmLib(L"dwmapi");
|
|
||||||
pDwmIsCompositionEnabled =
|
|
||||||
(PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
|
|
||||||
if (pDwmIsCompositionEnabled) {
|
|
||||||
pDwmDefWindowProc = (PtrDwmDefWindowProc)dwmLib.resolve("DwmDefWindowProc");
|
|
||||||
pDwmExtendFrameIntoClientArea =
|
|
||||||
(PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
|
|
||||||
}
|
|
||||||
QSystemLibrary themeLib(L"uxtheme");
|
|
||||||
pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed");
|
|
||||||
if (pIsAppThemed) {
|
|
||||||
pDrawThemeBackground = (PtrDrawThemeBackground)themeLib.resolve("DrawThemeBackground");
|
|
||||||
pGetThemePartSize = (PtrGetThemePartSize)themeLib.resolve("GetThemePartSize");
|
|
||||||
pGetThemeColor = (PtrGetThemeColor)themeLib.resolve("GetThemeColor");
|
|
||||||
pIsThemeActive = (PtrIsThemeActive)themeLib.resolve("IsThemeActive");
|
|
||||||
pOpenThemeData = (PtrOpenThemeData)themeLib.resolve("OpenThemeData");
|
|
||||||
pCloseThemeData = (PtrCloseThemeData)themeLib.resolve("CloseThemeData");
|
|
||||||
pGetThemeSysFont = (PtrGetThemeSysFont)themeLib.resolve("GetThemeSysFont");
|
|
||||||
pDrawThemeTextEx = (PtrDrawThemeTextEx)themeLib.resolve("DrawThemeTextEx");
|
|
||||||
pSetWindowThemeAttribute = (PtrSetWindowThemeAttribute)themeLib.resolve("SetWindowThemeAttribute");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
pDwmIsCompositionEnabled != 0
|
|
||||||
&& pDwmDefWindowProc != 0
|
|
||||||
&& pDwmExtendFrameIntoClientArea != 0
|
|
||||||
&& pIsAppThemed != 0
|
|
||||||
&& pDrawThemeBackground != 0
|
|
||||||
&& pGetThemePartSize != 0
|
|
||||||
&& pGetThemeColor != 0
|
|
||||||
&& pIsThemeActive != 0
|
|
||||||
&& pOpenThemeData != 0
|
|
||||||
&& pCloseThemeData != 0
|
|
||||||
&& pGetThemeSysFont != 0
|
|
||||||
&& pDrawThemeTextEx != 0
|
|
||||||
&& pSetWindowThemeAttribute != 0
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
int QVistaHelper::titleOffset()
|
int QVistaHelper::titleOffset()
|
||||||
{
|
{
|
||||||
int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing;
|
int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing;
|
||||||
|
@ -126,7 +126,6 @@ private:
|
|||||||
int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; }
|
int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; }
|
||||||
|
|
||||||
int titleOffset();
|
int titleOffset();
|
||||||
bool resolveSymbols();
|
|
||||||
void drawTitleBar(QPainter *painter);
|
void drawTitleBar(QPainter *painter);
|
||||||
void setMouseCursor(QPoint pos);
|
void setMouseCursor(QPoint pos);
|
||||||
void collapseTopFrameStrut();
|
void collapseTopFrameStrut();
|
||||||
@ -137,7 +136,6 @@ private:
|
|||||||
bool eventFilter(QObject *obj, QEvent *event);
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
|
|
||||||
static int instanceCount;
|
static int instanceCount;
|
||||||
static bool is_vista;
|
|
||||||
static VistaState cachedVistaState;
|
static VistaState cachedVistaState;
|
||||||
static bool isCompositionEnabled();
|
static bool isCompositionEnabled();
|
||||||
static bool isThemeActive();
|
static bool isThemeActive();
|
||||||
|
@ -2,4 +2,6 @@
|
|||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
INCLUDEPATH += ../3rdparty/wintab
|
INCLUDEPATH += ../3rdparty/wintab
|
||||||
!winrt: LIBS_PRIVATE *= -lshell32
|
!winrt: LIBS_PRIVATE *= -lshell32 -luxtheme -ldwmapi
|
||||||
|
# Override MinGW's definition in _mingw.h
|
||||||
|
mingw: DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
|
|
||||||
#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
|
#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
|
||||||
|
|
||||||
#include <private/qsystemlibrary_p.h>
|
|
||||||
#include "qapplication.h"
|
#include "qapplication.h"
|
||||||
#include "qbitmap.h"
|
#include "qbitmap.h"
|
||||||
#include "qdrawutil.h" // for now
|
#include "qdrawutil.h" // for now
|
||||||
@ -87,26 +86,7 @@ QT_END_INCLUDE_NAMESPACE
|
|||||||
# define COLOR_GRADIENTINACTIVECAPTION 28
|
# define COLOR_GRADIENTINACTIVECAPTION 28
|
||||||
# endif
|
# 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 HICON qt_pixmapToWinHICON(const QPixmap &);
|
||||||
Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
|
|
||||||
#endif //Q_OS_WIN
|
#endif //Q_OS_WIN
|
||||||
|
|
||||||
QT_BEGIN_INCLUDE_NAMESPACE
|
QT_BEGIN_INCLUDE_NAMESPACE
|
||||||
@ -122,13 +102,6 @@ enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
|
|||||||
QWindowsStylePrivate::QWindowsStylePrivate()
|
QWindowsStylePrivate::QWindowsStylePrivate()
|
||||||
: alt_down(false), menuBarTimer(0)
|
: 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()
|
qreal QWindowsStylePrivate::appDevicePixelRatio()
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include <qwindow.h>
|
#include <qwindow.h>
|
||||||
#include <private/qstyleanimation_p.h>
|
#include <private/qstyleanimation_p.h>
|
||||||
#include <private/qstylehelper_p.h>
|
#include <private/qstylehelper_p.h>
|
||||||
#include <private/qsystemlibrary_p.h>
|
|
||||||
#include <private/qapplication_p.h>
|
#include <private/qapplication_p.h>
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
|
|
||||||
@ -88,8 +87,7 @@ bool QWindowsVistaStylePrivate::useVista()
|
|||||||
{
|
{
|
||||||
return (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
|
return (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
|
||||||
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
|
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
|
||||||
&& QWindowsVistaStylePrivate::useXP()
|
&& QWindowsVistaStylePrivate::useXP();
|
||||||
&& QWindowsVistaStylePrivate::pGetThemeTransitionDuration != Q_NULLPTR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* \internal
|
/* \internal
|
||||||
@ -356,13 +354,13 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
|
|||||||
|
|
||||||
HTHEME theme;
|
HTHEME theme;
|
||||||
int partId;
|
int partId;
|
||||||
int duration;
|
DWORD duration;
|
||||||
int fromState = 0;
|
int fromState = 0;
|
||||||
int toState = 0;
|
int toState = 0;
|
||||||
|
|
||||||
//translate state flags to UXTHEME states :
|
//translate state flags to UXTHEME states :
|
||||||
if (element == PE_FrameLineEdit) {
|
if (element == PE_FrameLineEdit) {
|
||||||
theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Edit");
|
theme = OpenThemeData(0, L"Edit");
|
||||||
partId = EP_EDITBORDER_NOSCROLL;
|
partId = EP_EDITBORDER_NOSCROLL;
|
||||||
|
|
||||||
if (oldState & State_MouseOver)
|
if (oldState & State_MouseOver)
|
||||||
@ -380,7 +378,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
|
|||||||
toState = ETS_NORMAL;
|
toState = ETS_NORMAL;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Button");
|
theme = OpenThemeData(0, L"Button");
|
||||||
if (element == PE_IndicatorRadioButton)
|
if (element == PE_IndicatorRadioButton)
|
||||||
partId = BP_RADIOBUTTON;
|
partId = BP_RADIOBUTTON;
|
||||||
else if (element == PE_IndicatorCheckBox)
|
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.
|
// Retrieve the transition time between the states from the system.
|
||||||
if (theme && QWindowsXPStylePrivate::pGetThemeTransitionDuration(theme, partId, fromState, toState,
|
if (theme
|
||||||
TMT_TRANSITIONDURATIONS, &duration) == S_OK)
|
&& SUCCEEDED(GetThemeTransitionDuration(theme, partId, fromState, toState,
|
||||||
{
|
TMT_TRANSITIONDURATIONS, &duration))) {
|
||||||
t->setDuration(duration);
|
t->setDuration(duration);
|
||||||
}
|
}
|
||||||
t->setStartTime(QTime::currentTime());
|
t->setStartTime(QTime::currentTime());
|
||||||
@ -513,7 +511,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
|
|||||||
EP_EDITBORDER_HVSCROLL, stateId, option->rect);
|
EP_EDITBORDER_HVSCROLL, stateId, option->rect);
|
||||||
// Since EP_EDITBORDER_HVSCROLL does not us borderfill, theme.noContent cannot be used for clipping
|
// Since EP_EDITBORDER_HVSCROLL does not us borderfill, theme.noContent cannot be used for clipping
|
||||||
int borderSize = 1;
|
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 clipRegion = option->rect;
|
||||||
QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize);
|
QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize);
|
||||||
clipRegion ^= content;
|
clipRegion ^= content;
|
||||||
@ -548,22 +546,18 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int bgType;
|
int bgType;
|
||||||
QWindowsXPStylePrivate::pGetThemeEnumValue( theme.handle(),
|
GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType);
|
||||||
partId,
|
|
||||||
stateId,
|
|
||||||
TMT_BGTYPE,
|
|
||||||
&bgType);
|
|
||||||
if( bgType == BT_IMAGEFILE ) {
|
if( bgType == BT_IMAGEFILE ) {
|
||||||
d->drawBackground(theme);
|
d->drawBackground(theme);
|
||||||
} else {
|
} else {
|
||||||
QBrush fillColor = option->palette.brush(QPalette::Base);
|
QBrush fillColor = option->palette.brush(QPalette::Base);
|
||||||
if (!isEnabled) {
|
if (!isEnabled) {
|
||||||
PROPERTYORIGIN origin = PO_NOTFOUND;
|
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
|
// Use only if the fill property comes from our part
|
||||||
if ((origin == PO_PART || origin == PO_STATE)) {
|
if ((origin == PO_PART || origin == PO_STATE)) {
|
||||||
COLORREF bgRef;
|
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)));
|
fillColor = QBrush(qRgb(GetRValue(bgRef), GetGValue(bgRef), GetBValue(bgRef)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -899,12 +893,12 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
|
|||||||
t->setEndImage(endImage);
|
t->setEndImage(endImage);
|
||||||
|
|
||||||
|
|
||||||
int duration = 0;
|
DWORD duration = 0;
|
||||||
HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Button");
|
const HTHEME theme = OpenThemeData(0, L"Button");
|
||||||
|
|
||||||
int fromState = buttonStateId(oldState, BP_PUSHBUTTON);
|
int fromState = buttonStateId(oldState, BP_PUSHBUTTON);
|
||||||
int toState = buttonStateId(option->state, 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);
|
t->setDuration(duration);
|
||||||
else
|
else
|
||||||
t->setDuration(0);
|
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
|
// We cannot currently get the correct selection color for "explorer style" views
|
||||||
COLORREF cref = 0;
|
COLORREF cref = 0;
|
||||||
XPThemeData theme(d->treeViewHelper(), 0, QLatin1String("LISTVIEW"), 0, 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));
|
QColor textColor(GetRValue(cref), GetGValue(cref), GetBValue(cref));
|
||||||
*/
|
*/
|
||||||
QPalette palette = vopt->palette;
|
QPalette palette = vopt->palette;
|
||||||
@ -1925,7 +1919,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
|
|||||||
case SE_PushButtonContents:
|
case SE_PushButtonContents:
|
||||||
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
|
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
|
||||||
MARGINS borderSize;
|
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) {
|
if (theme) {
|
||||||
int stateId = PBS_NORMAL;
|
int stateId = PBS_NORMAL;
|
||||||
if (!(option->state & State_Enabled))
|
if (!(option->state & State_Enabled))
|
||||||
@ -1940,15 +1934,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
|
|||||||
int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
|
int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
|
||||||
rect = option->rect.adjusted(border, border, -border, -border);
|
rect = option->rect.adjusted(border, border, -border, -border);
|
||||||
|
|
||||||
int result = QWindowsXPStylePrivate::pGetThemeMargins(theme,
|
if (SUCCEEDED(GetThemeMargins(theme, NULL, BP_PUSHBUTTON, stateId, TMT_CONTENTMARGINS, NULL, &borderSize))) {
|
||||||
NULL,
|
|
||||||
BP_PUSHBUTTON,
|
|
||||||
stateId,
|
|
||||||
TMT_CONTENTMARGINS,
|
|
||||||
NULL,
|
|
||||||
&borderSize);
|
|
||||||
|
|
||||||
if (result == S_OK) {
|
|
||||||
rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight,
|
rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight,
|
||||||
-borderSize.cxRightWidth, -borderSize.cyBottomHeight);
|
-borderSize.cxRightWidth, -borderSize.cyBottomHeight);
|
||||||
rect = visualRect(option->direction, option->rect, rect);
|
rect = visualRect(option->direction, option->rect, rect);
|
||||||
@ -2318,15 +2304,13 @@ void QWindowsVistaStyle::polish(QWidget *widget)
|
|||||||
//we do not have to care about unpolishing
|
//we do not have to care about unpolishing
|
||||||
widget->setContentsMargins(3, 0, 4, 0);
|
widget->setContentsMargins(3, 0, 4, 0);
|
||||||
COLORREF bgRef;
|
COLORREF bgRef;
|
||||||
HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"TOOLTIP");
|
HTHEME theme = OpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"TOOLTIP");
|
||||||
if (theme) {
|
if (theme && SUCCEEDED(GetThemeColor(theme, TTP_STANDARD, TTSS_NORMAL, TMT_TEXTCOLOR, &bgRef))) {
|
||||||
if (QWindowsXPStylePrivate::pGetThemeColor(theme, TTP_STANDARD, TTSS_NORMAL, TMT_TEXTCOLOR, &bgRef) == S_OK) {
|
|
||||||
QColor textColor = QColor::fromRgb(bgRef);
|
QColor textColor = QColor::fromRgb(bgRef);
|
||||||
QPalette pal;
|
QPalette pal;
|
||||||
pal.setColor(QPalette::All, QPalette::ToolTipText, textColor);
|
pal.setColor(QPalette::All, QPalette::ToolTipText, textColor);
|
||||||
widget->setPalette(pal);
|
widget->setPalette(pal);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (qobject_cast<QMessageBox *> (widget)) {
|
} else if (qobject_cast<QMessageBox *> (widget)) {
|
||||||
widget->setAttribute(Qt::WA_StyledBackground);
|
widget->setAttribute(Qt::WA_StyledBackground);
|
||||||
QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox"));
|
QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox"));
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include <qpa/qplatformnativeinterface.h>
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#include <private/qstylehelper_p.h>
|
#include <private/qstylehelper_p.h>
|
||||||
#include <private/qwidget_p.h>
|
#include <private/qwidget_p.h>
|
||||||
#include <private/qsystemlibrary_p.h>
|
|
||||||
#include <qpainter.h>
|
#include <qpainter.h>
|
||||||
#include <qpaintengine.h>
|
#include <qpaintengine.h>
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
@ -76,78 +75,6 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
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
|
// General const values
|
||||||
static const int windowsItemFrame = 2; // menu item frame width
|
static const int windowsItemFrame = 2; // menu item frame width
|
||||||
static const int windowsItemHMargin = 3; // menu item hor text margin
|
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)
|
HRGN XPThemeData::mask(QWidget *widget)
|
||||||
{
|
{
|
||||||
if (!QWindowsXPStylePrivate::pIsThemeBackgroundPartiallyTransparent(handle(), partId, stateId))
|
if (!IsThemeBackgroundPartiallyTransparent(handle(), partId, stateId))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
HRGN hrgn;
|
HRGN hrgn;
|
||||||
@ -239,7 +166,7 @@ HRGN XPThemeData::mask(QWidget *widget)
|
|||||||
if (widget)
|
if (widget)
|
||||||
dc = hdcForWidgetBackingStore(widget);
|
dc = hdcForWidgetBackingStore(widget);
|
||||||
RECT nativeRect = toRECT(rect);
|
RECT nativeRect = toRECT(rect);
|
||||||
QWindowsXPStylePrivate::pGetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn);
|
GetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn);
|
||||||
return hrgn;
|
return hrgn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,8 +212,7 @@ bool QWindowsXPStylePrivate::useXP(bool update)
|
|||||||
{
|
{
|
||||||
if (!update)
|
if (!update)
|
||||||
return use_xp;
|
return use_xp;
|
||||||
return (use_xp = QWindowsUxThemeLib::resolveSymbols() && pIsThemeActive()
|
return use_xp = IsThemeActive() && (IsAppThemed() || !QApplication::instance());
|
||||||
&& (pIsAppThemed() || !QApplication::instance()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* \internal
|
/* \internal
|
||||||
@ -366,7 +292,7 @@ bool QWindowsXPStylePrivate::initVistaTreeViewTheming()
|
|||||||
qWarning("Unable to create the treeview helper window.");
|
qWarning("Unable to create the treeview helper window.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (FAILED(QWindowsXPStylePrivate::pSetWindowTheme(m_vistaTreeViewHelper, L"explorer", NULL))) {
|
if (FAILED(SetWindowTheme(m_vistaTreeViewHelper, L"explorer", NULL))) {
|
||||||
qErrnoWarning("SetWindowTheme() failed.");
|
qErrnoWarning("SetWindowTheme() failed.");
|
||||||
cleanupVistaTreeViewTheming();
|
cleanupVistaTreeViewTheming();
|
||||||
return false;
|
return false;
|
||||||
@ -391,7 +317,7 @@ void QWindowsXPStylePrivate::cleanupHandleMap()
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < NThemes; ++i)
|
for (int i = 0; i < NThemes; ++i)
|
||||||
if (m_themes[i]) {
|
if (m_themes[i]) {
|
||||||
pCloseThemeData(m_themes[i]);
|
CloseThemeData(m_themes[i]);
|
||||||
m_themes[i] = 0;
|
m_themes[i] = 0;
|
||||||
}
|
}
|
||||||
QWindowsXPStylePrivate::cleanupVistaTreeViewTheming();
|
QWindowsXPStylePrivate::cleanupVistaTreeViewTheming();
|
||||||
@ -407,7 +333,7 @@ HTHEME QWindowsXPStylePrivate::createTheme(int theme, HWND hwnd)
|
|||||||
const wchar_t *name = themeNames[theme];
|
const wchar_t *name = themeNames[theme];
|
||||||
if (theme == VistaTreeViewTheme && QWindowsXPStylePrivate::initVistaTreeViewTheming())
|
if (theme == VistaTreeViewTheme && QWindowsXPStylePrivate::initVistaTreeViewTheming())
|
||||||
hwnd = QWindowsXPStylePrivate::m_vistaTreeViewHelper;
|
hwnd = QWindowsXPStylePrivate::m_vistaTreeViewHelper;
|
||||||
m_themes[theme] = pOpenThemeData(hwnd, name);
|
m_themes[theme] = OpenThemeData(hwnd, name);
|
||||||
if (Q_UNLIKELY(!m_themes[theme]))
|
if (Q_UNLIKELY(!m_themes[theme]))
|
||||||
qErrnoWarning("OpenThemeData() failed for theme %d (%s).",
|
qErrnoWarning("OpenThemeData() failed for theme %d (%s).",
|
||||||
theme, qPrintable(themeName(theme)));
|
theme, qPrintable(themeName(theme)));
|
||||||
@ -504,48 +430,6 @@ const QPixmap *QWindowsXPStylePrivate::tabBody(QWidget *widget)
|
|||||||
return tabbody;
|
return tabbody;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \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
|
/*! \internal
|
||||||
Returns a native buffer (DIB section) of at least the size of
|
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
|
( \a x , \a y ). The buffer has a 32 bit depth, to not lose
|
||||||
@ -614,7 +498,7 @@ HBITMAP QWindowsXPStylePrivate::buffer(int w, int h)
|
|||||||
*/
|
*/
|
||||||
bool QWindowsXPStylePrivate::isTransparent(XPThemeData &themeData)
|
bool QWindowsXPStylePrivate::isTransparent(XPThemeData &themeData)
|
||||||
{
|
{
|
||||||
return pIsThemeBackgroundPartiallyTransparent(themeData.handle(), themeData.partId,
|
return IsThemeBackgroundPartiallyTransparent(themeData.handle(), themeData.partId,
|
||||||
themeData.stateId);
|
themeData.stateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,9 +510,10 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData)
|
|||||||
{
|
{
|
||||||
HRGN hRgn = 0;
|
HRGN hRgn = 0;
|
||||||
RECT rect = themeData.toRECT(themeData.rect);
|
RECT rect = themeData.toRECT(themeData.rect);
|
||||||
if (!SUCCEEDED(pGetThemeBackgroundRegion(themeData.handle(), bufferHDC(), themeData.partId,
|
if (!SUCCEEDED(GetThemeBackgroundRegion(themeData.handle(), bufferHDC(), themeData.partId,
|
||||||
themeData.stateId, &rect, &hRgn)))
|
themeData.stateId, &rect, &hRgn))) {
|
||||||
return QRegion();
|
return QRegion();
|
||||||
|
}
|
||||||
|
|
||||||
HRGN dest = CreateRectRgn(0, 0, 0, 0);
|
HRGN dest = CreateRectRgn(0, 0, 0, 0);
|
||||||
const bool success = CombineRgn(dest, hRgn, 0, RGN_COPY) != ERROR;
|
const bool success = CombineRgn(dest, hRgn, 0, RGN_COPY) != ERROR;
|
||||||
@ -822,7 +707,6 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
|
|||||||
bool canDrawDirectly = false;
|
bool canDrawDirectly = false;
|
||||||
if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate
|
if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate
|
||||||
&& tt != ComplexTransform && !themeData.mirrorVertically
|
&& tt != ComplexTransform && !themeData.mirrorVertically
|
||||||
&& (!themeData.mirrorHorizontally || pDrawThemeBackgroundEx)
|
|
||||||
&& !translucentToplevel) {
|
&& !translucentToplevel) {
|
||||||
// Draw on backing store DC only for real widgets or backing store images.
|
// Draw on backing store DC only for real widgets or backing store images.
|
||||||
const QPaintDevice *enginePaintDevice = painter->paintEngine()->paintDevice();
|
const QPaintDevice *enginePaintDevice = painter->paintEngine()->paintDevice();
|
||||||
@ -904,44 +788,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa
|
|||||||
| (themeData.noContent ? DTBG_OMITCONTENT : 0)
|
| (themeData.noContent ? DTBG_OMITCONTENT : 0)
|
||||||
| (themeData.mirrorHorizontally ? DTBG_MIRRORDC : 0);
|
| (themeData.mirrorHorizontally ? DTBG_MIRRORDC : 0);
|
||||||
|
|
||||||
HRESULT result = S_FALSE;
|
const HRESULT result = DrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &drawOptions);
|
||||||
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));
|
|
||||||
}
|
|
||||||
SelectClipRgn(dc, 0);
|
SelectClipRgn(dc, 0);
|
||||||
DeleteObject(hrgn);
|
DeleteObject(hrgn);
|
||||||
return SUCCEEDED(result);
|
return SUCCEEDED(result);
|
||||||
@ -1020,17 +867,17 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
|
|||||||
BOOL tmt_borderonly = false;
|
BOOL tmt_borderonly = false;
|
||||||
COLORREF tmt_transparentcolor = 0x0;
|
COLORREF tmt_transparentcolor = 0x0;
|
||||||
PROPERTYORIGIN proporigin = PO_NOTFOUND;
|
PROPERTYORIGIN proporigin = PO_NOTFOUND;
|
||||||
pGetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERONLY, &tmt_borderonly);
|
GetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERONLY, &tmt_borderonly);
|
||||||
pGetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, TMT_TRANSPARENTCOLOR, &tmt_transparentcolor);
|
GetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, TMT_TRANSPARENTCOLOR, &tmt_transparentcolor);
|
||||||
pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_CAPTIONMARGINS, &proporigin);
|
GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_CAPTIONMARGINS, &proporigin);
|
||||||
|
|
||||||
partIsTransparent = isTransparent(themeData);
|
partIsTransparent = isTransparent(themeData);
|
||||||
|
|
||||||
potentialInvalidAlpha = false;
|
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) {
|
if (proporigin == PO_PART || proporigin == PO_STATE) {
|
||||||
int tmt_glyphtype = GT_NONE;
|
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;
|
potentialInvalidAlpha = partIsTransparent && tmt_glyphtype == GT_IMAGEGLYPH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1060,8 +907,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
|
|||||||
|
|
||||||
int borderSize = 0;
|
int borderSize = 0;
|
||||||
PROPERTYORIGIN origin = PO_NOTFOUND;
|
PROPERTYORIGIN origin = PO_NOTFOUND;
|
||||||
pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin);
|
GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin);
|
||||||
pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize);
|
GetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize);
|
||||||
|
|
||||||
// Clip away border region
|
// Clip away border region
|
||||||
if ((origin == PO_CLASS || origin == PO_PART || origin == PO_STATE) && borderSize > 0) {
|
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
|
// Difference between area and rect
|
||||||
int dx = area.x() - rect.x();
|
int dx = area.x() - rect.x();
|
||||||
int dy = area.y() - rect.y();
|
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
|
// Adjust so painting rect starts from Origo
|
||||||
rect.moveTo(0,0);
|
rect.moveTo(0,0);
|
||||||
@ -1108,24 +953,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
|
|||||||
| (themeData.noContent ? DTBG_OMITCONTENT : 0);
|
| (themeData.noContent ? DTBG_OMITCONTENT : 0);
|
||||||
|
|
||||||
// Drawing the part into the backing store
|
// Drawing the part into the backing store
|
||||||
if (pDrawThemeBackgroundEx != 0) {
|
RECT wRect(themeData.toRECT(area));
|
||||||
RECT rect(themeData.toRECT(area));
|
DrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &wRect, &drawOptions);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If not cached, analyze the buffer data to figure
|
// If not cached, analyze the buffer data to figure
|
||||||
// out alpha type, and if it contains data
|
// out alpha type, and if it contains data
|
||||||
@ -1342,12 +1171,12 @@ void QWindowsXPStyle::polish(QWidget *widget)
|
|||||||
// Get text color for group box labels
|
// Get text color for group box labels
|
||||||
COLORREF cref;
|
COLORREF cref;
|
||||||
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0);
|
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));
|
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));
|
d->groupBoxTextColorDisabled = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref));
|
||||||
// Where does this color come from?
|
// 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->sliderTickColor = qRgb(165, 162, 148);
|
||||||
d->hasInitColors = true;
|
d->hasInitColors = true;
|
||||||
}
|
}
|
||||||
@ -1469,15 +1298,7 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option,
|
|||||||
int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
|
int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
|
||||||
rect = option->rect.adjusted(border, border, -border, -border);
|
rect = option->rect.adjusted(border, border, -border, -border);
|
||||||
|
|
||||||
int result = QWindowsXPStylePrivate::pGetThemeMargins(theme,
|
if (SUCCEEDED(GetThemeMargins(theme, NULL, BP_PUSHBUTTON, stateId, TMT_CONTENTMARGINS, NULL, &borderSize))) {
|
||||||
NULL,
|
|
||||||
BP_PUSHBUTTON,
|
|
||||||
stateId,
|
|
||||||
TMT_CONTENTMARGINS,
|
|
||||||
NULL,
|
|
||||||
&borderSize);
|
|
||||||
|
|
||||||
if (result == S_OK) {
|
|
||||||
rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight,
|
rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight,
|
||||||
-borderSize.cxRightWidth, -borderSize.cyBottomHeight);
|
-borderSize.cxRightWidth, -borderSize.cyBottomHeight);
|
||||||
rect = visualRect(option->direction, option->rect, rect);
|
rect = visualRect(option->direction, option->rect, rect);
|
||||||
@ -1664,14 +1485,14 @@ case PE_Frame:
|
|||||||
else
|
else
|
||||||
stateId = ETS_NORMAL;
|
stateId = ETS_NORMAL;
|
||||||
int fillType;
|
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) {
|
if (fillType == BT_BORDERFILL) {
|
||||||
COLORREF bcRef;
|
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)));
|
QColor bordercolor(qRgb(GetRValue(bcRef), GetGValue(bcRef), GetBValue(bcRef)));
|
||||||
QPen oldPen = p->pen();
|
QPen oldPen = p->pen();
|
||||||
// int borderSize = 1;
|
// int borderSize = 1;
|
||||||
// pGetThemeInt(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &borderSize);
|
// GetThemeInt(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &borderSize);
|
||||||
|
|
||||||
// Inner white border
|
// Inner white border
|
||||||
p->setPen(QPen(option->palette.base().color(), 1));
|
p->setPen(QPen(option->palette.base().color(), 1));
|
||||||
@ -1730,11 +1551,7 @@ case PE_Frame:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int bgType;
|
int bgType;
|
||||||
QWindowsXPStylePrivate::pGetThemeEnumValue( theme.handle(),
|
GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType);
|
||||||
partId,
|
|
||||||
stateId,
|
|
||||||
TMT_BGTYPE,
|
|
||||||
&bgType);
|
|
||||||
if( bgType == BT_IMAGEFILE ) {
|
if( bgType == BT_IMAGEFILE ) {
|
||||||
theme.mirrorHorizontally = hMirrored;
|
theme.mirrorHorizontally = hMirrored;
|
||||||
theme.mirrorVertically = vMirrored;
|
theme.mirrorVertically = vMirrored;
|
||||||
@ -1747,11 +1564,11 @@ case PE_Frame:
|
|||||||
|
|
||||||
if (!isEnabled) {
|
if (!isEnabled) {
|
||||||
PROPERTYORIGIN origin = PO_NOTFOUND;
|
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
|
// Use only if the fill property comes from our part
|
||||||
if ((origin == PO_PART || origin == PO_STATE)) {
|
if ((origin == PO_PART || origin == PO_STATE)) {
|
||||||
COLORREF bgRef;
|
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)));
|
fillColor = QBrush(qRgb(GetRValue(bgRef), GetGValue(bgRef), GetBValue(bgRef)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1777,7 +1594,7 @@ case PE_Frame:
|
|||||||
wchar_t themeFileName[maxlength];
|
wchar_t themeFileName[maxlength];
|
||||||
wchar_t themeColor[maxlength];
|
wchar_t themeColor[maxlength];
|
||||||
// Due to a a scaling issue with the XP Silver theme, tab gradients are not used with it
|
// 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;
|
wchar_t *offset = 0;
|
||||||
if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) {
|
if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) {
|
||||||
offset++;
|
offset++;
|
||||||
@ -2564,10 +2381,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
|
|||||||
= p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, titleRect.width());
|
= p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, titleRect.width());
|
||||||
|
|
||||||
int result = TST_NONE;
|
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) {
|
if (result != TST_NONE) {
|
||||||
COLORREF textShadowRef;
|
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));
|
QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef));
|
||||||
p->setPen(textShadow);
|
p->setPen(textShadow);
|
||||||
drawItemText(p, titleRect.adjusted(1, 1, 1, 1),
|
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);
|
QRect ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
|
||||||
|
|
||||||
int result = TST_NONE;
|
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) {
|
if (result != TST_NONE) {
|
||||||
COLORREF textShadowRef;
|
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));
|
QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef));
|
||||||
p->setPen(textShadow);
|
p->setPen(textShadow);
|
||||||
p->drawText(ir.x() + 3, ir.y() + 2, ir.width() - 1, ir.height(),
|
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)
|
static void showProperty(XPThemeData &themeData, const PropPair &prop)
|
||||||
{
|
{
|
||||||
PROPERTYORIGIN origin = PO_NOTFOUND;
|
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;
|
const char *originStr;
|
||||||
switch(origin) {
|
switch(origin) {
|
||||||
case PO_STATE:
|
case PO_STATE:
|
||||||
@ -4222,35 +4039,35 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
|
|||||||
case TMT_STRING:
|
case TMT_STRING:
|
||||||
{
|
{
|
||||||
wchar_t buffer[512];
|
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);
|
printf(" (%sString) %-20S: %S\n", originStr, prop.propName, buffer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TMT_ENUM:
|
case TMT_ENUM:
|
||||||
{
|
{
|
||||||
int result = -1;
|
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);
|
printf(" (%sEnum) %-20S: %d\n", originStr, prop.propName, result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TMT_INT:
|
case TMT_INT:
|
||||||
{
|
{
|
||||||
int result = -1;
|
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);
|
printf(" (%sint) %-20S: %d\n", originStr, prop.propName, result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TMT_BOOL:
|
case TMT_BOOL:
|
||||||
{
|
{
|
||||||
BOOL result = false;
|
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);
|
printf(" (%sbool) %-20S: %d\n", originStr, prop.propName, result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TMT_COLOR:
|
case TMT_COLOR:
|
||||||
{
|
{
|
||||||
COLORREF result = 0;
|
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);
|
printf(" (%scolor) %-20S: 0x%08X\n", originStr, prop.propName, result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4258,7 +4075,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
|
|||||||
{
|
{
|
||||||
MARGINS result;
|
MARGINS result;
|
||||||
memset(&result, 0, sizeof(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,
|
printf(" (%smargins) %-20S: (%d, %d, %d, %d)\n", originStr,
|
||||||
prop.propName, result.cxLeftWidth, result.cyTopHeight, result.cxRightWidth, result.cyBottomHeight);
|
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:
|
case TMT_FILENAME:
|
||||||
{
|
{
|
||||||
wchar_t buffer[512];
|
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);
|
printf(" (%sfilename)%-20S: %S\n", originStr, prop.propName, buffer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4278,9 +4095,9 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
|
|||||||
memset(&result1, 0, sizeof(result1));
|
memset(&result1, 0, sizeof(result1));
|
||||||
memset(&result2, 0, sizeof(result2));
|
memset(&result2, 0, sizeof(result2));
|
||||||
memset(&result3, 0, sizeof(result3));
|
memset(&result3, 0, sizeof(result3));
|
||||||
pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_MIN, &result1);
|
GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_MIN, &result1);
|
||||||
pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_TRUE, &result2);
|
GetThemePartSize(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_DRAW, &result3);
|
||||||
printf(" (%ssize) %-20S: Min (%d, %d), True(%d, %d), Draw(%d, %d)\n", originStr, prop.propName,
|
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);
|
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;
|
POINT result;
|
||||||
memset(&result, 0, sizeof(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);
|
printf(" (%sPosition)%-20S: (%d, %d)\n", originStr, prop.propName, result.x, result.y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4297,7 +4114,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
|
|||||||
{
|
{
|
||||||
RECT result;
|
RECT result;
|
||||||
memset(&result, 0, sizeof(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);
|
printf(" (%sRect) %-20S: (%d, %d, %d, %d)\n", originStr, prop.propName, result.left, result.top, result.right, result.bottom);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4305,7 +4122,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
|
|||||||
{
|
{
|
||||||
LOGFONT result;
|
LOGFONT result;
|
||||||
memset(&result, 0, sizeof(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,
|
printf(" (%sFont) %-20S: %S height(%d) width(%d) weight(%d)\n", originStr, prop.propName,
|
||||||
result.lfFaceName, result.lfHeight, result.lfWidth, result.lfWeight);
|
result.lfFaceName, result.lfHeight, result.lfWidth, result.lfWeight);
|
||||||
}
|
}
|
||||||
@ -4314,7 +4131,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
|
|||||||
{
|
{
|
||||||
INTLIST result;
|
INTLIST result;
|
||||||
memset(&result, 0, sizeof(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);
|
printf(" (%sInt list)%-20S: { ", originStr, prop.propName);
|
||||||
for (int i = 0; i < result.iValueCount; ++i)
|
for (int i = 0; i < result.iValueCount; ++i)
|
||||||
printf("%d ", result.iValues[i]);
|
printf("%d ", result.iValues[i]);
|
||||||
@ -4366,7 +4183,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData)
|
|||||||
for (int j = 0; j < all_props.count(); ++j) {
|
for (int j = 0; j < all_props.count(); ++j) {
|
||||||
PropPair prop = all_props.at(j);
|
PropPair prop = all_props.at(j);
|
||||||
wchar_t buf[500];
|
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);
|
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) {
|
for (int j = 0; j < all_props.count(); ++j) {
|
||||||
PropPair prop = all_props.at(j);
|
PropPair prop = all_props.at(j);
|
||||||
PROPERTYORIGIN origin = PO_NOTFOUND;
|
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) {
|
if (origin == PO_GLOBAL) {
|
||||||
showProperty(themeData, prop);
|
showProperty(themeData, prop);
|
||||||
}
|
}
|
||||||
@ -4387,7 +4204,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData)
|
|||||||
for (int j = 0; j < all_props.count(); ++j) {
|
for (int j = 0; j < all_props.count(); ++j) {
|
||||||
PropPair prop = all_props.at(j);
|
PropPair prop = all_props.at(j);
|
||||||
PROPERTYORIGIN origin = PO_NOTFOUND;
|
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)
|
if (origin != PO_NOTFOUND)
|
||||||
{
|
{
|
||||||
showProperty(themeData, prop);
|
showProperty(themeData, prop);
|
||||||
|
@ -57,101 +57,12 @@
|
|||||||
#include <qt_windows.h>
|
#include <qt_windows.h>
|
||||||
|
|
||||||
#include <uxtheme.h>
|
#include <uxtheme.h>
|
||||||
|
|
||||||
#if WINVER >= 0x0600
|
|
||||||
#include <vssym32.h>
|
#include <vssym32.h>
|
||||||
#else
|
|
||||||
#include <tmschema.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
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
|
// TMT_TEXTSHADOWCOLOR is wrongly defined in mingw
|
||||||
#if TMT_TEXTSHADOWCOLOR != 3818
|
#if TMT_TEXTSHADOWCOLOR != 3818
|
||||||
#undef TMT_TEXTSHADOWCOLOR
|
#undef TMT_TEXTSHADOWCOLOR
|
||||||
@ -161,13 +72,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
# define TST_NONE 0
|
# define TST_NONE 0
|
||||||
#endif
|
#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
|
// These defines are missing from the tmschema, but still exist as
|
||||||
// states for their parts
|
// states for their parts
|
||||||
#ifndef MINBS_INACTIVE
|
#ifndef MINBS_INACTIVE
|
||||||
@ -278,65 +182,7 @@ struct ThemeMapData {
|
|||||||
hasAlphaChannel(false), wasAlphaSwapped(false), hadInvalidAlpha(false) {}
|
hasAlphaChannel(false), wasAlphaSwapped(false), hadInvalidAlpha(false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QWindowsUxThemeLib {
|
class QWindowsXPStylePrivate : public QWindowsStylePrivate
|
||||||
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)
|
Q_DECLARE_PUBLIC(QWindowsXPStyle)
|
||||||
public:
|
public:
|
||||||
@ -385,7 +231,6 @@ public:
|
|||||||
HDC bufferHDC()
|
HDC bufferHDC()
|
||||||
{ return bufferDC;}
|
{ return bufferDC;}
|
||||||
|
|
||||||
static bool resolveSymbols();
|
|
||||||
static bool useXP(bool update = false);
|
static bool useXP(bool update = false);
|
||||||
static QRect scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme);
|
static QRect scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme);
|
||||||
|
|
||||||
@ -443,7 +288,7 @@ inline QSizeF XPThemeData::size()
|
|||||||
QSizeF result(0, 0);
|
QSizeF result(0, 0);
|
||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
SIZE size;
|
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);
|
result = QSize(size.cx, size.cy);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -455,7 +300,7 @@ inline QMarginsF XPThemeData::margins(const QRect &qRect, int propId)
|
|||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
MARGINS margins;
|
MARGINS margins;
|
||||||
RECT rect = XPThemeData::toRECT(qRect);
|
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);
|
result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -466,7 +311,7 @@ inline QMarginsF XPThemeData::margins(int propId)
|
|||||||
QMarginsF result(0, 0, 0 ,0);
|
QMarginsF result(0, 0, 0 ,0);
|
||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
MARGINS margins;
|
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);
|
result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -200,7 +200,7 @@ QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object)
|
|||||||
MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");
|
MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher
|
// Allow the WM_TASKBARCREATED message through the UIPI filter on Windows 7 and higher
|
||||||
static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx =
|
static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx =
|
||||||
(PtrChangeWindowMessageFilterEx)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");
|
(PtrChangeWindowMessageFilterEx)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");
|
||||||
|
|
||||||
@ -208,14 +208,15 @@ QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object)
|
|||||||
// Call the safer ChangeWindowMessageFilterEx API if available (Windows 7 onwards)
|
// Call the safer ChangeWindowMessageFilterEx API if available (Windows 7 onwards)
|
||||||
pChangeWindowMessageFilterEx(m_hwnd, MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0);
|
pChangeWindowMessageFilterEx(m_hwnd, MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0);
|
||||||
} else {
|
} else {
|
||||||
|
// Call the deprecated ChangeWindowMessageFilter API otherwise (Vista onwards)
|
||||||
|
// May 2016: Still resolved at runtime since the definition is not present in MinGW 4.9.
|
||||||
|
// TODO: Replace by direct invocation when upgrading MinGW.
|
||||||
static PtrChangeWindowMessageFilter pChangeWindowMessageFilter =
|
static PtrChangeWindowMessageFilter pChangeWindowMessageFilter =
|
||||||
(PtrChangeWindowMessageFilter)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");
|
(PtrChangeWindowMessageFilter)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");
|
||||||
|
|
||||||
if (pChangeWindowMessageFilter) {
|
if (pChangeWindowMessageFilter)
|
||||||
// Call the deprecated ChangeWindowMessageFilter API otherwise
|
|
||||||
pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW);
|
pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSystemTrayIconSys::~QSystemTrayIconSys()
|
QSystemTrayIconSys::~QSystemTrayIconSys()
|
||||||
@ -413,6 +414,7 @@ QRect QSystemTrayIconSys::findIconGeometry(UINT iconId)
|
|||||||
UINT uID;
|
UINT uID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Windows 7 onwards.
|
||||||
static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect =
|
static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect =
|
||||||
(PtrShell_NotifyIconGetRect)QSystemLibrary::resolve(QLatin1String("shell32"),
|
(PtrShell_NotifyIconGetRect)QSystemLibrary::resolve(QLatin1String("shell32"),
|
||||||
"Shell_NotifyIconGetRect");
|
"Shell_NotifyIconGetRect");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user