Cleanup QWizard Windows implementation
Since DWM composition is now always enabled and can't be disabled, The code for VistaBasic style is now dead code in reality, just remove them. Change-Id: Iab2ba9b11ed573b240814ab5e26dec656de42ed2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
97b32fa0b6
commit
4e52a4c7e3
@ -328,8 +328,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
|
||||
{
|
||||
bool modern = ((info.wizStyle == QWizard::ModernStyle)
|
||||
#if QT_CONFIG(style_windowsvista)
|
||||
|| ((info.wizStyle == QWizard::AeroStyle
|
||||
&& QVistaHelper::vistaState() == QVistaHelper::Classic) || vistaDisabled())
|
||||
|| vistaDisabled()
|
||||
#endif
|
||||
);
|
||||
|
||||
@ -535,7 +534,6 @@ public:
|
||||
void updatePixmap(QWizard::WizardPixmap which);
|
||||
#if QT_CONFIG(style_windowsvista)
|
||||
bool vistaDisabled() const;
|
||||
bool isVistaThemeEnabled(QVistaHelper::VistaState state) const;
|
||||
bool handleAeroStyleChange();
|
||||
#endif
|
||||
bool isVistaThemeEnabled() const;
|
||||
@ -604,7 +602,7 @@ public:
|
||||
QPointer<QShortcut> vistaNextShortcut;
|
||||
# endif
|
||||
bool vistaInitPending = true;
|
||||
QVistaHelper::VistaState vistaState = QVistaHelper::Dirty;
|
||||
bool vistaDirty = true;
|
||||
bool vistaStateChanged = false;
|
||||
bool inHandleAeroStyleChange = false;
|
||||
#endif
|
||||
@ -888,7 +886,7 @@ QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage()
|
||||
info.wizStyle = wizStyle;
|
||||
if (info.wizStyle == QWizard::AeroStyle
|
||||
#if QT_CONFIG(style_windowsvista)
|
||||
&& (QVistaHelper::vistaState() == QVistaHelper::Classic || vistaDisabled())
|
||||
&& vistaDisabled()
|
||||
#endif
|
||||
)
|
||||
info.wizStyle = QWizard::ModernStyle;
|
||||
@ -1520,13 +1518,6 @@ bool QWizardPrivate::vistaDisabled() const
|
||||
return v.isValid() && v.toBool();
|
||||
}
|
||||
|
||||
bool QWizardPrivate::isVistaThemeEnabled(QVistaHelper::VistaState state) const
|
||||
{
|
||||
return wizStyle == QWizard::AeroStyle
|
||||
&& QVistaHelper::vistaState() == state
|
||||
&& !vistaDisabled();
|
||||
}
|
||||
|
||||
bool QWizardPrivate::handleAeroStyleChange()
|
||||
{
|
||||
Q_Q(QWizard);
|
||||
@ -1550,25 +1541,17 @@ bool QWizardPrivate::handleAeroStyleChange()
|
||||
if (isVistaThemeEnabled()) {
|
||||
const int topOffset = vistaHelper->topOffset(q);
|
||||
const int topPadding = vistaHelper->topPadding(q);
|
||||
if (isVistaThemeEnabled(QVistaHelper::VistaAero)) {
|
||||
if (isWindow) {
|
||||
vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar);
|
||||
q->installEventFilter(vistaHelper);
|
||||
}
|
||||
q->setMouseTracking(true);
|
||||
antiFlickerWidget->move(0, vistaHelper->titleBarSize() + topOffset);
|
||||
vistaHelper->backButton()->move(
|
||||
0, topOffset // ### should ideally work without the '+ 1'
|
||||
- qMin(topOffset, topPadding + 1));
|
||||
vistaMargins = true;
|
||||
vistaHelper->backButton()->show();
|
||||
} else {
|
||||
if (isWindow)
|
||||
vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar);
|
||||
q->setMouseTracking(true);
|
||||
antiFlickerWidget->move(0, topOffset);
|
||||
vistaHelper->backButton()->move(0, -1); // ### should ideally work with (0, 0)
|
||||
if (isWindow) {
|
||||
vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar);
|
||||
q->installEventFilter(vistaHelper);
|
||||
}
|
||||
q->setMouseTracking(true);
|
||||
antiFlickerWidget->move(0, vistaHelper->titleBarSize() + topOffset);
|
||||
vistaHelper->backButton()->move(
|
||||
0, topOffset // ### should ideally work without the '+ 1'
|
||||
- qMin(topOffset, topPadding + 1));
|
||||
vistaMargins = true;
|
||||
vistaHelper->backButton()->show();
|
||||
if (isWindow)
|
||||
vistaHelper->setTitleBarIconAndCaptionVisible(false);
|
||||
QObject::connect(
|
||||
@ -1597,8 +1580,7 @@ bool QWizardPrivate::handleAeroStyleChange()
|
||||
bool QWizardPrivate::isVistaThemeEnabled() const
|
||||
{
|
||||
#if QT_CONFIG(style_windowsvista)
|
||||
return isVistaThemeEnabled(QVistaHelper::VistaAero)
|
||||
|| isVistaThemeEnabled(QVistaHelper::VistaBasic);
|
||||
return wizStyle == QWizard::AeroStyle && !vistaDisabled();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@ -1755,13 +1737,6 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
|
||||
painter.fillRect(0, buttonLayoutTop, width(), height() - buttonLayoutTop, brush);
|
||||
painter.setPen(QPen(QBrush(QColor(223, 223, 223)), 0)); // ### hardcoded for now
|
||||
painter.drawLine(0, buttonLayoutTop, width(), buttonLayoutTop);
|
||||
if (wizardPrivate->isVistaThemeEnabled(QVistaHelper::VistaBasic)) {
|
||||
if (window()->isActiveWindow())
|
||||
painter.setPen(QPen(QBrush(QColor(169, 191, 214)), 0)); // ### hardcoded for now
|
||||
else
|
||||
painter.setPen(QPen(QBrush(QColor(182, 193, 204)), 0)); // ### hardcoded for now
|
||||
painter.drawLine(0, 0, width(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -3171,12 +3146,7 @@ bool QWizard::event(QEvent *event)
|
||||
#if QT_CONFIG(style_windowsvista)
|
||||
else if (event->type() == QEvent::Show && d->vistaInitPending) {
|
||||
d->vistaInitPending = false;
|
||||
// Do not force AeroStyle when in Classic theme.
|
||||
// Note that d->handleAeroStyleChange() needs to be called in any case as it does some
|
||||
// necessary initialization, like ensures that the Aero specific back button is hidden if
|
||||
// Aero theme isn't active.
|
||||
if (QVistaHelper::vistaState() != QVistaHelper::Classic)
|
||||
d->wizStyle = AeroStyle;
|
||||
d->wizStyle = AeroStyle;
|
||||
d->handleAeroStyleChange();
|
||||
}
|
||||
else if (d->isVistaThemeEnabled()) {
|
||||
@ -3206,8 +3176,7 @@ void QWizard::resizeEvent(QResizeEvent *event)
|
||||
#if QT_CONFIG(style_windowsvista)
|
||||
if (d->isVistaThemeEnabled()) {
|
||||
heightOffset = d->vistaHelper->topOffset(this);
|
||||
if (d->isVistaThemeEnabled(QVistaHelper::VistaAero))
|
||||
heightOffset += d->vistaHelper->titleBarSize();
|
||||
heightOffset += d->vistaHelper->titleBarSize();
|
||||
}
|
||||
#endif
|
||||
d->antiFlickerWidget->resize(event->size().width(), event->size().height() - heightOffset);
|
||||
@ -3234,11 +3203,6 @@ void QWizard::paintEvent(QPaintEvent * event)
|
||||
}
|
||||
#if QT_CONFIG(style_windowsvista)
|
||||
else if (d->isVistaThemeEnabled()) {
|
||||
if (d->isVistaThemeEnabled(QVistaHelper::VistaBasic)) {
|
||||
QPainter painter(this);
|
||||
QColor color = d->vistaHelper->basicWindowFrameColor();
|
||||
painter.fillRect(0, 0, width(), QVistaHelper::topOffset(this), color);
|
||||
}
|
||||
d->vistaHelper->paintEvent(event);
|
||||
}
|
||||
#else
|
||||
@ -3257,12 +3221,12 @@ bool QWizard::nativeEvent(const QByteArray &eventType, void *message, qintptr *r
|
||||
if (d->isVistaThemeEnabled() && eventType == "windows_generic_MSG") {
|
||||
MSG *windowsMessage = static_cast<MSG *>(message);
|
||||
const bool winEventResult = d->vistaHelper->handleWinEvent(windowsMessage, result);
|
||||
if (QVistaHelper::vistaState() != d->vistaState) {
|
||||
if (d->vistaDirty) {
|
||||
// QTBUG-78300: When Qt::AA_NativeWindows is set, delay further
|
||||
// window creation until after the platform window creation events.
|
||||
if (windowsMessage->message == WM_GETICON) {
|
||||
d->vistaStateChanged = true;
|
||||
d->vistaState = QVistaHelper::vistaState();
|
||||
d->vistaDirty = false;
|
||||
setWizardStyle(AeroStyle);
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,7 @@ Q_DECLARE_METATYPE(QMargins)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
int QVistaHelper::instanceCount = 0;
|
||||
int QVistaHelper::m_devicePixelRatio = 1;
|
||||
QVistaHelper::VistaState QVistaHelper::cachedVistaState = QVistaHelper::Dirty;
|
||||
|
||||
/******************************************************************************
|
||||
** QVistaBackButton
|
||||
@ -118,18 +116,14 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
|
||||
, backButton_(0)
|
||||
{
|
||||
QVistaHelper::m_devicePixelRatio = wizard->devicePixelRatio();
|
||||
if (instanceCount++ == 0)
|
||||
cachedVistaState = Dirty;
|
||||
|
||||
backButton_ = new QVistaBackButton(wizard);
|
||||
backButton_->hide();
|
||||
|
||||
iconSpacing = QStyleHelper::dpiScaled(7, wizard);
|
||||
}
|
||||
|
||||
QVistaHelper::~QVistaHelper()
|
||||
{
|
||||
--instanceCount;
|
||||
}
|
||||
QVistaHelper::~QVistaHelper() = default;
|
||||
|
||||
void QVistaHelper::updateCustomMargins(bool vistaMargins)
|
||||
{
|
||||
@ -150,24 +144,6 @@ void QVistaHelper::updateCustomMargins(bool vistaMargins)
|
||||
}
|
||||
}
|
||||
|
||||
bool QVistaHelper::isCompositionEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QVistaHelper::isThemeActive()
|
||||
{
|
||||
return IsThemeActive();
|
||||
}
|
||||
|
||||
QVistaHelper::VistaState QVistaHelper::vistaState()
|
||||
{
|
||||
if (instanceCount == 0 || cachedVistaState == Dirty)
|
||||
cachedVistaState =
|
||||
isCompositionEnabled() ? VistaAero : isThemeActive() ? VistaBasic : Classic;
|
||||
return cachedVistaState;
|
||||
}
|
||||
|
||||
void QVistaHelper::disconnectBackButton()
|
||||
{
|
||||
if (backButton_) // Leave QStyleSheetStyle's connections on destroyed() intact.
|
||||
@ -188,18 +164,16 @@ QColor QVistaHelper::basicWindowFrameColor()
|
||||
|
||||
bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
|
||||
{
|
||||
bool value = false;
|
||||
if (vistaState() == VistaAero) {
|
||||
MARGINS mar = {0, 0, 0, 0};
|
||||
if (type == NormalTitleBar)
|
||||
mar.cyTopHeight = 0;
|
||||
else
|
||||
mar.cyTopHeight = (titleBarSize() + topOffset(wizard)) * QVistaHelper::m_devicePixelRatio;
|
||||
if (const HWND wizardHandle = wizardHWND())
|
||||
if (SUCCEEDED(DwmExtendFrameIntoClientArea(wizardHandle, &mar)))
|
||||
value = true;
|
||||
MARGINS mar = {0, 0, 0, 0};
|
||||
if (type == NormalTitleBar)
|
||||
mar.cyTopHeight = 0;
|
||||
else
|
||||
mar.cyTopHeight = (titleBarSize() + topOffset(wizard)) * QVistaHelper::m_devicePixelRatio;
|
||||
if (const HWND wizardHandle = wizardHWND()) {
|
||||
if (SUCCEEDED(DwmExtendFrameIntoClientArea(wizardHandle, &mar)))
|
||||
return true;
|
||||
}
|
||||
return value;
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
|
||||
@ -235,7 +209,7 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
|
||||
const bool isWindow = wizard->isWindow();
|
||||
const HDC hdc = QVistaHelper::backingStoreDC(wizard, &origin);
|
||||
|
||||
if (vistaState() == VistaAero && isWindow)
|
||||
if (isWindow)
|
||||
drawBlackRect(QRect(0, 0, wizard->width(),
|
||||
titleBarSize() + topOffset(wizard)), hdc);
|
||||
// The button is positioned in QWizardPrivate::handleAeroStyleChange(),
|
||||
@ -250,15 +224,9 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
|
||||
font = QApplication::font("QMdiSubWindowTitleBar");
|
||||
const QFontMetrics fontMetrics(font);
|
||||
const QRect brect = fontMetrics.boundingRect(text);
|
||||
int textHeight = brect.height();
|
||||
int textWidth = brect.width();
|
||||
int glowOffset = 0;
|
||||
|
||||
if (vistaState() == VistaAero) {
|
||||
glowOffset = glowSize(wizard);
|
||||
textHeight += 2 * glowOffset;
|
||||
textWidth += 2 * glowOffset;
|
||||
}
|
||||
const int glowOffset = glowSize(wizard);
|
||||
int textHeight = brect.height() + 2 * glowOffset;
|
||||
int textWidth = brect.width() + 2 * glowOffset;
|
||||
|
||||
const int titleLeft = (wizard->layoutDirection() == Qt::LeftToRight
|
||||
? titleOffset() - glowOffset
|
||||
@ -365,11 +333,8 @@ void QVistaHelper::mouseEvent(QEvent *event)
|
||||
|
||||
bool QVistaHelper::handleWinEvent(MSG *message, qintptr *result)
|
||||
{
|
||||
if (message->message == WM_THEMECHANGED || message->message == WM_DWMCOMPOSITIONCHANGED)
|
||||
cachedVistaState = Dirty;
|
||||
|
||||
bool status = false;
|
||||
if (wizard->wizardStyle() == QWizard::AeroStyle && vistaState() == VistaAero) {
|
||||
if (wizard->wizardStyle() == QWizard::AeroStyle) {
|
||||
status = winEvent(message, result);
|
||||
if (message->message == WM_NCPAINT)
|
||||
wizard->update();
|
||||
@ -382,8 +347,6 @@ void QVistaHelper::resizeEvent(QResizeEvent * event)
|
||||
Q_UNUSED(event);
|
||||
rtTop = QRect (0, 0, wizard->width(), frameSize());
|
||||
int height = captionSize() + topOffset(wizard);
|
||||
if (vistaState() == VistaBasic)
|
||||
height -= titleBarSize();
|
||||
rtTitle = QRect (0, frameSize(), wizard->width(), height);
|
||||
}
|
||||
|
||||
@ -422,7 +385,7 @@ void QVistaHelper::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
wizard->setGeometry(rect);
|
||||
|
||||
} else if (vistaState() == VistaAero) {
|
||||
} else {
|
||||
setMouseCursor(event->pos());
|
||||
}
|
||||
event->ignore();
|
||||
@ -440,11 +403,10 @@ void QVistaHelper::mousePressEvent(QMouseEvent *event)
|
||||
if (rtTitle.contains(event->pos())) {
|
||||
change = movePosition;
|
||||
} else if (rtTop.contains(event->pos()))
|
||||
change = (vistaState() == VistaAero) ? resizeTop : movePosition;
|
||||
change = resizeTop;
|
||||
|
||||
if (change != noChange) {
|
||||
if (vistaState() == VistaAero)
|
||||
setMouseCursor(event->pos());
|
||||
setMouseCursor(event->pos());
|
||||
pressed = true;
|
||||
pressedPos = event->pos();
|
||||
} else {
|
||||
@ -458,8 +420,7 @@ void QVistaHelper::mouseReleaseEvent(QMouseEvent *event)
|
||||
if (pressed) {
|
||||
pressed = false;
|
||||
wizard->releaseMouse();
|
||||
if (vistaState() == VistaAero)
|
||||
setMouseCursor(event->pos());
|
||||
setMouseCursor(event->pos());
|
||||
}
|
||||
event->ignore();
|
||||
}
|
||||
@ -547,90 +508,83 @@ HWND QVistaHelper::wizardHWND() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc)
|
||||
void QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc)
|
||||
{
|
||||
bool value = false;
|
||||
if (vistaState() == VistaAero) {
|
||||
const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
|
||||
rect.size() * QVistaHelper::m_devicePixelRatio);
|
||||
const HANDLE hTheme = OpenThemeData(GetDesktopWindow(), L"WINDOW");
|
||||
if (!hTheme) return false;
|
||||
// Set up a memory DC and bitmap that we'll draw into
|
||||
HDC dcMem;
|
||||
HBITMAP bmp;
|
||||
BITMAPINFO dib;
|
||||
ZeroMemory(&dib, sizeof(dib));
|
||||
dcMem = CreateCompatibleDC(hdc);
|
||||
Q_UNUSED(painter);
|
||||
|
||||
dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
dib.bmiHeader.biWidth = rectDp.width();
|
||||
dib.bmiHeader.biHeight = -rectDp.height();
|
||||
dib.bmiHeader.biPlanes = 1;
|
||||
dib.bmiHeader.biBitCount = 32;
|
||||
dib.bmiHeader.biCompression = BI_RGB;
|
||||
const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
|
||||
rect.size() * QVistaHelper::m_devicePixelRatio);
|
||||
const HANDLE hTheme = OpenThemeData(GetDesktopWindow(), L"WINDOW");
|
||||
if (!hTheme)
|
||||
return;
|
||||
// Set up a memory DC and bitmap that we'll draw into
|
||||
HDC dcMem;
|
||||
HBITMAP bmp;
|
||||
BITMAPINFO dib;
|
||||
ZeroMemory(&dib, sizeof(dib));
|
||||
dcMem = CreateCompatibleDC(hdc);
|
||||
|
||||
bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
dib.bmiHeader.biWidth = rectDp.width();
|
||||
dib.bmiHeader.biHeight = -rectDp.height();
|
||||
dib.bmiHeader.biPlanes = 1;
|
||||
dib.bmiHeader.biBitCount = 32;
|
||||
dib.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
// Set up the DC
|
||||
const LOGFONT captionLogFont = getCaptionLogFont(hTheme);
|
||||
const HFONT hCaptionFont = CreateFontIndirect(&captionLogFont);
|
||||
auto hOldBmp = reinterpret_cast<HBITMAP>(SelectObject(dcMem, (HGDIOBJ) bmp));
|
||||
auto hOldFont = reinterpret_cast<HFONT>(SelectObject(dcMem, (HGDIOBJ) hCaptionFont));
|
||||
bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
|
||||
// Draw the text!
|
||||
DTTOPTS dto;
|
||||
memset(&dto, 0, sizeof(dto));
|
||||
dto.dwSize = sizeof(dto);
|
||||
const UINT uFormat = DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX;
|
||||
RECT rctext ={0,0, rectDp.width(), rectDp.height()};
|
||||
// Set up the DC
|
||||
const LOGFONT captionLogFont = getCaptionLogFont(hTheme);
|
||||
const HFONT hCaptionFont = CreateFontIndirect(&captionLogFont);
|
||||
auto hOldBmp = reinterpret_cast<HBITMAP>(SelectObject(dcMem, (HGDIOBJ) bmp));
|
||||
auto hOldFont = reinterpret_cast<HFONT>(SelectObject(dcMem, (HGDIOBJ) hCaptionFont));
|
||||
|
||||
dto.dwFlags = DTT_COMPOSITED|DTT_GLOWSIZE;
|
||||
dto.iGlowSize = glowSize(wizard);
|
||||
// Draw the text!
|
||||
DTTOPTS dto;
|
||||
memset(&dto, 0, sizeof(dto));
|
||||
dto.dwSize = sizeof(dto);
|
||||
const UINT uFormat = DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX;
|
||||
RECT rctext ={0,0, rectDp.width(), rectDp.height()};
|
||||
|
||||
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);
|
||||
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
|
||||
SelectObject(dcMem, (HGDIOBJ) hOldFont);
|
||||
DeleteObject(bmp);
|
||||
DeleteObject(hCaptionFont);
|
||||
DeleteDC(dcMem);
|
||||
//ReleaseDC(hwnd, hdc);
|
||||
} else if (vistaState() == VistaBasic) {
|
||||
painter->drawText(rect, text);
|
||||
}
|
||||
return value;
|
||||
dto.dwFlags = DTT_COMPOSITED|DTT_GLOWSIZE;
|
||||
dto.iGlowSize = glowSize(wizard);
|
||||
|
||||
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);
|
||||
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
|
||||
SelectObject(dcMem, (HGDIOBJ) hOldFont);
|
||||
DeleteObject(bmp);
|
||||
DeleteObject(hCaptionFont);
|
||||
DeleteDC(dcMem);
|
||||
//ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
bool QVistaHelper::drawBlackRect(const QRect &rect, HDC hdc)
|
||||
void QVistaHelper::drawBlackRect(const QRect &rect, HDC hdc)
|
||||
{
|
||||
bool value = false;
|
||||
if (vistaState() == VistaAero) {
|
||||
// Set up a memory DC and bitmap that we'll draw into
|
||||
const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
|
||||
// Set up a memory DC and bitmap that we'll draw into
|
||||
const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
|
||||
rect.size() * QVistaHelper::m_devicePixelRatio);
|
||||
HDC dcMem;
|
||||
HBITMAP bmp;
|
||||
BITMAPINFO dib;
|
||||
ZeroMemory(&dib, sizeof(dib));
|
||||
dcMem = CreateCompatibleDC(hdc);
|
||||
HDC dcMem;
|
||||
HBITMAP bmp;
|
||||
BITMAPINFO dib;
|
||||
ZeroMemory(&dib, sizeof(dib));
|
||||
dcMem = CreateCompatibleDC(hdc);
|
||||
|
||||
dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
dib.bmiHeader.biWidth = rectDp.width();
|
||||
dib.bmiHeader.biHeight = -rectDp.height();
|
||||
dib.bmiHeader.biPlanes = 1;
|
||||
dib.bmiHeader.biBitCount = 32;
|
||||
dib.bmiHeader.biCompression = BI_RGB;
|
||||
dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
dib.bmiHeader.biWidth = rectDp.width();
|
||||
dib.bmiHeader.biHeight = -rectDp.height();
|
||||
dib.bmiHeader.biPlanes = 1;
|
||||
dib.bmiHeader.biBitCount = 32;
|
||||
dib.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
auto hOldBmp = reinterpret_cast<HBITMAP>(SelectObject(dcMem, (HGDIOBJ) bmp));
|
||||
bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
auto hOldBmp = reinterpret_cast<HBITMAP>(SelectObject(dcMem, (HGDIOBJ) bmp));
|
||||
|
||||
BitBlt(hdc, rectDp.left(), rectDp.top(), rectDp.width(), rectDp.height(), dcMem, 0, 0, SRCCOPY);
|
||||
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
|
||||
BitBlt(hdc, rectDp.left(), rectDp.top(), rectDp.width(), rectDp.height(), dcMem, 0, 0, SRCCOPY);
|
||||
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
|
||||
|
||||
DeleteObject(bmp);
|
||||
DeleteDC(dcMem);
|
||||
}
|
||||
return value;
|
||||
DeleteObject(bmp);
|
||||
DeleteDC(dcMem);
|
||||
}
|
||||
|
||||
int QVistaHelper::frameSizeDp()
|
||||
@ -661,8 +615,6 @@ int QVistaHelper::glowSize(const QPaintDevice *device)
|
||||
|
||||
int QVistaHelper::topOffset(const QPaintDevice *device)
|
||||
{
|
||||
if (vistaState() != VistaAero)
|
||||
return titleBarSize() + 3;
|
||||
static const int aeroOffset = QStyleHelper::dpiScaled(13, device);
|
||||
return aeroOffset + titleBarSize();
|
||||
}
|
||||
|
@ -64,8 +64,6 @@ public:
|
||||
void disconnectBackButton();
|
||||
void hideBackButton() { if (backButton_) backButton_->hide(); }
|
||||
QColor basicWindowFrameColor();
|
||||
enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
|
||||
static VistaState vistaState();
|
||||
static int titleBarSize() { return QVistaHelper::titleBarSizeDp() / QVistaHelper::m_devicePixelRatio; }
|
||||
static int titleBarSizeDp() { return QVistaHelper::frameSizeDp() + QVistaHelper::captionSizeDp(); }
|
||||
static int topPadding(const QPaintDevice *device) { // padding under text
|
||||
@ -77,8 +75,8 @@ public:
|
||||
|
||||
private:
|
||||
HWND wizardHWND() const;
|
||||
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
|
||||
static bool drawBlackRect(const QRect &rect, HDC hdc);
|
||||
void drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
|
||||
static void drawBlackRect(const QRect &rect, HDC hdc);
|
||||
|
||||
static int frameSize() { return QVistaHelper::frameSizeDp() / QVistaHelper::m_devicePixelRatio; }
|
||||
static int frameSizeDp();
|
||||
@ -102,10 +100,6 @@ private:
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
static int instanceCount;
|
||||
static VistaState cachedVistaState;
|
||||
static bool isCompositionEnabled();
|
||||
static bool isThemeActive();
|
||||
enum Changes { resizeTop, movePosition, noChange } change;
|
||||
QPoint pressedPos;
|
||||
bool pressed;
|
||||
|
Loading…
Reference in New Issue
Block a user