Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/dialogs/qwizard_win.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4444
    4545#include "qwizard_win_p.h"
    46 #include "qlibrary.h"
     46#include <private/qsystemlibrary_p.h>
    4747#include "qwizard.h"
    4848#include "qpaintengine.h"
     
    181181{
    182182    ensurePolished();
    183     int width = 32, height = 32;
     183    int size = int(QStyleHelper::dpiScaled(32));
     184    int width = size, height = size;
    184185/*
    185186    HANDLE theme = pOpenThemeData(0, L"Navigation");
     
    214215    //RECT rect;
    215216    RECT clipRect;
    216     int xoffset = QWidget::mapToParent(r.topLeft()).x();
    217     int yoffset = QWidget::mapToParent(r.topLeft()).y();
     217    int xoffset = QWidget::mapToParent(r.topLeft()).x() - 1;
     218    int yoffset = QWidget::mapToParent(r.topLeft()).y() - 1;
    218219
    219220    clipRect.top = r.top() + yoffset;
     
    238239
    239240QVistaHelper::QVistaHelper(QWizard *wizard)
    240     : pressed(false)
     241    : QObject(wizard)
     242    , pressed(false)
    241243    , wizard(wizard)
    242244    , backButton_(0)
     
    245247    if (is_vista)
    246248        backButton_ = new QVistaBackButton(wizard);
     249
     250    // Handle diff between Windows 7 and Vista
     251    iconSpacing = QStyleHelper::dpiScaled(7);
     252    textSpacing = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
     253                  iconSpacing : QStyleHelper::dpiScaled(20);
    247254}
    248255
     
    308315void QVistaHelper::drawTitleBar(QPainter *painter)
    309316{
     317    HDC hdc = painter->paintEngine()->getDC();
     318
    310319    if (vistaState() == VistaAero)
    311         drawBlackRect(
    312             QRect(0, 0, wizard->width(), titleBarSize() + topOffset()),
    313             painter->paintEngine()->getDC());
    314 
     320        drawBlackRect(QRect(0, 0, wizard->width(),
     321                            titleBarSize() + topOffset()), hdc);
    315322    Q_ASSERT(backButton_);
    316323    const int btnTop = backButton_->mapToParent(QPoint()).y();
    317324    const int btnHeight = backButton_->size().height();
    318     const int verticalCenter = (btnTop + btnHeight / 2);
    319 
    320     wizard->windowIcon().paint(
    321         painter, QRect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize()));
     325    const int verticalCenter = (btnTop + btnHeight / 2) - 1;
    322326
    323327    const QString text = wizard->window()->windowTitle();
     
    327331    int textHeight = brect.height();
    328332    int textWidth = brect.width();
     333    int glowOffset = 0;
     334
    329335    if (vistaState() == VistaAero) {
    330336        textHeight += 2 * glowSize();
    331337        textWidth += 2 * glowSize();
    332     }
     338        glowOffset = glowSize();
     339    }
     340
    333341    drawTitleText(
    334342        painter, text,
    335         QRect(titleOffset(), verticalCenter - textHeight / 2, textWidth, textHeight),
    336         painter->paintEngine()->getDC());
     343        QRect(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight),
     344        hdc);
     345
     346    if (!wizard->windowIcon().isNull()) {
     347        QRect rect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize());
     348        HICON hIcon = wizard->windowIcon().pixmap(iconSize()).toWinHICON();
     349        DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
     350        DestroyIcon(hIcon);
     351    }
    337352}
    338353
     
    692707    if (!tried) {
    693708        tried = true;
    694         QLibrary dwmLib(QString::fromAscii("dwmapi"));
     709        QSystemLibrary dwmLib(L"dwmapi");
    695710        pDwmIsCompositionEnabled =
    696711            (PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
     
    700715                (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
    701716        }
    702         QLibrary themeLib(QString::fromAscii("uxtheme"));
     717        QSystemLibrary themeLib(L"uxtheme");
    703718        pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed");
    704719        if (pIsAppThemed) {
     
    734749int QVistaHelper::titleOffset()
    735750{
    736     int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + padding();
     751    int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing;
    737752    return leftMargin() + iconOffset;
    738753}
Note: See TracChangeset for help on using the changeset viewer.