Changeset 561 for trunk/src/gui/styles


Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 deleted
50 edited
16 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/styles/qcdestyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qcdestyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qcleanlooksstyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4545#if !defined(QT_NO_STYLE_CLEANLOOKS) || defined(QT_PLUGIN)
    4646
     47#include <private/qstylehelper_p.h>
    4748#include "qwindowsstyle_p.h"
    4849#include <qcombobox.h>
     
    7374QT_BEGIN_NAMESPACE
    7475
    75 static const bool UsePixmapCache = true;
     76using namespace QStyleHelper;
    7677
    7778enum Direction {
     
    8485// from windows style
    8586static const int windowsItemFrame        =  2; // menu item frame width
    86 static const int windowsSepHeight        =  6; // separator item height
    8787static const int windowsItemHMargin      =  3; // menu item hor text margin
    8888static const int windowsItemVMargin      =  8; // menu item ver text margin
    89 static const int windowsArrowHMargin     =  6; // arrow horizontal margin
    90 static const int windowsTabSpacing       = 12; // space between text and tab
    91 static const int windowsCheckMarkHMargin =  2; // horiz. margins of check mark
    9289static const int windowsRightBorder      = 15; // right border on windows
    93 static const int windowsCheckMarkWidth   = 12; // checkmarks width on windows
    9490
    9591/* XPM */
     
    462458    "             "};
    463459
    464 #ifdef Q_WS_X11
    465 extern "C" {
    466     struct GConfClient;
    467     struct GError;
    468     typedef void (*Ptr_g_type_init)();
    469     typedef GConfClient* (*Ptr_gconf_client_get_default)();
    470     typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **);
    471     typedef void (*Ptr_g_object_unref)(void *);
    472     typedef void (*Ptr_g_error_free)(GError *);
    473     typedef void (*Ptr_g_free)(void*);
    474 }
    475 
    476 static Ptr_g_type_init p_g_type_init = 0;
    477 static Ptr_gconf_client_get_default p_gconf_client_get_default = 0;
    478 static Ptr_gconf_client_get_string p_gconf_client_get_string = 0;
    479 static Ptr_g_object_unref p_g_object_unref = 0;
    480 static Ptr_g_error_free p_g_error_free = 0;
    481 static Ptr_g_free p_g_free = 0;
    482 #endif
    483 
    484460static void qt_cleanlooks_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart,
    485461                                        const QColor &gradientStop, Direction direction = TopDown, QBrush bgBrush = QBrush())
     
    542518        else {
    543519            int size = horizontal ? rect.width() : rect.height() ;
    544             if (size < 1)
    545                 size = 1;
    546             float edge = 4.0/(float)size;
    547             gradient->setColorAt(0, gradientStart);
    548             gradient->setColorAt(edge, gradientMid.lighter(104));
    549             gradient->setColorAt(1.0 - edge, gradientMid.darker(100));
    550             gradient->setColorAt(1.0, gradientStop);
     520            if (size > 4) {
     521                float edge = 4.0/(float)size;
     522                gradient->setColorAt(0, gradientStart);
     523                gradient->setColorAt(edge, gradientMid.lighter(104));
     524                gradient->setColorAt(1.0 - edge, gradientMid.darker(100));
     525                gradient->setColorAt(1.0, gradientStop);
     526            }
    551527        }
    552528        painter->fillRect(rect, *gradient);
    553529        delete gradient;
    554 }
    555 
    556 static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
    557 {
    558     QString tmp;
    559     const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
    560     tmp.sprintf("%s-%d-%d-%lld-%dx%d-%d", key.toLatin1().constData(), uint(option->state),
    561                 complexOption ? uint(complexOption->activeSubControls) : uint(0),
    562                 option->palette.cacheKey(), size.width(), size.height(), option->direction);
    563 #ifndef QT_NO_SPINBOX
    564     if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
    565         tmp.append(QLatin1Char('-'));
    566         tmp.append(QString::number(spinBox->buttonSymbols));
    567         tmp.append(QLatin1Char('-'));
    568         tmp.append(QString::number(spinBox->stepEnabled));
    569         tmp.append(QLatin1Char('-'));
    570         tmp.append(QLatin1Char(spinBox->frame ? '1' : '0'));
    571     }
    572 #endif // QT_NO_SPINBOX
    573     return tmp;
    574530}
    575531
     
    606562
    607563    painter->setPen(QPen(mdiButtonBorderColor, 1));
    608     painter->drawLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top());
    609     painter->drawLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom());
    610     painter->drawLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2);
    611     painter->drawLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2);
    612     painter->drawPoint(tmp.left() + 1, tmp.top() + 1);
    613     painter->drawPoint(tmp.right() - 1, tmp.top() + 1);
    614     painter->drawPoint(tmp.left() + 1, tmp.bottom() - 1);
    615     painter->drawPoint(tmp.right() - 1, tmp.bottom() - 1);
     564    const QLine lines[4] = {
     565        QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()),
     566        QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()),
     567        QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2),
     568        QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2)
     569    };
     570    painter->drawLines(lines, 4);
     571    const QPoint points[4] = {
     572        QPoint(tmp.left() + 1, tmp.top() + 1),
     573        QPoint(tmp.right() - 1, tmp.top() + 1),
     574        QPoint(tmp.left() + 1, tmp.bottom() - 1),
     575        QPoint(tmp.right() - 1, tmp.bottom() - 1)
     576    };
     577    painter->drawPoints(points, 4);
    616578
    617579    painter->setPen(titleBarHighlight);
     
    783745            button.QStyleOption::operator=(*option);
    784746            button.state &= ~State_MouseOver;
    785             drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
     747            proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
    786748        }
    787749        return;
     
    803765        break;
    804766    case PE_IndicatorButtonDropDown:
    805         drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
     767        proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
    806768        break;
    807769    case PE_IndicatorToolBarSeparator:
     
    888850            if (widget && widget->inherits("QDockWidgetTitleButton")) {
    889851                   if (option->state & State_MouseOver)
    890                        drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
     852                       proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
    891853            } else {
    892                 drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
     854                proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
    893855            }
    894856        }
     
    903865            else
    904866                dockWidgetHandle.state |= State_Horizontal;
    905             drawControl(CE_Splitter, &dockWidgetHandle, painter, widget);
     867            proxy()->drawControl(CE_Splitter, &dockWidgetHandle, painter, widget);
    906868        }
    907869        break;
     
    929891#ifdef QT3_SUPPORT
    930892        if (widget && widget->inherits("Q3ToolBar")) {
    931             drawPrimitive(PE_Q3Separator, option, painter, widget);
     893            proxy()->drawPrimitive(PE_Q3Separator, option, painter, widget);
    932894            break;
    933895        }
     
    945907            painter->setPen(buttonShadowAlpha);
    946908            painter->drawLine(QPoint(r.left() + 2, r.top() - 1), QPoint(r.right() - 2, r.top() - 1));
    947             painter->drawPoint(r.right() - 1, r.top());
    948             painter->drawPoint(r.right(), r.top() + 1);
    949             painter->drawPoint(r.right() - 1, r.bottom());
    950             painter->drawPoint(r.right(), r.bottom() - 1);
    951             painter->drawPoint(r.left() + 1, r.top() );
    952             painter->drawPoint(r.left(), r.top() + 1);
    953             painter->drawPoint(r.left() + 1, r.bottom() );
    954             painter->drawPoint(r.left(), r.bottom() - 1);
     909            const QPoint points[8] = {
     910                QPoint(r.right() - 1, r.top()),
     911                QPoint(r.right(), r.top() + 1),
     912                QPoint(r.right() - 1, r.bottom()),
     913                QPoint(r.right(), r.bottom() - 1),
     914                QPoint(r.left() + 1, r.top() ),
     915                QPoint(r.left(), r.top() + 1),
     916                QPoint(r.left() + 1, r.bottom() ),
     917                QPoint(r.left(), r.bottom() - 1)
     918            };
     919            painter->drawPoints(points, 8);
    955920            painter->setPen(QPen(option->palette.background().color(), 1));
    956921            painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1));
     
    984949            painter->drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
    985950            painter->drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right() - 2, r.bottom()));
    986             painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
    987             painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
    988             painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
    989             painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
     951            const QPoint points2[4] = {
     952                QPoint(r.right() - 1, r.bottom() - 1),
     953                QPoint(r.right() - 1, r.top() + 1),
     954                QPoint(r.left() + 1, r.bottom() - 1),
     955                QPoint(r.left() + 1, r.top() + 1)
     956            };
     957            painter->drawPoints(points2, 4);
    990958            painter->drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
    991959            painter->setPen(oldPen);
     
    10851053            painter->setBrushOrigin(rect.topLeft());
    10861054            painter->setPen(Qt::NoPen);
    1087             painter->drawRect(rect.left(), rect.top(), rect.width(), 1);    // Top
    1088             painter->drawRect(rect.left(), rect.bottom(), rect.width(), 1); // Bottom
    1089             painter->drawRect(rect.left(), rect.top(), 1, rect.height());   // Left
    1090             painter->drawRect(rect.right(), rect.top(), 1, rect.height());  // Right
     1055            const QRect rects[4] = {
     1056                QRect(rect.left(), rect.top(), rect.width(), 1),    // Top
     1057                QRect(rect.left(), rect.bottom(), rect.width(), 1), // Bottom
     1058                QRect(rect.left(), rect.top(), 1, rect.height()),   // Left
     1059                QRect(rect.right(), rect.top(), 1, rect.height())   // Right
     1060            };
     1061            painter->drawRects(rects, 4);
    10911062            painter->restore();
    10921063        }
     
    11101081                    r = option->rect.adjusted(0, 1, 0, -1);
    11111082                    painter->setPen(QPen(Qt::black, 0));
    1112                     painter->drawLine(QPoint(r.left() + 2, r.top()),
    1113                                     QPoint(r.right() - 2, r.top()));
    1114                     painter->drawLine(QPoint(r.left(), r.top() + 2),
    1115                                     QPoint(r.left(), r.bottom() - 2));
    1116                     painter->drawLine(QPoint(r.right(), r.top() + 2),
    1117                                     QPoint(r.right(), r.bottom() - 2));
    1118                     painter->drawLine(QPoint(r.left() + 2, r.bottom()),
    1119                                     QPoint(r.right() - 2, r.bottom()));
    1120                     painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
    1121                     painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
    1122                     painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
    1123                     painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
     1083                    const QLine lines[4] = {
     1084                        QLine(QPoint(r.left() + 2, r.top()),
     1085                              QPoint(r.right() - 2, r.top())),
     1086                        QLine(QPoint(r.left(), r.top() + 2),
     1087                              QPoint(r.left(), r.bottom() - 2)),
     1088                        QLine(QPoint(r.right(), r.top() + 2),
     1089                              QPoint(r.right(), r.bottom() - 2)),
     1090                        QLine(QPoint(r.left() + 2, r.bottom()),
     1091                              QPoint(r.right() - 2, r.bottom()))
     1092                    };
     1093                    painter->drawLines(lines, 4);
     1094                    const QPoint points[4] = {
     1095                        QPoint(r.right() - 1, r.bottom() - 1),
     1096                        QPoint(r.right() - 1, r.top() + 1),
     1097                        QPoint(r.left() + 1, r.bottom() - 1),
     1098                        QPoint(r.left() + 1, r.top() + 1)
     1099                    };
     1100                    painter->drawPoints(points, 4);
    11241101                    painter->setPen(oldPen);
    11251102                }
     
    11851162            p->drawLine(QPoint(r.left() + 2, r.bottom()),
    11861163                              QPoint(r.right() - 2, r.bottom()));
    1187             p->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
    1188             p->drawPoint(QPoint(r.right() - 1, r.top() + 1));
    1189             p->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
    1190             p->drawPoint(QPoint(r.left() + 1, r.top() + 1));
     1164            const QPoint points[4] = {
     1165                QPoint(r.right() - 1, r.bottom() - 1),
     1166                QPoint(r.right() - 1, r.top() + 1),
     1167                QPoint(r.left() + 1, r.bottom() - 1),
     1168                QPoint(r.left() + 1, r.top() + 1)
     1169            };
     1170            p->drawPoints(points, 4);
    11911171
    11921172            if (!isDefault && !hasFocus && isEnabled)
     
    12081188
    12091189            p->setPen(topShadow);
    1210             p->drawPoint(QPoint(r.right(), r.top() + 1));
    1211             p->drawPoint(QPoint(r.right() - 1, r.top() ));
    1212             p->drawPoint(QPoint(r.right(), r.bottom() - 1));
    1213             p->drawPoint(QPoint(r.right() - 1, r.bottom() ));
    1214             p->drawPoint(QPoint(r.left() + 1, r.bottom()));
    1215             p->drawPoint(QPoint(r.left(), r.bottom() - 1));
    1216             p->drawPoint(QPoint(r.left() + 1, r.top()));
    1217             p->drawPoint(QPoint(r.left(), r.top() + 1));
     1190            const QPoint points2[8] = {
     1191                QPoint(r.right(), r.top() + 1),
     1192                QPoint(r.right() - 1, r.top() ),
     1193                QPoint(r.right(), r.bottom() - 1),
     1194                QPoint(r.right() - 1, r.bottom() ),
     1195                QPoint(r.left() + 1, r.bottom()),
     1196                QPoint(r.left(), r.bottom() - 1),
     1197                QPoint(r.left() + 1, r.top()),
     1198                QPoint(r.left(), r.top() + 1)
     1199            };
     1200            p->drawPoints(points2, 8);
    12181201
    12191202            topShadow.setAlpha(30);
     
    12281211                r.adjust(-1, -1, 1, 1);
    12291212                p->setPen(buttonShadowAlpha.darker(120));
    1230                 p->drawLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0));
    1231                 p->drawLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0));
    1232                 p->drawLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3));
    1233                 p->drawLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3));
    1234                 p->drawPoint(r.topRight() + QPoint(-2, 1));
    1235                 p->drawPoint(r.topRight() + QPoint(-1, 2));
    1236                 p->drawPoint(r.bottomRight() + QPoint(-1, -2));
    1237                 p->drawPoint(r.bottomRight() + QPoint(-2, -1));
    1238                 p->drawPoint(r.topLeft() + QPoint(1, 2));
    1239                 p->drawPoint(r.topLeft() + QPoint(2, 1));
    1240                 p->drawPoint(r.bottomLeft() + QPoint(1, -2));
    1241                 p->drawPoint(r.bottomLeft() + QPoint(2, -1));
     1213                const QLine lines[4] = {
     1214                    QLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0)),
     1215                    QLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0)),
     1216                    QLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3)),
     1217                    QLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3))
     1218                };
     1219                p->drawLines(lines, 4);
     1220                const QPoint points3[8] = {
     1221                    r.topRight() + QPoint(-2, 1),
     1222                    r.topRight() + QPoint(-1, 2),
     1223                    r.bottomRight() + QPoint(-1, -2),
     1224                    r.bottomRight() + QPoint(-2, -1),
     1225                    r.topLeft() + QPoint(1, 2),
     1226                    r.topLeft() + QPoint(2, 1),
     1227                    r.bottomLeft() + QPoint(1, -2),
     1228                    r.bottomLeft() + QPoint(2, -1)
     1229                };
     1230                p->drawPoints(points3, 8);
    12421231            }
    12431232            painter->setPen(oldPen);
     
    12581247            QColor innerShadow = mergedColors(borderColor, option->palette.base().color());
    12591248
    1260             int borderThickness = pixelMetric(PM_TabBarBaseOverlap, twf, widget);
     1249            int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, twf, widget);
    12611250            bool reverse = (twf->direction == Qt::RightToLeft);
    12621251            QRect tabBarRect;
     
    13521341
    13531342            painter->setPen(alphaCornerColor);
    1354             painter->drawPoint(leftBottomInnerCorner1);
    1355             painter->drawPoint(leftBottomInnerCorner2);
    1356             painter->drawPoint(rightBottomInnerCorner1);
    1357             painter->drawPoint(rightBottomInnerCorner2);
    1358             painter->drawPoint(leftTopInnerCorner1);
    1359             painter->drawPoint(leftTopInnerCorner2);
     1343            const QPoint points[6] = {
     1344                leftBottomInnerCorner1,
     1345                leftBottomInnerCorner2,
     1346                rightBottomInnerCorner1,
     1347                rightBottomInnerCorner2,
     1348                leftTopInnerCorner1,
     1349                leftTopInnerCorner2
     1350            };
     1351            painter->drawPoints(points, 6);
    13601352        }
    13611353#endif // QT_NO_TABWIDGET
     
    13711363                d->tabBarcloseButtonIcon = standardIcon(SP_DialogCloseButton, option, widget);
    13721364            if ((option->state & State_Enabled) && (option->state & State_MouseOver))
    1373                 drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
     1365                proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
    13741366            QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(QSize(16, 16), QIcon::Normal, QIcon::On);
    1375             drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap);
     1367            proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap);
    13761368        }
    13771369        break;
     
    15441536                    break;
    15451537                }
    1546                 if (QApplication::layoutDirection() == Qt::RightToLeft) { //reverse layout changes the order of Beginning/end
     1538                if (toolbar->direction == Qt::RightToLeft) { //reverse layout changes the order of Beginning/end
    15471539                    bool tmp = paintLeftBorder;
    15481540                    paintRightBorder=paintLeftBorder;
     
    16501642                    = painter->fontMetrics().elidedText(dwOpt->title,
    16511643                                            Qt::ElideRight, titleRect.width());
    1652                 drawItemText(painter,
     1644                proxy()->drawItemText(painter,
    16531645                             titleRect,
    16541646                             Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette,
     
    16651657        if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
    16661658            QPixmap cache;
    1667             QString pixmapName = uniqueName(QLatin1String("headersection"), option, option->rect.size());
    1668             pixmapName += QLatin1String("-") + QString::number(int(header->position));
    1669             pixmapName += QLatin1String("-") + QString::number(int(header->orientation));
     1659            QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size());
     1660            pixmapName += QString::number(- int(header->position));
     1661            pixmapName += QString::number(- int(header->orientation));
    16701662            QRect r = option->rect;
    16711663            QColor gradientStopColor;
     
    16841676            painter->fillRect(r, gradient);
    16851677
    1686             if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
     1678            if (!QPixmapCache::find(pixmapName, cache)) {
    16871679                cache = QPixmap(r.size());
    16881680                cache.fill(Qt::transparent);
     
    17031695                    cachePainter.drawLine(pixmapRect.topRight() + QPoint(0, 3), pixmapRect.bottomRight() + QPoint(0, -3));                                }
    17041696                cachePainter.end();
    1705                 if (UsePixmapCache)
    1706                     QPixmapCache::insert(pixmapName, cache);
     1697                QPixmapCache::insert(pixmapName, cache);
    17071698            }
    17081699            painter->drawPixmap(r.topLeft(), cache);
     
    17161707            QColor borderColor = dark.lighter(110);
    17171708            painter->setPen(QPen(borderColor, 0));
    1718             painter->drawLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top()));
    1719             painter->drawLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom()));
    1720             painter->drawLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1));
    1721             painter->drawLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1));
     1709            const QLine lines[4] = {
     1710                QLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top())),
     1711                QLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom())),
     1712                QLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1)),
     1713                QLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1))
     1714            };
     1715            painter->drawLines(lines, 4);
    17221716            QColor alphaCorner = mergedColors(borderColor, option->palette.background().color());
    17231717            QColor innerShadow = mergedColors(borderColor, option->palette.base().color());
     
    17251719            //corner smoothing
    17261720            painter->setPen(alphaCorner);
    1727             painter->drawPoint(rect.topRight());
    1728             painter->drawPoint(rect.topLeft());
    1729             painter->drawPoint(rect.bottomRight());
    1730             painter->drawPoint(rect.bottomLeft());
     1721            const QPoint points[4] = {
     1722                rect.topRight(),
     1723                rect.topLeft(),
     1724                rect.bottomRight(),
     1725                rect.bottomLeft()
     1726            };
     1727            painter->drawPoints(points, 4);
    17311728
    17321729            //inner shadow
     
    17591756            if (vertical) {
    17601757                rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
    1761                 QTransform m;
    1762                 m.translate(rect.height()-1, -1.0);
     1758                QTransform m = QTransform::fromTranslate(rect.height()-1, -1.0);
    17631759                m.rotate(90.0);
    17641760                painter->setTransform(m, true);
     
    17671763            int maxWidth = rect.width() - 4;
    17681764            int minWidth = 4;
    1769                         qint64 progress = (qint64)qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
    1770                         double vc6_workaround = ((progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * maxWidth);
    1771                         int progressBarWidth = (int(vc6_workaround) > minWidth ) ? int(vc6_workaround) : minWidth;
    1772                         int width = indeterminate ? maxWidth : progressBarWidth;
     1765            qreal progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
     1766            int progressBarWidth = (progress - bar->minimum) * qreal(maxWidth) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
     1767            int width = indeterminate ? maxWidth : qMax(minWidth, progressBarWidth);
    17731768
    17741769            bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
     
    18551850
    18561851                painter->setPen(QPen(highlightOutline, 0));
    1857                 painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom()));
    1858                 painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom()));
    1859                 painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
    1860                 painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
     1852                const QLine lines[4] = {
     1853                    QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom())),
     1854                    QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom())),
     1855                    QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
     1856                    QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
     1857                };
     1858                painter->drawLines(lines, 4);
    18611859
    18621860                //draw text
     
    18651863                if (!styleHint(SH_UnderlineShortcut, mbi, widget))
    18661864                    alignment |= Qt::TextHideMnemonic;
    1867                 drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole);
     1865                proxy()->drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole);
    18681866            }
    18691867
     
    18921890                if (!menuItem->text.isEmpty()) {
    18931891                    painter->setFont(menuItem->font);
    1894                     drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
     1892                    proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
    18951893                                 menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
    18961894                                 QPalette::Text);
     
    19121910                r = r.adjusted(-1, 0, 1, 0);
    19131911                painter->setPen(QPen(highlightOutline, 0));
    1914                 painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1));
    1915                 painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1));
    1916                 painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
    1917                 painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
     1912                const QLine lines[4] = {
     1913                    QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1)),
     1914                    QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1)),
     1915                    QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
     1916                    QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
     1917                };
     1918                painter->drawLines(lines, 4);
    19181919            } else {
    19191920                painter->fillRect(option->rect, menuBackground);
     
    19961997                QPixmap pixmap;
    19971998
    1998                 int smallIconSize = pixelMetric(PM_SmallIconSize, option, widget);
     1999                int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget);
    19992000                QSize iconSize(smallIconSize, smallIconSize);
    20002001#ifndef QT_NO_COMBOBOX
     
    20222023                    opt.state |= State_Sunken;
    20232024                    opt.rect = vCheckRect;
    2024                     drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
     2025                    proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
    20252026                }
    20262027                painter->drawPixmap(pmr.topLeft(), pixmap);
     
    20552056                    QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
    20562057                                                     QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
    2057                     if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) {
     2058                    if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
    20582059                        p->setPen(menuitem->palette.light().color());
    20592060                        p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, s.mid(t + 1));
     
    20642065                }
    20652066                QFont font = menuitem->font;
     2067                // font may not have any "hard" flags set. We override
     2068                // the point size so that when it is resolved against the device, this font will win.
     2069                // This is mainly to handle cases where someone sets the font on the window
     2070                // and then the combo inherits it and passes it onward. At that point the resolve mask
     2071                // is very, very weak. This makes it stonger.
     2072                font.setPointSizeF(QFontInfo(menuItem->font).pointSizeF());
    20662073
    20672074                if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
     
    20692076
    20702077                p->setFont(font);
    2071                 if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) {
     2078                if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
    20722079                    p->setPen(menuitem->palette.light().color());
    20732080                    p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, s.left(t));
     
    20922099                    newMI.palette.setColor(QPalette::ButtonText,
    20932100                                           newMI.palette.highlightedText().color());
    2094                 drawPrimitive(arrow, &newMI, painter, widget);
     2101                proxy()->drawPrimitive(arrow, &newMI, painter, widget);
    20952102            }
    20962103        }
     
    21532160            if (button->features & QStyleOptionButton::HasMenu)
    21542161                ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
    2155             drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled),
     2162            proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled),
    21562163                         button->text, QPalette::ButtonText);
    21572164        }
     
    22082215                     && tab->selectedPosition
    22092216                     == QStyleOptionTab::PreviousIsSelected));
    2210             int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget);
     2217            int tabBarAlignment = proxy()->styleHint(SH_TabBar_Alignment, tab, widget);
    22112218            bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft)
    22122219                               || (rtlHorTabs
     
    22212228
    22222229            QColor background = tab->palette.background().color();
    2223             int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget);
     2230            int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
    22242231            if (selected)
    22252232                borderThinkness /= 2;
     
    24572464        if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
    24582465            QPixmap cache;
    2459             QString pixmapName = uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size());
    2460             if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
     2466            QString pixmapName = QStyleHelper::uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size());
     2467            if (!QPixmapCache::find(pixmapName, cache)) {
    24612468                cache = QPixmap(spinBox->rect.size());
    24622469                cache.fill(Qt::transparent);
     
    24742481                QStyleOptionSpinBox spinBoxCopy = *spinBox;
    24752482                spinBoxCopy.rect = pixmapRect;
    2476                 QRect upRect = subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget);
    2477                 QRect downRect = subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget);
    2478 
    2479                 int fw = spinBoxCopy.frame ? pixelMetric(PM_SpinBoxFrameWidth, &spinBoxCopy, widget) : 0;
     2483                QRect upRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget);
     2484                QRect downRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget);
     2485
     2486                int fw = spinBoxCopy.frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, &spinBoxCopy, widget) : 0;
    24802487                cachePainter.fillRect(rect.adjusted(1, qMax(fw - 1, 0), -1, -fw),
    24812488                                      option->palette.base());
     
    24892496
    24902497                    // antialias corners
    2491                     cachePainter.drawPoint(QPoint(r.right(), r.top() + 1));
    2492                     cachePainter.drawPoint(QPoint(r.right() - 1, r.top() ));
    2493                     cachePainter.drawPoint(QPoint(r.right(), r.bottom() - 1));
    2494                     cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() ));
    2495                     cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom()));
    2496                     cachePainter.drawPoint(QPoint(r.left(), r.bottom() - 1));
    2497                     cachePainter.drawPoint(QPoint(r.left() + 1, r.top()));
    2498                     cachePainter.drawPoint(QPoint(r.left(), r.top() + 1));
     2498                    const QPoint points[8] = {
     2499                        QPoint(r.right(), r.top() + 1),
     2500                        QPoint(r.right() - 1, r.top() ),
     2501                        QPoint(r.right(), r.bottom() - 1),
     2502                        QPoint(r.right() - 1, r.bottom() ),
     2503                        QPoint(r.left() + 1, r.bottom()),
     2504                        QPoint(r.left(), r.bottom() - 1),
     2505                        QPoint(r.left() + 1, r.top()),
     2506                        QPoint(r.left(), r.top() + 1)
     2507                    };
     2508                    cachePainter.drawPoints(points, 8);
    24992509
    25002510                    // draw frame
     
    25242534
    25252535                    // top and bottom lines
    2526                     cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom()));
    2527                     cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
    2528                     cachePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
    2529                     cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
     2536                    const QLine lines[4] = {
     2537                        QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom())),
     2538                        QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top())),
     2539                        QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2)),
     2540                        QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
     2541                    };
     2542                    cachePainter.drawLines(lines, 4);
    25302543                }
    25312544
     
    25612574                if (spinBox->frame) {
    25622575                    // rounded corners
    2563                     cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
    2564                     cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
    2565                     cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
    2566                     cachePainter.drawPoint(QPoint(r.right() - 1, r.top() + 1));
     2576                    const QPoint points[4] = {
     2577                        QPoint(r.left() + 1, r.bottom() - 1),
     2578                        QPoint(r.left() + 1, r.top() + 1),
     2579                        QPoint(r.right() - 1, r.bottom() - 1),
     2580                        QPoint(r.right() - 1, r.top() + 1)
     2581                    };
     2582                    cachePainter.drawPoints(points, 4);
    25672583
    25682584                    if (option->state & State_HasFocus) {
     
    25732589                            cachePainter.drawRect(rect.adjusted(1, 2, -3 -downRect.width(), -3));
    25742590                            cachePainter.setPen(QPen(darkoutline, 0));
    2575                             cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom()));
    2576                             cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top()));
    2577                             cachePainter.drawLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1));
    2578                             cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
     2591                            const QLine lines[4] = {
     2592                                QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom())),
     2593                                QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top())),
     2594                                QLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1)),
     2595                                QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
     2596                            };
     2597                            cachePainter.drawLines(lines, 4);
    25792598                            cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
    25802599                            cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
     
    26752694                }
    26762695                cachePainter.end();
    2677                 if (UsePixmapCache)
    2678                     QPixmapCache::insert(pixmapName, cache);
     2696                QPixmapCache::insert(pixmapName, cache);
    26792697            }
    26802698            painter->drawPixmap(spinBox->rect.topLeft(), cache);
     
    27002718                QStyleOptionDockWidgetV2 dockwidget;
    27012719                dockwidget.QStyleOption::operator=(*option);
    2702                 drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
     2720                proxy()->drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
    27032721            } else
    27042722#endif // QT3_SUPPORT
     
    27222740                painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top());
    27232741                painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom());
    2724                 painter->drawPoint(fullRect.left() + 4, fullRect.top() + 1);
    2725                 painter->drawPoint(fullRect.left() + 3, fullRect.top() + 1);
    2726                 painter->drawPoint(fullRect.left() + 2, fullRect.top() + 2);
    2727                 painter->drawPoint(fullRect.left() + 1, fullRect.top() + 3);
    2728                 painter->drawPoint(fullRect.left() + 1, fullRect.top() + 4);
     2742                const QPoint points[5] = {
     2743                    QPoint(fullRect.left() + 4, fullRect.top() + 1),
     2744                    QPoint(fullRect.left() + 3, fullRect.top() + 1),
     2745                    QPoint(fullRect.left() + 2, fullRect.top() + 2),
     2746                    QPoint(fullRect.left() + 1, fullRect.top() + 3),
     2747                    QPoint(fullRect.left() + 1, fullRect.top() + 4)
     2748                };
     2749                painter->drawPoints(points, 5);
    27292750
    27302751                painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom());
    2731                 painter->drawPoint(fullRect.right() - 3, fullRect.top() + 1);
    2732                 painter->drawPoint(fullRect.right() - 4, fullRect.top() + 1);
    2733                 painter->drawPoint(fullRect.right() - 2, fullRect.top() + 2);
    2734                 painter->drawPoint(fullRect.right() - 1, fullRect.top() + 3);
    2735                 painter->drawPoint(fullRect.right() - 1, fullRect.top() + 4);
     2752                const QPoint points2[5] = {
     2753                    QPoint(fullRect.right() - 3, fullRect.top() + 1),
     2754                    QPoint(fullRect.right() - 4, fullRect.top() + 1),
     2755                    QPoint(fullRect.right() - 2, fullRect.top() + 2),
     2756                    QPoint(fullRect.right() - 1, fullRect.top() + 3),
     2757                    QPoint(fullRect.right() - 1, fullRect.top() + 4)
     2758                };
     2759                painter->drawPoints(points2, 5);
    27362760
    27372761                // draw bottomline
     
    27432767            }
    27442768            // draw title
    2745             QRect textRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
     2769            QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
    27462770            QFont font = painter->font();
    27472771            font.setBold(true);
     
    27582782            if ((titleBar->subControls & SC_TitleBarMinButton) && (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
    27592783                !(titleBar->titleBarState& Qt::WindowMinimized)) {
    2760                 QRect minButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
     2784                QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
    27612785                if (minButtonRect.isValid()) {
    27622786                    bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
     
    27792803            if ((titleBar->subControls & SC_TitleBarMaxButton) && (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
    27802804                !(titleBar->titleBarState & Qt::WindowMaximized)) {
    2781                 QRect maxButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
     2805                QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
    27822806                if (maxButtonRect.isValid()) {
    27832807                    bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
     
    27922816                                    maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1);
    27932817                    painter->setPen(textAlphaColor);
    2794                     painter->drawPoint(maxButtonIconRect.topLeft());
    2795                     painter->drawPoint(maxButtonIconRect.topRight());
    2796                     painter->drawPoint(maxButtonIconRect.bottomLeft());
    2797                     painter->drawPoint(maxButtonIconRect.bottomRight());
     2818                    const QPoint points[4] = {
     2819                        maxButtonIconRect.topLeft(),
     2820                        maxButtonIconRect.topRight(),
     2821                        maxButtonIconRect.bottomLeft(),
     2822                        maxButtonIconRect.bottomRight()
     2823                    };
     2824                    painter->drawPoints(points, 4);
    27982825                }
    27992826            }
     
    28012828            // close button
    28022829            if ((titleBar->subControls & SC_TitleBarCloseButton) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
    2803                 QRect closeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
     2830                QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
    28042831                if (closeButtonRect.isValid()) {
    28052832                    bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
     
    28082835                    QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
    28092836                    painter->setPen(textAlphaColor);
    2810                     painter->drawLine(closeIconRect.left() + 1, closeIconRect.top(),
    2811                                     closeIconRect.right(), closeIconRect.bottom() - 1);
    2812                     painter->drawLine(closeIconRect.left(), closeIconRect.top() + 1,
    2813                                     closeIconRect.right() - 1, closeIconRect.bottom());
    2814                     painter->drawLine(closeIconRect.right() - 1, closeIconRect.top(),
    2815                                     closeIconRect.left(), closeIconRect.bottom() - 1);
    2816                     painter->drawLine(closeIconRect.right(), closeIconRect.top() + 1,
    2817                                     closeIconRect.left() + 1, closeIconRect.bottom());
    2818                     painter->drawPoint(closeIconRect.topLeft());
    2819                     painter->drawPoint(closeIconRect.topRight());
    2820                     painter->drawPoint(closeIconRect.bottomLeft());
    2821                     painter->drawPoint(closeIconRect.bottomRight());
     2837                    const QLine lines[4] = {
     2838                        QLine(closeIconRect.left() + 1, closeIconRect.top(),
     2839                              closeIconRect.right(), closeIconRect.bottom() - 1),
     2840                        QLine(closeIconRect.left(), closeIconRect.top() + 1,
     2841                              closeIconRect.right() - 1, closeIconRect.bottom()),
     2842                        QLine(closeIconRect.right() - 1, closeIconRect.top(),
     2843                              closeIconRect.left(), closeIconRect.bottom() - 1),
     2844                        QLine(closeIconRect.right(), closeIconRect.top() + 1,
     2845                              closeIconRect.left() + 1, closeIconRect.bottom())
     2846                    };
     2847                    painter->drawLines(lines, 4);
     2848                    const QPoint points[4] = {
     2849                        closeIconRect.topLeft(),
     2850                        closeIconRect.topRight(),
     2851                        closeIconRect.bottomLeft(),
     2852                        closeIconRect.bottomRight()
     2853                    };
     2854                    painter->drawPoints(points, 4);
    28222855
    28232856                    painter->setPen(textColor);
     
    28352868               ((titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
    28362869               (titleBar->titleBarState & Qt::WindowMaximized)))) {
    2837                 QRect normalButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
     2870                QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
    28382871                if (normalButtonRect.isValid()) {
    28392872
     
    28492882                                    frontWindowRect.right() - 1, frontWindowRect.top() + 1);
    28502883                    painter->setPen(textAlphaColor);
    2851                     painter->drawPoint(frontWindowRect.topLeft());
    2852                     painter->drawPoint(frontWindowRect.topRight());
    2853                     painter->drawPoint(frontWindowRect.bottomLeft());
    2854                     painter->drawPoint(frontWindowRect.bottomRight());
     2884                    const QPoint points[4] = {
     2885                        frontWindowRect.topLeft(),
     2886                        frontWindowRect.topRight(),
     2887                        frontWindowRect.bottomLeft(),
     2888                        frontWindowRect.bottomRight()
     2889                    };
     2890                    painter->drawPoints(points, 4);
    28552891
    28562892                    QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3);
     
    28642900                                    backWindowRect.right() - 1, backWindowRect.top() + 1);
    28652901                    painter->setPen(textAlphaColor);
    2866                     painter->drawPoint(backWindowRect.topLeft());
    2867                     painter->drawPoint(backWindowRect.topRight());
    2868                     painter->drawPoint(backWindowRect.bottomLeft());
    2869                     painter->drawPoint(backWindowRect.bottomRight());
     2902                    const QPoint points2[4] = {
     2903                        backWindowRect.topLeft(),
     2904                        backWindowRect.topRight(),
     2905                        backWindowRect.bottomLeft(),
     2906                        backWindowRect.bottomRight()
     2907                    };
     2908                    painter->drawPoints(points2, 4);
    28702909                    painter->restore();
    28712910                }
     
    28752914            if (titleBar->subControls & SC_TitleBarContextHelpButton
    28762915                && (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint)) {
    2877                 QRect contextHelpButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
     2916                QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
    28782917                if (contextHelpButtonRect.isValid()) {
    28792918                    bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
     
    28942933            // shade button
    28952934            if (titleBar->subControls & SC_TitleBarShadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
    2896                 QRect shadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
     2935                QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
    28972936                if (shadeButtonRect.isValid()) {
    28982937                    bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
     
    29072946            // unshade button
    29082947            if (titleBar->subControls & SC_TitleBarUnshadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
    2909                 QRect unshadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
     2948                QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
    29102949                if (unshadeButtonRect.isValid()) {
    29112950                    bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
     
    29192958
    29202959            if ((titleBar->subControls & SC_TitleBarSysMenu) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
    2921                 QRect iconRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
     2960                QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
    29222961                if (iconRect.isValid()) {
    29232962                    if (!titleBar->icon.isNull()) {
     
    29292968                        tool.rect = iconRect;
    29302969                        painter->save();
    2931                         drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
     2970                        proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
    29322971                        painter->restore();
    29332972                    }
     
    29492988
    29502989            QRect rect = scrollBar->rect;
    2951             QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
    2952             QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
    2953             QRect scrollBarSlider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
    2954             QRect grooveRect = subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
     2990            QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
     2991            QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
     2992            QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
     2993            QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
    29552994
    29562995            // paint groove
     
    30873126            // The SubLine (up/left) buttons
    30883127            if (scrollBar->subControls & SC_ScrollBarSubLine) {
    3089                 //int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget);
     3128                //int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget);
    30903129                QRect pixmapRect = scrollBarSubLine;
    30913130                if (isEnabled ) {
     
    31333172                QStyleOption arrowOpt = *option;
    31343173                arrowOpt.rect = scrollBarSubLine.adjusted(3, 3, -2, -2);
    3135                 drawPrimitive(arrow, &arrowOpt, painter, widget);
     3174                proxy()->drawPrimitive(arrow, &arrowOpt, painter, widget);
    31363175
    31373176
    31383177                // The AddLine (down/right) button
    31393178                if (scrollBar->subControls & SC_ScrollBarAddLine) {
    3140                     QString addLinePixmapName = uniqueName(QLatin1String("scrollbar_addline"), option, QSize(16, 16));
     3179                    QString addLinePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_addline"), option, QSize(16, 16));
    31413180                    QRect pixmapRect = scrollBarAddLine;
    31423181                    if (isEnabled) {
     
    31843223                    QStyleOption arrowOpt = *option;
    31853224                    arrowOpt.rect = scrollBarAddLine.adjusted(3, 3, -2, -2);
    3186                     drawPrimitive(arrow, &arrowOpt, painter, widget);
     3225                    proxy()->drawPrimitive(arrow, &arrowOpt, painter, widget);
    31873226                }
    31883227            }
     
    31993238            bool focus = isEnabled && (comboBox->state & State_HasFocus);
    32003239            QPixmap cache;
    3201             QString pixmapName = uniqueName(QLatin1String("combobox"), option, comboBox->rect.size());
     3240            QString pixmapName = QStyleHelper::uniqueName(QLatin1String("combobox"), option, comboBox->rect.size());
    32023241            if (sunken)
    32033242                pixmapName += QLatin1String("-sunken");
     
    32073246                pixmapName += QLatin1String("-enabled");
    32083247
    3209             if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
     3248            if (!QPixmapCache::find(pixmapName, cache)) {
    32103249                cache = QPixmap(comboBox->rect.size());
    32113250                cache.fill(Qt::transparent);
     
    32163255
    32173256                QRect rect = pixmapRect;
    3218                 QRect downArrowRect = subControlRect(CC_ComboBox, &comboBoxCopy,
     3257                QRect downArrowRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
    32193258                                                     SC_ComboBoxArrow, widget);
    3220                 QRect editRect = subControlRect(CC_ComboBox, &comboBoxCopy,
     3259                QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
    32213260                                                     SC_ComboBoxEditField, widget);
    32223261                // Draw a push button
     
    32323271                    }
    32333272
    3234                     drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
     3273                    proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
    32353274
    32363275                    //remove shadow from left side of edit field when pressed:
     
    32743313                        buttonOption.state &= ~State_MouseOver;
    32753314                    }
    3276                     drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
     3315                    proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
    32773316
    32783317                    cachePainter.setPen(buttonShadow.darker(102));
     
    33273366                }
    33283367                // Draw the focus rect
    3329                 if ((focus && (option->state & State_KeyboardFocusChange)) && !comboBox->editable) {
     3368                if (focus && !comboBox->editable
     3369                    && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) {
    33303370                    QStyleOptionFocusRect focus;
    3331                     focus.rect = subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget)
     3371                    focus.rect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget)
    33323372                                 .adjusted(0, 2, option->direction == Qt::RightToLeft ? 1 : -1, -2);
    3333                     drawPrimitive(PE_FrameFocusRect, &focus, &cachePainter, widget);
     3373                    proxy()->drawPrimitive(PE_FrameFocusRect, &focus, &cachePainter, widget);
    33343374                }
    33353375                cachePainter.end();
    3336                 if (UsePixmapCache)
    3337                     QPixmapCache::insert(pixmapName, cache);
     3376                QPixmapCache::insert(pixmapName, cache);
    33383377            }
    33393378            painter->drawPixmap(comboBox->rect.topLeft(), cache);
     
    33463385        painter->save();
    33473386        if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
    3348             QRect textRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
    3349             QRect checkBoxRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget);
     3387            QRect textRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
     3388            QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget);
    33503389            bool flat = groupBox->features & QStyleOptionFrameV2::Flat;
    33513390
     
    33573396                    frame.lineWidth = groupBox->lineWidth;
    33583397                    frame.midLineWidth = groupBox->midLineWidth;
    3359                     frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
     3398                    frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
    33603399
    33613400                    painter->save();
     
    33663405                        painter->setClipRegion(region);
    33673406                    frame.palette.setBrush(QPalette::Dark, option->palette.mid().color().lighter(110));
    3368                     drawPrimitive(PE_FrameGroupBox, &frame, painter);
     3407                    proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter);
    33693408                    painter->restore();
    33703409                }
     
    33943433                box.QStyleOption::operator=(*groupBox);
    33953434                box.rect = checkBoxRect;
    3396                 drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
     3435                proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
    33973436            }
    33983437        }
     
    34033442    case CC_Slider:
    34043443        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    3405             QRect groove = subControlRect(CC_Slider, option, SC_SliderGroove, widget);
    3406             QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget);
    3407             QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
     3444            QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
     3445            QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
     3446            QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
    34083447
    34093448            bool horizontal = slider->orientation == Qt::Horizontal;
     
    34223461
    34233462            if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
    3424                 QString groovePixmapName = uniqueName(QLatin1String("slider_groove"), option, groove.size());
     3463                QString groovePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_groove"), option, groove.size());
    34253464                QRect pixmapRect(0, 0, groove.width(), groove.height());
    34263465
    34273466                // draw background groove
    3428                 if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
     3467                if (!QPixmapCache::find(groovePixmapName, cache)) {
    34293468                    cache = QPixmap(pixmapRect.size());
    34303469                    cache.fill(Qt::transparent);
     
    34533492                    groovePainter.drawRect(pixmapRect.adjusted(1, 1, -2, -2));
    34543493                    groovePainter.end();
    3455                     if (UsePixmapCache)
    3456                         QPixmapCache::insert(groovePixmapName, cache);
     3494                    QPixmapCache::insert(groovePixmapName, cache);
    34573495                }
    34583496                painter->drawPixmap(groove.topLeft(), cache);
     
    34613499                QRect clipRect;
    34623500                groovePixmapName += QLatin1String("_blue");
    3463                 if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
     3501                if (!QPixmapCache::find(groovePixmapName, cache)) {
    34643502                    cache = QPixmap(pixmapRect.size());
    34653503                    cache.fill(Qt::transparent);
     
    34803518                    groovePainter.drawRect(pixmapRect.adjusted(1, 1, -2, -2));
    34813519                    groovePainter.end();
    3482                     if (UsePixmapCache)
    3483                         QPixmapCache::insert(groovePixmapName, cache);
     3520                    QPixmapCache::insert(groovePixmapName, cache);
    34843521                }
    34853522                if (horizontal) {
     
    35023539            // draw handle
    35033540            if ((option->subControls & SC_SliderHandle) ) {
    3504                 QString handlePixmapName = uniqueName(QLatin1String("slider_handle"), option, handle.size());
    3505                 if (!UsePixmapCache || !QPixmapCache::find(handlePixmapName, cache)) {
     3541                QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size());
     3542                if (!QPixmapCache::find(handlePixmapName, cache)) {
    35063543                    cache = QPixmap(handle.size());
    35073544                    cache.fill(Qt::transparent);
     
    35433580                    handlePainter.setRenderHint(QPainter::Antialiasing);
    35443581                    handlePainter.translate(0.5, 0.5);
    3545                     handlePainter.drawLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom()));
    3546                     handlePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top()));
    3547                     handlePainter.drawLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom()));
    3548                     handlePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()));
     3582                    const QLine lines[4] = {
     3583                        QLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom())),
     3584                        QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top())),
     3585                        QLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom())),
     3586                        QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()))
     3587                    };
     3588                    handlePainter.drawLines(lines, 4);
    35493589                    handlePainter.restore();;
    35503590                    handlePainter.setPen(QPen(outline.darker(130), 1));
     
    35843624                    }
    35853625                    handlePainter.end();
    3586                     if (UsePixmapCache)
    3587                         QPixmapCache::insert(handlePixmapName, cache);
     3626                    QPixmapCache::insert(handlePixmapName, cache);
    35883627                }
    35893628
     
    35943633                    fropt.QStyleOption::operator=(*slider);
    35953634                    fropt.rect = slider->rect;
    3596                     drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
     3635                    proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
    35973636                }
    35983637            }
    35993638            if (option->subControls & SC_SliderTickmarks) {
    36003639                painter->setPen(darkOutline);
    3601                 int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
    3602                 int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
     3640                int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
     3641                int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
    36033642                int interval = slider->tickInterval;
    36043643                if (interval <= 0) {
     
    36143653
    36153654                int v = slider->minimum;
    3616                 int len = pixelMetric(PM_SliderLength, slider, widget);
     3655                int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
    36173656                while (v <= slider->maximum + 1) {
    36183657                    if (v == slider->maximum + 1 && interval == 1)
     
    36573696        break;
    36583697#endif // QT_NO_SLIDER
     3698#ifndef QT_NO_DIAL
     3699    case CC_Dial:
     3700        if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
     3701            QStyleHelper::drawDial(dial, painter);
     3702        break;
     3703#endif // QT_NO_DIAL
    36593704        default:
    36603705            QWindowsStyle::drawComplexControl(control, option, painter, widget);
     
    37733818            if (!btn->icon.isNull() && btn->iconSize.height() > 16)
    37743819                newSize -= QSize(0, 2);
     3820            newSize += QSize(0, 1);
    37753821        }
    37763822        if (const QPushButton *button = qobject_cast<const QPushButton *>(widget)) {
     
    37813827        }
    37823828        break;
     3829#ifndef QT_NO_GROUPBOX
    37833830    case CT_GroupBox:
     3831        // Since we use a bold font we have to recalculate base width
     3832        if (const QGroupBox *gb = qobject_cast<const QGroupBox*>(widget)) {
     3833            QFont font = gb->font();
     3834            font.setBold(true);
     3835            QFontMetrics metrics(font);
     3836            int baseWidth = metrics.width(gb->title()) + metrics.width(QLatin1Char(' '));
     3837            if (gb->isCheckable()) {
     3838                baseWidth += proxy()->pixelMetric(QStyle::PM_IndicatorWidth, option, widget);
     3839                baseWidth += proxy()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, option, widget);
     3840            }
     3841            newSize.setWidth(qMax(baseWidth, newSize.width()));
     3842        }
     3843        newSize += QSize(0, 1);
     3844        break;
     3845#endif //QT_NO_GROUPBOX
    37843846    case CT_RadioButton:
    37853847    case CT_CheckBox:
     
    38083870            if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
    38093871                if (!menuItem->text.isEmpty()) {
    3810                     newSize.setHeight(menuItem->fontMetrics.lineSpacing());
     3872                    newSize.setHeight(menuItem->fontMetrics.height());
    38113873                }
    38123874            }
     
    38493911{
    38503912    QWindowsStyle::polish(app);
    3851 #ifdef Q_WS_X11
    3852     Q_D(QCleanlooksStyle);
    3853 
    3854     QString dataDirs = QLatin1String(getenv("XDG_DATA_DIRS"));
    3855 
    3856     if (dataDirs.isEmpty())
    3857         dataDirs = QLatin1String("/usr/local/share/:/usr/share/");
    3858 
    3859     dataDirs.prepend(QDir::homePath() + QLatin1String("/:"));
    3860     d->iconDirs = dataDirs.split(QLatin1String(":"));
    3861 #endif
    38623913}
    38633914
     
    39604011    case CC_Slider:
    39614012        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    3962             int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
     4013            int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
    39634014            switch (subControl) {
    39644015            case SC_SliderHandle: {
     
    40154066            QSize bs;
    40164067            int center = spinbox->rect.height() / 2;
    4017             int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
     4068            int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
    40184069            int y = fw;
    40194070            bs.setHeight(qMax(8, spinbox->rect.height()/2 - y));
     
    40564107            int topMargin = 0;
    40574108            int topHeight = 0;
    4058             int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
     4109            int verticalAlignment = proxy()->styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
    40594110            bool flat = groupBox->features & QStyleOptionFrameV2::Flat;
    40604111            if (!groupBox->text.isEmpty()) {
     
    40874138                    QSize textRect = fontMetrics.boundingRect(groupBoxWidget->title()).size() + QSize(2, 2);
    40884139                    if (subControl == SC_GroupBoxCheckBox) {
    4089                         int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget);
    4090                         int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget);
     4140                        int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
     4141                        int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
    40914142                        rect.setWidth(indicatorWidth);
    40924143                        rect.setHeight(indicatorHeight);
     
    41094160            break;
    41104161        case SC_ComboBoxEditField: {
    4111             int frameWidth = pixelMetric(PM_DefaultFrameWidth);
     4162            int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth);
    41124163            rect = visualRect(option->direction, option->rect, rect);
    41134164            rect.setRect(option->rect.left() + frameWidth, option->rect.top() + frameWidth,
     
    43604411            r.adjust(0, 0, 0, -4);
    43614412        } else {
    4362             if (QApplication::layoutDirection() == Qt::LeftToRight)
     4413            if (opt->direction == Qt::LeftToRight)
    43634414                r.adjust(4, 0, 0, 0);
    43644415            else
     
    43754426    }
    43764427    return r;
    4377 }
    4378 
    4379 void QCleanlooksStylePrivate::lookupIconTheme() const
    4380 {
    4381 #ifdef Q_WS_X11
    4382 
    4383     if (themeName.isEmpty()) {
    4384         //resolve glib and gconf functions
    4385         p_g_type_init =              (Ptr_g_type_init)QLibrary::resolve(QLatin1String("gobject-2.0"), 0, "g_type_init");
    4386         p_gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLatin1String("gconf-2"), 4, "gconf_client_get_default");
    4387         p_gconf_client_get_string =  (Ptr_gconf_client_get_string)QLibrary::resolve(QLatin1String("gconf-2"), 4, "gconf_client_get_string");
    4388         p_g_object_unref =           (Ptr_g_object_unref)QLibrary::resolve(QLatin1String("gobject-2.0"), 0, "g_object_unref");
    4389         p_g_error_free =             (Ptr_g_error_free)QLibrary::resolve(QLatin1String("glib-2.0"), 0, "g_error_free");
    4390         p_g_free =                   (Ptr_g_free)QLibrary::resolve(QLatin1String("glib-2.0"), 0, "g_free");
    4391 
    4392         if (p_g_type_init &&
    4393              p_gconf_client_get_default &&
    4394              p_gconf_client_get_string &&
    4395              p_g_object_unref &&
    4396              p_g_error_free &&
    4397              p_g_free) {
    4398 
    4399             p_g_type_init();
    4400             GConfClient* client = p_gconf_client_get_default();
    4401             GError *err = 0;
    4402             char *str = p_gconf_client_get_string(client, "/desktop/gnome/interface/icon_theme", &err);
    4403             if (!err) {
    4404                 themeName = QString::fromUtf8(str);
    4405                 p_g_free(str);
    4406             }
    4407             p_g_object_unref(client);
    4408             if (err)
    4409                 p_g_error_free (err);
    4410         }
    4411         if (themeName.isEmpty())
    4412             themeName = QLatin1String("gnome");
    4413     }
    4414 #endif
    44154428}
    44164429
     
    44224435                                                  const QWidget *widget) const
    44234436{
    4424 #ifdef Q_WS_X11
    4425     Q_D(const QCleanlooksStyle);
    4426     if (!qApp->desktopSettingsAware())
    4427         return QWindowsStyle::standardIconImplementation(standardIcon, option, widget);
    4428     QIcon icon;
    4429     QPixmap pixmap;
    4430     QPixmap link;
    4431     d->lookupIconTheme();
    4432     switch (standardIcon) {
    4433     case SP_DirIcon: {
    4434         icon = QIcon(standardPixmap(standardIcon, option, widget));
    4435         icon.addPixmap(standardPixmap(SP_DirClosedIcon, option, widget),
    4436                        QIcon::Normal, QIcon::Off);
    4437         pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png"));
    4438         if (!pixmap.isNull())
    4439             icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off);
    4440         pixmap = d->findIcon(48, QLatin1String("gnome-fs-directory.png"));
    4441         if (!pixmap.isNull())
    4442             icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off);
    4443         pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory-accept.png"));
    4444         if (!pixmap.isNull())
    4445             icon.addPixmap(pixmap, QIcon::Normal, QIcon::On);
    4446         pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory-accept.png"));
    4447         if (!pixmap.isNull())
    4448             icon.addPixmap(pixmap, QIcon::Normal, QIcon::On);
    4449     }
    4450     break;
    4451     case SP_DirLinkIcon:
    4452         {
    4453             icon = QIcon(standardPixmap(standardIcon, option, widget));
    4454             QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png"));
    4455             if (!link.isNull()) {
    4456                 icon.addPixmap(standardPixmap(SP_DirLinkIcon, option, widget));
    4457                 pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png"));
    4458                 if (!pixmap.isNull()) {
    4459                     QPainter painter(&pixmap);
    4460                     painter.drawPixmap(8, 8, 8, 8, link);
    4461                     painter.end();
    4462                     icon.addPixmap(pixmap);
    4463                 }
    4464             }
    4465             break;
    4466         }
    4467     case SP_FileIcon:
    4468         {
    4469             icon = d->createIcon(QLatin1String("unknown.png"));
    4470             if (icon.isNull())
    4471                 icon = d->createIcon(QLatin1String("gnome-fs-regular.png"));
    4472             if (icon.isNull())
    4473                 icon = d->createIcon(QLatin1String("stock_new.png"));
    4474             break;
    4475         }
    4476     case SP_DialogCloseButton:
    4477         {
    4478             icon  = d->createIcon(QLatin1String("gtk-close.png"));
    4479             if (icon.isNull())
    4480                 icon = d->createIcon(QLatin1String("stock-close.png"));
    4481             break;
    4482         }
    4483     case SP_DirHomeIcon:
    4484         {
    4485             icon = d->createIcon(QLatin1String("folder_home.png"));
    4486             if (icon.isNull())
    4487                 icon = d->createIcon(QLatin1String("gnome_home.png"));
    4488             break;
    4489         }
    4490     case SP_DriveFDIcon:
    4491         {
    4492             icon = d->createIcon(QLatin1String("gnome-dev-floppy.png"));
    4493             break;
    4494         }
    4495     case SP_ComputerIcon:
    4496         {
    4497             icon = d->createIcon(QLatin1String("gnome-fs-client.png"));
    4498             break;
    4499         }
    4500     case SP_DesktopIcon:
    4501         {
    4502             icon = d->createIcon(QLatin1String("gnome-fs-desktop.png"));
    4503             break;
    4504         }
    4505     case SP_TrashIcon:
    4506         {
    4507             icon = d->createIcon(QLatin1String("gnome-fs-trash-empty.png"));
    4508             break;
    4509         }
    4510     case SP_DriveCDIcon:
    4511     case SP_DriveDVDIcon:
    4512         {
    4513             icon = d->createIcon(QLatin1String("gnome-dev-cdrom.png"));
    4514             break;
    4515         }
    4516     case SP_DriveHDIcon:
    4517         {
    4518             icon = d->createIcon(QLatin1String("gnome-dev-harddisk.png"));
    4519             break;
    4520         }
    4521     case SP_ArrowUp:
    4522         {
    4523             icon = d->createIcon(QLatin1String("stock_up.png"));
    4524             break;
    4525         }
    4526     case SP_ArrowDown:
    4527         {
    4528             icon = d->createIcon(QLatin1String("stock_down.png"));
    4529             break;
    4530         }
    4531     case SP_ArrowRight:
    4532         {
    4533             icon = d->createIcon(QLatin1String("stock_right.png"));
    4534             break;
    4535         }
    4536     case SP_ArrowLeft:
    4537         {
    4538             icon = d->createIcon(QLatin1String("stock_left.png"));
    4539             break;
    4540         }
    4541     case SP_BrowserReload:
    4542         {
    4543             icon = d->createIcon(QLatin1String("view-refresh.png"));
    4544             break;
    4545         }
    4546     case SP_BrowserStop:
    4547         {
    4548             pixmap = d->findIcon(24, QLatin1String("stop.png"));
    4549             break;
    4550         }
    4551     case SP_FileLinkIcon:
    4552         {
    4553             icon = QIcon(standardPixmap(standardIcon, option, widget));
    4554             QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png"));
    4555             if (!link.isNull()) {
    4556                 icon.addPixmap(standardPixmap(SP_FileLinkIcon,option, widget));
    4557                 pixmap = d->findIcon(16, QLatin1String("unknown.png"));
    4558                 if (pixmap.isNull())
    4559                     pixmap = d->findIcon(16, QLatin1String("stock_new.png"));
    4560                 if (!pixmap.isNull()) {
    4561                     QPainter painter(&pixmap);
    4562                     painter.drawPixmap(8, 8, 8, 8, link);
    4563                     painter.end();
    4564                     icon.addPixmap(pixmap);
    4565                 }
    4566             }
    4567             break;
    4568         }
    4569     case SP_ArrowForward:
    4570         if (QApplication::layoutDirection() == Qt::RightToLeft)
    4571             return standardIconImplementation(SP_ArrowLeft, option, widget);
    4572         return standardIconImplementation(SP_ArrowRight, option, widget);
    4573     case SP_ArrowBack:
    4574         if (QApplication::layoutDirection() == Qt::RightToLeft)
    4575             return standardIconImplementation(SP_ArrowRight, option, widget);
    4576         return standardIconImplementation(SP_ArrowLeft, option, widget);
    4577     default:
    4578         icon = QIcon(standardPixmap(standardIcon, option, widget));
    4579     }
    4580     if (!icon.isNull())
    4581         return icon;
    4582 #endif // Q_WS_X11
    45834437    return QWindowsStyle::standardIconImplementation(standardIcon, option, widget);
    45844438}
     
    45904444                                      const QWidget *widget) const
    45914445{
    4592 #ifdef Q_WS_X11
    4593     Q_D(const QCleanlooksStyle);
    45944446    QPixmap pixmap;
    4595     if (!qApp->desktopSettingsAware())
    4596         return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
    4597     d->lookupIconTheme();
     4447
    45984448#ifndef QT_NO_IMAGEFORMAT_XPM
    45994449    switch (standardPixmap) {
    4600     case SP_MessageBoxInformation:
    4601         {
    4602             pixmap = d->findIcon(48, QLatin1String("dialog-info.png"));
    4603             if (pixmap.isNull())
    4604                 pixmap = d->findIcon(48, QLatin1String("stock_dialog-info.png"));
    4605             if (!pixmap.isNull())
    4606                 return pixmap;
    4607             break;
    4608         }
    4609     case SP_MessageBoxWarning:
    4610         {
    4611             pixmap = d->findIcon(48, QLatin1String("dialog-warning.png"));
    4612             if (pixmap.isNull())
    4613                 pixmap = d->findIcon(48, QLatin1String("stock_dialog-warning.png"));
    4614             if (!pixmap.isNull())
    4615                 return pixmap;
    4616             break;
    4617         }
    4618     case SP_MessageBoxCritical:
    4619         {
    4620             pixmap = d->findIcon(48, QLatin1String("dialog-error.png"));
    4621             if (pixmap.isNull())
    4622                 pixmap = d->findIcon(48, QLatin1String("stock_dialog-error.png"));
    4623             if (!pixmap.isNull())
    4624                 return pixmap;
    4625             break;
    4626         }
    4627     case SP_MessageBoxQuestion:
    4628         {
    4629             pixmap = d->findIcon(48, QLatin1String("dialog-question.png"));
    4630             if (!pixmap.isNull())
    4631                 return pixmap;
    4632             break;
    4633         }
    4634     case SP_DirHomeIcon:
    4635         {
    4636             pixmap = d->findIcon(16, QLatin1String("folder_home.png"));
    4637             if (pixmap.isNull())
    4638                 pixmap = d->findIcon(16, QLatin1String("gnome_home.png"));
    4639             if (!pixmap.isNull())
    4640                 return pixmap;
    4641             break;
    4642         }
    4643     case SP_DialogOpenButton:
    4644     case SP_DirOpenIcon:
    4645         {
    4646             pixmap = d->findIcon(24, QLatin1String("stock_open.png"));
    4647             if (!pixmap.isNull())
    4648                 return pixmap;
    4649             break;
    4650         }
    4651     case SP_FileIcon:
    4652         {
    4653             pixmap = d->findIcon(24, QLatin1String("unknown.png"));
    4654             if (pixmap.isNull())
    4655                 pixmap = d->findIcon(24, QLatin1String("gnome-fs-regular.png"));
    4656             if (pixmap.isNull())
    4657                 pixmap = d->findIcon(24, QLatin1String("stock_new.png"));
    4658             if (!pixmap.isNull())
    4659                 return pixmap;
    4660             break;
    4661         }
    4662     case SP_FileLinkIcon:
    4663         {
    4664             pixmap = d->findIcon(24, QLatin1String("emblem-symbolic-link.png"));
    4665             if (!pixmap.isNull()) {
    4666                 QPixmap fileIcon = d->findIcon(24, QLatin1String("unknown.png"));
    4667                 if (fileIcon.isNull())
    4668                     fileIcon = d->findIcon(24, QLatin1String("stock_new.png"));
    4669                 if (!fileIcon.isNull()) {
    4670                     QPainter painter(&fileIcon);
    4671                     painter.setRenderHint(QPainter::SmoothPixmapTransform);
    4672                     painter.drawPixmap(12, 12, 12, 12, pixmap);
    4673                     return fileIcon;
    4674                 }
    4675             }
    4676             break;
    4677        }
    4678     case SP_DirClosedIcon:
    4679     case SP_DirIcon:
    4680         {
    4681             pixmap = d->findIcon(24, QLatin1String("gnome-fs-directory.png"));
    4682             if (!pixmap.isNull())
    4683                 return pixmap;
    4684             break;
    4685         }
    4686     case SP_DirLinkIcon:
    4687         {
    4688             pixmap = d->findIcon(24, QLatin1String("emblem-symbolic-link.png"));
    4689             if (!pixmap.isNull()) {
    4690                 QPixmap dirIcon = d->findIcon(24, QLatin1String("gnome-fs-directory.png"));
    4691                 if (!dirIcon.isNull()) {
    4692                     QPainter painter(&dirIcon);
    4693                     painter.setRenderHint(QPainter::SmoothPixmapTransform);
    4694                     painter.drawPixmap(12, 12, 12, 12, pixmap);
    4695                     return dirIcon;
    4696                 }
    4697             }
    4698             break;
    4699        }
    4700     case SP_DriveFDIcon:
    4701         {
    4702             pixmap = d->findIcon(24, QLatin1String("gnome-dev-floppy.png"));
    4703             if (!pixmap.isNull())
    4704                 return pixmap;
    4705             break;
    4706         }
    4707     case SP_ComputerIcon:
    4708         {
    4709             pixmap = d->findIcon(24, QLatin1String("gnome-fs-client.png"));
    4710             if (!pixmap.isNull())
    4711                 return pixmap;
    4712             break;
    4713         }
    4714     case SP_DesktopIcon:
    4715         {
    4716             pixmap = d->findIcon(24, QLatin1String("gnome-fs-desktop.png"));
    4717             if (!pixmap.isNull())
    4718                 return pixmap;
    4719             break;
    4720         }
    4721     case SP_TrashIcon:
    4722         {
    4723             pixmap = d->findIcon(24, QLatin1String("gnome-fs-trash-empty.png"));
    4724             if (!pixmap.isNull())
    4725                 return pixmap;
    4726             break;
    4727         }
    4728     case SP_DriveCDIcon:
    4729     case SP_DriveDVDIcon:
    4730         {
    4731             pixmap = d->findIcon(24, QLatin1String("gnome-dev-cdrom.png"));
    4732             if (!pixmap.isNull())
    4733                 return pixmap;
    4734             break;
    4735         }
    4736     case SP_DriveHDIcon:
    4737         {
    4738             pixmap = d->findIcon(24, QLatin1String("gnome-dev-harddisk.png"));
    4739             if (!pixmap.isNull())
    4740                 return pixmap;
    4741             break;
    4742         }
    4743     case SP_FileDialogToParent:
    4744         {
    4745             pixmap = d->findIcon(16, QLatin1String("stock_up.png"));
    4746             if (!pixmap.isNull())
    4747                 return pixmap;
    4748             break;
    4749         }
    4750     case SP_FileDialogNewFolder:
    4751         {
    4752             pixmap = d->findIcon(16, QLatin1String("stock_new-dir.png"));
    4753             if (!pixmap.isNull())
    4754                 return pixmap;
    4755             break;
    4756         }
    4757     case SP_ArrowUp:
    4758         {
    4759             pixmap = d->findIcon(16, QLatin1String("stock_up.png"));
    4760             if (!pixmap.isNull())
    4761                 return pixmap;
    4762             break;
    4763         }
    4764     case SP_ArrowDown:
    4765         {
    4766             pixmap = d->findIcon(16, QLatin1String("stock_down.png"));
    4767             if (!pixmap.isNull())
    4768                 return pixmap;
    4769             break;
    4770         }
    4771     case SP_ArrowRight:
    4772         {
    4773             pixmap = d->findIcon(16, QLatin1String("stock_right.png"));
    4774             if (!pixmap.isNull())
    4775                 return pixmap;
    4776             break;
    4777         }
    4778     case SP_ArrowLeft:
    4779         {
    4780             pixmap = d->findIcon(16, QLatin1String("stock_left.png"));
    4781             if (!pixmap.isNull())
    4782                 return pixmap;
    4783             break;
    4784         }
    4785     case SP_DialogCloseButton:
    4786         {
    4787             pixmap = d->findIcon(24, QLatin1String("gtk-close.png"));
    4788             if (pixmap.isNull())
    4789                 pixmap = d->findIcon(24, QLatin1String("stock-close.png"));
    4790             if (!pixmap.isNull())
    4791                 return pixmap;
    4792             break;
    4793         }
    4794     case SP_DialogApplyButton:
    4795         {
    4796             pixmap = d->findIcon(24, QLatin1String("dialog-apply.png"));
    4797             if (pixmap.isNull())
    4798                 pixmap = d->findIcon(24, QLatin1String("stock-apply.png"));
    4799             if (!pixmap.isNull())
    4800                 return pixmap;
    4801             break;
    4802         }
    4803     case SP_DialogResetButton:
    4804         {
    4805             pixmap = d->findIcon(24, QLatin1String("gtk-clear.png"));
    4806             if (!pixmap.isNull())
    4807                 return pixmap;
    4808             break;
    4809         }
    4810     case SP_DialogHelpButton:
    4811         {
    4812             pixmap = d->findIcon(24, QLatin1String("gtk-help.png"));
    4813             if (!pixmap.isNull())
    4814                 return pixmap;
    4815             break;
    4816         }
    4817     case SP_DialogOkButton:
    4818         {
    4819             pixmap = d->findIcon(24, QLatin1String("dialog-ok.png"));
    4820             if (pixmap.isNull())
    4821                 pixmap = d->findIcon(24, QLatin1String("stock-ok.png"));
    4822             if (!pixmap.isNull())
    4823                 return pixmap;
    4824             break;
    4825         }
    4826     case SP_DialogCancelButton:
    4827         {
    4828             pixmap = d->findIcon(24, QLatin1String("dialog-cancel.png"));
    4829             if (pixmap.isNull())
    4830                 pixmap = d->findIcon(24, QLatin1String("stock-cancel.png"));
    4831             if (pixmap.isNull())
    4832                 pixmap = d->findIcon(24, QLatin1String("process-stop.png"));
    4833             if (!pixmap.isNull())
    4834                 return pixmap;
    4835             break;
    4836         }
    4837     case SP_DialogSaveButton:
    4838         {
    4839             pixmap = d->findIcon(24, QLatin1String("stock_save.png"));
    4840             if (!pixmap.isNull())
    4841                 return pixmap;
    4842             break;
    4843         }
    4844     case SP_BrowserStop:
    4845         {
    4846             pixmap = d->findIcon(16, QLatin1String("process-stop.png"));
    4847             if (!pixmap.isNull())
    4848                 return pixmap;
    4849             break;
    4850         }
    4851     case SP_BrowserReload:
    4852         {
    4853             pixmap = d->findIcon(16, QLatin1String("view-refresh.png"));
    4854             if (!pixmap.isNull())
    4855                 return pixmap;
    4856             break;
    4857         }
    4858     case SP_MediaPlay:
    4859         {
    4860             pixmap = d->findIcon(24, QLatin1String("media-playback-start.png"));
    4861             if (!pixmap.isNull())
    4862                 return pixmap;
    4863             break;
    4864         }
    4865     case SP_MediaPause:
    4866         {
    4867             pixmap = d->findIcon(24, QLatin1String("media-playback-pause.png"));
    4868             if (!pixmap.isNull())
    4869                 return pixmap;
    4870             break;
    4871         }
    4872     case SP_MediaStop:
    4873         {
    4874             pixmap = d->findIcon(24, QLatin1String("media-playback-stop.png"));
    4875             if (!pixmap.isNull())
    4876                 return pixmap;
    4877             break;
    4878         }
    4879     case SP_MediaVolume:
    4880         {
    4881             pixmap = d->findIcon(16, QLatin1String("audio-volume-medium.png"));
    4882             if (!pixmap.isNull())
    4883                 return pixmap;
    4884             break;
    4885         }
    4886     case SP_MediaVolumeMuted:
    4887         {
    4888             pixmap = d->findIcon(16, QLatin1String("audio-volume-muted.png"));
    4889             if (!pixmap.isNull())
    4890                 return pixmap;
    4891             break;
    4892         }
    4893     case SP_MediaSeekForward:
    4894         {
    4895             pixmap = d->findIcon(24, QLatin1String("media-seek-forward.png"));
    4896             if (!pixmap.isNull())
    4897                 return pixmap;
    4898             break;
    4899         }
    4900     case SP_MediaSeekBackward:
    4901         {
    4902             pixmap = d->findIcon(24, QLatin1String("media-seek-backward.png"));
    4903             if (!pixmap.isNull())
    4904                 return pixmap;
    4905             break;
    4906         }
    4907     case SP_MediaSkipForward:
    4908         {
    4909             pixmap = d->findIcon(24, QLatin1String("media-skip-forward.png"));
    4910             if (!pixmap.isNull())
    4911                 return pixmap;
    4912             break;
    4913         }
    4914     case SP_MediaSkipBackward:
    4915         {
    4916             pixmap = d->findIcon(24, QLatin1String("media-skip-backward.png"));
    4917             if (!pixmap.isNull())
    4918                 return pixmap;
    4919             break;
    4920         }
    4921     case SP_TitleBarMenuButton:
    4922     case SP_TitleBarShadeButton:
    4923     case SP_TitleBarUnshadeButton:
    4924     case SP_TitleBarMaxButton:
    4925     case SP_TitleBarContextHelpButton:
    4926         return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
    49274450    case SP_TitleBarNormalButton:
    49284451        return QPixmap((const char **)dock_widget_restore_xpm);
     
    49374460    }
    49384461#endif //QT_NO_IMAGEFORMAT_XPM
    4939 #endif //Q_WS_X11
     4462
    49404463    return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
    49414464}
  • trunk/src/gui/styles/qcleanlooksstyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qcleanlooksstyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7272    ~QCleanlooksStylePrivate() {
    7373    }
    74 
    75     void lookupIconTheme() const;
    7674};
    7775
  • trunk/src/gui/styles/qcommonstyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6464#include <qtoolbutton.h>
    6565#include <qrubberband.h>
    66 #include <private/qapplication_p.h>
    6766#include <private/qcommonstylepixmaps_p.h>
    6867#include <private/qmath_p.h>
     68#include <private/qstylehelper_p.h>
    6969#include <qdebug.h>
    7070#include <qtextformat.h>
     
    7575#include <qsettings.h>
    7676#include <qpixmapcache.h>
     77#include <private/qguiplatformplugin_p.h>
    7778
    7879#include <limits.h>
     
    8485#ifdef Q_WS_X11
    8586#   include <private/qt_x11_p.h>
     87#elif defined(Q_WS_MAC)
     88#   include <private/qt_cocoa_helpers_mac_p.h>
    8689#endif
    8790
     
    125128
    126129/*!
    127     \overload
    128 
    129     Destroys the style
     130    Destroys the style.
    130131*/
    131132QCommonStyle::~QCommonStyle()
     
    155156        break;
    156157    case PE_IndicatorViewItemCheck:
    157         drawPrimitive(PE_IndicatorCheckBox, opt, p, widget);
     158        proxy()->drawPrimitive(PE_IndicatorCheckBox, opt, p, widget);
    158159        break;
    159160    case PE_IndicatorCheckBox:
     
    505506        }
    506507
    507         int size = pixelMetric(QStyle::PM_SmallIconSize);
     508        int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize);
    508509        QIcon::Mode mode = opt->state & State_Enabled ?
    509510                            (opt->state & State_Raised ? QIcon::Active : QIcon::Normal)
     
    516517        QIcon::State state = opt->state & State_Sunken ? QIcon::On : QIcon::Off;
    517518        QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(size, mode, state);
    518         drawItemPixmap(p, opt->rect, Qt::AlignCenter, pixmap);
     519        proxy()->drawItemPixmap(p, opt->rect, Qt::AlignCenter, pixmap);
    519520        break;
    520521    }
     
    525526        break;
    526527    case PE_FrameLineEdit:
    527         drawPrimitive(PE_Frame, opt, p, widget);
     528        proxy()->drawPrimitive(PE_Frame, opt, p, widget);
    528529        break;
    529530#ifndef QT_NO_GROUPBOX
     
    550551            int lw = frame->lineWidth;
    551552            if (lw <= 0)
    552                 lw = pixelMetric(PM_DockWidgetFrameWidth);
     553                lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth);
    553554
    554555            qDrawShadePanel(p, frame->rect, frame->palette, false, lw);
     
    562563        if (opt->state & State_Horizontal) {
    563564            int x = opt->rect.width() / 3;
    564             if (QApplication::layoutDirection() == Qt::RightToLeft)
     565            if (opt->direction == Qt::RightToLeft)
    565566                x -= 2;
    566567            if (opt->rect.height() > 4) {
     
    582583        break;
    583584    case PE_Q3DockWindowSeparator:
    584         drawPrimitive(PE_IndicatorToolBarSeparator, opt, p, widget);
     585        proxy()->drawPrimitive(PE_IndicatorToolBarSeparator, opt, p, widget);
    585586        break;
    586587    case PE_IndicatorToolBarSeparator:
     
    602603    case PE_IndicatorSpinMinus: {
    603604        QRect r = opt->rect;
    604         int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
     605        int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    605606        QRect br = r.adjusted(fw, fw, -fw, -fw);
    606607
     
    619620    case PE_IndicatorSpinDown: {
    620621        QRect r = opt->rect;
    621         int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
     622        int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    622623        // QRect br = r.adjusted(fw, fw, -fw, -fw);
    623624        int x = r.x(), y = r.y(), w = r.width(), h = r.height();
     
    644645        int bsy = 0;
    645646        if (opt->state & State_Sunken) {
    646             bsx = pixelMetric(PM_ButtonShiftHorizontal);
    647             bsy = pixelMetric(PM_ButtonShiftVertical);
     647            bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
     648            bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
    648649        }
    649650        p->save();
     
    694695
    695696            if (panel->lineWidth > 0)
    696                 drawPrimitive(PE_FrameLineEdit, panel, p, widget);
     697                proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget);
    697698        }
    698699        break;
     
    766767                cg = QPalette::Inactive;
    767768
    768             if ((vopt->state & QStyle::State_Selected) && styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, widget))
     769            if ((vopt->state & QStyle::State_Selected) &&  proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, widget))
    769770                p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight));
    770771            else if (vopt->features & QStyleOptionViewItemV2::Alternate)
     
    835836#endif // QT_NO_TOOLBUTTON
    836837
    837 
    838 
    839 #ifdef Q_WS_X11 // These functions are used to parse the X11 freedesktop icon spec
    840 
    841 void QCommonStylePrivate::lookupIconTheme() const
    842 {
    843     if (!themeName.isEmpty())
    844         return;
    845 
    846     QString dataDirs = QString::fromLocal8Bit(getenv("XDG_DATA_DIRS"));
    847     if (dataDirs.isEmpty())
    848         dataDirs = QLatin1String("/usr/local/share/:/usr/share/");
    849     dataDirs += QLatin1Char(':') + QApplicationPrivate::kdeHome() + QLatin1String("/share");
    850     dataDirs.prepend(QDir::homePath() + QLatin1String("/:"));
    851     QStringList kdeDirs = QString::fromLocal8Bit(getenv("KDEDIRS")).split(QLatin1Char(':'));
    852     foreach (const QString &dirName, kdeDirs)
    853         dataDirs.append(QLatin1String(":") + dirName + QLatin1String("/share"));
    854     iconDirs = dataDirs.split(QLatin1Char(':'));
    855 
    856     QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde"));
    857     QDir dir(fileInfo.canonicalFilePath());
    858     int kdeVersion = qgetenv("KDE_SESSION_VERSION").toInt();
    859     QString kdeDefault = kdeVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg");
    860     QString defaultTheme = fileInfo.exists() ? dir.dirName() : kdeDefault;
    861     QSettings settings(QApplicationPrivate::kdeHome() +
    862                        QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
    863     settings.beginGroup(QLatin1String("Icons"));
    864     themeName = settings.value(QLatin1String("Theme"), defaultTheme).toString();
    865 }
    866 
    867 QIconTheme QCommonStylePrivate::parseIndexFile(const QString &themeName) const
    868 {
    869     Q_Q(const QCommonStyle);
    870     QIconTheme theme;
    871     QFile themeIndex;
    872     QStringList parents;
    873     QHash <int, QString> dirList;
    874 
    875     for ( int i = 0 ; i < iconDirs.size() && !themeIndex.exists() ; ++i) {
    876           QString contentDir = QLatin1String(iconDirs[i].startsWith(QDir::homePath()) ?
    877                                 "/.icons/" : "/icons/");
    878           themeIndex.setFileName(iconDirs[i] + contentDir +
    879                                  themeName + QLatin1String("/index.theme"));
    880     }
    881 
    882     if (themeIndex.open(QIODevice::ReadOnly | QIODevice::Text)) {
    883 
    884         QTextStream in(&themeIndex);
    885 
    886         while (!in.atEnd()) {
    887 
    888             QString line = in.readLine();
    889 
    890             if (line.startsWith(QLatin1String("Inherits="))) {
    891                 line = line.right(line.length() - 9);
    892                 parents = line.split(QLatin1Char(','));
    893             }
    894 
    895             if (line.startsWith(QLatin1String("["))) {
    896                 line = line.trimmed();
    897                 line.chop(1);
    898                 QString dirName = line.right(line.length() - 1);
    899                 if (!in.atEnd()) {
    900                     line = in.readLine();
    901                     int size;
    902                     if (line.startsWith(QLatin1String("Size="))) {
    903                         size = line.right(line.length() - 5).toInt();
    904                         if (size)
    905                             dirList.insertMulti(size, dirName);
    906                     }
    907                 }
    908             }
    909         }
    910     }
    911 
    912     if (q->inherits("QPlastiqueStyle")) {
    913         QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde"));
    914         QDir dir(fileInfo.canonicalFilePath());
    915         QString defaultKDETheme = dir.exists() ? dir.dirName() : QString::fromLatin1("crystalsvg");
    916         if (!parents.contains(defaultKDETheme) && themeName != defaultKDETheme)
    917             parents.append(defaultKDETheme);
    918     } else if (parents.isEmpty() && themeName != QLatin1String("hicolor")) {
    919         parents.append(QLatin1String("hicolor"));
    920     }
    921     theme = QIconTheme(dirList, parents);
    922     return theme;
    923 }
    924 
    925 QPixmap QCommonStylePrivate::findIconHelper(int size,
    926                                                    const QString &themeName,
    927                                                    const QString &iconName,
    928                                                    QStringList &visited) const
    929 {
    930     QPixmap pixmap;
    931 
    932     if (!themeName.isEmpty()) {
    933 
    934         visited << themeName;
    935         QIconTheme theme = themeList.value(themeName);
    936 
    937         if (!theme.isValid()) {
    938             theme = parseIndexFile(themeName);
    939             themeList.insert(themeName, theme);
    940         }
    941 
    942         if (!theme.isValid())
    943             return QPixmap();
    944 
    945         QList <QString> subDirs = theme.dirList().values(size);
    946 
    947         for ( int i = 0 ; i < iconDirs.size() ; ++i) {
    948             for ( int j = 0 ; j < subDirs.size() ; ++j) {
    949                 QString contentDir = (iconDirs[i].startsWith(QDir::homePath())) ?
    950                                      QLatin1String("/.icons/") : QLatin1String("/icons/");
    951                 QString fileName = iconDirs[i] + contentDir + themeName + QLatin1Char('/') + subDirs[j] + QLatin1Char('/') + iconName;
    952                 QFile file(fileName);
    953                 if (file.exists())
    954                     pixmap.load(fileName);
    955                 if (!pixmap.isNull())
    956                     break;
    957             }
    958         }
    959 
    960         if (pixmap.isNull()) {
    961             QStringList parents = theme.parents();
    962             //search recursively through inherited themes
    963             for (int i = 0 ; pixmap.isNull() && i < parents.size() ; ++i) {
    964                QString parentTheme = parents[i].trimmed();
    965                if (!visited.contains(parentTheme)) //guard against endless recursion
    966                   pixmap = findIconHelper(size, parentTheme, iconName, visited);
    967             }
    968         }
    969     }
    970     return pixmap;
    971 }
    972 
    973 QPixmap QCommonStylePrivate::findIcon(int size, const QString &name) const
    974 {
    975     QPixmap pixmap;
    976     QString pixmapName = QLatin1String("$qt") + name + QString::number(size);
    977 
    978     if (QPixmapCache::find(pixmapName, pixmap))
    979         return pixmap;
    980 
    981     if (!themeName.isEmpty()) {
    982         QStringList visited;
    983         pixmap = findIconHelper(size, themeName, name, visited);
    984     }
    985     QPixmapCache::insert(pixmapName, pixmap);
    986     return pixmap;
    987 }
    988 
    989 QIcon QCommonStylePrivate::createIcon(const QString &name) const
    990 {
    991     QIcon icon;
    992     icon.addPixmap(findIcon(16, name));
    993     icon.addPixmap(findIcon(24, name));
    994     icon.addPixmap(findIcon(32, name));
    995     return icon;
    996 }
    997 
    998 #endif //Q_WS_X11
    999 
    1000838#ifndef QT_NO_ITEMVIEWS
    1001 
    1002839
    1003840QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, int role) const
     
    1048885            }
    1049886            textLayout.endLayout();
    1050             const QSize size = QSizeF(widthUsed, height).toSize();
     887            const QSize size(qCeil(widthUsed), qCeil(height));
    1051888            return QSize(size.width() + 2 * textMargin, size.height());
    1052889        }
     
    1153990}
    1154991
    1155 /* Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore
    1156    opt->rect and return rectangles in infinite space */
     992/*! \internal
     993    compute the position for the different component of an item (pixmap, text, checkbox)
     994
     995    Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore
     996   opt->rect and return rectangles in infinite space
     997
     998    Code duplicated in QItemDelegate::doLayout
     999*/
    11571000void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt,  QRect *checkRect,
    11581001                                         QRect *pixmapRect, QRect *textRect, bool sizehint) const
     
    11751018    int w, h;
    11761019
    1177     if (textRect->height() == 0 && !hasPixmap)
     1020    if (textRect->height() == 0 && (!hasPixmap || !sizehint)) {
     1021        //if there is no text, we still want to have a decent height for the item sizeHint and the editor size
    11781022        textRect->setHeight(opt->fontMetrics.height());
     1023    }
    11791024
    11801025    QSize pm(0, 0);
     
    12801125#endif // QT_NO_ITEMVIEWS
    12811126
     1127
     1128#ifndef QT_NO_TABBAR
     1129/*! \internal
     1130    Compute the textRect and the pixmapRect from the opt rect
     1131
     1132    Uses the same computation than in QTabBar::tabSizeHint
     1133 */
     1134void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const
     1135{
     1136    Q_ASSERT(textRect);
     1137    Q_ASSERT(iconRect);
     1138    QRect tr = opt->rect;
     1139    bool verticalTabs = opt->shape == QTabBar::RoundedEast
     1140                        || opt->shape == QTabBar::RoundedWest
     1141                        || opt->shape == QTabBar::TriangularEast
     1142                        || opt->shape == QTabBar::TriangularWest;
     1143    if (verticalTabs)
     1144        tr.setRect(0, 0, tr.height(), tr.width()); //0, 0 as we will have a translate transform
     1145
     1146    int verticalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftVertical, opt, widget);
     1147    int horizontalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, opt, widget);
     1148    int hpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2;
     1149    int vpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2;
     1150    if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth)
     1151        verticalShift = -verticalShift;
     1152    tr.adjust(hpadding, vpadding, horizontalShift - hpadding, verticalShift - vpadding);
     1153    bool selected = opt->state & QStyle::State_Selected;
     1154    if (selected) {
     1155        tr.setBottom(tr.bottom() - verticalShift);
     1156        tr.setRight(tr.right() - horizontalShift);
     1157    }
     1158
     1159    // left widget
     1160    if (!opt->leftButtonSize.isEmpty()) {
     1161        tr.setLeft(tr.left() + 4 +
     1162            (verticalTabs ? opt->leftButtonSize.height() : opt->leftButtonSize.width()));
     1163    }
     1164    // right widget
     1165    if (!opt->rightButtonSize.isEmpty()) {
     1166        tr.setRight(tr.right() - 4 -
     1167        (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width()));
     1168    }
     1169
     1170    // icon
     1171    if (!opt->icon.isNull()) {
     1172        QSize iconSize = opt->iconSize;
     1173        if (!iconSize.isValid()) {
     1174            int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize);
     1175            iconSize = QSize(iconExtent, iconExtent);
     1176        }
     1177        QSize tabIconSize = opt->icon.actualSize(iconSize,
     1178                        (opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled,
     1179                        (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off  );
     1180
     1181        *iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2,
     1182                    tabIconSize.width(), tabIconSize .height());
     1183        if (!verticalTabs)
     1184            *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect);
     1185        tr.setLeft(tr.left() + tabIconSize.width() + 4);
     1186    }
     1187
     1188    if (!verticalTabs)
     1189        tr = proxyStyle->visualRect(opt->direction, opt->rect, tr);
     1190
     1191    *textRect = tr;
     1192}
     1193#endif //QT_NO_TABBAR
     1194
     1195
    12821196/*!
    12831197  \reimp
     
    12911205    case CE_PushButton:
    12921206        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
    1293             drawControl(CE_PushButtonBevel, btn, p, widget);
     1207            proxy()->drawControl(CE_PushButtonBevel, btn, p, widget);
    12941208            QStyleOptionButton subopt = *btn;
    12951209            subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
    1296             drawControl(CE_PushButtonLabel, &subopt, p, widget);
     1210            proxy()->drawControl(CE_PushButtonLabel, &subopt, p, widget);
    12971211            if (btn->state & State_HasFocus) {
    12981212                QStyleOptionFocusRect fropt;
    12991213                fropt.QStyleOption::operator=(*btn);
    13001214                fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget);
    1301                 drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
     1215                proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
    13021216            }
    13031217        }
     
    13061220        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
    13071221            QRect br = btn->rect;
    1308             int dbi = pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
     1222            int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
    13091223            if (btn->features & QStyleOptionButton::DefaultButton)
    1310                 drawPrimitive(PE_FrameDefaultButton, opt, p, widget);
     1224                proxy()->drawPrimitive(PE_FrameDefaultButton, opt, p, widget);
    13111225            if (btn->features & QStyleOptionButton::AutoDefaultButton)
    13121226                br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi);
     
    13161230                QStyleOptionButton tmpBtn = *btn;
    13171231                tmpBtn.rect = br;
    1318                 drawPrimitive(PE_PanelButtonCommand, &tmpBtn, p, widget);
     1232                proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, p, widget);
    13191233            }
    13201234            if (btn->features & QStyleOptionButton::HasMenu) {
    1321                 int mbi = pixelMetric(PM_MenuButtonIndicator, btn, widget);
     1235                int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget);
    13221236                QRect ir = btn->rect;
    13231237                QStyleOptionButton newBtn = *btn;
    13241238                newBtn.rect = QRect(ir.right() - mbi + 2, ir.height()/2 - mbi/2 + 3, mbi - 6, mbi - 6);
    1325                 drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
     1239                proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
    13261240            }
    13271241        }
     
    13311245            QRect textRect = button->rect;
    13321246            uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
    1333             if (!styleHint(SH_UnderlineShortcut, button, widget))
     1247            if (!proxy()->styleHint(SH_UnderlineShortcut, button, widget))
    13341248                tf |= Qt::TextHideMnemonic;
    13351249
     
    13661280
    13671281                if (button->state & (State_On | State_Sunken))
    1368                     iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
    1369                                        pixelMetric(PM_ButtonShiftVertical, opt, widget));
     1282                    iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
     1283                                       proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget));
    13701284                p->drawPixmap(iconRect, pixmap);
    13711285            } else {
     
    13731287            }
    13741288            if (button->state & (State_On | State_Sunken))
    1375                 textRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
    1376                              pixelMetric(PM_ButtonShiftVertical, opt, widget));
     1289                textRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
     1290                             proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget));
    13771291
    13781292            if (button->features & QStyleOptionButton::HasMenu) {
    1379                 int indicatorSize = pixelMetric(PM_MenuButtonIndicator, button, widget);
     1293                int indicatorSize = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget);
    13801294                if (button->direction == Qt::LeftToRight)
    13811295                    textRect = textRect.adjusted(0, 0, -indicatorSize, 0);
     
    13831297                    textRect = textRect.adjusted(indicatorSize, 0, 0, 0);
    13841298            }
    1385             drawItemText(p, textRect, tf, button->palette, (button->state & State_Enabled),
     1299            proxy()->drawItemText(p, textRect, tf, button->palette, (button->state & State_Enabled),
    13861300                         button->text, QPalette::ButtonText);
    13871301        }
     
    13941308            subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
    13951309                                                 : SE_CheckBoxIndicator, btn, widget);
    1396             drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
     1310            proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
    13971311                          &subopt, p, widget);
    13981312            subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
    13991313                                                 : SE_CheckBoxContents, btn, widget);
    1400             drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget);
     1314            proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget);
    14011315            if (btn->state & State_HasFocus) {
    14021316                QStyleOptionFocusRect fropt;
     
    14041318                fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
    14051319                                                    : SE_CheckBoxFocusRect, btn, widget);
    1406                 drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
     1320                proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
    14071321            }
    14081322        }
     
    14131327            uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter);
    14141328
    1415             if (!styleHint(SH_UnderlineShortcut, btn, widget))
     1329            if (!proxy()->styleHint(SH_UnderlineShortcut, btn, widget))
    14161330                alignment |= Qt::TextHideMnemonic;
    14171331            QPixmap pix;
     
    14191333            if (!btn->icon.isNull()) {
    14201334                pix = btn->icon.pixmap(btn->iconSize, btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled);
    1421                 drawItemPixmap(p, btn->rect, alignment, pix);
     1335                proxy()->drawItemPixmap(p, btn->rect, alignment, pix);
    14221336                if (btn->direction == Qt::RightToLeft)
    14231337                    textRect.setRight(textRect.right() - btn->iconSize.width() - 4);
     
    14261340            }
    14271341            if (!btn->text.isEmpty()){
    1428                 drawItemText(p, textRect, alignment | Qt::TextShowMnemonic,
     1342                proxy()->drawItemText(p, textRect, alignment | Qt::TextShowMnemonic,
    14291343                    btn->palette, btn->state & State_Enabled, btn->text, QPalette::WindowText);
    14301344            }
     
    14361350        QStyleOption arrowOpt = *opt;
    14371351        arrowOpt.state |= State_Enabled;
    1438         drawPrimitive(((opt->state & State_DownArrow) ? PE_IndicatorArrowDown : PE_IndicatorArrowUp),
     1352        proxy()->drawPrimitive(((opt->state & State_DownArrow) ? PE_IndicatorArrowDown : PE_IndicatorArrowUp),
    14391353                    &arrowOpt, p, widget);
    14401354        break; }
     
    14581372            uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip
    14591373                            | Qt::TextSingleLine;
    1460             if (!styleHint(SH_UnderlineShortcut, mbi, widget))
     1374            if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
    14611375                alignment |= Qt::TextHideMnemonic;
    1462             QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
     1376            QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
    14631377            if (!pix.isNull())
    1464                 drawItemPixmap(p,mbi->rect, alignment, pix);
     1378                proxy()->drawItemPixmap(p,mbi->rect, alignment, pix);
    14651379            else
    1466                 drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled,
     1380                proxy()->drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled,
    14671381                             mbi->text, QPalette::ButtonText);
    14681382        }
     
    14791393            QStyleOptionProgressBarV2 subopt = *pb;
    14801394            subopt.rect = subElementRect(SE_ProgressBarGroove, pb, widget);
    1481             drawControl(CE_ProgressBarGroove, &subopt, p, widget);
     1395            proxy()->drawControl(CE_ProgressBarGroove, &subopt, p, widget);
    14821396            subopt.rect = subElementRect(SE_ProgressBarContents, pb, widget);
    1483             drawControl(CE_ProgressBarContents, &subopt, p, widget);
     1397            proxy()->drawControl(CE_ProgressBarContents, &subopt, p, widget);
    14841398            if (pb->textVisible) {
    14851399                subopt.rect = subElementRect(SE_ProgressBarLabel, pb, widget);
    1486                 drawControl(CE_ProgressBarLabel, &subopt, p, widget);
     1400                proxy()->drawControl(CE_ProgressBarLabel, &subopt, p, widget);
    14871401            }
    14881402        }
     
    15101424                    QPalette shadowPalette = pb->palette;
    15111425                    shadowPalette.setColor(textRole, shadowColor);
    1512                     drawItemText(p, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette,
     1426                    proxy()->drawItemText(p, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette,
    15131427                                 pb->state & State_Enabled, pb->text, textRole);
    15141428                }
    1515                 drawItemText(p, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette,
     1429                proxy()->drawItemText(p, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette,
    15161430                             pb->state & State_Enabled, pb->text, textRole);
    15171431            }
     
    15601474                p->drawLine(x, rect.y(), x, rect.height());
    15611475            } else {
    1562                 const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, pb, widget);
     1476                const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb, widget);
    15631477                if (!unit_width)
    15641478                    return;
     
    16021516                    pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);
    16031517                    pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
    1604                     drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
     1518                    proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
    16051519                    x += reverse ? -unit_width : unit_width;
    16061520                }
     
    16131527                    pbBits.rect.setRect(offset, myY, pixels_left, myHeight);
    16141528                    pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
    1615                     drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
     1529                    proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
    16161530                }
    16171531            }
     
    16241538            if (!header->icon.isNull()) {
    16251539                QPixmap pixmap
    1626                     = header->icon.pixmap(pixelMetric(PM_SmallIconSize), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
     1540                    = header->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
    16271541                int pixw = pixmap.width();
    16281542
     
    16411555                p->setFont(fnt);
    16421556            }
    1643             drawItemText(p, rect, header->textAlignment, header->palette,
     1557            proxy()->drawItemText(p, rect, header->textAlignment, header->palette,
    16441558                         (header->state & State_Enabled), header->text, QPalette::ButtonText);
    16451559        }
     
    16531567            int shiftY = 0;
    16541568            if (toolbutton->state & (State_Sunken | State_On)) {
    1655                 shiftX = pixelMetric(PM_ButtonShiftHorizontal, toolbutton, widget);
    1656                 shiftY = pixelMetric(PM_ButtonShiftVertical, toolbutton, widget);
     1569                shiftX = proxy()->pixelMetric(PM_ButtonShiftHorizontal, toolbutton, widget);
     1570                shiftY = proxy()->pixelMetric(PM_ButtonShiftVertical, toolbutton, widget);
    16571571            }
    16581572            // Arrow type always overrules and is always shown
     
    16611575                || toolbutton->toolButtonStyle == Qt::ToolButtonTextOnly) {
    16621576                int alignment = Qt::AlignCenter | Qt::TextShowMnemonic;
    1663                 if (!styleHint(SH_UnderlineShortcut, opt, widget))
     1577                if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
    16641578                    alignment |= Qt::TextHideMnemonic;
    16651579                rect.translate(shiftX, shiftY);
    1666                 drawItemText(p, rect, alignment, toolbutton->palette,
     1580                p->setFont(toolbutton->font);
     1581                proxy()->drawItemText(p, rect, alignment, toolbutton->palette,
    16671582                             opt->state & State_Enabled, toolbutton->text,
    16681583                             QPalette::ButtonText);
     
    16891604                    tr = rect;
    16901605                    int alignment = Qt::TextShowMnemonic;
    1691                     if (!styleHint(SH_UnderlineShortcut, opt, widget))
     1606                    if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
    16921607                        alignment |= Qt::TextHideMnemonic;
    16931608
    16941609                    if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
    16951610                        pr.setHeight(pmSize.height() + 6);
    1696                         tr.adjust(0, pr.height(), 0, -3);
     1611                        tr.adjust(0, pr.height() - 1, 0, -3);
    16971612                        pr.translate(shiftX, shiftY);
    16981613                        if (!hasArrow) {
    1699                             drawItemPixmap(p, pr, Qt::AlignCenter, pm);
     1614                            proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm);
    17001615                        } else {
    17011616                            drawArrow(this, toolbutton, pr, p, widget);
     
    17071622                        pr.translate(shiftX, shiftY);
    17081623                        if (!hasArrow) {
    1709                             drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm);
     1624                            proxy()->drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm);
    17101625                        } else {
    17111626                            drawArrow(this, toolbutton, pr, p, widget);
     
    17141629                    }
    17151630                    tr.translate(shiftX, shiftY);
    1716                     drawItemText(p, QStyle::visualRect(opt->direction, rect, tr), alignment, toolbutton->palette,
     1631                    proxy()->drawItemText(p, QStyle::visualRect(opt->direction, rect, tr), alignment, toolbutton->palette,
    17171632                                 toolbutton->state & State_Enabled, toolbutton->text,
    17181633                                 QPalette::ButtonText);
     
    17221637                        drawArrow(this, toolbutton, rect, p, widget);
    17231638                    } else {
    1724                         drawItemPixmap(p, rect, Qt::AlignCenter, pm);
     1639                        proxy()->drawItemPixmap(p, rect, Qt::AlignCenter, pm);
    17251640                    }
    17261641                }
     
    17321647    case CE_ToolBoxTab:
    17331648        if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
    1734             drawControl(CE_ToolBoxTabShape, tb, p, widget);
    1735             drawControl(CE_ToolBoxTabLabel, tb, p, widget);
     1649            proxy()->drawControl(CE_ToolBoxTabShape, tb, p, widget);
     1650            proxy()->drawControl(CE_ToolBoxTabLabel, tb, p, widget);
    17361651        }
    17371652        break;
     
    17791694    case CE_TabBarTab:
    17801695        if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
    1781             drawControl(CE_TabBarTabShape, tab, p, widget);
    1782             drawControl(CE_TabBarTabLabel, tab, p, widget);
     1696            proxy()->drawControl(CE_TabBarTabShape, tab, p, widget);
     1697            proxy()->drawControl(CE_TabBarTabLabel, tab, p, widget);
    17831698        }
    17841699        break;
     
    17901705            bool selected = tab->state & State_Selected;
    17911706            bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
    1792             int tabOverlap = onlyOne ? 0 : pixelMetric(PM_TabBarTabOverlap, opt, widget);
     1707            int tabOverlap = onlyOne ? 0 : proxy()->pixelMetric(PM_TabBarTabOverlap, opt, widget);
    17931708
    17941709            if (!selected) {
     
    18941809            bool enabled = tb->state & State_Enabled;
    18951810            bool selected = tb->state & State_Selected;
    1896             QPixmap pm = tb->icon.pixmap(pixelMetric(QStyle::PM_SmallIconSize, tb, widget),
     1811            QPixmap pm = tb->icon.pixmap(proxy()->pixelMetric(QStyle::PM_SmallIconSize, tb, widget),
    18971812                                         enabled ? QIcon::Normal : QIcon::Disabled);
    18981813
     
    19101825            }
    19111826
    1912             if (selected && styleHint(QStyle::SH_ToolBox_SelectedPageTitleBold, tb, widget)) {
     1827            if (selected && proxy()->styleHint(QStyle::SH_ToolBox_SelectedPageTitleBold, tb, widget)) {
    19131828                QFont f(p->font());
    19141829                f.setBold(true);
     
    19221837
    19231838            int alignment = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic;
    1924             if (!styleHint(QStyle::SH_UnderlineShortcut, tb, widget))
     1839            if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, tb, widget))
    19251840                alignment |= Qt::TextHideMnemonic;
    1926             drawItemText(p, tr, alignment, tb->palette, enabled, txt, QPalette::ButtonText);
     1841            proxy()->drawItemText(p, tr, alignment, tb->palette, enabled, txt, QPalette::ButtonText);
    19271842
    19281843            if (!txt.isEmpty() && opt->state & State_HasFocus) {
     
    19311846                opt.palette = tb->palette;
    19321847                opt.state = QStyle::State_None;
    1933                 drawPrimitive(QStyle::PE_FrameFocusRect, &opt, p, widget);
     1848                proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &opt, p, widget);
    19341849            }
    19351850        }
     
    19371852    case CE_TabBarTabLabel:
    19381853        if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
    1939             // ### consider merging this with SE_TabBarTabText
    19401854            QStyleOptionTabV3 tabV2(*tab);
    19411855            QRect tr = tabV2.rect;
     
    19461860
    19471861            int alignment = Qt::AlignCenter | Qt::TextShowMnemonic;
    1948             if (!styleHint(SH_UnderlineShortcut, opt, widget))
     1862            if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
    19491863                alignment |= Qt::TextHideMnemonic;
    19501864
     
    19611875                    newRot = -90;
    19621876                }
    1963                 tr.setRect(0, 0, tr.height(), tr.width());
    1964                 QTransform m;
    1965                 m.translate(newX, newY);
     1877                QTransform m = QTransform::fromTranslate(newX, newY);
    19661878                m.rotate(newRot);
    19671879                p->setTransform(m, true);
    19681880            }
    1969             tr = subElementRect(SE_TabBarTabText, opt, widget);
     1881            QRect iconRect;
     1882            d->tabLayout(&tabV2, widget, &tr, &iconRect);
     1883            tr = proxy()->subElementRect(SE_TabBarTabText, opt, widget); //we compute tr twice because the style may override subElementRect
    19701884
    19711885            if (!tabV2.icon.isNull()) {
    1972                 QSize iconSize = tabV2.iconSize;
    1973                 if (!iconSize.isValid()) {
    1974                     int iconExtent = pixelMetric(PM_SmallIconSize);
    1975                     iconSize = QSize(iconExtent, iconExtent);
    1976                 }
    1977                 QSize tabIconSize = tabV2.icon.actualSize(iconSize,
    1978                                                           (tabV2.state & State_Enabled) ? QIcon::Normal
    1979                                                           : QIcon::Disabled);
    1980                 QPixmap tabIcon = tabV2.icon.pixmap(iconSize,
     1886                QPixmap tabIcon = tabV2.icon.pixmap(tabV2.iconSize,
    19811887                                                    (tabV2.state & State_Enabled) ? QIcon::Normal
    1982                                                                                   : QIcon::Disabled);
    1983 
    1984                 int offset = 4;
    1985                 int left = opt->rect.left();
    1986                 if (tabV2.leftButtonSize.isEmpty())
    1987                     offset += 2;
    1988                 else
    1989                     left += tabV2.leftButtonSize.width() + (6 + 2) + 2;
    1990                 QRect iconRect = QRect(left + offset, tr.center().y() - tabIcon.height() / 2,
    1991                             tabIconSize.width(), tabIconSize.height());
    1992                 if (!verticalTabs)
    1993                     iconRect = visualRect(opt->direction, opt->rect, iconRect);
     1888                                                                                  : QIcon::Disabled,
     1889                                                    (tabV2.state & State_Selected) ? QIcon::On
     1890                                                                                   : QIcon::Off);
    19941891                p->drawPixmap(iconRect.x(), iconRect.y(), tabIcon);
    19951892            }
    19961893
    1997             drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
     1894            proxy()->drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
    19981895            if (verticalTabs)
    19991896                p->restore();
     
    21062003            QRect r = opt->rect;
    21072004            QStyleHintReturnMask mask;
    2108             if (styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
     2005            if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
    21092006                p->setClipRegion(mask.region);
    21102007            p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap);
     
    21442041
    21452042                const int indent = p->fontMetrics().descent();
    2146                 drawItemText(p, r.adjusted(indent + 1, 1, -indent - 1, -1),
     2043                proxy()->drawItemText(p, r.adjusted(indent + 1, 1, -indent - 1, -1),
    21472044                              Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette,
    21482045                              dwOpt->state & State_Enabled, dwOpt->title,
     
    21592056            QRegion clipRegion = p->clipRegion();
    21602057            p->setClipRect(opt->rect);
    2161             drawControl(CE_HeaderSection, header, p, widget);
     2058            proxy()->drawControl(CE_HeaderSection, header, p, widget);
    21622059            QStyleOptionHeader subopt = *header;
    21632060            subopt.rect = subElementRect(SE_HeaderLabel, header, widget);
    21642061            if (subopt.rect.isValid())
    2165                 drawControl(CE_HeaderLabel, &subopt, p, widget);
     2062                proxy()->drawControl(CE_HeaderLabel, &subopt, p, widget);
    21662063            if (header->sortIndicator != QStyleOptionHeader::None) {
    21672064                subopt.rect = subElementRect(SE_HeaderArrow, opt, widget);
    2168                 drawPrimitive(PE_IndicatorHeaderArrow, &subopt, p, widget);
     2065                proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, p, widget);
    21692066            }
    21702067            p->setClipRegion(clipRegion);
     
    21852082    case CE_ComboBoxLabel:
    21862083        if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
    2187             QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
     2084            QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
    21882085            p->save();
    21892086            p->setClipRect(editRect);
     
    21992096                if (cb->editable)
    22002097                    p->fillRect(iconRect, opt->palette.brush(QPalette::Base));
    2201                 drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
     2098                proxy()->drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
    22022099
    22032100                if (cb->direction == Qt::RightToLeft)
     
    22072104            }
    22082105            if (!cb->currentText.isEmpty() && !cb->editable) {
    2209                 drawItemText(p, editRect.adjusted(1, 0, -1, 0),
     2106                proxy()->drawItemText(p, editRect.adjusted(1, 0, -1, 0),
    22102107                             visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter),
    22112108                             cb->palette, cb->state & State_Enabled, cb->currentText);
     
    22232120            frame.lineWidth = toolBar->lineWidth;
    22242121            frame.midLineWidth = toolBar->midLineWidth;
    2225             drawPrimitive(PE_PanelToolBar, opt, p, widget);
     2122            proxy()->drawPrimitive(PE_PanelToolBar, opt, p, widget);
    22262123
    22272124            if (widget && qobject_cast<QToolBar *>(widget->parentWidget()))
     
    22652162
    22662163            // draw the background
    2267             drawPrimitive(PE_PanelItemViewItem, opt, p, widget);
     2164            proxy()->drawPrimitive(PE_PanelItemViewItem, opt, p, widget);
    22682165
    22692166            // draw the check mark
    2270             if (checkRect.isValid()) {
     2167            if (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator) {
    22712168                QStyleOptionViewItemV4 option(*vopt);
    22722169                option.rect = checkRect;
     
    22842181                    break;
    22852182                }
    2286                 drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, p, widget);
     2183                proxy()->drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, p, widget);
    22872184            }
    22882185
     
    23272224                o.backgroundColor = vopt->palette.color(cg, (vopt->state & QStyle::State_Selected)
    23282225                                             ? QPalette::Highlight : QPalette::Window);
    2329                 drawPrimitive(QStyle::PE_FrameFocusRect, &o, p, widget);
     2226                proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, p, widget);
    23302227            }
    23312228
     
    23662263                    widget->style()->drawPrimitive(QStyle::PE_Frame, opt, p, widget);
    23672264                } else {
    2368                     drawPrimitive(QStyle::PE_Frame, opt, p, widget);
     2265                    proxy()->drawPrimitive(QStyle::PE_Frame, opt, p, widget);
    23692266                }
    23702267                break;
     
    24242321        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
    24252322            int dx1, dx2;
    2426             dx1 = pixelMetric(PM_DefaultFrameWidth, btn, widget);
     2323            dx1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
    24272324            if (btn->features & QStyleOptionButton::AutoDefaultButton)
    2428                 dx1 += pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
     2325                dx1 += proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
    24292326            dx2 = dx1 * 2;
    24302327            r.setRect(opt->rect.x() + dx1, opt->rect.y() + dx1, opt->rect.width() - dx2,
     
    24372334            int dbw1 = 0, dbw2 = 0;
    24382335            if (btn->features & QStyleOptionButton::AutoDefaultButton){
    2439                 dbw1 = pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
     2336                dbw1 = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
    24402337                dbw2 = dbw1 * 2;
    24412338            }
    24422339
    2443             int dfw1 = pixelMetric(PM_DefaultFrameWidth, btn, widget) + 1,
     2340            int dfw1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) + 1,
    24442341                dfw2 = dfw1 * 2;
    24452342
     
    24512348    case SE_CheckBoxIndicator:
    24522349        {
    2453             int h = pixelMetric(PM_IndicatorHeight, opt, widget);
     2350            int h = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget);
    24542351            r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2),
    2455                       pixelMetric(PM_IndicatorWidth, opt, widget), h);
     2352                      proxy()->pixelMetric(PM_IndicatorWidth, opt, widget), h);
    24562353            r = visualRect(opt->direction, opt->rect, r);
    24572354        }
     
    24632360            QRect ir = visualRect(opt->direction, opt->rect,
    24642361                                  subElementRect(SE_CheckBoxIndicator, opt, widget));
    2465             int spacing = pixelMetric(PM_CheckBoxLabelSpacing, opt, widget);
     2362            int spacing = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget);
    24662363            r.setRect(ir.right() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing,
    24672364                      opt->rect.height());
     
    25032400    case SE_RadioButtonIndicator:
    25042401        {
    2505             int h = pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget);
     2402            int h = proxy()->pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget);
    25062403            r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2),
    2507                     pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), h);
     2404                    proxy()->pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), h);
    25082405            r = visualRect(opt->direction, opt->rect, r);
    25092406        }
     
    25142411            QRect ir = visualRect(opt->direction, opt->rect,
    25152412                                  subElementRect(SE_RadioButtonIndicator, opt, widget));
    2516             int spacing = pixelMetric(PM_RadioButtonLabelSpacing, opt, widget);
     2413            int spacing = proxy()->pixelMetric(PM_RadioButtonLabelSpacing, opt, widget);
    25172414            r.setRect(ir.left() + ir.width() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing,
    25182415                      opt->rect.height());
     
    25512448    case SE_SliderFocusRect:
    25522449        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    2553             int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
    2554             int thickness  = pixelMetric(PM_SliderControlThickness, slider, widget);
     2450            int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
     2451            int thickness  = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
    25552452            if (slider->orientation == Qt::Horizontal)
    25562453                r.setRect(0, tickOffset - 1, slider->rect.width(), thickness + 2);
     
    26232520#endif // QT_NO_TOOLBOX
    26242521    case SE_HeaderLabel: {
    2625         int margin = pixelMetric(QStyle::PM_HeaderMargin, opt, widget);
     2522        int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget);
    26262523        r.setRect(opt->rect.x() + margin, opt->rect.y() + margin,
    26272524                  opt->rect.width() - margin * 2, opt->rect.height() - margin * 2);
     
    26432540        int x = opt->rect.x();
    26442541        int y = opt->rect.y();
    2645         int margin = pixelMetric(QStyle::PM_HeaderMargin, opt, widget);
     2542        int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget);
    26462543
    26472544        if (opt->state & State_Horizontal) {
     
    26792576                                            - twf->leftCornerWidgetSize.width()
    26802577                                            - twf->rightCornerWidgetSize.width()));
    2681                 switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
     2578                switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
    26822579                default:
    26832580                case Qt::AlignLeft:
     
    27012598                                            - twf->leftCornerWidgetSize.width()
    27022599                                            - twf->rightCornerWidgetSize.width()));
    2703                 switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
     2600                switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
    27042601                default:
    27052602                case Qt::AlignLeft:
     
    27262623                                            - twf->leftCornerWidgetSize.height()
    27272624                                            - twf->rightCornerWidgetSize.height()));
    2728                 switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
     2625                switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
    27292626                default:
    27302627                case Qt::AlignLeft:
     
    27482645                                             - twf->leftCornerWidgetSize.height()
    27492646                                             - twf->rightCornerWidgetSize.height()));
    2750                 switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
     2647                switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
    27512648                default:
    27522649                case Qt::AlignLeft:
     
    27702667            QStyleOptionTab tabopt;
    27712668            tabopt.shape = twf->shape;
    2772             int overlap = pixelMetric(PM_TabBarBaseOverlap, &tabopt, widget);
     2669            int overlap = proxy()->pixelMetric(PM_TabBarBaseOverlap, &tabopt, widget);
    27732670            if (twf->lineWidth == 0)
    27742671                overlap = 0;
     
    28382735        break;
    28392736    case SE_TabBarTabText:
    2840         // ### consider merging this with CE_TabBarTabLabel
    28412737        if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
    2842             QStyleOptionTabV3 tabV2(*tab);
    2843             QRect tr = tabV2.rect;
    2844             bool verticalTabs = tabV2.shape == QTabBar::RoundedEast
    2845                                 || tabV2.shape == QTabBar::RoundedWest
    2846                                 || tabV2.shape == QTabBar::TriangularEast
    2847                                 || tabV2.shape == QTabBar::TriangularWest;
    2848             if (verticalTabs)
    2849                 tr.setRect(0, 0, tr.height(), tr.width());
    2850             int verticalShift = pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget);
    2851             int horizontalShift = pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget);
    2852             if (tabV2.shape == QTabBar::RoundedSouth || tabV2.shape == QTabBar::TriangularSouth)
    2853                 verticalShift = -verticalShift;
    2854             tr.adjust(0, 0, horizontalShift, verticalShift);
    2855             bool selected = tabV2.state & State_Selected;
    2856             if (selected) {
    2857                 tr.setBottom(tr.bottom() - verticalShift);
    2858                 tr.setRight(tr.right() - horizontalShift);
    2859             }
    2860 
    2861             // left widget
    2862             if (!tabV2.leftButtonSize.isEmpty()) {
    2863                 tr.setLeft(tr.left() + 6 + 2 +
    2864                     (verticalTabs ? tabV2.leftButtonSize.height() : tabV2.leftButtonSize.width()));
    2865             }
    2866 
    2867             // icon
    2868             if (!tabV2.icon.isNull()) {
    2869                 QSize iconSize = tabV2.iconSize;
    2870                 if (!iconSize.isValid()) {
    2871                     int iconExtent = pixelMetric(PM_SmallIconSize);
    2872                     iconSize = QSize(iconExtent, iconExtent);
    2873                 }
    2874                 QSize tabIconSize = tabV2.icon.actualSize(iconSize,
    2875                                                           (tabV2.state & State_Enabled) ? QIcon::Normal
    2876                                                           : QIcon::Disabled);
    2877                 int offset = 4;
    2878                 if (tabV2.leftButtonSize.isEmpty())
    2879                     offset += 2;
    2880 
    2881                 QRect iconRect = QRect(tr.left() + offset, tr.center().y() - tabIconSize.height() / 2,
    2882                             tabIconSize.width(), tabIconSize .height());
    2883                 if (!verticalTabs)
    2884                     iconRect = visualRect(opt->direction, opt->rect, iconRect);
    2885                 tr.setLeft(tr.left() + tabIconSize.width() + offset + 2);
    2886             }
    2887 
    2888             // right widget
    2889             if (!tabV2.rightButtonSize.isEmpty()) {
    2890                 tr.setRight(tr.right() - 6 - 2 -
    2891                     (verticalTabs ? tabV2.rightButtonSize.height() : tabV2.rightButtonSize.width()));
    2892             }
    2893 
    2894             if (!verticalTabs)
    2895                 tr = visualRect(opt->direction, opt->rect, tr);
    2896             r = tr;
     2738            QStyleOptionTabV3 tabV3(*tab);
     2739            QRect dummyIconRect;
     2740            d->tabLayout(&tabV3, widget, &r, &dummyIconRect);
    28972741        }
    28982742        break;
     
    29012745        if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) {
    29022746            bool selected = tab->state & State_Selected;
    2903             int verticalShift = pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget);
    2904             int horizontalShift = pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget);
     2747            int verticalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget);
     2748            int horizontalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget);
     2749            int hpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2;
     2750            hpadding = qMax(hpadding, 4); //workaround KStyle returning 0 because they workaround an old bug in Qt
    29052751
    29062752            bool verticalTabs = tab->shape == QTabBar::RoundedEast
     
    29172763                verticalShift *= -1;
    29182764            }
     2765            if (tab->shape == QTabBar::RoundedWest || tab->shape == QTabBar::TriangularWest)
     2766                horizontalShift = -horizontalShift;
     2767
    29192768            tr.adjust(0, 0, horizontalShift, verticalShift);
    29202769            if (selected)
     
    29272776            int w = size.width();
    29282777            int h = size.height();
    2929             int midHeight = static_cast<int>(ceil(float(tr.height() - h) / 2));
     2778            int midHeight = static_cast<int>(qCeil(float(tr.height() - h) / 2));
    29302779            int midWidth = ((tr.width() - w) / 2);
    29312780
     
    29422791            default:
    29432792                if (sr == SE_TabBarTabLeftButton)
    2944                     r = QRect(6 + tab->rect.x(), midHeight, w, h);
     2793                    r = QRect(tab->rect.x() + hpadding, midHeight, w, h);
    29452794                else
    2946                     r = QRect(tab->rect.right() - 6 - w, midHeight, w, h);
     2795                    r = QRect(tab->rect.right() - w - hpadding, midHeight, w, h);
    29472796                r = visualRect(tab->direction, tab->rect, r);
    29482797            }
    29492798            if (verticalTabs) {
    29502799                if (atTheTop)
    2951                     r = QRect(midWidth, tr.y() + tab->rect.height() - 6 - h, w, h);
     2800                    r = QRect(midWidth, tr.y() + tab->rect.height() - hpadding - h, w, h);
    29522801                else
    2953                     r = QRect(midWidth, tr.y() + 6, w, h);
     2802                    r = QRect(midWidth, tr.y() + hpadding, w, h);
    29542803            }
    29552804        }
     
    29912840    case SE_FrameContents:
    29922841        if (const QStyleOptionFrameV2 *f = qstyleoption_cast<const QStyleOptionFrameV2 *>(opt)) {
    2993             int fw = pixelMetric(PM_DefaultFrameWidth, f, widget);
     2842            int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, f, widget);
    29942843            r = opt->rect.adjusted(fw, fw, -fw, -fw);
    29952844            r = visualRect(opt->direction, opt->rect, r);
     
    30582907    case SE_DockWidgetTitleBarText:
    30592908    case SE_DockWidgetIcon: {
    3060         int iconSize = pixelMetric(PM_SmallIconSize, opt, widget);
    3061         int buttonMargin = pixelMetric(PM_DockWidgetTitleBarButtonMargin, opt, widget);
    3062         int margin = pixelMetric(QStyle::PM_DockWidgetTitleMargin, opt, widget);
     2909        int iconSize = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
     2910        int buttonMargin = proxy()->pixelMetric(PM_DockWidgetTitleBarButtonMargin, opt, widget);
     2911        int margin = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, opt, widget);
    30632912        QRect rect = opt->rect;
    30642913
     
    31252974                    icon = dw->windowIcon();
    31262975                if (!icon.isNull()
    3127                         && icon.cacheKey() != qApp->windowIcon().cacheKey()) {
     2976                        && icon.cacheKey() != QApplication::windowIcon().cacheKey()) {
    31282977                    QSize sz = icon.actualSize(QSize(r.height(), r.height()));
    31292978                    if (verticalTitleBar)
     
    31703019            if (!d->isViewItemCached(*vopt)) {
    31713020                d->viewItemLayout(vopt, &d->checkRect, &d->decorationRect, &d->displayRect, false);
    3172                 if (d->cachedOption)
     3021                if (d->cachedOption) {
    31733022                    delete d->cachedOption;
     3023                    d->cachedOption = 0;
     3024                }
    31743025                d->cachedOption = new QStyleOptionViewItemV4(*vopt);
    31753026            }
     
    31833034        break;
    31843035#endif //QT_NO_ITEMVIEWS
     3036#ifndef QT_NO_TOOLBAR
     3037    case SE_ToolBarHandle:
     3038        if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
     3039            if (tbopt->features & QStyleOptionToolBar::Movable) {
     3040                ///we need to access the widget here because the style option doesn't
     3041                //have all the information we need (ie. the layout's margin)
     3042                const QToolBar *tb = qobject_cast<const QToolBar*>(widget);
     3043                const int margin = tb && tb->layout() ? tb->layout()->margin() : 2;
     3044                const int handleExtent = pixelMetric(QStyle::PM_ToolBarHandleExtent, opt, tb);
     3045                if (tbopt->state & QStyle::State_Horizontal) {
     3046                    r = QRect(margin, margin, handleExtent, tbopt->rect.height() - 2*margin);
     3047                    r = QStyle::visualRect(tbopt->direction, tbopt->rect, r);
     3048                } else {
     3049                    r = QRect(margin, margin, tbopt->rect.width() - 2*margin, handleExtent);
     3050                }
     3051            }
     3052        }
     3053        break;
     3054#endif //QT_NO_TOOLBAR
    31853055    default:
    31863056        break;
     
    31903060
    31913061#ifndef QT_NO_DIAL
    3192 static qreal angle(const QPointF &p1, const QPointF &p2)
    3193 {
    3194     static const qreal rad_factor = 180 / Q_PI;
    3195     qreal _angle = 0;
    3196 
    3197     if (p1.x() == p2.x()) {
    3198         if (p1.y() < p2.y())
    3199             _angle = 270;
    3200         else
    3201             _angle = 90;
    3202     } else  {
    3203         qreal x1, x2, y1, y2;
    3204 
    3205         if (p1.x() <= p2.x()) {
    3206             x1 = p1.x(); y1 = p1.y();
    3207             x2 = p2.x(); y2 = p2.y();
    3208         } else {
    3209             x2 = p1.x(); y2 = p1.y();
    3210             x1 = p2.x(); y1 = p2.y();
    3211         }
    3212 
    3213         qreal m = -(y2 - y1) / (x2 - x1);
    3214         _angle = atan(m) *  rad_factor;
    3215 
    3216         if (p1.x() < p2.x())
    3217             _angle = 180 - _angle;
    3218         else
    3219             _angle = -_angle;
    3220     }
    3221     return _angle;
    3222 }
    3223 
    3224 static int calcBigLineSize(int radius)
    3225 {
    3226     int bigLineSize = radius / 6;
    3227     if (bigLineSize < 4)
    3228         bigLineSize = 4;
    3229     if (bigLineSize > radius / 2)
    3230         bigLineSize = radius / 2;
    3231     return bigLineSize;
    3232 }
    32333062
    32343063static QPolygonF calcArrow(const QStyleOptionSlider *dial, qreal &a)
     
    32513080    int yc = height / 2;
    32523081
    3253     int len = r - calcBigLineSize(r) - 5;
     3082    int len = r - QStyleHelper::calcBigLineSize(r) - 5;
    32543083    if (len < 5)
    32553084        len = 5;
     
    32663095}
    32673096
    3268 static QPolygonF calcLines(const QStyleOptionSlider *dial, const QWidget *)
    3269 {
    3270     QPolygonF poly;
    3271     int width = dial->rect.width();
    3272     int height = dial->rect.height();
    3273     qreal r = qMin(width, height) / 2;
    3274     int bigLineSize = calcBigLineSize(int(r));
    3275 
    3276     qreal xc = width / 2;
    3277     qreal yc = height / 2;
    3278     int ns = dial->tickInterval;
    3279     int notches = (dial->maximum + ns - 1 - dial->minimum) / ns;
    3280     if (notches <= 0)
    3281         return poly;
    3282     if (dial->maximum < dial->minimum
    3283         || dial->maximum - dial->minimum > 1000) {
    3284         int maximum = dial->minimum + 1000;
    3285         notches = (maximum + ns - 1 - dial->minimum) / ns;
    3286     }
    3287 
    3288     poly.resize(2 + 2 * notches);
    3289     int smallLineSize = bigLineSize / 2;
    3290     for (int i = 0; i <= notches; ++i) {
    3291         qreal angle = dial->dialWrapping ? Q_PI * 3 / 2 - i * 2 * Q_PI / notches
    3292             : (Q_PI * 8 - i * 10 * Q_PI / notches) / 6;
    3293         qreal s = qSin(angle);
    3294         qreal c = qCos(angle);
    3295         if (i == 0 || (((ns * i) % (dial->pageStep ? dial->pageStep : 1)) == 0)) {
    3296             poly[2 * i] = QPointF(xc + (r - bigLineSize) * c,
    3297                                   yc - (r - bigLineSize) * s);
    3298             poly[2 * i + 1] = QPointF(xc + r * c, yc - r * s);
    3299         } else {
    3300             poly[2 * i] = QPointF(xc + (r - 1 - smallLineSize) * c,
    3301                                   yc - (r - 1 - smallLineSize) * s);
    3302             poly[2 * i + 1] = QPointF(xc + (r - 1) * c, yc -(r - 1) * s);
    3303         }
    3304     }
    3305     return poly;
    3306 }
    33073097#endif // QT_NO_DIAL
    33083098
     
    33183108        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    33193109            if (slider->subControls == SC_SliderTickmarks) {
    3320                 int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
     3110                int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
    33213111                int ticks = slider->tickPosition;
    3322                 int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
    3323                 int len = pixelMetric(PM_SliderLength, slider, widget);
    3324                 int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
     3112                int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
     3113                int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
     3114                int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
    33253115                int interval = slider->tickInterval;
    33263116                if (interval <= 0) {
     
    33803170            if (scrollbar->subControls & SC_ScrollBarSubLine) {
    33813171                newScrollbar.state = saveFlags;
    3382                 newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarSubLine, widget);
     3172                newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubLine, widget);
    33833173                if (newScrollbar.rect.isValid()) {
    33843174                    if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine))
    33853175                        newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    3386                     drawControl(CE_ScrollBarSubLine, &newScrollbar, p, widget);
     3176                    proxy()->drawControl(CE_ScrollBarSubLine, &newScrollbar, p, widget);
    33873177                }
    33883178            }
     
    33903180                newScrollbar.rect = scrollbar->rect;
    33913181                newScrollbar.state = saveFlags;
    3392                 newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarAddLine, widget);
     3182                newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddLine, widget);
    33933183                if (newScrollbar.rect.isValid()) {
    33943184                    if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine))
    33953185                        newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    3396                     drawControl(CE_ScrollBarAddLine, &newScrollbar, p, widget);
     3186                    proxy()->drawControl(CE_ScrollBarAddLine, &newScrollbar, p, widget);
    33973187                }
    33983188            }
     
    34003190                newScrollbar.rect = scrollbar->rect;
    34013191                newScrollbar.state = saveFlags;
    3402                 newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarSubPage, widget);
     3192                newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubPage, widget);
    34033193                if (newScrollbar.rect.isValid()) {
    34043194                    if (!(scrollbar->activeSubControls & SC_ScrollBarSubPage))
    34053195                        newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    3406                     drawControl(CE_ScrollBarSubPage, &newScrollbar, p, widget);
     3196                    proxy()->drawControl(CE_ScrollBarSubPage, &newScrollbar, p, widget);
    34073197                }
    34083198            }
     
    34103200                newScrollbar.rect = scrollbar->rect;
    34113201                newScrollbar.state = saveFlags;
    3412                 newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarAddPage, widget);
     3202                newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddPage, widget);
    34133203                if (newScrollbar.rect.isValid()) {
    34143204                    if (!(scrollbar->activeSubControls & SC_ScrollBarAddPage))
    34153205                        newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    3416                     drawControl(CE_ScrollBarAddPage, &newScrollbar, p, widget);
     3206                    proxy()->drawControl(CE_ScrollBarAddPage, &newScrollbar, p, widget);
    34173207                }
    34183208            }
     
    34203210                newScrollbar.rect = scrollbar->rect;
    34213211                newScrollbar.state = saveFlags;
    3422                 newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarFirst, widget);
     3212                newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarFirst, widget);
    34233213                if (newScrollbar.rect.isValid()) {
    34243214                    if (!(scrollbar->activeSubControls & SC_ScrollBarFirst))
    34253215                        newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    3426                     drawControl(CE_ScrollBarFirst, &newScrollbar, p, widget);
     3216                    proxy()->drawControl(CE_ScrollBarFirst, &newScrollbar, p, widget);
    34273217                }
    34283218            }
     
    34303220                newScrollbar.rect = scrollbar->rect;
    34313221                newScrollbar.state = saveFlags;
    3432                 newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarLast, widget);
     3222                newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarLast, widget);
    34333223                if (newScrollbar.rect.isValid()) {
    34343224                    if (!(scrollbar->activeSubControls & SC_ScrollBarLast))
    34353225                        newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    3436                     drawControl(CE_ScrollBarLast, &newScrollbar, p, widget);
     3226                    proxy()->drawControl(CE_ScrollBarLast, &newScrollbar, p, widget);
    34373227                }
    34383228            }
     
    34403230                newScrollbar.rect = scrollbar->rect;
    34413231                newScrollbar.state = saveFlags;
    3442                 newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarSlider, widget);
     3232                newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSlider, widget);
    34433233                if (newScrollbar.rect.isValid()) {
    34443234                    if (!(scrollbar->activeSubControls & SC_ScrollBarSlider))
    34453235                        newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    3446                     drawControl(CE_ScrollBarSlider, &newScrollbar, p, widget);
     3236                    proxy()->drawControl(CE_ScrollBarSlider, &newScrollbar, p, widget);
    34473237
    34483238                    if (scrollbar->state & State_HasFocus) {
     
    34523242                                           newScrollbar.rect.width() - 5,
    34533243                                           newScrollbar.rect.height() - 5);
    3454                         drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
     3244                        proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
    34553245                    }
    34563246                }
     
    34743264
    34753265            if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
    3476                 QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
     3266                QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
    34773267                qDrawWinPanel(p, r, sb->palette, true);
    34783268            }
     
    34983288                      : PE_IndicatorSpinUp);
    34993289
    3500                 copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
    3501                 drawPrimitive(PE_PanelButtonBevel, &copy, p, widget);
     3290                copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
     3291                proxy()->drawPrimitive(PE_PanelButtonBevel, &copy, p, widget);
    35023292                copy.rect.adjust(3, 0, -4, 0);
    3503                 drawPrimitive(pe, &copy, p, widget);
     3293                proxy()->drawPrimitive(pe, &copy, p, widget);
    35043294            }
    35053295
     
    35243314                      : PE_IndicatorSpinDown);
    35253315
    3526                 copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
    3527                 drawPrimitive(PE_PanelButtonBevel, &copy, p, widget);
     3316                copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
     3317                proxy()->drawPrimitive(PE_PanelButtonBevel, &copy, p, widget);
    35283318                copy.rect.adjust(3, 0, -4, 0);
    3529                 drawPrimitive(pe, &copy, p, widget);
     3319                proxy()->drawPrimitive(pe, &copy, p, widget);
    35303320            }
    35313321        }
     
    35373327            = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
    35383328            QRect button, menuarea;
    3539             button = subControlRect(cc, toolbutton, SC_ToolButton, widget);
    3540             menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
     3329            button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget);
     3330            menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
    35413331
    35423332            State bflags = toolbutton->state & ~State_Sunken;
     
    35603350                    tool.rect = button;
    35613351                    tool.state = bflags;
    3562                     drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     3352                    proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    35633353                }
    35643354            }
     
    35693359                fr.rect.adjust(3, 3, -3, -3);
    35703360                if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
    3571                     fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator,
     3361                    fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
    35723362                                                      toolbutton, widget), 0);
    3573                 drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
     3363                proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
    35743364            }
    35753365            QStyleOptionToolButton label = *toolbutton;
    35763366            label.state = bflags;
    3577             int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
     3367            int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    35783368            label.rect = button.adjusted(fw, fw, -fw, -fw);
    3579             drawControl(CE_ToolButtonLabel, &label, p, widget);
     3369            proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
    35803370
    35813371            if (toolbutton->subControls & SC_ToolButtonMenu) {
     
    35833373                tool.state = mflags;
    35843374                if (mflags & (State_Sunken | State_On | State_Raised))
    3585                     drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
    3586                 drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
     3375                    proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
     3376                proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
    35873377            } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
    3588                 int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
     3378                int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
    35893379                QRect ir = toolbutton->rect;
    35903380                QStyleOptionToolButton newBtn = *toolbutton;
    35913381                newBtn.rect = QRect(ir.right() + 5 - mbi, ir.y() + ir.height() - mbi + 4, mbi - 6, mbi - 6);
    3592                 drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
     3382                proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
    35933383            }
    35943384        }
     
    36143404                p->fillRect(opt->rect, fillBrush);
    36153405
    3616                 ir = subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
     3406                ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
    36173407
    36183408                p->setPen(tb->palette.highlightedText().color());
     
    36273417            tool.palette = tb->palette;
    36283418            if (tb->subControls & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
    3629                 ir = subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget);
     3419                ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget);
    36303420                down = tb->activeSubControls & SC_TitleBarCloseButton && (opt->state & State_Sunken);
    36313421                if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool
     
    36393429                tool.rect = ir;
    36403430                tool.state = down ? State_Sunken : State_Raised;
    3641                 drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     3431                proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    36423432
    36433433                p->save();
    36443434                if (down)
    3645                     p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
    3646                                  pixelMetric(PM_ButtonShiftVertical, tb, widget));
    3647                 drawItemPixmap(p, ir, Qt::AlignCenter, pm);
     3435                    p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
     3436                                 proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
     3437                proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
    36483438                p->restore();
    36493439            }
     
    36523442                    && tb->titleBarFlags & Qt::WindowMaximizeButtonHint
    36533443                    && !(tb->titleBarState & Qt::WindowMaximized)) {
    3654                 ir = subControlRect(CC_TitleBar, tb, SC_TitleBarMaxButton, widget);
     3444                ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMaxButton, widget);
    36553445
    36563446                down = tb->activeSubControls & SC_TitleBarMaxButton && (opt->state & State_Sunken);
     
    36583448                tool.rect = ir;
    36593449                tool.state = down ? State_Sunken : State_Raised;
    3660                 drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     3450                proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    36613451
    36623452                p->save();
    36633453                if (down)
    3664                     p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
    3665                                  pixelMetric(PM_ButtonShiftVertical, tb, widget));
    3666                 drawItemPixmap(p, ir, Qt::AlignCenter, pm);
     3454                    p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
     3455                                 proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
     3456                proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
    36673457                p->restore();
    36683458            }
     
    36713461                    && tb->titleBarFlags & Qt::WindowMinimizeButtonHint
    36723462                    && !(tb->titleBarState & Qt::WindowMinimized)) {
    3673                 ir = subControlRect(CC_TitleBar, tb, SC_TitleBarMinButton, widget);
     3463                ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMinButton, widget);
    36743464                down = tb->activeSubControls & SC_TitleBarMinButton && (opt->state & State_Sunken);
    36753465                pm = standardIcon(SP_TitleBarMinButton, &tool, widget).pixmap(10, 10);
    36763466                tool.rect = ir;
    36773467                tool.state = down ? State_Sunken : State_Raised;
    3678                 drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     3468                proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    36793469
    36803470                p->save();
    36813471                if (down)
    3682                     p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
    3683                                  pixelMetric(PM_ButtonShiftVertical, tb, widget));
    3684                 drawItemPixmap(p, ir, Qt::AlignCenter, pm);
     3472                    p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
     3473                                 proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
     3474                proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
    36853475                p->restore();
    36863476            }
     
    36933483
    36943484            if (drawNormalButton) {
    3695                 ir = subControlRect(CC_TitleBar, tb, SC_TitleBarNormalButton, widget);
     3485                ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarNormalButton, widget);
    36963486                down = tb->activeSubControls & SC_TitleBarNormalButton && (opt->state & State_Sunken);
    36973487                pm = standardIcon(SP_TitleBarNormalButton, &tool, widget).pixmap(10, 10);
    36983488                tool.rect = ir;
    36993489                tool.state = down ? State_Sunken : State_Raised;
    3700                 drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     3490                proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    37013491
    37023492                p->save();
    37033493                if (down)
    3704                     p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
    3705                                  pixelMetric(PM_ButtonShiftVertical, tb, widget));
    3706                 drawItemPixmap(p, ir, Qt::AlignCenter, pm);
     3494                    p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
     3495                                 proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
     3496                proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
    37073497                p->restore();
    37083498            }
     
    37113501                    && tb->titleBarFlags & Qt::WindowShadeButtonHint
    37123502                    && !(tb->titleBarState & Qt::WindowMinimized)) {
    3713                 ir = subControlRect(CC_TitleBar, tb, SC_TitleBarShadeButton, widget);
     3503                ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarShadeButton, widget);
    37143504                down = (tb->activeSubControls & SC_TitleBarShadeButton && (opt->state & State_Sunken));
    37153505                pm = standardIcon(SP_TitleBarShadeButton, &tool, widget).pixmap(10, 10);
    37163506                tool.rect = ir;
    37173507                tool.state = down ? State_Sunken : State_Raised;
    3718                 drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     3508                proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    37193509                p->save();
    37203510                if (down)
    3721                     p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
    3722                                  pixelMetric(PM_ButtonShiftVertical, tb, widget));
    3723                 drawItemPixmap(p, ir, Qt::AlignCenter, pm);
     3511                    p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
     3512                                 proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
     3513                proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
    37243514                p->restore();
    37253515            }
     
    37283518                    && tb->titleBarFlags & Qt::WindowShadeButtonHint
    37293519                    && tb->titleBarState & Qt::WindowMinimized) {
    3730                 ir = subControlRect(CC_TitleBar, tb, SC_TitleBarUnshadeButton, widget);
     3520                ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarUnshadeButton, widget);
    37313521
    37323522                down = tb->activeSubControls & SC_TitleBarUnshadeButton  && (opt->state & State_Sunken);
     
    37343524                tool.rect = ir;
    37353525                tool.state = down ? State_Sunken : State_Raised;
    3736                 drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     3526                proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    37373527                p->save();
    37383528                if (down)
    3739                     p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
    3740                                  pixelMetric(PM_ButtonShiftVertical, tb, widget));
    3741                 drawItemPixmap(p, ir, Qt::AlignCenter, pm);
     3529                    p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
     3530                                 proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
     3531                proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
    37423532                p->restore();
    37433533            }
    37443534            if (tb->subControls & SC_TitleBarContextHelpButton
    37453535                    && tb->titleBarFlags & Qt::WindowContextHelpButtonHint) {
    3746                 ir = subControlRect(CC_TitleBar, tb, SC_TitleBarContextHelpButton, widget);
     3536                ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarContextHelpButton, widget);
    37473537
    37483538                down = tb->activeSubControls & SC_TitleBarContextHelpButton  && (opt->state & State_Sunken);
     
    37503540                tool.rect = ir;
    37513541                tool.state = down ? State_Sunken : State_Raised;
    3752                 drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     3542                proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    37533543                p->save();
    37543544                if (down)
    3755                     p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
    3756                                  pixelMetric(PM_ButtonShiftVertical, tb, widget));
    3757                 drawItemPixmap(p, ir, Qt::AlignCenter, pm);
     3545                    p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
     3546                                 proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
     3547                proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
    37583548                p->restore();
    37593549            }
    37603550            if (tb->subControls & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
    3761                 ir = subControlRect(CC_TitleBar, tb, SC_TitleBarSysMenu, widget);
     3551                ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarSysMenu, widget);
    37623552                if (!tb->icon.isNull()) {
    37633553                    tb->icon.paint(p, ir);
    37643554                } else {
    3765                     int iconSize = pixelMetric(PM_SmallIconSize, tb, widget);
     3555                    int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget);
    37663556                    pm = standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(iconSize, iconSize);
    37673557                    tool.rect = ir;
    37683558                    p->save();
    3769                     drawItemPixmap(p, ir, Qt::AlignCenter, pm);
     3559                    proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
    37703560                    p->restore();
    37713561                }
     
    37953585            if (dial->subControls & QStyle::SC_DialTickmarks) {
    37963586                p->setPen(pal.foreground().color());
    3797                 p->drawLines(calcLines(dial, widget)); // ### calcLines could be cached...
     3587                p->drawLines(QStyleHelper::calcLines(dial));
    37983588            }
    37993589
    38003590            if (dial->state & State_Enabled) {
    3801                 p->setBrush(pal.brush(QPalette::ColorRole(styleHint(SH_Dial_BackgroundRole,
     3591                p->setBrush(pal.brush(QPalette::ColorRole(proxy()->styleHint(SH_Dial_BackgroundRole,
    38023592                                                                    dial, widget))));
    38033593                p->setPen(Qt::NoPen);
     
    38173607            p->drawPolygon(arrow);
    38183608
    3819             a = angle(QPointF(width / 2, height / 2), arrow[0]);
     3609            a = QStyleHelper::angle(QPointF(width / 2, height / 2), arrow[0]);
    38203610            p->setBrush(Qt::NoBrush);
    38213611
     
    38603650                }
    38613651                fropt.rect = br.adjusted(-2, -2, 2, 2);
    3862                 drawPrimitive(QStyle::PE_FrameFocusRect, &fropt, p, widget);
     3652                proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &fropt, p, widget);
    38633653            }
    38643654            p->restore();
     
    38703660        if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
    38713661            // Draw frame
    3872             QRect textRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, widget);
    3873             QRect checkBoxRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, widget);
     3662            QRect textRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, widget);
     3663            QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, widget);
    38743664            if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
    38753665                QStyleOptionFrameV2 frame;
     
    38783668                frame.lineWidth = groupBox->lineWidth;
    38793669                frame.midLineWidth = groupBox->midLineWidth;
    3880                 frame.rect = subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, widget);
     3670                frame.rect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, widget);
    38813671                p->save();
    38823672                QRegion region(groupBox->rect);
     
    38933683                }
    38943684                p->setClipRegion(region);
    3895                 drawPrimitive(PE_FrameGroupBox, &frame, p, widget);
     3685                proxy()->drawPrimitive(PE_FrameGroupBox, &frame, p, widget);
    38963686                p->restore();
    38973687            }
     
    39033693                    p->setPen(textColor);
    39043694                int alignment = int(groupBox->textAlignment);
    3905                 if (!styleHint(QStyle::SH_UnderlineShortcut, opt, widget))
     3695                if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, opt, widget))
    39063696                    alignment |= Qt::TextHideMnemonic;
    39073697
    3908                 drawItemText(p, textRect,  Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
     3698                proxy()->drawItemText(p, textRect,  Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
    39093699                             groupBox->palette, groupBox->state & State_Enabled, groupBox->text,
    39103700                             textColor.isValid() ? QPalette::NoRole : QPalette::WindowText);
     
    39143704                    fropt.QStyleOption::operator=(*groupBox);
    39153705                    fropt.rect = textRect;
    3916                     drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
     3706                    proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
    39173707                }
    39183708            }
     
    39233713                box.QStyleOption::operator=(*groupBox);
    39243714                box.rect = checkBoxRect;
    3925                 drawPrimitive(PE_IndicatorCheckBox, &box, p, widget);
     3715                proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, p, widget);
    39263716            }
    39273717        }
     
    39403730                    btnOpt.state |= State_Sunken;
    39413731                    btnOpt.state &= ~State_Raised;
    3942                     bsx = pixelMetric(PM_ButtonShiftHorizontal);
    3943                     bsy = pixelMetric(PM_ButtonShiftVertical);
     3732                    bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
     3733                    bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
    39443734                } else {
    39453735                    btnOpt.state |= State_Raised;
     
    39483738                    bsy = 0;
    39493739                }
    3950                 btnOpt.rect = subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget);
    3951                 drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
     3740                btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget);
     3741                proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
    39523742                QPixmap pm = standardIcon(SP_TitleBarCloseButton).pixmap(16, 16);
    3953                 drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
     3743                proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
    39543744            }
    39553745            if (opt->subControls & QStyle::SC_MdiNormalButton) {
     
    39573747                    btnOpt.state |= State_Sunken;
    39583748                    btnOpt.state &= ~State_Raised;
    3959                     bsx = pixelMetric(PM_ButtonShiftHorizontal);
    3960                     bsy = pixelMetric(PM_ButtonShiftVertical);
     3749                    bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
     3750                    bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
    39613751                } else {
    39623752                    btnOpt.state |= State_Raised;
     
    39653755                    bsy = 0;
    39663756                }
    3967                 btnOpt.rect = subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget);
    3968                 drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
     3757                btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget);
     3758                proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
    39693759                QPixmap pm = standardIcon(SP_TitleBarNormalButton).pixmap(16, 16);
    3970                 drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
     3760                proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
    39713761            }
    39723762            if (opt->subControls & QStyle::SC_MdiMinButton) {
     
    39743764                    btnOpt.state |= State_Sunken;
    39753765                    btnOpt.state &= ~State_Raised;
    3976                     bsx = pixelMetric(PM_ButtonShiftHorizontal);
    3977                     bsy = pixelMetric(PM_ButtonShiftVertical);
     3766                    bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
     3767                    bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
    39783768                } else {
    39793769                    btnOpt.state |= State_Raised;
     
    39823772                    bsy = 0;
    39833773                }
    3984                 btnOpt.rect = subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget);
    3985                 drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
     3774                btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget);
     3775                proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
    39863776                QPixmap pm = standardIcon(SP_TitleBarMinButton).pixmap(16, 16);
    3987                 drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
     3777                proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
    39883778            }
    39893779        }
     
    40073797    case CC_Slider:
    40083798        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    4009             QRect r = subControlRect(cc, slider, SC_SliderHandle, widget);
     3799            QRect r = proxy()->subControlRect(cc, slider, SC_SliderHandle, widget);
    40103800            if (r.isValid() && r.contains(pt)) {
    40113801                sc = SC_SliderHandle;
    40123802            } else {
    4013                 r = subControlRect(cc, slider, SC_SliderGroove ,widget);
     3803                r = proxy()->subControlRect(cc, slider, SC_SliderGroove ,widget);
    40143804                if (r.isValid() && r.contains(pt))
    40153805                    sc = SC_SliderGroove;
     
    40243814            uint ctrl = SC_ScrollBarAddLine;
    40253815            while (ctrl <= SC_ScrollBarGroove) {
    4026                 r = subControlRect(cc, scrollbar, QStyle::SubControl(ctrl), widget);
     3816                r = proxy()->subControlRect(cc, scrollbar, QStyle::SubControl(ctrl), widget);
    40273817                if (r.isValid() && r.contains(pt)) {
    40283818                    sc = QStyle::SubControl(ctrl);
     
    40403830            uint ctrl = SC_ToolButton;
    40413831            while (ctrl <= SC_ToolButtonMenu) {
    4042                 r = subControlRect(cc, toolbutton, QStyle::SubControl(ctrl), widget);
     3832                r = proxy()->subControlRect(cc, toolbutton, QStyle::SubControl(ctrl), widget);
    40433833                if (r.isValid() && r.contains(pt)) {
    40443834                    sc = QStyle::SubControl(ctrl);
     
    40643854            uint ctrl = SC_SpinBoxUp;
    40653855            while (ctrl <= SC_SpinBoxEditField) {
    4066                 r = subControlRect(cc, spinbox, QStyle::SubControl(ctrl), widget);
     3856                r = proxy()->subControlRect(cc, spinbox, QStyle::SubControl(ctrl), widget);
    40673857                if (r.isValid() && r.contains(pt)) {
    40683858                    sc = QStyle::SubControl(ctrl);
     
    40803870
    40813871            while (ctrl <= SC_TitleBarLabel) {
    4082                 r = subControlRect(cc, tb, QStyle::SubControl(ctrl), widget);
     3872                r = proxy()->subControlRect(cc, tb, QStyle::SubControl(ctrl), widget);
    40833873                if (r.isValid() && r.contains(pt)) {
    40843874                    sc = QStyle::SubControl(ctrl);
     
    40953885            uint ctrl = SC_ComboBoxArrow;  // Start here and go down.
    40963886            while (ctrl > 0) {
    4097                 r = subControlRect(cc, cb, QStyle::SubControl(ctrl), widget);
     3887                r = proxy()->subControlRect(cc, cb, QStyle::SubControl(ctrl), widget);
    40983888                if (r.isValid() && r.contains(pt)) {
    40993889                    sc = QStyle::SubControl(ctrl);
     
    41113901            uint ctrl = SC_GroupBoxCheckBox;
    41123902            while (ctrl <= SC_GroupBoxFrame) {
    4113                 r = subControlRect(cc, groupBox, QStyle::SubControl(ctrl), widget);
     3903                r = proxy()->subControlRect(cc, groupBox, QStyle::SubControl(ctrl), widget);
    41143904                if (r.isValid() && r.contains(pt)) {
    41153905                    sc = QStyle::SubControl(ctrl);
     
    41263916            uint ctrl = SC_MdiMinButton;
    41273917            while (ctrl <= SC_MdiCloseButton) {
    4128                 r = subControlRect(CC_MdiControls, opt, QStyle::SubControl(ctrl), widget);
     3918                r = proxy()->subControlRect(CC_MdiControls, opt, QStyle::SubControl(ctrl), widget);
    41293919                if (r.isValid() && r.contains(pt) && (opt->subControls & ctrl)) {
    41303920                    sc = QStyle::SubControl(ctrl);
     
    41523942    case CC_Slider:
    41533943        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    4154             int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
    4155             int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
     3944            int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
     3945            int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
    41563946
    41573947            switch (sc) {
    41583948            case SC_SliderHandle: {
    41593949                int sliderPos = 0;
    4160                 int len = pixelMetric(PM_SliderLength, slider, widget);
     3950                int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
    41613951                bool horizontal = slider->orientation == Qt::Horizontal;
    41623952                sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum,
     
    41893979        if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    41903980            const QRect scrollBarRect = scrollbar->rect;
    4191             int sbextent = pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
     3981            int sbextent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
    41923982            int maxlen = ((scrollbar->orientation == Qt::Horizontal) ?
    41933983                          scrollBarRect.width() : scrollBarRect.height()) - (sbextent * 2);
     
    41993989                sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep);
    42003990
    4201                 int slidermin = pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
     3991                int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
    42023992                if (sliderlen < slidermin || range > INT_MAX / 2)
    42033993                    sliderlen = slidermin;
     
    42724062        if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
    42734063            QSize bs;
    4274             int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
     4064            int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
    42754065            bs.setHeight(qMax(8, spinbox->rect.height()/2 - fw));
    42764066            // 1.6 -approximate golden mean
     
    43134103    case CC_ToolButton:
    43144104        if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
    4315             int mbi = pixelMetric(PM_MenuButtonIndicator, tb, widget);
     4105            int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, tb, widget);
    43164106            ret = tb->rect;
    43174107            switch (sc) {
     
    44534243                int topMargin = 0;
    44544244                int topHeight = 0;
    4455                 int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
     4245                int verticalAlignment = proxy()->styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
    44564246                if (groupBox->text.size() || (groupBox->subControls & QStyle::SC_GroupBoxCheckBox)) {
    44574247                    topHeight = groupBox->fontMetrics.height();
     
    44734263                if (!(widget && widget->inherits("Q3GroupBox"))
    44744264                    && ((groupBox->features & QStyleOptionFrameV2::Flat) == 0)) {
    4475                     frameWidth = pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
     4265                    frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
    44764266                }
    44774267                ret = frameRect.adjusted(frameWidth, frameWidth + topHeight - topMargin,
     
    44894279                ret.setHeight(h);
    44904280
    4491                 int indicatorWidth = pixelMetric(PM_IndicatorWidth, opt, widget);
    4492                 int indicatorSpace = pixelMetric(PM_CheckBoxLabelSpacing, opt, widget) - 1;
     4281                int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, opt, widget);
     4282                int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget) - 1;
    44934283                bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
    44944284                int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
     
    45044294                    // Adjust for check box
    45054295                    if (sc == SC_GroupBoxCheckBox) {
    4506                         int indicatorHeight = pixelMetric(PM_IndicatorHeight, opt, widget);
     4296                        int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget);
    45074297                        left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
    45084298                        int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2;
     
    45904380        break;
    45914381    case PM_DialogButtonsSeparator:
    4592         ret = 5;
     4382        ret = int(QStyleHelper::dpiScaled(5.));
    45934383        break;
    45944384    case PM_DialogButtonsButtonWidth:
    4595         ret = 70;
     4385        ret = int(QStyleHelper::dpiScaled(70.));
    45964386        break;
    45974387    case PM_DialogButtonsButtonHeight:
    4598         ret = 30;
     4388        ret = int(QStyleHelper::dpiScaled(30.));
    45994389        break;
    46004390    case PM_CheckListControllerSize:
    46014391    case PM_CheckListButtonSize:
    4602         ret = 16;
     4392        ret = int(QStyleHelper::dpiScaled(16.));
    46034393        break;
    46044394    case PM_TitleBarHeight: {
    46054395        if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
    46064396            if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool) {
    4607                 ret = qMax(widget ? widget->fontMetrics().lineSpacing() : opt->fontMetrics.lineSpacing(), 16);
     4397                ret = qMax(widget ? widget->fontMetrics().height() : opt->fontMetrics.height(), 16);
    46084398#ifndef QT_NO_DOCKWIDGET
    46094399            } else if (qobject_cast<const QDockWidget*>(widget)) {
    4610                 ret = qMax(widget->fontMetrics().lineSpacing(), 13);
     4400                ret = qMax(widget->fontMetrics().height(), int(QStyleHelper::dpiScaled(13)));
    46114401#endif
    46124402            } else {
    4613                 ret = qMax(widget ? widget->fontMetrics().lineSpacing() : opt->fontMetrics.lineSpacing(), 18);
     4403                ret = qMax(widget ? widget->fontMetrics().height() : opt->fontMetrics.height(), 18);
    46144404            }
    46154405        } else {
    4616             ret = 18;
     4406            ret = int(QStyleHelper::dpiScaled(18.));
    46174407        }
    46184408
    46194409        break; }
    46204410    case PM_ScrollBarSliderMin:
    4621         ret = 9;
     4411        ret = int(QStyleHelper::dpiScaled(9.));
    46224412        break;
    46234413
    46244414    case PM_ButtonMargin:
    4625         ret = 6;
     4415        ret = int(QStyleHelper::dpiScaled(6.));
    46264416        break;
    46274417
    46284418    case PM_DockWidgetTitleBarButtonMargin:
    4629         ret = 2;
     4419        ret = int(QStyleHelper::dpiScaled(2.));
    46304420        break;
    46314421
     
    46354425
    46364426    case PM_MenuButtonIndicator:
    4637         ret = 12;
     4427        ret = int(QStyleHelper::dpiScaled(12.));
    46384428        break;
    46394429
     
    46504440    case PM_TabBarBaseOverlap:
    46514441    case PM_TabBarBaseHeight:
    4652         ret = pixelMetric(PM_DefaultFrameWidth, opt, widget);
     4442        ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    46534443        break;
    46544444
    46554445    case PM_MdiSubWindowFrameWidth:
    4656         ret = 4;
     4446        ret = int(QStyleHelper::dpiScaled(4.));
    46574447        break;
    46584448
    46594449    case PM_MdiSubWindowMinimizedWidth:
    4660         ret = 196;
     4450        ret = int(QStyleHelper::dpiScaled(196.));
    46614451        break;
    46624452
     
    46694459            ret = qMax(16, s);
    46704460        } else {
    4671             ret = 16;
     4461            ret = int(QStyleHelper::dpiScaled(16.));
    46724462        }
    46734463        break;
     
    46794469#ifndef QT_NO_SLIDER
    46804470    case PM_SliderThickness:
    4681         ret = 16;
     4471        ret = int(QStyleHelper::dpiScaled(16.));
    46824472        break;
    46834473
     
    46864476            int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height()
    46874477                                                            : sl->rect.width();
    4688             int thickness = pixelMetric(PM_SliderControlThickness, sl, widget);
     4478            int thickness = proxy()->pixelMetric(PM_SliderControlThickness, sl, widget);
    46894479            int ticks = sl->tickPosition;
    46904480
     
    47034493        if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    47044494            if (sl->orientation == Qt::Horizontal)
    4705                 ret = sl->rect.width() - pixelMetric(PM_SliderLength, sl, widget);
     4495                ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, sl, widget);
    47064496            else
    4707                 ret = sl->rect.height() - pixelMetric(PM_SliderLength, sl, widget);
     4497                ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, sl, widget);
    47084498        } else {
    47094499            ret = 0;
     
    47134503#ifndef QT_NO_DOCKWIDGET
    47144504    case PM_DockWidgetSeparatorExtent:
    4715         ret = 6;
     4505        ret = int(QStyleHelper::dpiScaled(6.));
    47164506        break;
    47174507
    47184508    case PM_DockWidgetHandleExtent:
    4719         ret = 8;
     4509        ret = int(QStyleHelper::dpiScaled(8.));
    47204510        break;
    47214511    case PM_DockWidgetTitleMargin:
     
    47464536
    47474537    case PM_ToolBarItemSpacing:
    4748         ret = 4;
     4538        ret = int(QStyleHelper::dpiScaled(4.));
    47494539        break;
    47504540
    47514541    case PM_ToolBarHandleExtent:
    4752         ret = 8;
     4542        ret = int(QStyleHelper::dpiScaled(8.));
    47534543        break;
    47544544
    47554545    case PM_ToolBarSeparatorExtent:
    4756         ret = 6;
     4546        ret = int(QStyleHelper::dpiScaled(6.));
    47574547        break;
    47584548
    47594549    case PM_ToolBarExtensionExtent:
    4760         ret = 12;
     4550        ret = int(QStyleHelper::dpiScaled(12.));
    47614551        break;
    47624552#endif // QT_NO_TOOLBAR
     
    47684558
    47694559    case PM_TabBarTabHSpace:
    4770         ret = 24;
     4560        ret = int(QStyleHelper::dpiScaled(24.));
    47714561        break;
    47724562
     
    47974587
    47984588    case PM_IndicatorWidth:
    4799         ret = 13;
     4589        ret = int(QStyleHelper::dpiScaled(13.));
    48004590        break;
    48014591
    48024592    case PM_IndicatorHeight:
    4803         ret = 13;
     4593        ret = int(QStyleHelper::dpiScaled(13.));
    48044594        break;
    48054595
    48064596    case PM_ExclusiveIndicatorWidth:
    4807         ret = 12;
     4597        ret = int(QStyleHelper::dpiScaled(12.));
    48084598        break;
    48094599
    48104600    case PM_ExclusiveIndicatorHeight:
    4811         ret = 12;
     4601        ret = int(QStyleHelper::dpiScaled(12.));
    48124602        break;
    48134603
    48144604    case PM_MenuTearoffHeight:
    4815         ret = 10;
     4605        ret = int(QStyleHelper::dpiScaled(10.));
    48164606        break;
    48174607
    48184608    case PM_MenuScrollerHeight:
    4819         ret = 10;
     4609        ret = int(QStyleHelper::dpiScaled(10.));
    48204610        break;
    48214611
     
    48274617
    48284618    case PM_HeaderMargin:
    4829         ret = 4;
     4619        ret = int(QStyleHelper::dpiScaled(4.));
    48304620        break;
    48314621    case PM_HeaderMarkSize:
    4832         ret = 32;
     4622        ret = int(QStyleHelper::dpiScaled(32.));
    48334623        break;
    48344624    case PM_HeaderGripMargin:
    4835         ret = 4;
     4625        ret = int(QStyleHelper::dpiScaled(4.));
    48364626        break;
    48374627    case PM_TabBarScrollButtonWidth:
    4838         ret = 16;
     4628        ret = int(QStyleHelper::dpiScaled(16.));
    48394629        break;
    48404630    case PM_LayoutLeftMargin:
     
    48494639                isWindow = widget->isWindow();
    48504640            }
    4851             ret = pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin);
     4641            ret = proxy()->pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin);
    48524642        }
    48534643        break;
    48544644    case PM_LayoutHorizontalSpacing:
    48554645    case PM_LayoutVerticalSpacing:
    4856         ret = pixelMetric(PM_DefaultLayoutSpacing);
     4646        ret = proxy()->pixelMetric(PM_DefaultLayoutSpacing);
    48574647        break;
    48584648
    48594649    case PM_DefaultTopLevelMargin:
    4860         ret = 11;
     4650        ret = int(QStyleHelper::dpiScaled(11.));
    48614651        break;
    48624652    case PM_DefaultChildMargin:
    4863         ret = 9;
     4653        ret = int(QStyleHelper::dpiScaled(9.));
    48644654        break;
    48654655    case PM_DefaultLayoutSpacing:
    4866         ret = 6;
     4656        ret = int(QStyleHelper::dpiScaled(6.));
     4657        break;
     4658
     4659    case PM_ToolBarIconSize:
     4660        ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ToolBarIconSize);
     4661        if (!ret)
     4662            ret = int(QStyleHelper::dpiScaled(24.));
    48674663        break;
    48684664
    48694665    case PM_TabBarIconSize:
    4870     case PM_ToolBarIconSize:
    48714666    case PM_ListViewIconSize:
    4872         ret = pixelMetric(PM_SmallIconSize, opt, widget);
     4667        ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
    48734668        break;
    48744669
    48754670    case PM_ButtonIconSize:
    48764671    case PM_SmallIconSize:
    4877         ret = 16;
     4672        ret = int(QStyleHelper::dpiScaled(16.));
    48784673        break;
    48794674    case PM_IconViewIconSize:
    4880         ret = pixelMetric(PM_LargeIconSize, opt, widget);
     4675        ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
    48814676        break;
    48824677
    48834678    case PM_LargeIconSize:
    4884         ret = 32;
     4679        ret = int(QStyleHelper::dpiScaled(32.));
    48854680        break;
    48864681
     
    48904685    case PM_CheckBoxLabelSpacing:
    48914686    case PM_RadioButtonLabelSpacing:
    4892         ret = 6;
     4687        ret = int(QStyleHelper::dpiScaled(6.));
    48934688        break;
    48944689    case PM_SizeGripSize:
    4895         ret = 13;
     4690        ret = int(QStyleHelper::dpiScaled(13.));
    48964691        break;
    48974692    case PM_MessageBoxIconSize:
    4898         ret = 32;
     4693#ifdef Q_WS_MAC
     4694        if (QApplication::desktopSettingsAware()) {
     4695            ret = 64; // No DPI scaling, it's handled elsewhere.
     4696        } else
     4697#endif
     4698        {
     4699            ret = int(QStyleHelper::dpiScaled(32.));
     4700        }
    48994701        break;
    49004702    case PM_TextCursorWidth:
     
    49064708    case PM_TabCloseIndicatorWidth:
    49074709    case PM_TabCloseIndicatorHeight:
    4908         ret = 16;
     4710        ret = int(QStyleHelper::dpiScaled(16.));
    49094711        break;
    49104712    case PM_ScrollView_ScrollBarSpacing:
    4911         ret = 2 * pixelMetric(PM_DefaultFrameWidth, opt, widget);
     4713        ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    49124714        break;
    49134715    case PM_SubMenuOverlap:
    4914         ret = -pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget);
     4716        ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget);
    49154717        break;
    49164718    default:
     
    49354737            int w = csz.width(),
    49364738                h = csz.height(),
    4937                 bm = pixelMetric(PM_ButtonMargin, btn, widget),
    4938             fw = pixelMetric(PM_DefaultFrameWidth, btn, widget) * 2;
     4739                bm = proxy()->pixelMetric(PM_ButtonMargin, btn, widget),
     4740            fw = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) * 2;
    49394741            w += bm + fw;
    49404742            h += bm + fw;
    49414743            if (btn->features & QStyleOptionButton::AutoDefaultButton){
    4942                 int dbw = pixelMetric(PM_ButtonDefaultIndicator, btn, widget) * 2;
     4744                int dbw = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget) * 2;
    49434745                w += dbw;
    49444746                h += dbw;
     
    49524754            bool isRadio = (ct == CT_RadioButton);
    49534755
    4954             int w = pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth
     4756            int w = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth
    49554757                                        : PM_IndicatorWidth, btn, widget);
    4956             int h = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
     4758            int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
    49574759                                        : PM_IndicatorHeight, btn, widget);
    49584760
     
    49604762            // we add 4 pixels for label margins
    49614763            if (btn->icon.isNull() || !btn->text.isEmpty())
    4962                 margins = 4 + pixelMetric(isRadio ? PM_RadioButtonLabelSpacing
     4764                margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing
    49634765                                                  : PM_CheckBoxLabelSpacing, opt, widget);
    49644766            sz += QSize(w + margins, 4);
     
    49784780                h =  mi->fontMetrics.height() + 8;
    49794781                if (!mi->icon.isNull()) {
    4980                     int iconExtent = pixelMetric(PM_SmallIconSize);
     4782                    int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
    49814783                    h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4);
    49824784                }
     
    50034805    case CT_ComboBox:
    50044806        if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
    5005             int fw = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0;
    5006             const int textMargins = 2*(pixelMetric(PM_FocusFrameHMargin) + 1);
     4807            int fw = cmb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0;
     4808            const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
    50074809            // QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins...
    5008             int other = qMax(23, 2*textMargins + pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget));
     4810            int other = qMax(23, 2*textMargins + proxy()->pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget));
    50094811            sz = QSize(sz.width() + fw + other, sz.height() + fw);
    50104812        }
     
    50144816        if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
    50154817            bool nullIcon = hdr->icon.isNull();
    5016             int margin = pixelMetric(QStyle::PM_HeaderMargin, hdr, widget);
    5017             int iconSize = nullIcon ? 0 : pixelMetric(QStyle::PM_SmallIconSize, hdr, widget);
     4818            int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget);
     4819            int iconSize = nullIcon ? 0 : proxy()->pixelMetric(QStyle::PM_SmallIconSize, hdr, widget);
    50184820            QSize txt = hdr->fontMetrics.size(0, hdr->text);
    50194821            sz.setHeight(margin + qMax(iconSize, txt.height()) + margin);
     
    52135015            if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
    52145016                mask->region = widget->rect();
    5215                 int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin),
    5216                     hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin);
     5017                int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin),
     5018                    hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin);
    52175019                mask->region -= QRect(widget->rect().adjusted(hmargin, vmargin, -hmargin, -vmargin));
    52185020            }
     
    52275029                if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
    52285030                    mask->region = opt->rect;
    5229                     int margin = pixelMetric(PM_DefaultFrameWidth) * 2;
     5031                    int margin = proxy()->pixelMetric(PM_DefaultFrameWidth) * 2;
    52305032                    mask->region -= opt->rect.adjusted(margin, margin, -margin, -margin);
    52315033                }
     
    52555057
    52565058    case SH_ItemView_ActivateItemOnSingleClick:
    5257         ret = false;
     5059        ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ItemView_ActivateItemOnSingleClick);
    52585060        break;
    52595061
     
    52835085        break;
    52845086    case SH_DialogButtonBox_ButtonsHaveIcons:
     5087#ifdef Q_WS_X11
     5088        return true;
     5089#endif
    52855090        ret = 0;
    52865091        break;
     
    53455150        ret = true;
    53465151        break;
     5152    case SH_ToolButtonStyle:
     5153        ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ToolButtonStyle);
     5154        break;
     5155    case SH_RequestSoftwareInputPanel:
     5156        ret = RSIP_OnMouseClickAndAlreadyFocused;
     5157        break;
    53475158    default:
    53485159        ret = 0;
     
    53575168                                     const QWidget *widget) const
    53585169{
     5170    const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
    53595171#ifdef QT_NO_IMAGEFORMAT_PNG
    5360     Q_UNUSED(option);
    53615172    Q_UNUSED(widget);
    53625173    Q_UNUSED(sp);
    53635174#else
    5364 #ifdef Q_WS_X11
    5365     Q_D(const QCommonStyle);
    53665175    QPixmap pixmap;
    5367     if (qApp->desktopSettingsAware()) {
    5368         d->lookupIconTheme();
     5176
     5177    if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
    53695178        switch (sp) {
     5179        case SP_DialogYesButton:
     5180        case SP_DialogOkButton:
     5181            pixmap = QIcon::fromTheme(QLatin1String("dialog-ok")).pixmap(16);
     5182            break;
     5183        case SP_DialogApplyButton:
     5184            pixmap = QIcon::fromTheme(QLatin1String("dialog-ok-apply")).pixmap(16);
     5185            break;
     5186        case SP_DialogDiscardButton:
     5187            pixmap = QIcon::fromTheme(QLatin1String("edit-delete")).pixmap(16);
     5188            break;
     5189        case SP_DialogCloseButton:
     5190            pixmap = QIcon::fromTheme(QLatin1String("dialog-close")).pixmap(16);
     5191            break;
    53705192        case SP_DirHomeIcon:
    5371             {
    5372                 pixmap = d->findIcon(16, QLatin1String("folder_home.png"));
    5373                 if (!pixmap.isNull())
    5374                     return pixmap;
    5375                 break;
    5376             }
     5193            pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16);
     5194            break;
    53775195        case SP_MessageBoxInformation:
    5378             {
    5379                 pixmap = d->findIcon(32, QLatin1String("messagebox_info.png"));
    5380                 if (!pixmap.isNull())
    5381                     return pixmap;
    5382                 break;
    5383             }
     5196            pixmap = QIcon::fromTheme(QLatin1String("messagebox_info")).pixmap(16);
     5197            break;
    53845198        case SP_MessageBoxWarning:
    5385             {
    5386                 pixmap = d->findIcon(32, QLatin1String("messagebox_warning.png"));
    5387                 if (!pixmap.isNull())
    5388                     return pixmap;
    5389                 break;
    5390             }
     5199            pixmap = QIcon::fromTheme(QLatin1String("messagebox_warning")).pixmap(16);
     5200            break;
    53915201        case SP_MessageBoxCritical:
    5392             {
    5393                 pixmap = d->findIcon(32, QLatin1String("messagebox_critical.png"));
    5394                 if (!pixmap.isNull())
    5395                     return pixmap;
    5396                 break;
    5397             }
     5202            pixmap = QIcon::fromTheme(QLatin1String("messagebox_critical")).pixmap(16);
     5203            break;
    53985204        case SP_MessageBoxQuestion:
    5399             {
    5400                 pixmap = d->findIcon(32, QLatin1String("help.png"));
    5401                 if (!pixmap.isNull())
    5402                     return pixmap;
    5403                 break;
    5404             }
     5205            pixmap = QIcon::fromTheme(QLatin1String("help")).pixmap(16);
     5206            break;
    54055207        case SP_DialogOpenButton:
    54065208        case SP_DirOpenIcon:
    5407             {
    5408                 pixmap = d->findIcon(16, QLatin1String("folder-open.png"));
    5409                 if (pixmap.isNull())
    5410                     pixmap = d->findIcon(16, QLatin1String("folder_open.png"));
    5411                 if (!pixmap.isNull())
    5412                     return pixmap;
    5413                 break;
    5414             }
     5209            pixmap = QIcon::fromTheme(QLatin1String("folder-open")).pixmap(16);
     5210            break;
    54155211        case SP_FileIcon:
    5416             {
    5417                 pixmap = d->findIcon(16, QLatin1String("text-x-generic.png"));
    5418                 if (pixmap.isNull())
    5419                     pixmap = d->findIcon(16, QLatin1String("empty.png"));
    5420                 if (!pixmap.isNull())
    5421                     return pixmap;
    5422                 break;
    5423             }
    5424         case SP_FileLinkIcon:
    5425             {
    5426                 pixmap = d->findIcon(16, QLatin1String("link_overlay.png"));
    5427                 if (!pixmap.isNull()) {
    5428                     QPixmap fileIcon = d->findIcon(16, QLatin1String("text-x-generic.png"));
    5429                     if (fileIcon.isNull())
    5430                         fileIcon = d->findIcon(16, QLatin1String("empty.png"));
    5431                     if (!fileIcon.isNull()) {
    5432                         QPainter painter(&fileIcon);
    5433                         painter.drawPixmap(0, 0, 16, 16, pixmap);
    5434                         return fileIcon;
    5435                     }
    5436                 }
    5437                 break;
    5438            }
     5212            pixmap = QIcon::fromTheme(QLatin1String("text-x-generic"),
     5213                                      QIcon::fromTheme(QLatin1String("empty"))).pixmap(16);
     5214            break;
    54395215        case SP_DirClosedIcon:
    54405216        case SP_DirIcon:
    5441             {
    5442                 pixmap = d->findIcon(16, QLatin1String("folder.png"));
    5443                 if (!pixmap.isNull())
    5444                     return pixmap;
    5445                 break;
    5446             }
     5217                pixmap = QIcon::fromTheme(QLatin1String("folder")).pixmap(16);
     5218                break;
     5219        case SP_DriveFDIcon:
     5220                pixmap = QIcon::fromTheme(QLatin1String("media-floppy"),
     5221                                          QIcon::fromTheme(QLatin1String("3floppy_unmount"))).pixmap(16);
     5222                break;
     5223        case SP_ComputerIcon:
     5224                pixmap = QIcon::fromTheme(QLatin1String("computer"),
     5225                                          QIcon::fromTheme(QLatin1String("system"))).pixmap(16);
     5226                break;
     5227        case SP_DesktopIcon:
     5228                pixmap = QIcon::fromTheme(QLatin1String("user-desktop"),
     5229                                          QIcon::fromTheme(QLatin1String("desktop"))).pixmap(16);
     5230                break;
     5231        case SP_TrashIcon:
     5232                pixmap = QIcon::fromTheme(QLatin1String("user-trash"),
     5233                                          QIcon::fromTheme(QLatin1String("trashcan_empty"))).pixmap(16);
     5234                break;
     5235        case SP_DriveCDIcon:
     5236        case SP_DriveDVDIcon:
     5237                pixmap = QIcon::fromTheme(QLatin1String("media-optical"),
     5238                                          QIcon::fromTheme(QLatin1String("cdrom_unmount"))).pixmap(16);
     5239                break;
     5240        case SP_DriveHDIcon:
     5241                pixmap = QIcon::fromTheme(QLatin1String("drive-harddisk"),
     5242                                          QIcon::fromTheme(QLatin1String("hdd_unmount"))).pixmap(16);
     5243                break;
     5244        case SP_FileDialogToParent:
     5245                pixmap = QIcon::fromTheme(QLatin1String("go-up"),
     5246                                          QIcon::fromTheme(QLatin1String("up"))).pixmap(16);
     5247                break;
     5248        case SP_FileDialogNewFolder:
     5249                pixmap = QIcon::fromTheme(QLatin1String("folder_new")).pixmap(16);
     5250                break;
     5251        case SP_ArrowUp:
     5252                pixmap = QIcon::fromTheme(QLatin1String("go-up"),
     5253                                          QIcon::fromTheme(QLatin1String("up"))).pixmap(16);
     5254                break;
     5255        case SP_ArrowDown:
     5256                pixmap = QIcon::fromTheme(QLatin1String("go-down"),
     5257                                          QIcon::fromTheme(QLatin1String("down"))).pixmap(16);
     5258                break;
     5259        case SP_ArrowRight:
     5260                pixmap = QIcon::fromTheme(QLatin1String("go-next"),
     5261                                          QIcon::fromTheme(QLatin1String("forward"))).pixmap(16);
     5262                break;
     5263        case SP_ArrowLeft:
     5264                pixmap = QIcon::fromTheme(QLatin1String("go-previous"),
     5265                                          QIcon::fromTheme(QLatin1String("back"))).pixmap(16);
     5266                break;
     5267        case SP_FileDialogDetailedView:
     5268                pixmap = QIcon::fromTheme(QLatin1String("view_detailed")).pixmap(16);
     5269                break;
     5270        case SP_FileDialogListView:
     5271                pixmap = QIcon::fromTheme(QLatin1String("view_icon")).pixmap(16);
     5272                break;
     5273        case SP_BrowserReload:
     5274                pixmap = QIcon::fromTheme(QLatin1String("reload")).pixmap(16);
     5275                break;
     5276        case SP_BrowserStop:
     5277                pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(16);
     5278                break;
     5279        case SP_MediaPlay:
     5280                pixmap = QIcon::fromTheme(QLatin1String("media-playback-start")).pixmap(16);
     5281                break;
     5282        case SP_MediaPause:
     5283                pixmap = QIcon::fromTheme(QLatin1String("media-playback-pause")).pixmap(16);
     5284                break;
     5285        case SP_MediaStop:
     5286                pixmap = QIcon::fromTheme(QLatin1String("media-playback-stop")).pixmap(16);
     5287                break;
     5288        case SP_MediaSeekForward:
     5289                pixmap = QIcon::fromTheme(QLatin1String("media-seek-forward")).pixmap(16);
     5290                break;
     5291        case SP_MediaSeekBackward:
     5292                pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16);
     5293                break;
     5294        case SP_MediaSkipForward:
     5295                pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
     5296                break;
     5297        case SP_MediaSkipBackward:
     5298                pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
     5299                break;
     5300        case SP_DialogResetButton:
     5301                pixmap = QIcon::fromTheme(QLatin1String("edit-clear")).pixmap(24);
     5302                break;
     5303        case SP_DialogHelpButton:
     5304                pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24);
     5305                break;
     5306        case SP_DialogNoButton:
     5307        case SP_DialogCancelButton:
     5308                pixmap = QIcon::fromTheme(QLatin1String("dialog-cancel"),
     5309                                         QIcon::fromTheme(QLatin1String("process-stop"))).pixmap(24);
     5310                break;
     5311        case SP_DialogSaveButton:
     5312                pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24);
     5313                break;
     5314        case SP_FileLinkIcon:
     5315            pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16);
     5316            if (!pixmap.isNull()) {
     5317                QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16);
     5318                if (fileIcon.isNull())
     5319                    fileIcon = QIcon::fromTheme(QLatin1String("empty")).pixmap(16);
     5320                if (!fileIcon.isNull()) {
     5321                    QPainter painter(&fileIcon);
     5322                    painter.drawPixmap(0, 0, 16, 16, pixmap);
     5323                    return fileIcon;
     5324                }
     5325            }
     5326            break;
    54475327        case SP_DirLinkIcon:
    5448             {
    5449                 pixmap = d->findIcon(16, QLatin1String("link_overlay.png"));
     5328                pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16);
    54505329                if (!pixmap.isNull()) {
    5451                     QPixmap dirIcon = d->findIcon(16, QLatin1String("folder.png"));
     5330                    QPixmap dirIcon = QIcon::fromTheme(QLatin1String("folder")).pixmap(16);
    54525331                    if (!dirIcon.isNull()) {
    54535332                        QPainter painter(&dirIcon);
     
    54575336                }
    54585337                break;
    5459            }
    5460         case SP_DriveFDIcon:
    5461             {
    5462                 pixmap = d->findIcon(16, QLatin1String("media-floppy.png"));
    5463                 if (pixmap.isNull())
    5464                     pixmap = d->findIcon(16, QLatin1String("3floppy_unmount.png"));
    5465                 if (!pixmap.isNull())
    5466                     return pixmap;
    5467                 break;
    5468             }
    5469         case SP_ComputerIcon:
    5470             {
    5471                 pixmap = d->findIcon(16, QLatin1String("computer.png"));
    5472                 if (pixmap.isNull())
    5473                     pixmap = d->findIcon(16, QLatin1String("system.png"));
    5474                 if (!pixmap.isNull())
    5475                     return pixmap;
    5476                 break;
    5477             }
    5478         case SP_DesktopIcon:
    5479             {
    5480                 pixmap = d->findIcon(16, QLatin1String("user-desktop.png"));
    5481                 if (pixmap.isNull())
    5482                     pixmap = d->findIcon(16, QLatin1String("desktop.png"));
    5483                 if (!pixmap.isNull())
    5484                     return pixmap;
    5485                 break;
    5486             }
    5487         case SP_TrashIcon:
    5488             {
    5489                 pixmap = d->findIcon(16, QLatin1String("user-trash.png"));
    5490                 if (pixmap.isNull())
    5491                     pixmap = d->findIcon(16, QLatin1String("trashcan_empty.png"));
    5492                 if (!pixmap.isNull())
    5493                     return pixmap;
    5494                 break;
    5495             }
    5496         case SP_DriveCDIcon:
    5497         case SP_DriveDVDIcon:
    5498             {
    5499                 pixmap = d->findIcon(16, QLatin1String("media-optical.png"));
    5500                 if (pixmap.isNull())
    5501                     pixmap = d->findIcon(16, QLatin1String("cdrom_unmount.png"));
    5502                 if (!pixmap.isNull())
    5503                     return pixmap;
    5504                 break;
    5505             }
    5506         case SP_DriveHDIcon:
    5507             {
    5508                 pixmap = d->findIcon(16, QLatin1String("drive-harddisk.png"));
    5509                 if (pixmap.isNull())
    5510                     pixmap = d->findIcon(16, QLatin1String("hdd_unmount.png"));
    5511                 if (!pixmap.isNull())
    5512                     return pixmap;
    5513                 break;
    5514             }
    5515         case SP_FileDialogToParent:
    5516             {
    5517                 pixmap = d->findIcon(32, QLatin1String("go-up.png"));
    5518                 if (pixmap.isNull())
    5519                     pixmap = d->findIcon(32, QLatin1String("up.png"));
    5520                 if (!pixmap.isNull())
    5521                     return pixmap;
    5522                 break;
    5523             }
    5524         case SP_FileDialogNewFolder:
    5525             {
    5526                 pixmap = d->findIcon(16, QLatin1String("folder_new.png"));
    5527                 if (!pixmap.isNull())
    5528                     return pixmap;
    5529                 break;
    5530             }
    5531         case SP_ArrowUp:
    5532             {
    5533                 pixmap = d->findIcon(32, QLatin1String("go-up.png"));
    5534                 if (pixmap.isNull())
    5535                     pixmap = d->findIcon(32, QLatin1String("up.png"));
    5536                 if (!pixmap.isNull())
    5537                     return pixmap;
    5538                 break;
    5539             }
    5540         case SP_ArrowDown:
    5541             {
    5542                 pixmap = d->findIcon(32, QLatin1String("go-down.png"));
    5543                 if (pixmap.isNull())
    5544                     pixmap = d->findIcon(32, QLatin1String("down.png"));
    5545                 if (!pixmap.isNull())
    5546                     return pixmap;
    5547                 break;
    5548             }
    5549         case SP_ArrowRight:
    5550             {
    5551                 pixmap = d->findIcon(32, QLatin1String("go-next.png"));
    5552                 if (pixmap.isNull())
    5553                     pixmap = d->findIcon(32, QLatin1String("forward.png"));
    5554                 if (!pixmap.isNull())
    5555                     return pixmap;
    5556                 break;
    5557             }
    5558         case SP_ArrowLeft:
    5559             {
    5560                 pixmap = d->findIcon(32, QLatin1String("go-previous.png"));
    5561                 if (pixmap.isNull())
    5562                     pixmap = d->findIcon(32, QLatin1String("back.png"));
    5563                 if (!pixmap.isNull())
    5564                     return pixmap;
    5565                 break;
    5566             }
    5567         case SP_FileDialogDetailedView:
    5568             {
    5569                 pixmap = d->findIcon(16, QLatin1String("view_detailed.png"));
    5570                 if (!pixmap.isNull())
    5571                     return pixmap;
    5572                 break;
    5573             }
    5574 
    5575         case SP_FileDialogListView:
    5576             {
    5577                 pixmap = d->findIcon(16, QLatin1String("view_icon.png"));
    5578                 if (!pixmap.isNull())
    5579                     return pixmap;
    5580                 break;
    5581             }
    5582         case SP_BrowserReload:
    5583             {
    5584                 pixmap = d->findIcon(32, QLatin1String("reload.png"));
    5585                 if (!pixmap.isNull())
    5586                     return pixmap;
    5587                 break;
    5588             }
    5589         case SP_BrowserStop:
    5590             {
    5591                 pixmap = d->findIcon(32, QLatin1String("stop.png"));
    5592                 if (!pixmap.isNull())
    5593                     return pixmap;
    5594                 break;
    5595             }
    5596         case SP_MediaPlay:
    5597             {
    5598                 pixmap = d->findIcon(16, QLatin1String("player_play.png"));
    5599                 if (!pixmap.isNull())
    5600                     return pixmap;
    5601                 break;
    5602             }
    5603         case SP_MediaPause:
    5604             {
    5605                 pixmap = d->findIcon(16, QLatin1String("player_pause.png"));
    5606                 if (!pixmap.isNull())
    5607                     return pixmap;
    5608                 break;
    5609             }
    5610         case SP_MediaStop:
    5611             {
    5612                 pixmap = d->findIcon(16, QLatin1String("player_stop.png"));
    5613                 if (!pixmap.isNull())
    5614                     return pixmap;
    5615                 break;
    5616             }
    5617         case SP_MediaSeekForward:
    5618             {
    5619                 pixmap = d->findIcon(16, QLatin1String("player_fwd.png"));
    5620                 if (!pixmap.isNull())
    5621                     return pixmap;
    5622                 break;
    5623             }
    5624         case SP_MediaSeekBackward:
    5625             {
    5626                 pixmap = d->findIcon(16, QLatin1String("player_rew.png"));
    5627                 if (!pixmap.isNull())
    5628                     return pixmap;
    5629                 break;
    5630             }
    5631         case SP_MediaSkipForward:
    5632             {
    5633                 pixmap = d->findIcon(16, QLatin1String("player_end.png"));
    5634                 if (!pixmap.isNull())
    5635                     return pixmap;
    5636                 break;
    5637             }
    5638         case SP_MediaSkipBackward:
    5639             {
    5640                 pixmap = d->findIcon(16, QLatin1String("player_start.png"));
    5641                 if (!pixmap.isNull())
    5642                     return pixmap;
    5643                 break;
    5644             }
    5645 
    56465338        default:
    56475339            break;
    56485340        }
    56495341    }
    5650 #endif //Q_WS_X11
     5342
     5343    if (!pixmap.isNull())
     5344        return pixmap;
    56515345#endif //QT_NO_IMAGEFORMAT_PNG
    56525346    switch (sp) {
    56535347#ifndef QT_NO_IMAGEFORMAT_XPM
    56545348    case SP_ToolBarHorizontalExtensionButton:
    5655         if (QApplication::layoutDirection() == Qt::RightToLeft) {
     5349        if (rtl) {
    56565350            QImage im(tb_extension_arrow_h_xpm);
    56575351            im = im.convertToFormat(QImage::Format_ARGB32).mirrored(true, false);
     
    56695363    case SP_CommandLink:
    56705364    case SP_ArrowForward:
    5671         if (QApplication::layoutDirection() == Qt::RightToLeft)
    5672             return standardPixmap(SP_ArrowLeft, option, widget);
    5673         return standardPixmap(SP_ArrowRight, option, widget);
     5365        if (rtl)
     5366            return proxy()->standardPixmap(SP_ArrowLeft, option, widget);
     5367        return proxy()->standardPixmap(SP_ArrowRight, option, widget);
    56745368    case SP_ArrowBack:
    5675         if (QApplication::layoutDirection() == Qt::RightToLeft)
    5676             return standardPixmap(SP_ArrowRight, option, widget);
    5677         return standardPixmap(SP_ArrowLeft, option, widget);
     5369        if (rtl)
     5370            return proxy()->standardPixmap(SP_ArrowRight, option, widget);
     5371        return proxy()->standardPixmap(SP_ArrowLeft, option, widget);
    56785372    case SP_ArrowLeft:
    56795373        return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/left-16.png"));
     
    56855379        return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/down-16.png"));
    56865380    case SP_FileDialogToParent:
    5687         return standardPixmap(SP_ArrowUp, option, widget);
     5381        return proxy()->standardPixmap(SP_ArrowUp, option, widget);
    56885382    case SP_FileDialogNewFolder:
    56895383        return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/newdirectory-16.png"));
     
    56975391        return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/viewlist-16.png"));
    56985392    case SP_FileDialogBack:
    5699         return standardPixmap(SP_ArrowBack, option, widget);
     5393        return proxy()->standardPixmap(SP_ArrowBack, option, widget);
    57005394    case SP_DriveHDIcon:
    57015395        return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/harddrive-16.png"));
     
    57845478{
    57855479    QIcon icon;
    5786 #ifdef Q_WS_X11
    5787     Q_D(const QCommonStyle);
    5788     if (qApp->desktopSettingsAware()) {
    5789         d->lookupIconTheme();
    5790         QPixmap pixmap;
     5480    const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
     5481    if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
    57915482        switch (standardIcon) {
    57925483        case SP_DirHomeIcon:
    5793             {
    5794                 icon = d->createIcon(QLatin1String("folder_home.png"));
    5795                 break;
    5796             }
     5484                icon = QIcon::fromTheme(QLatin1String("user-home"));
     5485                break;
    57975486        case SP_MessageBoxInformation:
    5798             {
    5799                 icon = d->createIcon(QLatin1String("dialog-information.png"));
    5800                 if (icon.isNull())
    5801                     icon = d->createIcon(QLatin1String("messagebox_info.png"));
    5802                 break;
    5803             }
     5487                icon = QIcon::fromTheme(QLatin1String("dialog-information"));
     5488                break;
    58045489        case SP_MessageBoxWarning:
    5805             {
    5806                 icon = d->createIcon(QLatin1String("dialog-warning.png"));
    5807                 if (icon.isNull())
    5808                     icon = d->createIcon(QLatin1String("messagebox_warning.png"));
    5809                 break;
    5810             }
     5490                icon = QIcon::fromTheme(QLatin1String("dialog-warning"));
     5491                break;
    58115492        case SP_MessageBoxCritical:
    5812             {
    5813                 icon = d->createIcon(QLatin1String("dialog-error.png"));
    5814                 if (icon.isNull())
    5815                     icon = d->createIcon(QLatin1String("messagebox_critical.png"));
    5816                 break;
    5817             }
     5493                icon = QIcon::fromTheme(QLatin1String("dialog-error"));
     5494                break;
    58185495        case SP_MessageBoxQuestion:
    5819             {
    5820                 icon = d->createIcon(QLatin1String("help.png"));
    5821                 break;
    5822             }
     5496                icon = QIcon::fromTheme(QLatin1String("dialog-question"));
     5497                break;
    58235498        case SP_DialogOpenButton:
    58245499        case SP_DirOpenIcon:
    5825             {
    5826                 icon = d->createIcon(QLatin1String("folder-open.png"));
    5827                 if (icon.isNull())
    5828                     icon = d->createIcon(QLatin1String("folder_open.png"));
    5829                 break;
    5830             }
     5500                icon = QIcon::fromTheme(QLatin1String("folder-open"));
     5501                break;
     5502        case SP_DialogSaveButton:
     5503                icon = QIcon::fromTheme(QLatin1String("document-save"));
     5504                break;
     5505        case SP_DialogApplyButton:
     5506                icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply"));
     5507                break;
     5508        case SP_DialogYesButton:
     5509        case SP_DialogOkButton:
     5510                icon = QIcon::fromTheme(QLatin1String("dialog-ok"));
     5511                break;
     5512        case SP_DialogDiscardButton:
     5513                icon = QIcon::fromTheme(QLatin1String("edit-delete"));
     5514                break;
     5515        case SP_DialogResetButton:
     5516                icon = QIcon::fromTheme(QLatin1String("edit-clear"));
     5517                break;
     5518        case SP_DialogHelpButton:
     5519                icon = QIcon::fromTheme(QLatin1String("help-contents"));
     5520                break;
    58315521        case SP_FileIcon:
    5832             {
    5833                 icon = d->createIcon(QLatin1String("text-x-generic.png"));
    5834                 if (icon.isNull())
    5835                     icon = d->createIcon(QLatin1String("empty.png"));
    5836                 break;
    5837             }
     5522                icon = QIcon::fromTheme(QLatin1String("text-x-generic"));
     5523                break;
    58385524        case SP_DirClosedIcon:
    58395525        case SP_DirIcon:
    5840             {
    5841                 icon = d->createIcon(QLatin1String("folder.png"));
    5842                 break;
    5843             }
     5526                icon = QIcon::fromTheme(QLatin1String("folder"));
     5527                break;
    58445528        case SP_DriveFDIcon:
    5845             {
    5846                 icon = d->createIcon(QLatin1String("floppy_unmount.png"));
    5847                 break;
    5848             }
     5529                icon = QIcon::fromTheme(QLatin1String("floppy_unmount"));
     5530                break;
    58495531        case SP_ComputerIcon:
    5850             {
    5851                 icon = d->createIcon(QLatin1String("computer.png"));
    5852                 if (icon.isNull())
    5853                     icon = d->createIcon(QLatin1String("system.png"));
    5854                 break;
    5855             }
     5532                icon = QIcon::fromTheme(QLatin1String("computer"),
     5533                                        QIcon::fromTheme(QLatin1String("system")));
     5534                break;
    58565535        case SP_DesktopIcon:
    5857             {
    5858                 icon = d->createIcon(QLatin1String("user-desktop.png"));
    5859                 break;
    5860             }
     5536                icon = QIcon::fromTheme(QLatin1String("user-desktop"));
     5537                break;
    58615538        case SP_TrashIcon:
    5862             {
    5863                 icon = d->createIcon(QLatin1String("user-trash.png"));
    5864                 break;
    5865             }
     5539                icon = QIcon::fromTheme(QLatin1String("user-trash"));
     5540                break;
    58665541        case SP_DriveCDIcon:
    58675542        case SP_DriveDVDIcon:
     5543                icon = QIcon::fromTheme(QLatin1String("media-optical"));
     5544                break;
     5545        case SP_DriveHDIcon:
     5546                icon = QIcon::fromTheme(QLatin1String("drive-harddisk"));
     5547                break;
     5548        case SP_FileDialogToParent:
     5549                icon = QIcon::fromTheme(QLatin1String("go-up"));
     5550                break;
     5551        case SP_FileDialogNewFolder:
     5552                icon = QIcon::fromTheme(QLatin1String("folder-new"));
     5553                break;
     5554        case SP_ArrowUp:
     5555                icon = QIcon::fromTheme(QLatin1String("go-up"));
     5556                break;
     5557        case SP_ArrowDown:
     5558                icon = QIcon::fromTheme(QLatin1String("go-down"));
     5559                break;
     5560        case SP_ArrowRight:
     5561                icon = QIcon::fromTheme(QLatin1String("go-next"));
     5562                break;
     5563        case SP_ArrowLeft:
     5564                icon = QIcon::fromTheme(QLatin1String("go-previous"));
     5565                break;
     5566        case SP_DialogCancelButton:
     5567                icon = QIcon::fromTheme(QLatin1String("dialog-cancel"),
     5568                                        QIcon::fromTheme(QLatin1String("process-stop")));
     5569                break;
     5570        case SP_DialogCloseButton:
     5571                icon = QIcon::fromTheme(QLatin1String("window-close"));
     5572                break;
     5573        case SP_FileDialogDetailedView:
     5574                icon = QIcon::fromTheme(QLatin1String("view-list-details"));
     5575                break;
     5576        case SP_FileDialogListView:
     5577                icon = QIcon::fromTheme(QLatin1String("view-list-icons"));
     5578                break;
     5579        case SP_BrowserReload:
     5580                icon = QIcon::fromTheme(QLatin1String("view-refresh"));
     5581                break;
     5582        case SP_BrowserStop:
     5583                icon = QIcon::fromTheme(QLatin1String("process-stop"));
     5584                break;
     5585        case SP_MediaPlay:
     5586                icon = QIcon::fromTheme(QLatin1String("media-playback-start"));
     5587                break;
     5588        case SP_MediaPause:
     5589                icon = QIcon::fromTheme(QLatin1String("media-playback-pause"));
     5590                break;
     5591        case SP_MediaStop:
     5592                icon = QIcon::fromTheme(QLatin1String("media-playback-stop"));
     5593                break;
     5594        case SP_MediaSeekForward:
     5595                icon = QIcon::fromTheme(QLatin1String("media-seek-forward"));
     5596                break;
     5597        case SP_MediaSeekBackward:
     5598                icon = QIcon::fromTheme(QLatin1String("media-seek-backward"));
     5599                break;
     5600        case SP_MediaSkipForward:
     5601                icon = QIcon::fromTheme(QLatin1String("media-skip-forward"));
     5602                break;
     5603        case SP_MediaSkipBackward:
     5604                icon = QIcon::fromTheme(QLatin1String("media-skip-backward"));
     5605                break;
     5606        case SP_MediaVolume:
     5607                icon = QIcon::fromTheme(QLatin1String("audio-volume-medium"));
     5608                break;
     5609        case SP_MediaVolumeMuted:
     5610                icon = QIcon::fromTheme(QLatin1String("audio-volume-muted"));
     5611                break;
     5612        case SP_ArrowForward:
     5613            if (rtl)
     5614                return standardIconImplementation(SP_ArrowLeft, option, widget);
     5615            return standardIconImplementation(SP_ArrowRight, option, widget);
     5616        case SP_ArrowBack:
     5617            if (rtl)
     5618                return standardIconImplementation(SP_ArrowRight, option, widget);
     5619            return standardIconImplementation(SP_ArrowLeft, option, widget);
     5620        case SP_FileLinkIcon:
    58685621            {
    5869                 icon = d->createIcon(QLatin1String("media-optical.png"));
    5870                 if (icon.isNull())
    5871                     icon = d->createIcon(QLatin1String("cdrom_unmount.png"));
    5872                 break;
    5873             }
    5874         case SP_DriveHDIcon:
     5622                QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link"));
     5623                if (!linkIcon.isNull()) {
     5624                    QIcon baseIcon = standardIconImplementation(SP_FileIcon, option, widget);
     5625                    const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off);
     5626                    for (int i = 0 ; i < sizes.size() ; ++i) {
     5627                        int size = sizes[i].width();
     5628                        QPixmap basePixmap = baseIcon.pixmap(size);
     5629                        QPixmap linkPixmap = linkIcon.pixmap(size/2);
     5630                        QPainter painter(&basePixmap);
     5631                        painter.drawPixmap(size/2, size/2, linkPixmap);
     5632                        icon.addPixmap(basePixmap);
     5633                    }
     5634                }
     5635            }
     5636            break;
     5637        case SP_DirLinkIcon:
    58755638            {
    5876                 icon = d->createIcon(QLatin1String("drive-harddisk.png"));
    5877                 if (icon.isNull())
    5878                     icon = d->createIcon(QLatin1String("hdd_unmount.png"));
    5879                 break;
    5880             }
    5881         case SP_FileDialogToParent:
    5882             {
    5883                 icon = d->createIcon(QLatin1String("go-up.png"));
    5884                 if (icon.isNull())
    5885                     icon = d->createIcon(QLatin1String("up.png"));
    5886                 break;
    5887             }
    5888         case SP_FileDialogNewFolder:
    5889             {
    5890                 icon = d->createIcon(QLatin1String("folder_new.png"));
    5891                 break;
    5892             }
    5893         case SP_ArrowUp:
    5894             {
    5895                 icon = d->createIcon(QLatin1String("go-up.png"));
    5896                 if (icon.isNull())
    5897                     icon = d->createIcon(QLatin1String("up.png"));
    5898                 break;
    5899             }
    5900         case SP_ArrowDown:
    5901             {
    5902                 icon = d->createIcon(QLatin1String("go-down.png"));
    5903                 if (icon.isNull())
    5904                     icon = d->createIcon(QLatin1String("down.png"));
    5905                 break;
    5906             }
    5907         case SP_ArrowRight:
    5908             {
    5909                 icon = d->createIcon(QLatin1String("go-next.png"));
    5910                 if (icon.isNull())
    5911                     icon = d->createIcon(QLatin1String("forward.png"));
    5912                 break;
    5913             }
    5914         case SP_ArrowLeft:
    5915             {
    5916                 icon = d->createIcon(QLatin1String("go-previous.png"));
    5917                 if (icon.isNull())
    5918                     icon = d->createIcon(QLatin1String("back.png"));
    5919                 break;
    5920             }
    5921         case SP_FileDialogDetailedView:
    5922             {
    5923                 icon = d->createIcon(QLatin1String("view-list-details.png"));
    5924                 if (icon.isNull())
    5925                     icon = d->createIcon(QLatin1String("view_detailed.png"));
    5926                 break;
    5927             }
    5928         case SP_FileDialogListView:
    5929             {
    5930                 icon = d->createIcon(QLatin1String("view-list-icons.png"));
    5931                 if (icon.isNull())
    5932                     icon = d->createIcon(QLatin1String("view_icon.png"));
    5933                 break;
    5934             }
    5935         case SP_BrowserReload:
    5936             {
    5937                 icon = d->createIcon(QLatin1String("view-refresh.png"));
    5938                 if (icon.isNull())
    5939                     icon = d->createIcon(QLatin1String("reload.png"));
    5940                 break;
    5941             }
    5942         case SP_BrowserStop:
    5943             {
    5944                 icon = d->createIcon(QLatin1String("process-stop.png"));
    5945                 if (icon.isNull())
    5946                     icon = d->createIcon(QLatin1String("stop.png"));
    5947                 break;
    5948             }
    5949         case SP_MediaPlay:
    5950             {
    5951                 icon = d->createIcon(QLatin1String("media-playback-start.png"));
    5952                 if (icon.isNull())
    5953                     icon = d->createIcon(QLatin1String("player_play.png"));
    5954                 break;
    5955             }
    5956         case SP_MediaPause:
    5957             {
    5958                 icon = d->createIcon(QLatin1String("media-playback-pause.png"));
    5959                 if (icon.isNull())
    5960                     icon = d->createIcon(QLatin1String("player_pause.png"));
    5961                 break;
    5962             }
    5963         case SP_MediaStop:
    5964             {
    5965                 icon = d->createIcon(QLatin1String("media-playback-stop.png"));
    5966                 if (icon.isNull())
    5967                     icon = d->createIcon(QLatin1String("player_stop.png"));
    5968                 break;
    5969             }
    5970         case SP_MediaSeekForward:
    5971             {
    5972                 icon = d->createIcon(QLatin1String("media-skip-forward.png"));
    5973                 if (icon.isNull())
    5974                     icon = d->createIcon(QLatin1String("player_fwd.png"));
    5975                 break;
    5976             }
    5977         case SP_MediaSeekBackward:
    5978             {
    5979                 icon = d->createIcon(QLatin1String("media-skip-backward.png"));
    5980                 if (icon.isNull())
    5981                     icon = d->createIcon(QLatin1String("player_rew.png"));
    5982                 break;
    5983             }
    5984         case SP_MediaSkipForward:
    5985             {
    5986                 icon = d->createIcon(QLatin1String("media-skip-forward.png"));
    5987                 if (icon.isNull())
    5988                     icon = d->createIcon(QLatin1String("player_end.png"));
    5989                 break;
    5990             }
    5991         case SP_MediaSkipBackward:
    5992             {
    5993                 icon = d->createIcon(QLatin1String("media-skip-backward.png"));
    5994                 if (icon.isNull())
    5995                     icon = d->createIcon(QLatin1String("player_start.png"));
    5996                 break;
    5997             }
    5998 
    5999         case SP_FileLinkIcon: {
    6000             icon = QIcon(standardPixmap(standardIcon, option, widget));
    6001             QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png"));
    6002             if (!pixmap.isNull()) {
    6003                 QPixmap fileIcon = d->findIcon(32, QLatin1String("text-x-generic.png"));
    6004                 if (fileIcon.isNull())
    6005                     fileIcon = d->findIcon(32, QLatin1String("empty.png"));
    6006                 if (!fileIcon.isNull()) {
    6007                     QPainter painter(&fileIcon);
    6008                     painter.drawPixmap(0, 0, 32, 32, pixmap);
    6009                     icon.addPixmap(fileIcon);
    6010                 }
    6011             }
    6012         }
    6013         break;
    6014         case SP_DirLinkIcon: {
    6015             icon = QIcon(standardPixmap(standardIcon, option, widget));
    6016             QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png"));
    6017             if (!pixmap.isNull()) {
    6018                 QPixmap fileIcon = d->findIcon(32, QLatin1String("folder.png"));
    6019                 if (!fileIcon.isNull()) {
    6020                     QPainter painter(&fileIcon);
    6021                     painter.drawPixmap(0, 0, 32, 32, pixmap);
    6022                     icon.addPixmap(fileIcon);
    6023                 }
    6024             }
     5639                QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link"));
     5640                if (!linkIcon.isNull()) {
     5641                    QIcon baseIcon = standardIconImplementation(SP_DirIcon, option, widget);
     5642                    const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off);
     5643                    for (int i = 0 ; i < sizes.size() ; ++i) {
     5644                        int size = sizes[i].width();
     5645                        QPixmap basePixmap = baseIcon.pixmap(size);
     5646                        QPixmap linkPixmap = linkIcon.pixmap(size/2);
     5647                        QPainter painter(&basePixmap);
     5648                        painter.drawPixmap(size/2, size/2, linkPixmap);
     5649                        icon.addPixmap(basePixmap);
     5650                    }
     5651                }
    60255652        }
    60265653        break;
     
    60285655            break;
    60295656        }
     5657    } // if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty())
    60305658        if (!icon.isNull())
    60315659            return icon;
    6032     }
    6033 #endif//Q_WS_X11
     5660#if defined(Q_WS_MAC)
     5661    if (QApplication::desktopSettingsAware()) {
     5662        OSType iconType = 0;
     5663        switch (standardIcon) {
     5664        case QStyle::SP_MessageBoxQuestion:
     5665        case QStyle::SP_MessageBoxInformation:
     5666        case QStyle::SP_MessageBoxWarning:
     5667        case QStyle::SP_MessageBoxCritical:
     5668            iconType = kGenericApplicationIcon;
     5669            break;
     5670        case SP_DesktopIcon:
     5671            iconType = kDesktopIcon;
     5672            break;
     5673        case SP_TrashIcon:
     5674            iconType = kTrashIcon;
     5675            break;
     5676        case SP_ComputerIcon:
     5677            iconType = kComputerIcon;
     5678            break;
     5679        case SP_DriveFDIcon:
     5680            iconType = kGenericFloppyIcon;
     5681            break;
     5682        case SP_DriveHDIcon:
     5683            iconType = kGenericHardDiskIcon;
     5684            break;
     5685        case SP_DriveCDIcon:
     5686        case SP_DriveDVDIcon:
     5687            iconType = kGenericCDROMIcon;
     5688            break;
     5689        case SP_DriveNetIcon:
     5690            iconType = kGenericNetworkIcon;
     5691            break;
     5692        case SP_DirOpenIcon:
     5693            iconType = kOpenFolderIcon;
     5694            break;
     5695        case SP_DirClosedIcon:
     5696        case SP_DirLinkIcon:
     5697            iconType = kGenericFolderIcon;
     5698            break;
     5699        case SP_FileLinkIcon:
     5700        case SP_FileIcon:
     5701            iconType = kGenericDocumentIcon;
     5702            break;
     5703        case SP_DirIcon: {
     5704            // A rather special case
     5705            QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget);
     5706            QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget);
     5707            closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On);
     5708            closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On);
     5709            closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On);
     5710            closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On);
     5711            return closeIcon;
     5712        }
     5713        case SP_TitleBarNormalButton:
     5714        case SP_TitleBarCloseButton: {
     5715            QIcon titleBarIcon;
     5716            if (standardIcon == SP_TitleBarCloseButton) {
     5717                titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png"));
     5718                titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
     5719            } else {
     5720                titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png"));
     5721                titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
     5722            }
     5723            return titleBarIcon;
     5724        }
     5725        default:
     5726            break;
     5727        }
     5728        if (iconType != 0) {
     5729            QIcon retIcon;
     5730            IconRef icon;
     5731            IconRef overlayIcon = 0;
     5732            if (iconType != kGenericApplicationIcon) {
     5733                GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
     5734            } else {
     5735                FSRef fsRef;
     5736                ProcessSerialNumber psn = { 0, kCurrentProcess };
     5737                GetProcessBundleLocation(&psn, &fsRef);
     5738                GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
     5739                if (standardIcon == SP_MessageBoxCritical) {
     5740                    overlayIcon = icon;
     5741                    GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
     5742                }
     5743            }
     5744            if (icon) {
     5745                qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon);
     5746                ReleaseIconRef(icon);
     5747            }
     5748            if (overlayIcon)
     5749                ReleaseIconRef(overlayIcon);
     5750            return retIcon;
     5751        }
     5752    } // if (QApplication::desktopSettingsAware())
     5753#endif // Q_WS_MAC
    60345754
    60355755    switch (standardIcon) {
     
    61205840        break;
    61215841    case SP_ArrowForward:
    6122         if (QApplication::layoutDirection() == Qt::RightToLeft)
     5842        if (rtl)
    61235843            return standardIconImplementation(SP_ArrowLeft, option, widget);
    61245844        return standardIconImplementation(SP_ArrowRight, option, widget);
    61255845    case SP_ArrowBack:
    6126         if (QApplication::layoutDirection() == Qt::RightToLeft)
     5846        if (rtl)
    61275847            return standardIconImplementation(SP_ArrowRight, option, widget);
    61285848        return standardIconImplementation(SP_ArrowLeft, option, widget);
     
    62315951#endif // QT_NO_IMAGEFORMAT_PNG
    62325952    default:
    6233         icon.addPixmap(standardPixmap(standardIcon, option, widget));
     5953        icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget));
    62345954        break;
    62355955    }
  • trunk/src/gui/styles/qcommonstyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qcommonstyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6262
    6363class QStringList;
    64 
    65 #ifdef Q_WS_X11
    66 class QIconTheme
    67 {
    68 public:
    69     QIconTheme(QHash <int, QString> dirList, QStringList parents) :
    70           _dirList(dirList), _parents(parents), _valid(true){ }
    71     QIconTheme() : _valid(false){ }
    72 
    73     QHash <int, QString> dirList() {return _dirList;}
    74     QStringList parents() {return _parents;}
    75     bool isValid() {return _valid;}
    76 
    77 private:
    78     QHash <int, QString> _dirList;
    79     QStringList _parents;
    80     bool _valid;
    81 };
    82 #endif
    8364
    8465// Private class
     
    123104#endif
    124105    mutable QIcon tabBarcloseButtonIcon;
    125 
    126 //icon detection on X11
    127 #ifdef Q_WS_X11
    128     void lookupIconTheme() const;
    129     QIcon createIcon(const QString &) const;
    130     QPixmap findIcon(int size, const QString &) const;
    131     QPixmap findIconHelper(int size, const QString &, const QString &, QStringList &visited) const;
    132     QIconTheme parseIndexFile(const QString &themeName) const;
    133     mutable QString themeName;
    134     mutable QStringList iconDirs;
    135     mutable QHash <QString, QIconTheme> themeList;
     106#ifndef QT_NO_TABBAR
     107    void tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *pixmapRect) const;
    136108#endif
    137 
    138109};
    139110
  • trunk/src/gui/styles/qcommonstylepixmaps_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qgtkpainter.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    109109    QRect pixmapRect(0, 0, rect.width(), rect.height());                                           \
    110110    {                                                                                              \
    111         GdkPixmap *pixmap = QGtk::gdk_pixmap_new((GdkDrawable*)(m_window->window),                    \
     111        GdkPixmap *pixmap = QGtkStylePrivate::gdk_pixmap_new((GdkDrawable*)(m_window->window),                    \
    112112                                            rect.width(), rect.height(), -1);                      \
    113113        if (!pixmap)                                                                               \
    114114            return;                                                                                \
    115         style = QGtk::gtk_style_attach (style, m_window->window);                                  \
    116         QGtk::gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, true,                \
     115        style = QGtkStylePrivate::gtk_style_attach (style, m_window->window);                                  \
     116        QGtkStylePrivate::gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, true,                \
    117117                           0, 0, rect.width(), rect.height());                                     \
    118118        draw_func;                                                                                 \
    119         GdkPixbuf *imgb = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.width(), rect.height());\
     119        GdkPixbuf *imgb = QGtkStylePrivate::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.width(), rect.height());\
    120120        if (!imgb)                                                                                 \
    121121            return;                                                                                \
    122         imgb = QGtk::gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0,                  \
     122        imgb = QGtkStylePrivate::gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0,                  \
    123123                                            rect.width(), rect.height());                          \
    124         uchar* bdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgb);                                  \
     124        uchar* bdata = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(imgb);                                  \
    125125        if (m_alpha) {                                                                             \
    126             QGtk::gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, rect.width(), rect.height());  \
     126            QGtkStylePrivate::gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, rect.width(), rect.height());  \
    127127            draw_func;                                                                             \
    128             GdkPixbuf *imgw = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.              \
     128            GdkPixbuf *imgw = QGtkStylePrivate::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.              \
    129129                                             width(), rect.height());                              \
    130130            if (!imgw)                                                                             \
    131131                return;                                                                            \
    132             imgw = QGtk::gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0,              \
     132            imgw = QGtkStylePrivate::gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0,              \
    133133                                                rect.width(), rect.height());                      \
    134             uchar* wdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgw);                                    \
     134            uchar* wdata = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(imgw);                                    \
    135135            cache = renderTheme(bdata, wdata, rect);                                               \
    136             QGtk::gdk_pixbuf_unref(imgw);                                                          \
     136            QGtkStylePrivate::gdk_pixbuf_unref(imgw);                                                          \
    137137        } else {                                                                                   \
    138138            cache = renderTheme(bdata, 0, rect);                                                   \
    139139        }                                                                                          \
    140         QGtk::gdk_drawable_unref(pixmap);                                                          \
    141         QGtk::gdk_pixbuf_unref(imgb);                                                              \
     140        QGtkStylePrivate::gdk_drawable_unref(pixmap);                                                          \
     141        QGtkStylePrivate::gdk_pixbuf_unref(imgb);                                                              \
    142142    }
    143143
    144144QGtkPainter::QGtkPainter(QPainter *_painter)
    145         : m_window(QGtk::gtkWidget(QLatin1String("GtkWindow")))
     145        : m_window(QGtkStylePrivate::gtkWidget(QLatin1String("GtkWindow")))
    146146        , m_painter(_painter)
    147147        , m_alpha(true)
     
    186186QPixmap QGtkPainter::getIcon(const char* iconName, GtkIconSize size)
    187187{
    188     GtkStyle *style = QGtk::gtkStyle();
    189     GtkIconSet* iconSet  = QGtk::gtk_icon_factory_lookup_default (iconName);
    190     GdkPixbuf* icon = QGtk::gtk_icon_set_render_icon(iconSet,
     188    GtkStyle *style = QGtkStylePrivate::gtkStyle();
     189    GtkIconSet* iconSet  = QGtkStylePrivate::gtk_icon_factory_lookup_default (iconName);
     190    GdkPixbuf* icon = QGtkStylePrivate::gtk_icon_set_render_icon(iconSet,
    191191                                                 style,
    192192                                                 GTK_TEXT_DIR_LTR,
     
    195195                                                 NULL,
    196196                                                 "button");
    197     uchar* data = (uchar*)QGtk::gdk_pixbuf_get_pixels(icon);
    198     int width = QGtk::gdk_pixbuf_get_width(icon);
    199     int height = QGtk::gdk_pixbuf_get_height(icon);
     197    uchar* data = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(icon);
     198    int width = QGtkStylePrivate::gdk_pixbuf_get_width(icon);
     199    int height = QGtkStylePrivate::gdk_pixbuf_get_height(icon);
    200200    QImage converted(width, height, QImage::Format_ARGB32);
    201201    uchar* tdata = (uchar*)converted.bits();
     
    209209    }
    210210
    211     QGtk::gdk_pixbuf_unref(icon);
     211    QGtkStylePrivate::gdk_pixbuf_unref(icon);
    212212
    213213    // should we free iconset?
     
    241241
    242242    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    243         DRAW_TO_CACHE(QGtk::gtk_paint_box_gap (style,
     243        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_box_gap (style,
    244244                                           pixmap,
    245245                                           state,
     
    306306
    307307    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    308         DRAW_TO_CACHE(QGtk::gtk_paint_box (style,
     308        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_box (style,
    309309                                           pixmap,
    310310                                           state,
     
    357357                         + hLineExtras + pmKey;
    358358    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    359         DRAW_TO_CACHE(QGtk::gtk_paint_hline (style,
     359        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_hline (style,
    360360                                         pixmap,
    361361                                         state,
     
    384384                                    gtkWidget) + vLineExtras +pmKey;
    385385    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    386         DRAW_TO_CACHE(QGtk::gtk_paint_vline (style,
     386        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_vline (style,
    387387                                         pixmap,
    388388                                         state,
     
    411411                                    gtkWidget) + QString::number(expander_state) + pmKey;
    412412    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    413         DRAW_TO_CACHE(QGtk::gtk_paint_expander (style, pixmap,
     413        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_expander (style, pixmap,
    414414                                            state, NULL,
    415415                                            gtkWidget, part,
     
    434434    QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + pmKey;
    435435    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    436         DRAW_TO_CACHE(QGtk::gtk_paint_focus (style, pixmap, state, NULL,
     436        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_focus (style, pixmap, state, NULL,
    437437                                         gtkWidget,
    438438                                         part,
     
    459459    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey;
    460460    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    461         DRAW_TO_CACHE(QGtk::gtk_paint_resize_grip (style, pixmap, state,
     461        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_resize_grip (style, pixmap, state,
    462462                                               NULL, gtkWidget,
    463463                                               part, edge, 0, 0,
     
    489489    int yOffset = m_cliprect.isValid() ? arrowrect.y() - m_cliprect.y() : 0;
    490490    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    491         DRAW_TO_CACHE(QGtk::gtk_paint_arrow (style, pixmap, state, shadow,
     491        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_arrow (style, pixmap, state, shadow,
    492492                                         &gtkCliprect,
    493493                                         gtkWidget,
     
    516516                         + QString::number(orientation);
    517517    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    518         DRAW_TO_CACHE(QGtk::gtk_paint_handle (style,
     518        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_handle (style,
    519519                                          pixmap,
    520520                                          state,
     
    544544    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey;
    545545    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    546         DRAW_TO_CACHE(QGtk::gtk_paint_slider (style,
     546        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_slider (style,
    547547                                          pixmap,
    548548                                          state,
     
    575575    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey;
    576576    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    577         DRAW_TO_CACHE(QGtk::gtk_paint_shadow(style, pixmap, state, shadow, NULL,
     577        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_shadow(style, pixmap, state, shadow, NULL,
    578578                                         gtkWidget, part, 0, 0, rect.width(), rect.height()));
    579579        if (m_usePixmapCache)
     
    594594    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey;
    595595    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    596         DRAW_TO_CACHE(QGtk::gtk_paint_flat_box (style,
     596        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_flat_box (style,
    597597                                            pixmap,
    598598                                            state,
     
    623623
    624624    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    625         DRAW_TO_CACHE(QGtk::gtk_paint_extension (style, pixmap, state, shadow,
     625        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_extension (style, pixmap, state, shadow,
    626626                                             NULL, gtkWidget,
    627627                                             (gchar*)part, 0, 0,
     
    652652    int yOffset = m_cliprect.isValid() ? radiorect.y() - m_cliprect.y() : 0;
    653653    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    654         DRAW_TO_CACHE(QGtk::gtk_paint_option(style, pixmap,
     654        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_option(style, pixmap,
    655655                                         state, shadow,
    656656                                         &gtkCliprect,
     
    684684    int yOffset = m_cliprect.isValid() ? checkrect.y() - m_cliprect.y() : 0;
    685685    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    686         DRAW_TO_CACHE(QGtk::gtk_paint_check (style,
     686        DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_check (style,
    687687                                         pixmap,
    688688                                         state,
  • trunk/src/gui/styles/qgtkpainter_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5757#if !defined(QT_NO_STYLE_GTK)
    5858
    59 #include "gtksymbols_p.h"
    6059#include <QtGui/QCleanlooksStyle>
    6160#include <QtGui/QPainter>
    6261#include <QtGui/QPalette>
    6362#include <QtGui/QFont>
     63#include <private/qgtkstyle_p.h>
    6464
    6565QT_BEGIN_NAMESPACE
  • trunk/src/gui/styles/qgtkstyle.cpp

    r2 r561  
    1 /*******    *********************************************************************
     1/****************************************************************************
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7070#include <qpixmapcache.h>
    7171#undef signals // Collides with GTK stymbols
    72 #include "qgtkpainter_p.h"
    73 
     72#include <private/qgtkpainter_p.h>
     73#include <private/qstylehelper_p.h>
     74#include <private/qgtkstyle_p.h>
    7475#include <private/qcleanlooksstyle_p.h>
    7576
    7677
    7778QT_BEGIN_NAMESPACE
    78 
    79 typedef QStringList (*_qt_filedialog_open_filenames_hook)(QWidget * parent, const QString &caption, const QString &dir,
    80                                                           const QString &filter, QString *selectedFilter, QFileDialog::Options options);
    81 typedef QString (*_qt_filedialog_open_filename_hook)     (QWidget * parent, const QString &caption, const QString &dir,
    82                                                           const QString &filter, QString *selectedFilter, QFileDialog::Options options);
    83 typedef QString (*_qt_filedialog_save_filename_hook)     (QWidget * parent, const QString &caption, const QString &dir,
    84                                                           const QString &filter, QString *selectedFilter, QFileDialog::Options options);
    85 typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir,
    86                                                           QFileDialog::Options options);
    87 
    88 extern Q_GUI_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook;
    89 extern Q_GUI_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook;
    90 extern Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook;
    91 extern Q_GUI_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook;
    9279
    9380static const char * const dock_widget_close_xpm[] =
     
    137124    };
    138125
    139 
    140 class QGtkStyleFilter : public QObject
    141 {
    142 public:
    143     QGtkStyleFilter() {
    144         qApp->installEventFilter(this);
    145     }
    146 
    147 private:
    148     bool eventFilter(QObject *obj, QEvent *e);
    149 };
    150 
    151 bool QGtkStyleFilter::eventFilter(QObject *obj, QEvent *e)
    152 {
    153     if (e->type() == QEvent::ApplicationPaletteChange) {
    154         // Only do this the first time since this will also
    155         // generate applicationPaletteChange events
    156         extern QHash<QByteArray, QPalette> *qt_app_palettes_hash(); //qapplication.cpp
    157         if (!qt_app_palettes_hash() ||  qt_app_palettes_hash()->isEmpty()) {
    158             QGtk::applyCustomPaletteHash();
    159         }
    160     }
    161     return QObject::eventFilter(obj, e);
    162 }
    163 
    164 class QGtkStylePrivate : public QCleanlooksStylePrivate
    165 {
    166     Q_DECLARE_PUBLIC(QGtkStyle)
    167 public:
    168     QGtkStylePrivate()
    169             : QCleanlooksStylePrivate()
    170     {}
    171     QGtkStyleFilter filter;
    172 };
    173 
    174126static const int groupBoxBottomMargin    =  2;  // space below the groupbox
    175127static const int groupBoxTitleMargin     =  6;  // space between contents and title
    176128static const int groupBoxTopMargin       =  2;
    177 static bool UsePixmapCache = true;
    178 
    179 // Get size of the arrow controls in a GtkSpinButton
    180 static int spinboxArrowSize()
     129
     130/*!
     131  Returns the configuration string for \a value.
     132  Returns \a fallback if \a value is not found.
     133 */
     134QString QGtkStyle::getGConfString(const QString &value, const QString &fallback)
    181135{
    182     const int MIN_ARROW_WIDTH = 6;
    183     GtkWidget *spinButton = QGtk::gtkWidget(QLS("GtkSpinButton"));
    184     GtkStyle *style = spinButton->style;
    185     gint size = QGtk::pango_font_description_get_size (style->font_desc);
    186     gint arrow_size;
    187     arrow_size = qMax(PANGO_PIXELS (size), MIN_ARROW_WIDTH) + style->xthickness;
    188     arrow_size += arrow_size%2 + 1;
    189     return arrow_size;
     136    return QGtkStylePrivate::getGConfString(value, fallback);
     137}
     138
     139/*!
     140  Returns the configuration boolean for \a key.
     141  Returns \a fallback if \a key is not found.
     142 */
     143bool QGtkStyle::getGConfBool(const QString &key, bool fallback)
     144{
     145    return QGtkStylePrivate::getGConfBool(key, fallback);
    190146}
    191147
     
    209165}
    210166
    211 // Note this is different from uniqueName as used in QGtkPainter
    212 static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
    213 {
    214     QString tmp;
    215     const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
    216     tmp.sprintf("%s-%d-%d-%d-%lld-%dx%d", key.toLatin1().constData(), uint(option->state),
    217                 option->direction, complexOption ? uint(complexOption->activeSubControls) : uint(0),
    218                 option->palette.cacheKey(), size.width(), size.height());
    219     return tmp;
    220 }
    221 
    222167/*!
    223168    \class QGtkStyle
     
    244189    : QCleanlooksStyle(*new QGtkStylePrivate)
    245190{
    246     QGtk::initGtkWidgets();
     191    Q_D(QGtkStyle);
     192    d->init();
    247193}
     194
     195/*!
     196    \internal
     197
     198    Constructs a QGtkStyle object.
     199*/
     200QGtkStyle::QGtkStyle(QGtkStylePrivate &dd)
     201     : QCleanlooksStyle(dd)
     202{
     203    Q_D(QGtkStyle);
     204    d->init();
     205}
     206
    248207
    249208/*!
     
    259218QPalette QGtkStyle::standardPalette() const
    260219{
     220    Q_D(const QGtkStyle);
     221
    261222    QPalette palette = QCleanlooksStyle::standardPalette();
    262     if (QGtk::isThemeAvailable()) {
    263         GtkStyle *style = QGtk::gtkStyle();
    264         GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
    265         GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry"));
     223    if (d->isThemeAvailable()) {
     224        GtkStyle *style = d->gtkStyle();
     225        GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     226        GtkWidget *gtkEntry = d->getTextColorWidget();
    266227
    267228        GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg;
     
    293254
    294255        QColor alternateRowColor = palette.base().color().lighter(93); // ref gtkstyle.c draw_flat_box
    295         GtkWidget *gtkTreeView = QGtk::gtkWidget(QLS("GtkTreeView"));
     256        GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView"));
    296257        GdkColor *gtkAltBase = NULL;
    297         QGtk::gtk_widget_style_get(gtkTreeView, "odd-row-color", &gtkAltBase, NULL);
     258        d->gtk_widget_style_get(gtkTreeView, "odd-row-color", &gtkAltBase, NULL);
    298259        if (gtkAltBase) {
    299260            alternateRowColor = QColor(gtkAltBase->red>>8, gtkAltBase->green>>8, gtkAltBase->blue>>8);
    300             QGtk::gdk_color_free(gtkAltBase);
     261            d->gdk_color_free(gtkAltBase);
    301262        }
    302263        palette.setColor(QPalette::AlternateBase, alternateRowColor);
     
    318279        palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight);
    319280        palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highlightText);
    320         style = QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", Q_GTK_TYPE_WINDOW);
     281        style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow",
     282                d->gtk_window_get_type());
    321283        if (style) {
    322284            gdkText = style->fg[GTK_STATE_NORMAL];
     
    333295void QGtkStyle::polish(QPalette &palette)
    334296{
     297    Q_D(QGtkStyle);
     298
    335299    // QCleanlooksStyle will alter the palette, hence we do
    336300    // not want to polish the palette unless we are using it as
    337301    // the fallback
    338     if (!QGtk::isThemeAvailable())
     302    if (!d->isThemeAvailable())
    339303        QCleanlooksStyle::polish(palette);
    340304    else
     
    347311void QGtkStyle::polish(QApplication *app)
    348312{
     313    Q_D(QGtkStyle);
     314
    349315    QCleanlooksStyle::polish(app);
    350316    // Custom fonts and palettes with QtConfig are intentionally
    351317    // not supported as these should be entirely determined by
    352318    // current Gtk settings
    353     if (app->desktopSettingsAware() && QGtk::isThemeAvailable()) {
     319    if (app->desktopSettingsAware() && d->isThemeAvailable()) {
    354320        QApplicationPrivate::setSystemPalette(standardPalette());
    355         QApplicationPrivate::setSystemFont(QGtk::getThemeFont());
    356         QGtk::applyCustomPaletteHash();
    357         if (!QGtk::isKDE4Session()) {
    358             qt_filedialog_open_filename_hook = &QGtk::openFilename;
    359             qt_filedialog_save_filename_hook = &QGtk::saveFilename;
    360             qt_filedialog_open_filenames_hook = &QGtk::openFilenames;
    361             qt_filedialog_existing_directory_hook = &QGtk::openDirectory;
     321        QApplicationPrivate::setSystemFont(d->getThemeFont());
     322        d->applyCustomPaletteHash();
     323        if (!d->isKDE4Session()) {
     324            qt_filedialog_open_filename_hook = &QGtkStylePrivate::openFilename;
     325            qt_filedialog_save_filename_hook = &QGtkStylePrivate::saveFilename;
     326            qt_filedialog_open_filenames_hook = &QGtkStylePrivate::openFilenames;
     327            qt_filedialog_existing_directory_hook = &QGtkStylePrivate::openDirectory;
    362328        }
    363329    }
     
    369335void QGtkStyle::unpolish(QApplication *app)
    370336{
     337    Q_D(QGtkStyle);
     338
    371339    QCleanlooksStyle::unpolish(app);
    372340    QPixmapCache::clear();
    373341
    374     if (app->desktopSettingsAware() && QGtk::isThemeAvailable()
    375         && !QGtk::isKDE4Session()) {
     342    if (app->desktopSettingsAware() && d->isThemeAvailable()
     343        && !d->isKDE4Session()) {
    376344        qt_filedialog_open_filename_hook = 0;
    377345        qt_filedialog_save_filename_hook = 0;
     
    387355void QGtkStyle::polish(QWidget *widget)
    388356{
     357    Q_D(QGtkStyle);
     358
    389359    QCleanlooksStyle::polish(widget);
    390     if (!QGtk::isThemeAvailable())
     360    if (!d->isThemeAvailable())
    391361        return;
    392362    if (qobject_cast<QAbstractButton*>(widget)
     
    416386*/
    417387int QGtkStyle::pixelMetric(PixelMetric metric,
    418 
    419388                           const QStyleOption *option,
    420389                           const QWidget *widget) const
    421390{
    422     if (!QGtk::isThemeAvailable())
     391    Q_D(const QGtkStyle);
     392
     393    if (!d->isThemeAvailable())
    423394        return QCleanlooksStyle::pixelMetric(metric, option, widget);
    424395
     
    427398        if (qobject_cast<const QFrame*>(widget)) {
    428399            if (GtkStyle *style =
    429                 QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(),
     400                d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(),
    430401                                                "*.GtkScrolledWindow",
    431402                                                "*.GtkScrolledWindow",
    432                                                 Q_GTK_TYPE_WINDOW))
     403                                                d->gtk_window_get_type()))
    433404                return qMax(style->xthickness, style->ythickness);
    434405        }
     
    451422
    452423    case PM_ButtonShiftHorizontal: {
    453         GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
     424        GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
    454425        guint horizontal_shift;
    455         QGtk::gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL);
     426        d->gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL);
    456427        return horizontal_shift;
    457428    }
    458429
    459430    case PM_ButtonShiftVertical: {
    460         GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
     431        GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
    461432        guint vertical_shift;
    462         QGtk::gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL);
     433        d->gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL);
    463434        return vertical_shift;
    464435    }
     
    468439
    469440    case PM_MenuPanelWidth: {
    470         GtkWidget *gtkMenu = QGtk::gtkWidget(QLS("GtkMenu"));
     441        GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));
    471442        guint horizontal_padding = 0;
    472443        // horizontal-padding is used by Maemo to get thicker borders
    473         if (!QGtk::gtk_check_version(2, 10, 0))
    474             QGtk::gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL);
     444        if (!d->gtk_check_version(2, 10, 0))
     445            d->gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL);
    475446        int padding = qMax<int>(gtkMenu->style->xthickness, horizontal_padding);
    476447        return padding;
     
    479450    case PM_ButtonIconSize: {
    480451        int retVal = 24;
    481         GtkSettings *settings = QGtk::gtk_settings_get_default();
     452        GtkSettings *settings = d->gtk_settings_get_default();
    482453        gchararray icon_sizes;
    483454        g_object_get(settings, "gtk-icon-sizes", &icon_sizes, NULL);
     
    525496    case PM_SliderThickness:
    526497    case PM_SliderControlThickness: {
    527         GtkWidget *gtkScale = QGtk::gtkWidget(QLS("GtkHScale"));
     498        GtkWidget *gtkScale = d->gtkWidget(QLS("GtkHScale"));
    528499        gint val;
    529         QGtk::gtk_widget_style_get(gtkScale, "slider-width", &val, NULL);
     500        d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL);
    530501        if (metric == PM_SliderControlThickness)
    531502            return val + 2*gtkScale->style->ythickness;
     
    536507        gint sliderLength;
    537508        gint trough_border;
    538         GtkWidget *hScrollbar = QGtk::gtkWidget(QLS("GtkHScrollbar"));
    539         QGtk::gtk_widget_style_get(hScrollbar,
     509        GtkWidget *hScrollbar = d->gtkWidget(QLS("GtkHScrollbar"));
     510        d->gtk_widget_style_get(hScrollbar,
    540511                               "trough-border",   &trough_border,
    541512                               "slider-width",    &sliderLength,
     
    549520    case PM_SliderLength:
    550521        gint val;
    551         QGtk::gtk_widget_style_get(QGtk::gtkWidget(QLS("GtkHScale")), "slider-length", &val, NULL);
     522        d->gtk_widget_style_get(d->gtkWidget(QLS("GtkHScale")), "slider-length", &val, NULL);
    552523        return val;
    553524
     
    556527    case PM_IndicatorWidth:
    557528    case PM_IndicatorHeight: {
    558         GtkWidget *gtkCheckButton = QGtk::gtkWidget(QLS("GtkCheckButton"));
     529        GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
    559530        gint size, spacing;
    560         QGtk::gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL);
     531        d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL);
    561532        return size + 2 * spacing;
    562533    }
    563534
    564535    case PM_MenuBarVMargin: {
    565         GtkWidget *gtkMenubar = QGtk::gtkWidget(QLS("GtkMenuBar"));
     536        GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
    566537        return  qMax(0, gtkMenubar->style->ythickness);
    567538    }
     
    569540    {
    570541        gint spacing = 3;
    571         GtkWidget *gtkScrollWindow = QGtk::gtkWidget(QLS("GtkScrolledWindow"));
     542        GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow"));
    572543        Q_ASSERT(gtkScrollWindow);
    573         QGtk::gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL);
     544        d->gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL);
    574545        return spacing;
    575546    }
    576547    case PM_SubMenuOverlap: {
    577548        gint offset = 0;
    578         GtkWidget *gtkMenu = QGtk::gtkWidget(QLS("GtkMenu"));
    579         QGtk::gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL);
     549        GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));
     550        d->gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL);
    580551        return offset;
    581552    }
     
    592563                         QStyleHintReturn *returnData = 0) const
    593564{
    594     if (!QGtk::isThemeAvailable())
     565    Q_D(const QGtkStyle);
     566
     567    if (!d->isThemeAvailable())
    595568        return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
    596569
     
    600573        int ret = QDialogButtonBox::GnomeLayout;
    601574        gboolean alternateOrder = 0;
    602         GtkSettings *settings = QGtk::gtk_settings_get_default();
     575        GtkSettings *settings = d->gtk_settings_get_default();
    603576        g_object_get(settings, "gtk-alternative-button-order", &alternateOrder, NULL);
    604577
     
    611584    break;
    612585
     586    case SH_ToolButtonStyle:
     587    {
     588        if (d->isKDE4Session())
     589            return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
     590        GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar"));
     591        GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
     592        g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL);
     593        switch (toolbar_style) {
     594        case GTK_TOOLBAR_TEXT:
     595            return Qt::ToolButtonTextOnly;
     596        case GTK_TOOLBAR_BOTH:
     597            return Qt::ToolButtonTextUnderIcon;
     598        case GTK_TOOLBAR_BOTH_HORIZ:
     599            return Qt::ToolButtonTextBesideIcon;
     600        case GTK_TOOLBAR_ICONS:
     601        default:
     602            return Qt::ToolButtonIconOnly;
     603        }
     604    }
     605    break;
    613606    case SH_SpinControls_DisableOnBounds:
    614607        return int(true);
     
    618611
    619612    case SH_ComboBox_Popup: {
    620         GtkWidget *gtkComboBox = QGtk::gtkWidget(QLS("GtkComboBox"));
     613        GtkWidget *gtkComboBox = d->gtkWidget(QLS("GtkComboBox"));
    621614        gboolean appears_as_list;
    622         QGtk::gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL);
     615        d->gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL);
    623616        return appears_as_list ? 0 : 1;
    624617    }
     
    632625    case SH_Menu_SubMenuPopupDelay: {
    633626        gint delay = 225;
    634         GtkSettings *settings = QGtk::gtk_settings_get_default();
     627        GtkSettings *settings = d->gtk_settings_get_default();
    635628        g_object_get(settings, "gtk-menu-popup-delay", &delay, NULL);
    636629        return delay;
     
    641634        if (widget && widget->isWindow())
    642635            scrollbars_within_bevel = true;
    643         else if (!QGtk::gtk_check_version(2, 12, 0)) {
    644             GtkWidget *gtkScrollWindow = QGtk::gtkWidget(QLS("GtkScrolledWindow"));
    645             QGtk::gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
     636        else if (!d->gtk_check_version(2, 12, 0)) {
     637            GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow"));
     638            d->gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
    646639        }
    647640        return !scrollbars_within_bevel;
     641    }
     642
     643    case SH_DialogButtonBox_ButtonsHaveIcons: {
     644        static bool buttonsHaveIcons = d->getGConfBool(QLS("/desktop/gnome/interface/buttons_have_icons"));
     645        return buttonsHaveIcons;
     646    }
     647
     648    case SH_UnderlineShortcut: {
     649        gboolean underlineShortcut = true;
     650        if (!d->gtk_check_version(2, 12, 0)) {
     651            GtkSettings *settings = d->gtk_settings_get_default();
     652            g_object_get(settings, "gtk-enable-mnemonics", &underlineShortcut, NULL);
     653        }
     654        return underlineShortcut;
    648655    }
    649656
     
    657664*/
    658665void QGtkStyle::drawPrimitive(PrimitiveElement element,
    659 
    660666                              const QStyleOption *option,
    661667                              QPainter *painter,
    662668                              const QWidget *widget) const
    663669{
    664     if (!QGtk::isThemeAvailable()) {
     670    Q_D(const QGtkStyle);
     671
     672    if (!d->isThemeAvailable()) {
    665673        QCleanlooksStyle::drawPrimitive(element, option, painter, widget);
    666674        return;
    667675    }
    668676
    669     GtkStyle* style = QGtk::gtkStyle();
     677    GtkStyle* style = d->gtkStyle();
    670678    QGtkPainter gtkPainter(painter);
    671679
     
    675683            QStyleOption copy = *option;
    676684            copy.state |= State_Raised;
    677             drawPrimitive(PE_PanelMenu, &copy, painter, widget);
     685            proxy()->drawPrimitive(PE_PanelMenu, &copy, painter, widget);
    678686            break;
    679687        }
     
    682690        // thin rectangular images
    683691        const int pmSize = 64;
    684         const int border = pixelMetric(PM_DefaultFrameWidth, option, widget);
     692        const int border = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
    685693        const QString pmKey = QString(QLS("windowframe %0")).arg(option->state);
    686694
    687695        QPixmap pixmap;
    688         QPixmapCache::find(pmKey, pixmap);
    689696        QRect pmRect(QPoint(0,0), QSize(pmSize, pmSize));
    690697
    691698        // Only draw through style once
    692         if (pixmap.isNull()) {
     699        if (!QPixmapCache::find(pmKey, pixmap)) {
    693700            pixmap = QPixmap(pmSize, pmSize);
    694701            pixmap.fill(Qt::transparent);
     
    703710                shadow_type = GTK_SHADOW_OUT;
    704711
    705             GtkStyle *style = QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(),
    706                                      "*.GtkScrolledWindow", "*.GtkScrolledWindow", Q_GTK_TYPE_WINDOW);
     712            GtkStyle *style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(),
     713                                     "*.GtkScrolledWindow", "*.GtkScrolledWindow", d->gtk_window_get_type());
    707714            if (style)
    708                 gtkFramePainter.paintShadow(QGtk::gtkWidget(QLS("GtkFrame")), "viewport", pmRect,
     715                gtkFramePainter.paintShadow(d->gtkWidget(QLS("GtkFrame")), "viewport", pmRect,
    709716                                         option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
    710717                                         shadow_type, style);
     
    733740
    734741    case PE_PanelTipLabel: {
    735         GtkWidget *gtkWindow = QGtk::gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed
    736         style = QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", Q_GTK_TYPE_WINDOW);
     742        GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed
     743        style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow",
     744                d->gtk_window_get_type());
    737745        gtkPainter.paintFlatBox(gtkWindow, "tooltip", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, style);
    738746    }
     
    747755        }
    748756        GtkShadowType shadow_type;
    749         GtkWidget *gtkStatusbarFrame = QGtk::gtkWidget(QLS("GtkStatusbar.GtkFrame"));
    750         QGtk::gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL);
     757        GtkWidget *gtkStatusbarFrame = d->gtkWidget(QLS("GtkStatusbar.GtkFrame"));
     758        d->gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL);
    751759        gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL,
    752760                               shadow_type, gtkStatusbarFrame->style);
     
    756764    case PE_IndicatorHeaderArrow:
    757765        if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
    758             GtkWidget *gtkTreeHeader = QGtk::gtkWidget(QLS("GtkTreeView.GtkButton"));
     766            GtkWidget *gtkTreeHeader = d->gtkWidget(QLS("GtkTreeView.GtkButton"));
    759767            GtkStateType state = gtkPainter.gtkState(option);
    760768            style = gtkTreeHeader->style;
     
    789797        if (option->state & State_Children) {
    790798            QRect rect = option->rect;
    791             rect = QRect(0, 0, 10, 10);
     799            rect = QRect(0, 0, 12, 12);
    792800            rect.moveCenter(option->rect.center());
    793801            rect.translate(2, 0);
    794802            GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED;
    795803            GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED;
    796             GtkWidget *gtkExpander = QGtk::gtkWidget(QLS("GtkExpander"));
    797             guint expanderSize;
    798             QGtk::gtk_widget_style_get(gtkExpander, "expander-size", &expanderSize, NULL);
    799             // Note CleanIce will crash unless a GtkExpander is provided
    800             // but providing the expander will enforce the expander-size, which we
    801             // don't neccessarily have room for
     804            GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView"));
     805
    802806            GtkStateType state = GTK_STATE_NORMAL;
    803807            if (!(option->state & State_Enabled))
     
    805809            else if (option->state & State_MouseOver)
    806810                state = GTK_STATE_PRELIGHT;
    807             gtkPainter.paintExpander(expanderSize <= 10 ? gtkExpander : NULL, "expander", rect, state,
    808                                      option->state & State_Open ? openState : closedState , gtkExpander->style);
     811
     812            gtkPainter.paintExpander(gtkTreeView, "treeview", rect, state,
     813                                     option->state & State_Open ? openState : closedState , gtkTreeView->style);
    809814        }
    810815        break;
     
    833838        {
    834839            const int margin = 6;
    835             GtkWidget *gtkSeparator = QGtk::gtkWidget(QLS("GtkToolbar.GtkSeparatorToolItem"));
     840            GtkWidget *gtkSeparator = d->gtkWidget(QLS("GtkToolbar.GtkSeparatorToolItem"));
    836841            if (option->state & State_Horizontal) {
    837842                const int offset = option->rect.width()/2;
     
    853858
    854859    case PE_IndicatorToolBarHandle: {
    855         GtkWidget *gtkToolbar = QGtk::gtkWidget(QLS("GtkToolbar"));
     860        GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar"));
    856861        GtkShadowType shadow_type;
    857         QGtk::gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
     862        d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
    858863        //Note when the toolbar is horizontal, the handle is vertical
    859864        painter->setClipRect(option->rect);
     
    893898        int bsx = 0, bsy = 0;
    894899        if (option->state & State_Sunken) {
    895             bsx = pixelMetric(PM_ButtonShiftHorizontal);
    896             bsy = pixelMetric(PM_ButtonShiftVertical);
     900            bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
     901            bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
    897902        }
    898903        QRect arrowRect = option->rect.adjusted(border + bsx, border + bsy, -border + bsx, -border + bsy);
     
    901906
    902907        QColor arrowColor = option->palette.buttonText().color();
    903         GtkWidget *gtkArrow = QGtk::gtkWidget(QLS("GtkArrow"));
     908        GtkWidget *gtkArrow = d->gtkWidget(QLS("GtkArrow"));
    904909        GdkColor color = fromQColor(arrowColor);
    905         QGtk::gtk_widget_modify_fg (gtkArrow, state, &color);
     910        d->gtk_widget_modify_fg (gtkArrow, state, &color);
    906911        gtkPainter.paintArrow(gtkArrow, "button", arrowRect,
    907912                              type, state, shadow, FALSE, gtkArrow->style,
    908913                              QString::number(arrowColor.rgba(), 16));
    909914        // Passing NULL will revert the color change
    910         QGtk::gtk_widget_modify_fg (gtkArrow, state, NULL);
     915        d->gtk_widget_modify_fg (gtkArrow, state, NULL);
    911916    }
    912917    break;
     
    917922
    918923    case PE_PanelMenu: {
    919             GtkWidget *gtkMenu = QGtk::gtkWidget(QLS("GtkMenu"));
     924            GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));
    920925            gtkPainter.setAlphaSupport(false); // Note, alpha disabled for performance reasons
    921926            gtkPainter.paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkMenu->style, QString());
     
    929934        // This is only used by floating tool bars
    930935        if (qobject_cast<const QToolBar *>(widget)) {
    931             GtkWidget *gtkMenubar = QGtk::gtkWidget(QLS("GtkMenuBar"));
     936            GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
    932937            gtkPainter.paintBox( gtkMenubar, "toolbar",  option->rect,
    933938                                 GTK_STATE_NORMAL, GTK_SHADOW_OUT, style);
     
    938943
    939944    case PE_FrameLineEdit: {
    940         GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry"));
    941 
    942         if (option->state & State_HasFocus)
    943             GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
    944         else
    945             GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
     945        GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
     946
    946947
    947948        gboolean interior_focus;
    948949        gint focus_line_width;
    949950        QRect rect = option->rect;
    950         QGtk::gtk_widget_style_get(gtkEntry,
     951        d->gtk_widget_style_get(gtkEntry,
    951952                               "interior-focus", &interior_focus,
    952953                               "focus-line-width", &focus_line_width, NULL);
    953954
     955        // See https://bugzilla.mozilla.org/show_bug.cgi?id=405421 for info about this hack
     956        g_object_set_data(G_OBJECT(gtkEntry), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
     957
    954958        if (!interior_focus && option->state & State_HasFocus)
    955959            rect.adjust(focus_line_width, focus_line_width, -focus_line_width, -focus_line_width);
    956960
     961        if (option->state & State_HasFocus)
     962            GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
    957963        gtkPainter.paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ?
    958964                               GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
    959965                               GTK_SHADOW_IN, gtkEntry->style,
    960966                               option->state & State_HasFocus ? QLS("focus") : QString());
    961 
    962967        if (!interior_focus && option->state & State_HasFocus)
    963968            gtkPainter.paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ?
    964969                                   GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
    965970                                   GTK_SHADOW_IN, gtkEntry->style, QLS("GtkEntryShadowIn"));
     971
     972        if (option->state & State_HasFocus)
     973            GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
    966974    }
    967975    break;
     
    969977    case PE_PanelLineEdit:
    970978        if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
    971             GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry"));
     979            GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
    972980            if (panel->lineWidth > 0)
    973                 drawPrimitive(PE_FrameLineEdit, option, painter, widget);
     981                proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget);
    974982            uint resolve_mask = option->palette.resolve();
    975983            QRect textRect = option->rect.adjusted(gtkEntry->style->xthickness, gtkEntry->style->ythickness,
     
    978986            if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
    979987                resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
    980                 painter->fillRect(textRect, option->palette.base().color());
     988                painter->fillRect(textRect, option->palette.base());
    981989            else
    982990                gtkPainter.paintFlatBox( gtkEntry, "entry_bg", textRect,
     
    987995    case PE_FrameTabWidget:
    988996        if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast<const QStyleOptionTabWidgetFrame*>(option)) {
    989             GtkWidget *gtkNotebook = QGtk::gtkWidget(QLS("GtkNotebook"));
     997            GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook"));
    990998            style = gtkPainter.getStyle(gtkNotebook);
    991999            gtkPainter.setAlphaSupport(false);
    9921000            GtkShadowType shadow = GTK_SHADOW_OUT;
    9931001            GtkStateType state = GTK_STATE_NORMAL; // Only state supported by gtknotebook
    994             if (const QTabWidget *tabwidget = qobject_cast<const QTabWidget*>(widget)) {
    995                 // We should introduce QStyleOptionTabWidgetFrameV2 to obtain this information
    996                 // No gap if we do not show the actual tabs
    997                 QTabBar *tabBar = tabwidget->findChild<QTabBar*>();
    998                 if (tabwidget->count() > 0 && tabBar->isVisible()) {
    999                     QRect tabRect = tabBar->tabRect(tabBar->currentIndex());
    1000                     int begin = 0, size = 0;
    1001                     GtkPositionType frameType = GTK_POS_TOP;
    1002                     QTabBar::Shape shape = frame->shape;
    1003                     if (shape == QTabBar::RoundedNorth || shape == QTabBar::RoundedSouth) {
    1004                         begin = option->direction == Qt::LeftToRight ?
    1005                                 frame->leftCornerWidgetSize.width() + tabRect.left() :
    1006                                 frame->rect.width() - frame->tabBarSize.width() + tabRect.left()
    1007                                 - frame->rightCornerWidgetSize.width();
    1008                         size = tabRect.width();
    1009                         frameType = (shape == QTabBar::RoundedNorth) ? GTK_POS_TOP : GTK_POS_BOTTOM;
    1010                     } else {
    1011                         begin = frame->leftCornerWidgetSize.height() + tabRect.top();
    1012                         size = tabRect.height();
    1013                         frameType = (shape == QTabBar::RoundedWest) ? GTK_POS_LEFT : GTK_POS_RIGHT;
    1014                     }
    1015                     gtkPainter.paintBoxGap(gtkNotebook, "notebook",  option->rect, state, shadow, frameType,
    1016                                             begin, size, style);
    1017                     break; // done
     1002            bool reverse = (option->direction == Qt::RightToLeft);
     1003            QGtkStylePrivate::gtk_widget_set_direction(gtkNotebook, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
     1004            if (const QStyleOptionTabWidgetFrameV2 *tabframe = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2*>(option)) {
     1005                GtkPositionType frameType = GTK_POS_TOP;
     1006                QTabBar::Shape shape = frame->shape;
     1007                int gapStart = 0;
     1008                int gapSize = 0;
     1009                if (shape == QTabBar::RoundedNorth || shape == QTabBar::RoundedSouth) {
     1010                    frameType = (shape == QTabBar::RoundedNorth) ? GTK_POS_TOP : GTK_POS_BOTTOM;
     1011                    gapStart = tabframe->selectedTabRect.left();
     1012                    gapSize = tabframe->selectedTabRect.width();
     1013                } else {
     1014                    frameType = (shape == QTabBar::RoundedWest) ? GTK_POS_LEFT : GTK_POS_RIGHT;
     1015                    gapStart = tabframe->selectedTabRect.y();
     1016                    gapSize = tabframe->selectedTabRect.height();
    10181017                }
    1019             }
     1018                gtkPainter.paintBoxGap(gtkNotebook, "notebook",  option->rect, state, shadow, frameType,
     1019                                        gapStart, gapSize, style);
     1020                break; // done
     1021            }
     1022
    10201023            // Note this is only the fallback option
    10211024            gtkPainter.paintBox(gtkNotebook, "notebook",  option->rect, state, shadow, style);
     
    10231026        break;
    10241027
    1025     case PE_PanelButtonCommand: {
     1028    case PE_PanelButtonCommand:
     1029    case PE_PanelButtonTool: {
    10261030        bool isDefault = false;
     1031        bool isTool = (element == PE_PanelButtonTool);
    10271032        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton*>(option))
    10281033            isDefault = btn->features & QStyleOptionButton::DefaultButton;
     1034
     1035        // don't draw a frame for tool buttons that have the autoRaise flag and are not enabled or on
     1036        if (isTool && !(option->state & State_Enabled || option->state & State_On) && (option->state & State_AutoRaise))
     1037            break;
     1038        // don't draw a frame for dock widget buttons, unless we are hovering
     1039        if (widget && widget->inherits("QDockWidgetTitleButton") && !(option->state & State_MouseOver))
     1040            break;
    10291041
    10301042        GtkStateType state = gtkPainter.gtkState(option);
    10311043        if (option->state & State_On || option->state & State_Sunken)
    10321044            state = GTK_STATE_ACTIVE;
    1033         GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
     1045        GtkWidget *gtkButton = d->gtkWidget(isTool ? QLS("GtkToolButton.GtkButton") : QLS("GtkButton"));
    10341046        gint focusWidth, focusPad;
    10351047        gboolean interiorFocus = false;
    1036         QGtk::gtk_widget_style_get (gtkButton,
     1048        d->gtk_widget_style_get (gtkButton,
    10371049                                "focus-line-width", &focusWidth,
    10381050                                "focus-padding", &focusPad,
     
    10491061            gtkPainter.paintBox(gtkButton, "buttondefault", buttonRect, state, GTK_SHADOW_IN,
    10501062                                style, isDefault ? QLS("d") : QString());
    1051         } else
    1052             GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_DEFAULT);
     1063        }
    10531064
    10541065        bool hasFocus = option->state & State_HasFocus;
     
    10571068            key += QLS("def");
    10581069            GTK_WIDGET_SET_FLAGS(gtkButton, GTK_HAS_FOCUS);
    1059 
    1060         } else {
    1061             GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_FOCUS);
    10621070        }
    10631071
     
    10701078        gtkPainter.paintBox(gtkButton, "button", buttonRect, state, shadow,
    10711079                            style, key);
     1080        if (isDefault)
     1081            GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_DEFAULT);
     1082        if (hasFocus)
     1083            GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_FOCUS);
    10721084    }
    10731085    break;
     
    10871099            shadow = GTK_SHADOW_OUT;
    10881100
    1089         GtkWidget *gtkRadioButton = QGtk::gtkWidget(QLS("GtkRadioButton"));
     1101        GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton"));
    10901102        gint spacing;
    1091         QGtk::gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL);
     1103        d->gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL);
    10921104        QRect buttonRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing);
    10931105        gtkPainter.setClipRect(option->rect);
    10941106        // ### Note: Ubuntulooks breaks when the proper widget is passed
    10951107        //           Murrine engine requires a widget not to get RGBA check - warnings
    1096         GtkWidget *gtkCheckButton = QGtk::gtkWidget(QLS("GtkCheckButton"));
     1108        GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
    10971109        gtkPainter.paintOption(gtkCheckButton , buttonRect, state, shadow, gtkRadioButton->style, QLS("radiobutton"));
    10981110
     
    11161128        int spacing;
    11171129
    1118         GtkWidget *gtkCheckButton = QGtk::gtkWidget(QLS("GtkCheckButton"));
     1130        GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
    11191131
    11201132        // Some styles such as aero-clone assume they can paint in the spacing area
    11211133        gtkPainter.setClipRect(option->rect);
    11221134
    1123         QGtk::gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, NULL);
     1135        d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, NULL);
    11241136
    11251137        QRect checkRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing);
     
    11881200                                   QPainter *painter, const QWidget *widget) const
    11891201{
    1190     if (!QGtk::isThemeAvailable()) {
     1202    Q_D(const QGtkStyle);
     1203
     1204    if (!d->isThemeAvailable()) {
    11911205        QCleanlooksStyle::drawComplexControl(control, option, painter, widget);
    11921206        return;
    11931207    }
    11941208
    1195     GtkStyle* style = QGtk::gtkStyle();
     1209    GtkStyle* style = d->gtkStyle();
    11961210    QGtkPainter gtkPainter(painter);
    11971211    QColor button = option->palette.button().color();
     
    12421256
    12431257        if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
    1244             QRect textRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
    1245             QRect checkBoxRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget);
     1258            QRect textRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
     1259            QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget);
    12461260            // Draw title
    12471261
    12481262            if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
    12491263                // Draw prelight background
    1250                 GtkWidget *gtkCheckButton = QGtk::gtkWidget(QLS("GtkCheckButton"));
     1264                GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
    12511265
    12521266                if (option->state & State_MouseOver) {
     
    12581272                if (!groupBox->text.isEmpty()) {
    12591273                    int alignment = int(groupBox->textAlignment);
    1260                     if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget))
     1274                    if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget))
    12611275                        alignment |= Qt::TextHideMnemonic;
    12621276                    QColor textColor = groupBox->textColor; // Note: custom textColor is currently ignored
     
    12831297                box.QStyleOption::operator=(*groupBox);
    12841298                box.rect = checkBoxRect;
    1285                 drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
     1299                proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
    12861300            }
    12871301        }
     
    13061320            QColor buttonShadow = option->palette.dark().color();
    13071321            GtkStateType state = gtkPainter.gtkState(option);
    1308             int appears_as_list = !styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget);
     1322            int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget);
    13091323            QPixmap cache;
    13101324            QString pixmapName;
     
    13141328            bool reverse = (option->direction == Qt::RightToLeft);
    13151329            QRect rect = option->rect;
    1316             QRect arrowButtonRect = subControlRect(CC_ComboBox, &comboBoxCopy,
     1330            QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
    13171331                                                   SC_ComboBoxArrow, widget);
    1318             QRect editRect = subControlRect(CC_ComboBox, &comboBoxCopy,
     1332            QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
    13191333                                            SC_ComboBoxEditField, widget);
    13201334
     
    13241338
    13251339            // We use the gtk widget to position arrows and separators for us
    1326             GtkWidget *gtkCombo = QGtk::gtkWidget(comboBoxPath);
     1340            GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath);
    13271341            GtkAllocation geometry = {0, 0, option->rect.width(), option->rect.height()};
    1328             QGtk::gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
    1329             QGtk::gtk_widget_size_allocate(gtkCombo, &geometry);
     1342            d->gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
     1343            d->gtk_widget_size_allocate(gtkCombo, &geometry);
    13301344
    13311345            QString buttonPath = comboBoxPath + QLS(".GtkToggleButton");
    1332             GtkWidget *gtkToggleButton = QGtk::gtkWidget(buttonPath);
    1333             QGtk::gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
     1346            GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath);
     1347            d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
    13341348            if (gtkToggleButton && (appears_as_list || comboBox->editable)) {
     1349                if (focus)
     1350                    GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
    13351351                // Draw the combo box as a line edit with a button next to it
    13361352                if (comboBox->editable || appears_as_list) {
    13371353                    GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state;
    13381354                    QString entryPath = QLS(comboBox->editable ? "GtkComboBoxEntry.GtkEntry" : "GtkComboBox.GtkFrame");
    1339                     GtkWidget *gtkEntry = QGtk::gtkWidget(entryPath);
    1340                     QGtk::gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
     1355                    GtkWidget *gtkEntry = d->gtkWidget(entryPath);
     1356                    d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
    13411357                    QRect frameRect = option->rect;
    13421358
     
    13451361                    else
    13461362                        frameRect.setRight(arrowButtonRect.left());
    1347 
    1348                     // Required for inner blue highlight with clearlooks
    1349                     if (focus) {
    1350                         GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
    1351                         GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
    1352 
    1353                     } else {
    1354                         GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
    1355                         GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
    1356                     }
    13571363
    13581364                    // Fill the line edit background
     
    13621368                    int yt = gtkEntry->style->ythickness;
    13631369                    QRect contentRect = frameRect.adjusted(xt, yt, -xt, -yt);
     1370                    // Required for inner blue highlight with clearlooks
     1371                    if (focus)
     1372                        GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
     1373
    13641374                    if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
    13651375                        resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
     
    13681378                        gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect,
    13691379                                                option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
    1370                                                 GTK_SHADOW_NONE, style, entryPath + QString::number(focus));
     1380                                                GTK_SHADOW_NONE, gtkCombo->style, entryPath + QString::number(focus));
    13711381                    }
    13721382
     
    13751385                                           QString::number(focus) + QString::number(comboBox->editable) +
    13761386                                           QString::number(option->direction));
     1387                    if (focus)
     1388                        GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
    13771389                }
    13781390
     
    13931405                                     shadow, gtkToggleButton->style, buttonPath +
    13941406                                     QString::number(focus) + QString::number(option->direction));
    1395 
     1407                if (focus)
     1408                    GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
    13961409            } else {
    13971410                // Draw combo box as a button
    13981411                QRect buttonRect = option->rect;
    13991412
    1400                 if (focus) { // Clearlooks actually check the widget for the default state
     1413                if (focus) // Clearlooks actually check the widget for the default state
    14011414                    GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
    1402 
    1403                 } else {
    1404                     GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
    1405                 }
    1406 
    14071415                gtkCachedPainter.paintBox(gtkToggleButton, "button",
    14081416                                    buttonRect, state,
    14091417                                    shadow, gtkToggleButton->style,
    14101418                                    buttonPath + QString::number(focus));
     1419                if (focus)
     1420                    GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
     1421
    14111422                // Draw the separator between label and arrows
    14121423                QString vSeparatorPath = buttonPath + QLS(".GtkHBox.GtkVSeparator");
    14131424
    1414                 if (GtkWidget *gtkVSeparator = QGtk::gtkWidget(vSeparatorPath)) {
     1425                if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) {
    14151426                    QRect vLineRect(gtkVSeparator->allocation.x,
    14161427                                    gtkVSeparator->allocation.y,
     
    14241435
    14251436                    gint interiorFocus = true;
    1426                     QGtk::gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL);
     1437                    d->gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL);
    14271438                    int xt = interiorFocus ? gtkToggleButton->style->xthickness : 0;
    14281439                    int yt = interiorFocus ? gtkToggleButton->style->ythickness : 0;
    1429                     if ((focus && (option->state & State_KeyboardFocusChange)))
     1440                    if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget)))
    14301441                        gtkCachedPainter.paintFocus(gtkToggleButton, "button",
    14311442                                              option->rect.adjusted(xt, yt, -xt, -yt),
     
    14481459                                                    : ".GtkToggleButton.GtkHBox.GtkArrow");
    14491460
    1450                 GtkWidget *gtkArrow = QGtk::gtkWidget(arrowPath);
     1461                GtkWidget *gtkArrow = d->gtkWidget(arrowPath);
    14511462                gfloat scale = 0.7;
    14521463                gint minSize = 15;
    14531464                QRect arrowWidgetRect;
    14541465
    1455                 if (gtkArrow && !QGtk::gtk_check_version(2, 12, 0)) {
    1456                     QGtk::gtk_widget_style_get(gtkArrow, "arrow-scaling", &scale, NULL);
    1457                     QGtk::gtk_widget_style_get(gtkCombo, "arrow-size", &minSize, NULL);
     1466                if (gtkArrow && !d->gtk_check_version(2, 12, 0)) {
     1467                    d->gtk_widget_style_get(gtkArrow, "arrow-scaling", &scale, NULL);
     1468                    d->gtk_widget_style_get(gtkCombo, "arrow-size", &minSize, NULL);
    14581469                }
    14591470                if (gtkArrow) {
     
    14731484                if (sunken) {
    14741485                    int xoff, yoff;
    1475                     GtkWidget *gtkButton = QGtk::gtkWidget(comboBoxPath + QLS(".GtkToggleButton"));
    1476                     QGtk::gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL);
    1477                     QGtk::gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL);
     1486                    GtkWidget *gtkButton = d->gtkWidget(comboBoxPath + QLS(".GtkToggleButton"));
     1487                    d->gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL);
     1488                    d->gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL);
    14781489                    arrowRect = arrowRect.adjusted(xoff, yoff, xoff, yoff);
    14791490                }
     
    14981509                = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
    14991510            QRect button, menuarea;
    1500             button = subControlRect(control, toolbutton, SC_ToolButton, widget);
    1501             menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
     1511            button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget);
     1512            menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
    15021513            State bflags = toolbutton->state & ~(State_Sunken | State_MouseOver);
    15031514
     
    15281539                    tool.rect = button;
    15291540                    tool.state = bflags;
    1530                     drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
     1541                    proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
    15311542                }
    15321543            }
     
    15391550                QStyleOptionFocusRect fr;
    15401551                fr.QStyleOption::operator=(*toolbutton);
    1541                 fr.rect = subControlRect(CC_ToolButton, toolbutton, SC_ToolButton, widget);
     1552                fr.rect = proxy()->subControlRect(CC_ToolButton, toolbutton, SC_ToolButton, widget);
    15421553                fr.rect.adjust(1, 1, -1, -1);
    1543                 drawPrimitive(PE_FrameFocusRect, &fr, painter, widget);
     1554                proxy()->drawPrimitive(PE_FrameFocusRect, &fr, painter, widget);
    15441555            }
    15451556
    15461557            QStyleOptionToolButton label = *toolbutton;
    15471558            label.state = bflags;
    1548             GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
     1559            GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton"));
    15491560            QPalette pal = toolbutton->palette;
    15501561            if (option->state & State_Enabled &&
     
    15571568            label.rect = button.adjusted(style->xthickness, style->ythickness,
    15581569                                        -style->xthickness - popupArrowSize, -style->ythickness);
    1559             drawControl(CE_ToolButtonLabel, &label, painter, widget);
     1570            proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget);
    15601571
    15611572            if (toolbutton->subControls & SC_ToolButtonMenu) {
     
    15631574                tool.state = mflags;
    15641575                if ((mflags & State_Enabled && (mflags & (State_Sunken | State_Raised | State_MouseOver))) || !(mflags & State_AutoRaise))
    1565                     drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget);
    1566 
    1567                 drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
     1576                    proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget);
     1577
     1578                proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
    15681579
    15691580            } else if (drawMenuArrow) {
     
    15711582                QStyleOptionToolButton newBtn = *toolbutton;
    15721583                newBtn.rect = QRect(ir.right() - popupArrowSize - style->xthickness - 3, ir.height()/2 - 1, popupArrowSize, popupArrowSize);
    1573                 drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
     1584                proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
    15741585            }
    15751586        }
     
    15811592    case CC_ScrollBar:
    15821593        if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    1583             GtkWidget *gtkHScrollBar = QGtk::gtkWidget(QLS("GtkHScrollbar"));
    1584             GtkWidget *gtkVScrollBar = QGtk::gtkWidget(QLS("GtkVScrollbar"));
     1594            GtkWidget *gtkHScrollBar = d->gtkWidget(QLS("GtkHScrollbar"));
     1595            GtkWidget *gtkVScrollBar = d->gtkWidget(QLS("GtkVScrollbar"));
    15851596
    15861597            // Fill background in case the scrollbar is partially transparent
     
    15881599
    15891600            QRect rect = scrollBar->rect;
    1590             QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
    1591             QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
    1592             QRect scrollBarSlider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
    1593             QRect grooveRect = subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
     1601            QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
     1602            QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
     1603            QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
     1604            QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
    15941605            bool horizontal = scrollBar->orientation == Qt::Horizontal;
    15951606            GtkWidget * scrollbarWidget = horizontal ? gtkHScrollBar : gtkVScrollBar;
     
    15991610            gboolean stepper_size = 14;
    16001611            gint trough_border = 1;
    1601             if (!QGtk::gtk_check_version(2, 10, 0)) {
    1602                 QGtk::gtk_widget_style_get((GtkWidget*)(scrollbarWidget),
     1612            if (!d->gtk_check_version(2, 10, 0)) {
     1613                d->gtk_widget_style_get((GtkWidget*)(scrollbarWidget),
    16031614                                           "trough-border",   &trough_border,
    16041615                                           "trough-side-details",   &trough_side_details,
     
    16241635            else if (scrollBar->sliderPosition > scrollBar->minimum)
    16251636                fakePos = maximum - 1;
    1626             GtkObject *adjustment =  QGtk::gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0);
     1637            GtkObject *adjustment =  d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0);
    16271638
    16281639            if (horizontal)
    1629                 QGtk::gtk_range_set_adjustment((GtkRange*)(gtkHScrollBar), (GtkAdjustment*)(adjustment));
     1640                d->gtk_range_set_adjustment((GtkRange*)(gtkHScrollBar), (GtkAdjustment*)(adjustment));
    16301641            else
    1631                 QGtk::gtk_range_set_adjustment((GtkRange*)(gtkVScrollBar), (GtkAdjustment*)(adjustment));
     1642                d->gtk_range_set_adjustment((GtkRange*)(gtkVScrollBar), (GtkAdjustment*)(adjustment));
    16321643
    16331644            if (scrollBar->subControls & SC_ScrollBarGroove) {
     
    17261737    case CC_SpinBox:
    17271738        if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
    1728             GtkWidget *gtkSpinButton = QGtk::gtkWidget(QLS("GtkSpinButton"));
     1739            GtkWidget *gtkSpinButton = d->gtkWidget(QLS("GtkSpinButton"));
    17291740            bool isEnabled = (spinBox->state & State_Enabled);
    17301741            bool hover = isEnabled && (spinBox->state & State_MouseOver);
     
    17351746
    17361747            //### Move this to subControlRect
    1737             QRect upRect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
     1748            QRect upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
    17381749            upRect.setTop(option->rect.top());
    17391750
     
    17431754                upRect.setRight(option->rect.right());
    17441755
    1745             QRect editRect = subControlRect(CC_SpinBox, option, SC_SpinBoxEditField, widget);
    1746             QRect downRect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
     1756            QRect editRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxEditField, widget);
     1757            QRect downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
    17471758            downRect.setBottom(option->rect.bottom());
    17481759
     
    17741785                style = gtkPainter.getStyle(gtkSpinButton);
    17751786
    1776                 if (option->state & State_HasFocus)
     1787
     1788                QString key;
     1789
     1790                if (option->state & State_HasFocus) {
     1791                    key += QLatin1Char('f');
    17771792                    GTK_WIDGET_SET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
    1778                 else
    1779                     GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
    1780 
    1781                 QString key;
    1782 
    1783                 if (option->state & State_HasFocus)
    1784                     key = QLS("f");
     1793                }
    17851794
    17861795                uint resolve_mask = option->palette.resolve();
     
    18151824                else
    18161825                    gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key);
     1826
     1827                if (option->state & State_HasFocus)
     1828                    GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
    18171829            }
    18181830
     
    18401852
    18411853            } else {
    1842                 int size = spinboxArrowSize();
     1854                int size = d->getSpinboxArrowSize();
    18431855                int w = size / 2 - 1;
    18441856                w -= w % 2 - 1; // force odd
     
    18721884    case CC_Slider:
    18731885        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    1874             GtkWidget *hScaleWidget = QGtk::gtkWidget(QLS("GtkHScale"));
    1875             GtkWidget *vScaleWidget = QGtk::gtkWidget(QLS("GtkVScale"));
    1876 
    1877             QRect groove = subControlRect(CC_Slider, option, SC_SliderGroove, widget);
    1878             QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget);
    1879             QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
     1886            GtkWidget *hScaleWidget = d->gtkWidget(QLS("GtkHScale"));
     1887            GtkWidget *vScaleWidget = d->gtkWidget(QLS("GtkVScale"));
     1888
     1889            QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
     1890            QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
     1891            QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
    18801892
    18811893            bool horizontal = slider->orientation == Qt::Horizontal;
     
    18971909
    18981910            if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
    1899                 GtkObject *adjustment =  QGtk::gtk_adjustment_new(slider->sliderPosition,
     1911                GtkObject *adjustment =  d->gtk_adjustment_new(slider->sliderPosition,
    19001912                                         slider->minimum,
    19011913                                         slider->maximum,
     
    19041916                                         slider->pageStep);
    19051917                int outerSize;
    1906                 QGtk::gtk_range_set_adjustment ((GtkRange*)(scaleWidget), (GtkAdjustment*)(adjustment));
    1907                 QGtk::gtk_range_set_inverted((GtkRange*)(scaleWidget), !horizontal);
    1908                 QGtk::gtk_widget_style_get(scaleWidget, "trough-border", &outerSize, NULL);
     1918                d->gtk_range_set_adjustment ((GtkRange*)(scaleWidget), (GtkAdjustment*)(adjustment));
     1919                d->gtk_range_set_inverted((GtkRange*)(scaleWidget), !horizontal);
     1920                d->gtk_widget_style_get(scaleWidget, "trough-border", &outerSize, NULL);
    19091921                outerSize++;
    19101922
     
    19141926                                   -focusFrameMargin, -outerSize - focusFrameMargin);
    19151927
    1916                 gtkPainter.paintBox( scaleWidget, "trough", grooveRect, state,
    1917                                      GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition));
    1918 
    19191928                gboolean trough_side_details = false; // Indicates if the upper or lower scale background differs
    1920                 if (!QGtk::gtk_check_version(2, 10, 0))
    1921                     QGtk::gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details",   &trough_side_details, NULL);
    1922 
    1923                 if (trough_side_details && horizontal) { //### Vertical sliders look broken with this for some reason
     1929                if (!d->gtk_check_version(2, 10, 0))
     1930                    d->gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details",   &trough_side_details, NULL);
     1931
     1932                if (!trough_side_details) {
     1933                    gtkPainter.paintBox( scaleWidget, "trough", grooveRect, state,
     1934                                         GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition));
     1935                } else {
     1936                    QRect upperGroove = grooveRect;
    19241937                    QRect lowerGroove = grooveRect;
    1925                     lowerGroove.setRight(handle.center().x());
     1938
     1939                    if (horizontal) {
     1940                        upperGroove.setLeft(handle.center().x());
     1941                        lowerGroove.setRight(handle.center().x());
     1942                    } else {
     1943                        upperGroove.setBottom(handle.center().y());
     1944                        lowerGroove.setTop(handle.center().y());
     1945                    }
     1946
     1947                    gtkPainter.paintBox( scaleWidget, "trough-upper", upperGroove, state,
     1948                                         GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition));
    19261949                    gtkPainter.paintBox( scaleWidget, "trough-lower", lowerGroove, state,
    19271950                                         GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition));
    19281951                }
    1929 
    19301952            }
    19311953
    19321954            if (option->subControls & SC_SliderTickmarks) {
    19331955                painter->setPen(darkOutline);
    1934                 int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
    1935                 int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
     1956                int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
     1957                int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
    19361958                int interval = slider->tickInterval;
    19371959
     
    19501972
    19511973                int v = slider->minimum;
    1952                 int len = pixelMetric(PM_SliderLength, slider, widget);
     1974                int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
    19531975                while (v <= slider->maximum + 1) {
    19541976                    if (v == slider->maximum + 1 && interval == 1)
     
    20112033                        fropt.rect.setRight(handle.right() + 3);
    20122034                    }
    2013                     drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
     2035                    proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
    20142036                }
    20152037                gtkPainter.paintSlider( scaleWidget, horizontal ? "hscale" : "vscale", handle, state, shadow, style,
     
    20402062                            const QWidget *widget) const
    20412063{
    2042     if (!QGtk::isThemeAvailable()) {
     2064    Q_D(const QGtkStyle);
     2065
     2066    if (!d->isThemeAvailable()) {
    20432067        QCleanlooksStyle::drawControl(element, option, painter, widget);
    20442068        return;
    20452069    }
    20462070
    2047     GtkStyle* style = QGtk::gtkStyle();
     2071    GtkStyle* style = d->gtkStyle();
    20482072    QGtkPainter gtkPainter(painter);
    20492073
     
    20512075    case CE_ProgressBarLabel:
    20522076        if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
    2053             GtkWidget *gtkProgressBar = QGtk::gtkWidget(QLS("GtkProgressBar"));
     2077            GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar"));
    20542078            if (!gtkProgressBar)
    20552079                return;
     
    20702094            if (vertical)
    20712095                rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
    2072             const int progressIndicatorPos = static_cast<int>((bar->progress - qint64(bar->minimum)) /
    2073                                        qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * rect.width());
     2096            const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() /
     2097                                              qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
    20742098            if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
    20752099                leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height());
     
    21012125            if (option->state & State_Sunken)
    21022126                buttonShift = QPoint(pixelMetric(PM_ButtonShiftHorizontal, option, widget),
    2103                                      pixelMetric(PM_ButtonShiftVertical, option, widget));
    2104 
    2105             if (styleHint(SH_UnderlineShortcut, button, widget))
     2127                                     proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));
     2128
     2129            if (proxy()->styleHint(SH_UnderlineShortcut, button, widget))
    21062130                tf |= Qt::TextShowMnemonic;
    21072131            else
     
    21542178                ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
    21552179
    2156             GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
     2180            GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
    21572181            QPalette pal = button->palette;
    21582182            int labelState = GTK_STATE_INSENSITIVE;
     
    21642188            QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
    21652189            pal.setBrush(QPalette::ButtonText, textColor);
    2166             drawItemText(painter, ir, tf, pal, (button->state & State_Enabled),
     2190            proxy()->drawItemText(painter, ir, tf, pal, (button->state & State_Enabled),
    21672191                         button->text, QPalette::ButtonText);
    21682192        }
     
    21752199
    21762200            // Draw prelight background
    2177             GtkWidget *gtkRadioButton = QGtk::gtkWidget(QLS("GtkRadioButton"));
     2201            GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton"));
    21782202
    21792203            if (option->state & State_MouseOver) {
     
    21852209            subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
    21862210                                         : SE_CheckBoxIndicator, btn, widget);
    2187             drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
     2211            proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
    21882212                          &subopt, painter, widget);
    21892213            subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
     
    21992223            pal.setBrush(QPalette::WindowText, textColor);
    22002224            subopt.palette = pal;
    2201             drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
     2225            proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
    22022226
    22032227            if (btn->state & State_HasFocus) {
     
    22062230                fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
    22072231                                            : SE_CheckBoxFocusRect, btn, widget);
    2208                 drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
     2232                proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
    22092233            }
    22102234        }
     
    22152239    case CE_ComboBoxLabel:
    22162240        if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
    2217             QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
    2218             bool appearsAsList = !styleHint(QStyle::SH_ComboBox_Popup, cb, widget);
     2241            QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
     2242            bool appearsAsList = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, cb, widget);
    22192243            painter->save();
    22202244            painter->setClipRect(editRect);
     
    22342258                    painter->fillRect(iconRect, option->palette.brush(QPalette::Base));
    22352259
    2236                 drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
     2260                proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
    22372261
    22382262                if (cb->direction == Qt::RightToLeft)
     
    22432267
    22442268            if (!cb->currentText.isEmpty() && !cb->editable) {
    2245                 GtkWidget *gtkCombo = QGtk::gtkWidget(QLS("GtkComboBox"));
     2269                GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox"));
    22462270                QPalette pal = cb->palette;
    22472271                int labelState = GTK_STATE_INSENSITIVE;
     
    22562280                pal.setBrush(QPalette::ButtonText, textColor);
    22572281
    2258                 drawItemText(painter, editRect.adjusted(1, 0, -1, 0),
     2282                proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0),
    22592283                             visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter),
    22602284                             pal, cb->state & State_Enabled, cb->currentText, QPalette::ButtonText);
     
    23022326                    = painter->fontMetrics().elidedText(dwOpt->title,
    23032327                                            Qt::ElideRight, titleRect.width());
    2304                 drawItemText(painter,
     2328                proxy()->drawItemText(painter,
    23052329                             titleRect,
    23062330                             Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette,
     
    23202344        if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
    23212345            Q_UNUSED(header);
    2322             GtkWidget *gtkTreeView = QGtk::gtkWidget(QLS("GtkTreeView"));
     2346            GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView"));
    23232347            // Get the middle column
    2324             GtkTreeViewColumn *column = QGtk::gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1);
     2348            GtkTreeViewColumn *column = d->gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1);
    23252349            Q_ASSERT(column);
    23262350
     
    23412365
    23422366    case CE_SizeGrip: {
    2343         GtkWidget *gtkStatusbar = QGtk::gtkWidget(QLS("GtkStatusbar.GtkFrame"));
     2367        GtkWidget *gtkStatusbar = d->gtkWidget(QLS("GtkStatusbar.GtkFrame"));
    23442368        QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness);
    2345         gtkPainter.paintResizeGrip( gtkStatusbar, "window", gripRect, GTK_STATE_NORMAL,
     2369        gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL,
    23462370                                    GTK_SHADOW_OUT, QApplication::isRightToLeft() ?
    23472371                                        GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST,
     
    23532377
    23542378    case CE_MenuBarEmptyArea: {
    2355         GtkWidget *gtkMenubar = QGtk::gtkWidget(QLS("GtkMenuBar"));
     2379        GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
    23562380        GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency
    23572381        painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
     
    23632387            QGtkPainter gtkMenuBarPainter(&pmPainter);
    23642388            GtkShadowType shadow_type;
    2365             QGtk::gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
     2389            d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
    23662390            gtkMenuBarPainter.paintBox( gtkMenubar, "menubar",  menuBarRect,
    23672391                                        GTK_STATE_NORMAL, shadow_type, gtkMenubar->style);
     
    23762400
    23772401        if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
    2378             GtkWidget *gtkMenubarItem = QGtk::gtkWidget(QLS("GtkMenuBar.GtkMenuItem"));
    2379             GtkWidget *gtkMenubar = QGtk::gtkWidget(QLS("GtkMenuBar"));
     2402            GtkWidget *gtkMenubarItem = d->gtkWidget(QLS("GtkMenuBar.GtkMenuItem"));
     2403            GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
    23802404
    23812405            style = gtkMenubarItem->style;
     
    23922416                QGtkPainter menubarPainter(&pmPainter);
    23932417                GtkShadowType shadow_type;
    2394                 QGtk::gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
     2418                d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
    23952419                GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency
    23962420                painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
     
    24162440            if (act) {
    24172441                GtkShadowType shadowType = GTK_SHADOW_NONE;
    2418                 QGtk::gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL);
     2442                d->gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL);
    24192443                gtkPainter.paintBox(gtkMenubarItem, "menuitem",  option->rect.adjusted(0, 0, 0, 3),
    24202444                                    GTK_STATE_PRELIGHT, shadowType, gtkMenubarItem->style);
     
    24232447                uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
    24242448
    2425                 if (!QCleanlooksStyle::styleHint(SH_UnderlineShortcut, mbi, widget))
     2449                if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
    24262450                    alignment |= Qt::TextHideMnemonic;
    24272451
    2428                 drawItemText(painter, item.rect, alignment, item.palette, mbi->state & State_Enabled, mbi->text, textRole);
     2452                proxy()->drawItemText(painter, item.rect, alignment, item.palette, mbi->state & State_Enabled, mbi->text, textRole);
    24292453            }
    24302454        }
     
    24332457
    24342458    case CE_Splitter: {
    2435         GtkWidget *gtkWindow = QGtk::gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed
     2459        GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed
    24362460        gtkPainter.paintHandle(gtkWindow, "splitter", option->rect, gtkPainter.gtkState(option), GTK_SHADOW_NONE,
    24372461                                !(option->state & State_Horizontal) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL,
     
    24532477                rect.adjust(0, 0, 1, 0);
    24542478
    2455             GtkWidget *gtkToolbar = QGtk::gtkWidget(QLS("GtkToolbar"));
     2479            GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar"));
    24562480            GtkShadowType shadow_type = GTK_SHADOW_NONE;
    2457             QGtk::gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
     2481            d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
    24582482            gtkPainter.paintBox( gtkToolbar, "toolbar",  rect,
    24592483                                 GTK_STATE_NORMAL, shadow_type, gtkToolbar->style);
     
    24722496            const int windowsItemVMargin      = 26; // menu item ver text margin
    24732497            const int windowsRightBorder      = 15; // right border on windows
    2474             GtkWidget *gtkMenu = QGtk::gtkWidget(QLS("GtkMenu"));
    2475             GtkWidget *gtkMenuItem = menuItem->checked ? QGtk::gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")) :
    2476                                      QGtk::gtkWidget(QLS("GtkMenu.GtkMenuItem"));
     2498            GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));
     2499            GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")) :
     2500                                     d->gtkWidget(QLS("GtkMenu.GtkMenuItem"));
    24772501
    24782502            style = gtkPainter.getStyle(gtkMenuItem);
     
    24812505
    24822506            if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
    2483                 GtkWidget *gtkMenuSeparator = QGtk::gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem"));
     2507                GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem"));
    24842508                painter->setPen(shadow.lighter(106));
    24852509                gboolean wide_separators = 0;
    24862510                gint     separator_height = 0;
    24872511                guint    horizontal_padding = 3;
    2488                 if (!QGtk::gtk_check_version(2, 10, 0)) {
    2489                     QGtk::gtk_widget_style_get(gtkMenuSeparator,
     2512                if (!d->gtk_check_version(2, 10, 0)) {
     2513                    d->gtk_widget_style_get(gtkMenuSeparator,
    24902514                                           "wide-separators",    &wide_separators,
    24912515                                           "separator-height",   &separator_height,
     
    25072531
    25082532            if (selected) {
    2509                 QRect rect = option->rect.adjusted(0, 0, -1, -1);
     2533                QRect rect = option->rect.adjusted(0, 0, 0, -1);
    25102534#ifndef QT_NO_COMBOBOX
    25112535                if (qobject_cast<const QComboBox*>(widget))
     
    25212545
    25222546            gint checkSize;
    2523             QGtk::gtk_widget_style_get(QGtk::gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL);
     2547            d->gtk_widget_style_get(d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL);
    25242548
    25252549            int checkcol = qMax(menuItem->maxIconWidth, qMax(20, checkSize));
     
    25982622
    25992623                QPixmap pixmap;
    2600                 int smallIconSize = pixelMetric(PM_SmallIconSize, option, widget);
     2624                int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget);
    26012625                QSize iconSize(smallIconSize, smallIconSize);
    26022626
     
    26142638                int pixh = pixmap.height();
    26152639                QRect pmr(0, 0, pixw, pixh);
    2616                 pmr.moveCenter(vCheckRect.center());
     2640                pmr.moveCenter(vCheckRect.center() - QPoint(0, 1));
    26172641                painter->setPen(menuItem->palette.text().color());
    26182642                if (!ignoreCheckMark && checkable && checked) {
     
    26262650                    opt.state |= State_Sunken;
    26272651                    opt.rect = vCheckRect;
    2628                     drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
     2652                    proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
    26292653                }
    26302654                painter->drawPixmap(pmr.topLeft(), pixmap);
     
    26562680            int tab = menuitem->tabWidth;
    26572681            int xm = windowsItemFrame + checkcol + windowsItemHMargin;
    2658             int xpos = menuitem->rect.x() + xm;
    2659             QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
     2682            int xpos = menuitem->rect.x() + xm + 1;
     2683            QRect textRect(xpos, y + windowsItemVMargin - 1, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
    26602684            QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
    26612685            QString s = menuitem->text;
     
    26662690                int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
    26672691
    2668                 if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
     2692                if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
    26692693                    text_flags |= Qt::TextHideMnemonic;
    26702694
     
    26992723            if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
    27002724                QPoint buttonShift(pixelMetric(PM_ButtonShiftHorizontal, option, widget),
    2701                                    pixelMetric(PM_ButtonShiftVertical, option, widget));
     2725                                   proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));
    27022726
    27032727                QFontMetrics fm(menuitem->font);
    27042728                int arrow_size = fm.ascent() + fm.descent() - 2 * gtkMenuItem->style->ythickness;
    27052729                gfloat arrow_scaling = 0.8;
    2706 
    2707                 // "arrow-scaling" is actually hardcoded and fails on hardy (see gtk+-2.12/gtkmenuitem.c)
    2708                 // though the current documentation states otherwise
     2730                int extra = 0;
     2731                if (!d->gtk_check_version(2, 16, 0)) {
     2732                    // "arrow-scaling" is actually hardcoded and fails on hardy (see gtk+-2.12/gtkmenuitem.c)
     2733                    // though the current documentation states otherwise
     2734                    d->gtk_widget_style_get(gtkMenuItem, "arrow-scaling", &arrow_scaling, NULL);
     2735                    // in versions < 2.16 ythickness was previously subtracted from the arrow_size
     2736                    extra = 2 * gtkMenuItem->style->ythickness;
     2737                }
     2738
    27092739                int horizontal_padding;
    2710                 QGtk::gtk_widget_style_get(gtkMenuItem, "horizontal-padding", &horizontal_padding, NULL);
    2711 
    2712                 const int dim = static_cast<int>(arrow_size * arrow_scaling);
     2740                d->gtk_widget_style_get(gtkMenuItem, "horizontal-padding", &horizontal_padding, NULL);
     2741
     2742                const int dim = static_cast<int>(arrow_size * arrow_scaling) + extra;
    27132743                int xpos = menuItem->rect.left() + menuItem->rect.width() - horizontal_padding - dim;
    27142744                QRect  vSubMenuRect = visualRect(option->direction, menuItem->rect,
     
    27262756    case CE_PushButton:
    27272757        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
    2728             GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
    2729             drawControl(CE_PushButtonBevel, btn, painter, widget);
     2758            GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     2759            proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget);
    27302760            QStyleOptionButton subopt = *btn;
    27312761            subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
    27322762            gint interiorFocus = true;
    2733             QGtk::gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL);
     2763            d->gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL);
    27342764            int xt = interiorFocus ? gtkButton->style->xthickness : 0;
    27352765            int yt = interiorFocus ? gtkButton->style->ythickness : 0;
     
    27372767            if (btn->features & QStyleOptionButton::Flat && btn->state & State_HasFocus)
    27382768                // The normal button focus rect does not work well for flat buttons in Clearlooks
    2739                 drawPrimitive(PE_FrameFocusRect, option, painter, widget);
     2769                proxy()->drawPrimitive(PE_FrameFocusRect, option, painter, widget);
    27402770            else if (btn->state & State_HasFocus)
    27412771                gtkPainter.paintFocus(gtkButton, "button",
     
    27442774                                      gtkButton->style);
    27452775
    2746             drawControl(CE_PushButtonLabel, &subopt, painter, widget);
     2776            proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget);
    27472777        }
    27482778        break;
     
    27522782    case CE_TabBarTabShape:
    27532783        if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
    2754             GtkWidget *gtkNotebook = QGtk::gtkWidget(QLS("GtkNotebook"));
     2784            GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook"));
    27552785            style = gtkPainter.getStyle(gtkNotebook);
    27562786
     
    27612791                state = GTK_STATE_NORMAL;
    27622792
    2763             bool first = tab->position == QStyleOptionTab::Beginning || tab->position == QStyleOptionTab::OnlyOneTab;
    2764             bool last = tab->position == QStyleOptionTab::End || tab->position == QStyleOptionTab::OnlyOneTab;
    27652793            bool selected = (tab->state & State_Selected);
    2766             if (option->direction == Qt::RightToLeft) {
     2794            bool first = false, last = false;
     2795            if (widget) {
     2796                // This is most accurate and avoids resizing tabs while moving
     2797                first = tab->rect.left() == widget->rect().left();
     2798                last = tab->rect.right() == widget->rect().right();
     2799            } else if (option->direction == Qt::RightToLeft) {
    27672800                bool tmp = first;
    27682801                first = last;
     
    28162849        if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
    28172850            Q_UNUSED(bar);
    2818             GtkWidget *gtkProgressBar = QGtk::gtkWidget(QLS("GtkProgressBar"));
     2851            GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar"));
    28192852            GtkStateType state = gtkPainter.gtkState(option);
    28202853            gtkPainter.paintBox( gtkProgressBar, "trough",  option->rect, state, GTK_SHADOW_IN, gtkProgressBar->style);
     
    28262859        if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
    28272860            GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
    2828             GtkWidget *gtkProgressBar = QGtk::gtkWidget(QLS("GtkProgressBar"));
     2861            GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar"));
    28292862            style = gtkProgressBar->style;
    28302863            gtkPainter.paintBox( gtkProgressBar, "trough",  option->rect, state, GTK_SHADOW_IN, style);
     
    28482881                rect.translate(xt, -yt * 2);
    28492882                rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // Flip width and height
    2850                 QTransform m;
    2851                 m.translate(rect.height(), 0);
     2883                QTransform m = QTransform::fromTranslate(rect.height(), 0);
    28522884                m.rotate(90.0);
    28532885                painter->setTransform(m);
     
    28752907                fakePos = maximum - 1;
    28762908
    2877             GtkObject *adjustment =  QGtk::gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0);
    2878             QGtk::gtk_progress_set_adjustment((GtkProgress*)(gtkProgressBar), (GtkAdjustment*)(adjustment));
     2909            GtkObject *adjustment =  d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0);
     2910            d->gtk_progress_set_adjustment((GtkProgress*)(gtkProgressBar), (GtkAdjustment*)(adjustment));
    28792911
    28802912            QRect progressBar;
     
    29162948                                SubControl subControl, const QWidget *widget) const
    29172949{
     2950    Q_D(const QGtkStyle);
     2951
    29182952    QRect rect = QWindowsStyle::subControlRect(control, option, subControl, widget);
    2919     if (!QGtk::isThemeAvailable())
     2953    if (!d->isThemeAvailable())
    29202954        return QCleanlooksStyle::subControlRect(control, option, subControl, widget);
    29212955
     
    29592993                QFontMetrics fontMetrics(font);
    29602994                QSize textRect = fontMetrics.boundingRect(groupBoxWidget->title()).size() + QSize(4, 4);
    2961                 int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget);
    2962                 int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget);
     2995                int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
     2996                int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
    29632997
    29642998                if (subControl == SC_GroupBoxCheckBox) {
     
    29833017    case CC_SpinBox:
    29843018        if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
    2985             GtkWidget *gtkSpinButton = QGtk::gtkWidget(QLS("GtkSpinButton"));
     3019            GtkWidget *gtkSpinButton = d->gtkWidget(QLS("GtkSpinButton"));
    29863020            int center = spinbox->rect.height() / 2;
    29873021            int xt = spinbox->frame ? gtkSpinButton->style->xthickness : 0;
     
    29913025            QSize bs;
    29923026            bs.setHeight(qMax(8, spinbox->rect.height()/2 - y));
    2993             bs.setWidth(spinboxArrowSize());
     3027            bs.setWidth(d->getSpinboxArrowSize());
    29943028            int x, lx, rx;
    29953029            x = spinbox->rect.width() - y - bs.width() + 2;
     
    30373071            // We employ the gtk widget to position arrows and separators for us
    30383072            QString comboBoxPath = box->editable ? QLS("GtkComboBoxEntry") : QLS("GtkComboBox");
    3039             GtkWidget *gtkCombo = QGtk::gtkWidget(comboBoxPath);
    3040             QGtk::gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
     3073            GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath);
     3074            d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
    30413075            GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())};
    3042             QGtk::gtk_widget_size_allocate(gtkCombo, &geometry);
    3043             int appears_as_list = !styleHint(QStyle::SH_ComboBox_Popup, option, widget);
     3076            d->gtk_widget_size_allocate(gtkCombo, &geometry);
     3077            int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget);
    30443078            QString arrowPath = comboBoxPath + QLS(".GtkToggleButton");
    30453079
     
    30473081                arrowPath += QLS(".GtkHBox.GtkArrow");
    30483082
    3049             GtkWidget *arrowWidget = QGtk::gtkWidget(arrowPath);
     3083            GtkWidget *arrowWidget = d->gtkWidget(arrowPath);
    30503084            if (!arrowWidget)
    30513085                return QCleanlooksStyle::subControlRect(control, option, subControl, widget);
    30523086
    3053             QRect buttonRect(arrowWidget->allocation.x, arrowWidget->allocation.y,
     3087            QRect buttonRect(option->rect.left() + arrowWidget->allocation.x,
     3088                             option->rect.top() + arrowWidget->allocation.y,
    30543089                             arrowWidget->allocation.width, arrowWidget->allocation.height);
    30553090
     
    30583093            case SC_ComboBoxArrow: // Note: this indicates the arrowbutton for editable combos
    30593094                rect = buttonRect;
    3060 
    30613095                break;
    30623096
     
    30923126*/
    30933127QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
    3094 
    30953128                                  const QSize &size, const QWidget *widget) const
    30963129{
     3130    Q_D(const QGtkStyle);
    30973131
    30983132    QSize newSize = QCleanlooksStyle::sizeFromContents(type, option, size, widget);
    3099     if (!QGtk::isThemeAvailable())
     3133    if (!d->isThemeAvailable())
    31003134        return newSize;
    31013135
     
    31043138    case CT_ToolButton:
    31053139        if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
    3106             GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
    3107             newSize = size + QSize(2 * gtkButton->style->xthickness, 1 + 2 * gtkButton->style->ythickness);
     3140            GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton"));
     3141            newSize = size + QSize(2 * gtkButton->style->xthickness, 2 + 2 * gtkButton->style->ythickness);
    31083142            if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
    31093143                QSize minSize(0, 25);
     
    31123146                newSize = newSize.expandedTo(minSize);
    31133147            }
    3114            
     3148
    31153149            if (toolbutton->features & QStyleOptionToolButton::HasMenu)
    31163150                newSize += QSize(6, 0);
     
    31233157
    31243158            if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
    3125                 GtkWidget *gtkMenuSeparator = QGtk::gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem"));
     3159                GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem"));
    31263160                gboolean wide_separators;
    31273161                gint     separator_height;
    3128                 QGtk::gtk_widget_style_get(gtkMenuSeparator,
     3162                d->gtk_widget_style_get(gtkMenuSeparator,
    31293163                                       "wide-separators",    &wide_separators,
    31303164                                       "separator-height",   &separator_height,
     
    31353169            }
    31363170
    3137             GtkWidget *gtkMenuItem = QGtk::gtkWidget(QLS("GtkMenu.GtkMenuItem"));
     3171            GtkWidget *gtkMenuItem = d->gtkWidget(QLS("GtkMenu.GtkMenuItem"));
    31383172            GtkStyle* style = gtkMenuItem->style;
    3139             newSize += QSize(textMargin + style->xthickness - 2, style->ythickness - 4);
     3173            newSize += QSize(textMargin + style->xthickness - 1, style->ythickness - 3);
    31403174
    31413175            // Cleanlooks assumes a check column of 20 pixels so we need to
    31423176            // expand it a bit
    31433177            gint checkSize;
    3144             QGtk::gtk_widget_style_get(QGtk::gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL);
     3178            d->gtk_widget_style_get(d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL);
    31453179            newSize.setHeight(qMax(newSize.height(), checkSize + 2));
    31463180            newSize.setWidth(newSize.width() + qMax(0, checkSize - 20));
     
    31573191    case CT_SpinBox:
    31583192        // QSpinBox does some nasty things that depends on CT_LineEdit
    3159         newSize = size + QSize(0, -QGtk::gtkWidget(QLS("GtkSpinButton"))->style->ythickness * 2 + 2);
     3193        newSize = size + QSize(0, -d->gtkWidget(QLS("GtkSpinButton"))->style->ythickness * 2);
    31603194        break;
    31613195
    31623196    case CT_PushButton:
    31633197        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
    3164             GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
     3198            GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
    31653199            gint focusPadding, focusWidth;
    3166             QGtk::gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL);
    3167             QGtk::gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL);
     3200            d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL);
     3201            d->gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL);
    31683202            newSize = size;
    31693203            newSize += QSize(2*gtkButton->style->xthickness + 4, 2*gtkButton->style->ythickness);
    31703204            newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding));
    31713205
    3172             GtkWidget *gtkButtonBox = QGtk::gtkWidget(QLS("GtkHButtonBox"));
     3206            GtkWidget *gtkButtonBox = d->gtkWidget(QLS("GtkHButtonBox"));
    31733207            gint minWidth = 85, minHeight = 0;
    3174             QGtk::gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth,
     3208            d->gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth,
    31753209                                   "child-min-height", &minHeight, NULL);
    31763210            if (!btn->text.isEmpty() && newSize.width() < minWidth)
     
    31833217
    31843218    case CT_Slider: {
    3185         GtkWidget *gtkSlider = QGtk::gtkWidget(QLS("GtkHScale"));
     3219        GtkWidget *gtkSlider = d->gtkWidget(QLS("GtkHScale"));
    31863220        newSize = size + QSize(2*gtkSlider->style->xthickness, 2*gtkSlider->style->ythickness);
    31873221    }
    31883222    break;
    31893223
    3190     case CT_MenuBarItem://cleanlooks adds 2 pixels
    3191         newSize = QWindowsStyle::sizeFromContents(type, option, size, widget) + QSize(0, 1);
    3192         break;
    3193 
    31943224    case CT_LineEdit: {
    3195         GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry"));
    3196         newSize = size + QSize(2*gtkEntry->style->xthickness, 2*gtkEntry->style->ythickness);
     3225        GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
     3226        newSize = size + QSize(2*gtkEntry->style->xthickness, 2 + 2*gtkEntry->style->ythickness);
    31973227    }
    31983228    break;
     
    32043234    case CT_ComboBox:
    32053235        if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
    3206             GtkWidget *gtkCombo = QGtk::gtkWidget(QLS("GtkComboBox"));
    3207             QRect arrowButtonRect = subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget);
     3236            GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox"));
     3237            QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget);
    32083238            newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness);
    32093239
    32103240            if (!(widget && qobject_cast<QToolBar *>(widget->parentWidget())))
    3211                 newSize += QSize(0, 3);
     3241                newSize += QSize(0, 2);
    32123242        }
    32133243        break;
     
    32223252                newSize += QSize(6, 0);
    32233253        }
    3224         newSize += QSize(1, 0);
     3254        newSize += QSize(1, 1);
    32253255        break;
    32263256
     
    32313261    return newSize;
    32323262}
     3263
    32333264
    32343265/*! \reimp */
     
    32363267                                  const QWidget *widget) const
    32373268{
    3238     if (!QGtk::isThemeAvailable())
     3269    Q_D(const QGtkStyle);
     3270
     3271    if (!d->isThemeAvailable())
    32393272        return QCleanlooksStyle::standardPixmap(sp, option, widget);
    32403273
     
    32643297    break;
    32653298
    3266     case SP_DialogDiscardButton: {
     3299    case SP_DialogDiscardButton:
    32673300        return QGtkPainter::getIcon(GTK_STOCK_DELETE);
    3268     }
    3269 
    3270     case SP_DialogOkButton: {
     3301    case SP_DialogOkButton:
    32713302        return QGtkPainter::getIcon(GTK_STOCK_OK);
    3272     }
    3273 
    3274     case SP_DialogCancelButton: {
     3303    case SP_DialogCancelButton:
    32753304        return QGtkPainter::getIcon(GTK_STOCK_CANCEL);
    3276     }
    3277 
    3278     case SP_DialogYesButton: {
     3305    case SP_DialogYesButton:
    32793306        return QGtkPainter::getIcon(GTK_STOCK_YES);
    3280     }
    3281 
    3282     case SP_DialogNoButton: {
     3307    case SP_DialogNoButton:
    32833308        return QGtkPainter::getIcon(GTK_STOCK_NO);
    3284     }
    3285 
    3286     case SP_DialogOpenButton: {
     3309    case SP_DialogOpenButton:
    32873310        return QGtkPainter::getIcon(GTK_STOCK_OPEN);
    3288     }
    3289 
    3290     case SP_DialogCloseButton: {
     3311    case SP_DialogCloseButton:
    32913312        return QGtkPainter::getIcon(GTK_STOCK_CLOSE);
    3292     }
    3293 
    3294     case SP_DialogApplyButton: {
     3313    case SP_DialogApplyButton:
    32953314        return QGtkPainter::getIcon(GTK_STOCK_APPLY);
    3296     }
    3297 
    3298     case SP_DialogSaveButton: {
     3315    case SP_DialogSaveButton:
    32993316        return QGtkPainter::getIcon(GTK_STOCK_SAVE);
    3300     }
    3301 
    3302     case SP_MessageBoxWarning: {
     3317    case SP_MessageBoxWarning:
    33033318        return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
    3304     }
    3305 
    3306     case SP_MessageBoxQuestion: {
     3319    case SP_MessageBoxQuestion:
    33073320        return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
    3308     }
    3309 
    3310     case SP_MessageBoxInformation: {
     3321    case SP_MessageBoxInformation:
    33113322        return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
    3312     }
    3313 
    3314     case SP_MessageBoxCritical: {
     3323    case SP_MessageBoxCritical:
    33153324        return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
    3316     }
    3317 
    33183325    default:
    33193326        return QCleanlooksStyle::standardPixmap(sp, option, widget);
    33203327    }
    3321 
    3322     return QPixmap();
     3328    return pixmap;
    33233329}
     3330
     3331/*!
     3332    \internal
     3333*/
     3334QIcon QGtkStyle::standardIconImplementation(StandardPixmap standardIcon,
     3335                                                  const QStyleOption *option,
     3336                                                  const QWidget *widget) const
     3337{
     3338    Q_D(const QGtkStyle);
     3339
     3340    if (!d->isThemeAvailable())
     3341        return QCleanlooksStyle::standardIconImplementation(standardIcon, option, widget);
     3342    switch (standardIcon) {
     3343    case SP_DialogDiscardButton:
     3344        return QGtkPainter::getIcon(GTK_STOCK_DELETE);
     3345    case SP_DialogOkButton:
     3346        return QGtkPainter::getIcon(GTK_STOCK_OK);
     3347    case SP_DialogCancelButton:
     3348        return QGtkPainter::getIcon(GTK_STOCK_CANCEL);
     3349    case SP_DialogYesButton:
     3350        return QGtkPainter::getIcon(GTK_STOCK_YES);
     3351    case SP_DialogNoButton:
     3352        return QGtkPainter::getIcon(GTK_STOCK_NO);
     3353    case SP_DialogOpenButton:
     3354        return QGtkPainter::getIcon(GTK_STOCK_OPEN);
     3355    case SP_DialogCloseButton:
     3356        return QGtkPainter::getIcon(GTK_STOCK_CLOSE);
     3357    case SP_DialogApplyButton:
     3358        return QGtkPainter::getIcon(GTK_STOCK_APPLY);
     3359    case SP_DialogSaveButton:
     3360        return QGtkPainter::getIcon(GTK_STOCK_SAVE);
     3361    case SP_MessageBoxWarning:
     3362        return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
     3363    case SP_MessageBoxQuestion:
     3364        return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
     3365    case SP_MessageBoxInformation:
     3366        return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
     3367    case SP_MessageBoxCritical:
     3368        return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
     3369    default:
     3370        return QCleanlooksStyle::standardIconImplementation(standardIcon, option, widget);
     3371    }
     3372}
     3373
    33243374
    33253375/*! \reimp */
    33263376QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
    33273377{
     3378    Q_D(const QGtkStyle);
     3379
    33283380    QRect r = QCleanlooksStyle::subElementRect(element, option, widget);
    33293381    switch (element) {
     
    33323384    case SE_ProgressBarGroove:
    33333385        return option->rect;
     3386    case SE_PushButtonContents:
     3387        if (!d->gtk_check_version(2, 10, 0)) {
     3388            GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
     3389            GtkBorder *border = 0;
     3390            d->gtk_widget_style_get(gtkButton, "inner-border", &border, NULL);
     3391            if (border) {
     3392                r = option->rect.adjusted(border->left, border->top, -border->right, -border->bottom);
     3393                d->gtk_border_free(border);
     3394            } else {
     3395                r = option->rect.adjusted(1, 1, -1, -1);
     3396            }
     3397            r = visualRect(option->direction, option->rect, r);
     3398        }
     3399        break;
    33343400    default:
    33353401        break;
  • trunk/src/gui/styles/qgtkstyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4646#include <QtGui/QPalette>
    4747#include <QtGui/QFont>
     48#include <QtGui/QFileDialog>
    4849
    4950QT_BEGIN_HEADER
     
    6566public:
    6667    QGtkStyle();
     68    QGtkStyle(QGtkStylePrivate &dd);
     69
    6770    ~QGtkStyle();
    6871
     
    107110    void unpolish(QWidget *widget);
    108111    void unpolish(QApplication *app);
     112
     113    static bool getGConfBool(const QString &key, bool fallback = 0);
     114    static QString getGConfString(const QString &key, const QString &fallback = QString());
     115
     116
     117protected Q_SLOTS:
     118    QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option,
     119                                     const QWidget *widget = 0) const;
    109120};
    110 
    111121
    112122#endif //!defined(QT_NO_STYLE_QGTK)
  • trunk/src/gui/styles/qmacstyle_mac.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qmacstyle_mac.mm

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
    4040****************************************************************************/
    4141
     42/*
     43  Note: The qdoc comments for QMacStyle are contained in
     44  .../doc/src/qstyles.qdoc.
     45*/
     46
    4247#include "qmacstyle_mac.h"
    4348
     
    4651//#define DEBUG_SIZE_CONSTRAINT
    4752
     53#include <private/qapplication_p.h>
    4854#include <private/qcombobox_p.h>
    4955#include <private/qmacstylepixmaps_mac_p.h>
     
    5157#include <private/qpainter_p.h>
    5258#include <private/qprintengine_mac_p.h>
     59#include <private/qstylehelper_p.h>
    5360#include <qapplication.h>
    5461#include <qbitmap.h>
     
    98105
    99106extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp
    100 extern QHash<QByteArray, QFont> *qt_app_fonts_hash(); // qapplication.cpp
    101107
    102108// The following constants are used for adjusting the size
     
    126132static const QColor mainWindowGradientEnd(200, 200, 200);
    127133
     134#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5)
     135enum {
     136    kThemePushButtonTextured = 31,
     137    kThemePushButtonTexturedSmall = 32,
     138    kThemePushButtonTexturedMini = 33
     139};
     140
     141/* Search fields */
     142enum {
     143    kHIThemeFrameTextFieldRound = 1000,
     144    kHIThemeFrameTextFieldRoundSmall = 1001,
     145    kHIThemeFrameTextFieldRoundMini = 1002
     146};
     147#endif
    128148
    129149// Resolve these at run-time, since the functions was moved in Leopard.
     
    323343    }
    324344    p->setPen(borderHighlightTop);
    325     p->drawLine(0, 0, width, 0);
     345    p->drawLine(tabRect.x(), 0, width, 0);
    326346    p->setPen(borderTop);
    327     p->drawLine(0, 1, width, 1);
     347    p->drawLine(tabRect.x(), 1, width, 1);
    328348
    329349    // center block
    330     QRect centralRect(0, 2, width, height - 2);
     350    QRect centralRect(tabRect.x(), 2, width, height - 2);
    331351    if (active) {
    332352        QColor mainColor = QColor(120, 120, 120);
     
    351371    }
    352372    p->setPen(borderHighlightBottom);
    353     p->drawLine(0, height - 2, width, height - 2);
     373    p->drawLine(tabRect.x(), height - 2, width, height - 2);
    354374    p->setPen(borderBottom);
    355     p->drawLine(0, height - 1, width, height - 1);
     375    p->drawLine(tabRect.x(), height - 1, width, height - 1);
    356376}
    357377
     
    487507                             QPainter *p, const QStyleOption *opt) const;
    488508
    489     void drawPantherTab(const QStyleOptionTab *tab, QPainter *p, const QWidget *w = 0) const;
    490 
    491509    QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const;
    492510
     
    541559 *****************************************************************************/
    542560extern CGContextRef qt_mac_cg_context(const QPaintDevice *); //qpaintdevice_mac.cpp
    543 extern QPixmap qt_mac_convert_iconref(const IconRef, int, int); //qpixmap_mac.cpp
    544561extern QRegion qt_mac_convert_mac_region(HIShapeRef); //qregion_mac.cpp
    545562void qt_mac_dispose_rgn(RgnHandle r); //qregion_mac.cpp
     
    550567 *****************************************************************************/
    551568const int qt_mac_hitheme_version = 0; //the HITheme version we speak
    552 const int macSpinBoxSep        = 5;    // distance between spinwidget and the lineedit
    553569const int macItemFrame         = 2;    // menu item frame width
    554570const int macItemHMargin       = 3;    // menu item hor text margin
     
    563579static inline int qt_mac_hitheme_tab_version()
    564580{
    565 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
    566     if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
    567         return 1;
    568 #endif
    569     return 0;
     581    return 1;
    570582}
    571583
     
    833845        break;
    834846    case QStyle::CT_HeaderSection:
    835         if (sz == QAquaSizeLarge && isTreeView(widg))
     847        if (isTreeView(widg))
    836848           ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight));
    837849        break;
     
    10331045    csz.setWidth(iconSize.width() + textRect.width()
    10341046             + ((btn->features & QStyleOptionButton::HasMenu)
    1035                             ? q->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, 0) : 0));
     1047                            ? q->proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, 0) : 0));
    10361048    csz.setHeight(qMax(iconSize.height(), textRect.height()));
    10371049    return csz;
     
    14531465
    14541466    // Tiger broke reverse scroll bars so put them back and "fake it"
    1455     if (isScrollbar && (tdi->attributes & kThemeTrackRightToLeft)
    1456         && QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
     1467    if (isScrollbar && (tdi->attributes & kThemeTrackRightToLeft)) {
    14571468        tdi->attributes &= ~kThemeTrackRightToLeft;
    14581469        tdi->value = tdi->max - slider->sliderPosition;
     
    15351546    if ((defaultButton || !progressBars.isEmpty()) && timerID <= -1)
    15361547        timerID = startTimer(animateSpeed(AquaListViewItemOpen));
    1537 }
    1538 
    1539 enum { TabNormalLeft, TabNormalMid, TabNormalRight, TabSelectedActiveLeft,
    1540        TabSelectedActiveMid, TabSelectedActiveRight, TabSelectedInactiveLeft,
    1541        TabSelectedInactiveMid, TabSelectedInactiveRight, TabSelectedActiveGraphiteLeft,
    1542        TabSelectedActiveGraphiteMid, TabSelectedActiveGraphiteRight,
    1543        TabPressedLeft, TabPressedMid, TabPressedRight };
    1544 
    1545 static const char * const * const PantherTabXpms[] = {
    1546                                     qt_mac_tabnrm_left,
    1547                                     qt_mac_tabnrm_mid,
    1548                                     qt_mac_tabnrm_right,
    1549                                     qt_mac_tabselected_active_left,
    1550                                     qt_mac_tabselected_active_mid,
    1551                                     qt_mac_tabselected_active_right,
    1552                                     qt_mac_tabselected_inactive_left,
    1553                                     qt_mac_tabselected_inactive_mid,
    1554                                     qt_mac_tabselected_inactive_right,
    1555                                     qt_mac_tab_selected_active_graph_left,
    1556                                     qt_mac_tab_selected_active_graph_mid,
    1557                                     qt_mac_tab_selected_active_graph_right,
    1558                                     qt_mac_tab_press_left,
    1559                                     qt_mac_tab_press_mid,
    1560                                     qt_mac_tab_press_right};
    1561 
    1562 void QMacStylePrivate::drawPantherTab(const QStyleOptionTab *tabOpt, QPainter *p,
    1563                                       const QWidget *) const
    1564 {
    1565     QString tabKey = QLatin1String("$qt_mac_style_tab_");
    1566     int pantherTabStart;
    1567     int pantherTabMid;
    1568     int pantherTabEnd;
    1569 
    1570     ThemeTabDirection ttd = getTabDirection(tabOpt->shape);
    1571 
    1572     if (tabOpt->state & QStyle::State_Selected) {
    1573         if (!(tabOpt->state & QStyle::State_Active)) {
    1574             pantherTabStart = TabSelectedInactiveLeft;
    1575         } else {
    1576             // Draw into a pixmap to determine which version we use, Aqua or Graphite.
    1577             QPixmap tabPix(20, 20);
    1578             QPainter pixPainter(&tabPix);
    1579             HIThemeTabDrawInfo tdi;
    1580             tdi.version = 0;
    1581             tdi.style = kThemeTabFront;
    1582             tdi.direction = kThemeTabNorth;
    1583             tdi.size = kHIThemeTabSizeNormal;
    1584             tdi.adornment = kHIThemeTabAdornmentNone;
    1585             HIRect inRect = CGRectMake(0.0f, 0.0f, 20.0f, 20.0f);
    1586             HIThemeDrawTab(&inRect, &tdi, QMacCGContext(&pixPainter), kHIThemeOrientationNormal, 0);
    1587             pixPainter.end();
    1588             const QRgb GraphiteColor = 0xffa7b0ba;
    1589             QRgb pmColor = tabPix.toImage().pixel(10, 10);
    1590             if (qAbs(qRed(pmColor) - qRed(GraphiteColor)) < 3 &&
    1591                 qAbs(qGreen(pmColor) - qGreen(GraphiteColor)) < 3
    1592                 && qAbs(qBlue(pmColor) - qBlue(GraphiteColor)) < 3)
    1593                 pantherTabStart = TabSelectedActiveGraphiteLeft;
    1594             else
    1595                 pantherTabStart = TabSelectedActiveLeft;
    1596         }
    1597     } else if (tabOpt->state & QStyle::State_Sunken) {
    1598         pantherTabStart = TabPressedLeft;
    1599     } else {
    1600         pantherTabStart = TabNormalLeft;
    1601     }
    1602 
    1603 
    1604     bool doLine;
    1605     bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast;
    1606 
    1607     QStyleOptionTab::TabPosition tp = tabOpt->position;
    1608     if (ttd == kThemeTabWest
    1609         || ((ttd == kThemeTabNorth || ttd == kThemeTabSouth)
    1610             && tabOpt->direction == Qt::RightToLeft)) {
    1611         if (tp == QStyleOptionTab::Beginning)
    1612             tp = QStyleOptionTab::End;
    1613         else if (tp == QStyleOptionTab::End)
    1614             tp = QStyleOptionTab::Beginning;
    1615     }
    1616 
    1617     switch (tp) {
    1618     default:  // Stupid GCC, being overly pedantic
    1619     case QStyleOptionTab::Beginning:
    1620         doLine = false;
    1621         pantherTabMid = pantherTabEnd = pantherTabStart + 1;
    1622         break;
    1623     case QStyleOptionTab::Middle:
    1624         doLine = true;
    1625         pantherTabMid = pantherTabEnd = ++pantherTabStart;
    1626         break;
    1627     case QStyleOptionTab::End:
    1628         doLine = true;
    1629         pantherTabMid = ++pantherTabStart;
    1630         pantherTabEnd = pantherTabMid + 1;
    1631         break;
    1632     case QStyleOptionTab::OnlyOneTab:
    1633         doLine = false;
    1634         pantherTabMid = pantherTabStart + 1;
    1635         pantherTabEnd = pantherTabMid + 1;
    1636         break;
    1637     }
    1638 
    1639     QPixmap pmStart;
    1640     if (!QPixmapCache::find(tabKey + QString::number(pantherTabStart), pmStart)) {
    1641         pmStart = QPixmap(PantherTabXpms[pantherTabStart]);
    1642         QPixmapCache::insert(tabKey + QString::number(pantherTabStart), pmStart);
    1643     }
    1644 
    1645     QPixmap pmMid;
    1646     if (!QPixmapCache::find(tabKey + QString::number(pantherTabMid), pmMid)) {
    1647         pmMid = QPixmap(PantherTabXpms[pantherTabMid]);
    1648         QPixmapCache::insert(tabKey + QString::number(pantherTabMid), pmMid);
    1649     }
    1650 
    1651     QPixmap pmEnd;
    1652     if (!QPixmapCache::find(tabKey + QString::number(pantherTabEnd), pmEnd)) {
    1653         pmEnd = QPixmap(PantherTabXpms[pantherTabEnd]);
    1654         QPixmapCache::insert(tabKey + QString::number(pantherTabEnd), pmEnd);
    1655     }
    1656     QRect tr = tabOpt->rect;
    1657     if (verticalTabs) {
    1658         p->save();
    1659         int newX, newY, newRot;
    1660         if (tabOpt->shape == QTabBar::RoundedEast || tabOpt->shape == QTabBar::TriangularEast) {
    1661             newX = tr.width();
    1662             newY = tr.y();
    1663             newRot = 90;
    1664         } else {
    1665             newX = 0;
    1666             newY = tr.y() + tr.height();
    1667             newRot = -90;
    1668         }
    1669         tr.setRect(0, 0, tr.height(), tr.width());
    1670         QMatrix m;
    1671         if (ttd == kThemeTabEast) {
    1672             // It's lame but Apple inverts these on the East side.
    1673             m.scale(-1, 1);
    1674             m.translate(-tabOpt->rect.width(), 0);
    1675         }
    1676         m.translate(newX, newY);
    1677         m.rotate(newRot);
    1678         p->setMatrix(m, true);
    1679     }
    1680 
    1681     int x = tr.x();
    1682     int y = tr.y();
    1683     int endX = x + tr.width() - pmEnd.width();
    1684 
    1685     p->drawPixmap(x, y, pmStart.width(), tr.height(), pmStart);
    1686     if (doLine) {
    1687         QPen oldPen = p->pen();
    1688         p->setPen(QColor(0, 0, 0, 0x35));
    1689         p->drawLine(x, y + (verticalTabs ? 0 : 1), x, tr.height() - 2);
    1690     }
    1691 
    1692     for (x = x + pmStart.width(); x < endX; x += pmMid.width())
    1693         p->drawPixmap(x, y, pmMid.width(), tr.height(), pmMid);
    1694     p->drawPixmap(endX, y, pmEnd.width(), tr.height(), pmEnd);
    1695     if (verticalTabs)
    1696         p->restore();
    16971548}
    16981549
     
    19901841}
    19911842
    1992 /*!
    1993     \class QMacStyle
    1994     \brief The QMacStyle class provides a Mac OS X style using the Apple Appearance Manager.
    1995 
    1996     \ingroup appearance
    1997 
    1998     This class is implemented as a wrapper to the HITheme
    1999     APIs, allowing applications to be styled according to the current
    2000     theme in use on Mac OS X. This is done by having primitives
    2001     in QStyle implemented in terms of what Mac OS X would normally theme.
    2002 
    2003     \warning This style is only available on Mac OS X because it relies on the
    2004     HITheme APIs.
    2005 
    2006     There are additional issues that should be taken
    2007     into consideration to make an application compatible with the
    2008     \link http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html
    2009     Apple Human Interface Guidelines \endlink. Some of these issues are outlined
    2010     below.
    2011 
    2012     \list
    2013 
    2014     \i Layout - The restrictions on window layout are such that some
    2015     aspects of layout that are style-dependent cannot be achieved
    2016     using QLayout. Changes are being considered (and feedback would be
    2017     appreciated) to make layouts QStyle-able. Some of the restrictions
    2018     involve horizontal and vertical widget alignment and widget size
    2019     (covered below).
    2020 
    2021     \i Widget size - Mac OS X allows widgets to have specific fixed sizes.  Qt
    2022     does not fully implement this behavior so as to maintain cross-platform
    2023     compatibility. As a result some widgets sizes may be inappropriate (and
    2024     subsequently not rendered correctly by the HITheme APIs).The
    2025     QWidget::sizeHint() will return the appropriate size for many
    2026     managed widgets (widgets enumerated in \l QStyle::ContentsType).
    2027 
    2028     \i Effects - QMacStyle uses HITheme for performing most of the drawing, but
    2029     also uses emulation in a few cases where HITheme does not provide the
    2030     required functionality (for example, tab bars on Panther, the toolbar
    2031     separator, etc). We tried to make the emulation as close to the original as
    2032     possible. Please report any issues you see in effects or non-standard
    2033     widgets.
    2034 
    2035     \endlist
    2036 
    2037     There are other issues that need to be considered in the feel of
    2038     your application (including the general color scheme to match the
    2039     Aqua colors). The Guidelines mentioned above will remain current
    2040     with new advances and design suggestions for Mac OS X.
    2041 
    2042     Note that the functions provided by QMacStyle are
    2043     reimplementations of QStyle functions; see QStyle for their
    2044     documentation.
    2045 
    2046     \img qmacstyle.png
    2047     \sa QWindowsXPStyle, QWindowsStyle, QPlastiqueStyle, QCDEStyle, QMotifStyle
    2048 */
    2049 
    2050 
    2051 /*!
    2052     \enum QMacStyle::WidgetSizePolicy
    2053 
    2054     \value SizeSmall
    2055     \value SizeLarge
    2056     \value SizeMini
    2057     \value SizeDefault
    2058     \omitvalue SizeNone
    2059 */
    2060 
    2061 /*!
    2062     Constructs a QMacStyle object.
    2063 */
    20641843QMacStyle::QMacStyle()
    20651844    : QWindowsStyle()
     
    20681847}
    20691848
    2070 /*!
    2071     Destructs a QMacStyle object.
    2072 */
    20731849QMacStyle::~QMacStyle()
    20741850{
     
    20841860{
    20851861    QPixmap px(4, 4);
    2086 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
    2087     if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
    2088         QMacCGContext cg(&px);
    2089         HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationNormal);
    2090         const CGRect cgRect = CGRectMake(0, 0, px.width(), px.height());
    2091         CGContextFillRect(cg, cgRect);
    2092     } else
    2093 #endif
    2094     {
    2095 #ifndef QT_MAC_NO_QUICKDRAW
    2096         QMacSavedPortInfo port(&px);
    2097         SetThemeBackground(kThemeBrushDialogBackgroundActive, px.depth(), true);
    2098         const Rect qdRect = { 0, 0, px.width(), px.height() };
    2099         EraseRect(&qdRect);
    2100 #endif
    2101     }
     1862    QMacCGContext cg(&px);
     1863    HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationNormal);
     1864    const CGRect cgRect = CGRectMake(0, 0, px.width(), px.height());
     1865    CGContextFillRect(cg, cgRect);
    21021866    return px;
    21031867}
     
    21071871    HIThemeSetFill us used directly if we are filling with the standard background.
    21081872*/
    2109 void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush)
    2110 {
    2111 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
     1873void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush)
     1874{
    21121875    QPoint dummy;
    21131876    const QPaintDevice *target = painter->device();
    21141877    const QPaintDevice *redirected = QPainter::redirected(target, &dummy);
    21151878    const bool usePainter = redirected && redirected != target;
    2116     const QRegion translated = rgn.translated(offset);
    2117 
    2118     if (!usePainter && QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4 && qt_mac_backgroundPattern
     1879
     1880    if (!usePainter && qt_mac_backgroundPattern
    21191881        && qt_mac_backgroundPattern->cacheKey() == brush.texture().cacheKey()) {
    21201882
    2121         painter->setClipRegion(translated);
     1883        painter->setClipRegion(rgn);
    21221884
    21231885        CGContextRef cg = qt_mac_cg_context(target);
     
    21251887        HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted);
    21261888
    2127         const QVector<QRect> &rects = translated.rects();
     1889        const QVector<QRect> &rects = rgn.rects();
    21281890        for (int i = 0; i < rects.size(); ++i) {
    21291891            const QRect rect(rects.at(i));
     
    21351897
    21361898        CGContextRestoreGState(cg);
    2137     } else
    2138 #endif
    2139     {
    2140         const QRect rect(translated.boundingRect());
    2141         painter->setClipRegion(translated);
     1899    } else {
     1900        const QRect rect(rgn.boundingRect());
     1901        painter->setClipRegion(rgn);
    21421902        painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
    21431903    }
    21441904}
    21451905
    2146 /*! \reimp */
    21471906void QMacStyle::polish(QPalette &pal)
    21481907{
    2149     if (qt_mac_backgroundPattern == 0)
     1908    if (!qt_mac_backgroundPattern) {
     1909        if (!qApp)
     1910            return;
    21501911        qt_mac_backgroundPattern = new QPixmap(d->generateBackgroundPattern());
     1912    }
    21511913
    21521914    QColor pc(Qt::black);
     
    21651927}
    21661928
    2167 /*! \reimp */
    21681929void QMacStyle::polish(QApplication *)
    21691930{
    21701931}
    21711932
    2172 /*! \reimp */
    21731933void QMacStyle::unpolish(QApplication *)
    21741934{
    21751935}
    21761936
    2177 /*! \reimp */
    21781937void QMacStyle::polish(QWidget* w)
    21791938{
     
    21931952        if (!w->testAttribute(Qt::WA_SetPalette)) {
    21941953            QPixmap px(64, 64);
     1954            px.fill(Qt::white);
    21951955            HIThemeMenuDrawInfo mtinfo;
    21961956            mtinfo.version = qt_mac_hitheme_version;
     
    22081968    }
    22091969
    2210     // Adjust the lineedit of the editable combo box
    2211     if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_3) {
    2212         if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(w)) {
    2213             if (qobject_cast<QComboBox *>(lineEdit->parentWidget())
    2214                     && !lineEdit->testAttribute(Qt::WA_SetFont)) {
    2215                 QFont font = lineEdit->font();
    2216                 font.setPointSize(font.pointSize() - 1);
    2217                 lineEdit->setFont(font);
    2218             }
    2219         }
    2220     }
    2221 
    22221970    if (QTabBar *tb = qobject_cast<QTabBar*>(w)) {
    22231971        if (tb->documentMode()) {
     
    22391987}
    22401988
    2241 /*! \reimp */
    22421989void QMacStyle::unpolish(QWidget* w)
    22431990{
     
    22702017}
    22712018
    2272 /*! \reimp */
    22732019int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const
    22742020{
     
    22822028        break;
    22832029    case PM_ToolBarIconSize:
    2284         ret = pixelMetric(PM_LargeIconSize);
     2030        ret = proxy()->pixelMetric(PM_LargeIconSize);
    22852031        break;
    22862032    case PM_FocusFrameVMargin:
     
    23742120    case PM_SpinBoxFrameWidth:
    23752121        GetThemeMetric(kThemeMetricEditTextFrameOutset, &ret);
    2376         ret += 2;
     2122        switch (d->aquaSizeConstrain(opt, widget)) {
     2123        default:
     2124            ret += 2;
     2125            break;
     2126        case QAquaSizeMini:
     2127            ret += 1;
     2128            break;
     2129        }
    23772130        break;
    23782131    case PM_ButtonShiftHorizontal:
     
    24032156            QCFType<HIShapeRef> region;
    24042157            HIRect hirect = qt_hirectForQRect(tb->rect);
    2405             if (hirect.size.width == -1)
     2158            if (hirect.size.width <= 0)
    24062159                hirect.size.width = 100;
    2407             if (hirect.size.height == -1)
     2160            if (hirect.size.height <= 0)
    24082161                hirect.size.height = 30;
    24092162
     
    24492202            break;
    24502203        case QAquaSizeMini:
    2451 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) && 0
    2452             if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_3) {
    2453                 GetThemeMetric(kThemeMetricMiniScrollBarWidth, &ret);
    2454                 break;
    2455             }
    2456 #endif
    24572204        case QAquaSizeSmall:
    24582205            GetThemeMetric(kThemeMetricSmallScrollBarWidth, &ret);
     
    25562303    case PM_ToolBarItemSpacing:
    25572304        ret = 4;
    2558         break;
    2559     case PM_MessageBoxIconSize:
    2560         ret = 64;
    25612305        break;
    25622306    case PM_SplitterWidth:
     
    26352379        ret = 0;
    26362380        break;
     2381    case PM_ToolBarFrameWidth:
     2382        ret = 0;
     2383        break;
    26372384    default:
    26382385        ret = QWindowsStyle::pixelMetric(metric, opt, widget);
     
    26422389}
    26432390
    2644 /*! \reimp */
    26452391QPalette QMacStyle::standardPalette() const
    26462392{
     
    26522398}
    26532399
    2654 /*! \reimp */
    26552400int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w,
    26562401                         QStyleHintReturn *hret) const
     
    27982543                pix.fill(QColor(fillR, fillG, fillB));
    27992544                QPainter pix_paint(&pix);
    2800                 drawControl(CE_FocusFrame, opt, &pix_paint, w);
     2545                proxy()->drawControl(CE_FocusFrame, opt, &pix_paint, w);
    28012546                pix_paint.end();
    28022547                img = pix.toImage();
     
    29472692}
    29482693
    2949 /*! \reimp */
    29502694QPixmap QMacStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
    29512695                                       const QStyleOption *opt) const
     
    29732717
    29742718
    2975 /*! \reimp */
    29762719QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
    29772720                                  const QWidget *widget) const
     
    30042747    return icon.pixmap(size, size);
    30052748}
    3006 /*!
    3007     \enum QMacStyle::FocusRectPolicy
    3008 
    3009     This type is used to signify a widget's focus rectangle policy.
    3010 
    3011     \value FocusEnabled  show a focus rectangle when the widget has focus.
    3012     \value FocusDisabled  never show a focus rectangle for the widget.
    3013     \value FocusDefault  show a focus rectangle when the widget has
    3014     focus and the widget is a QSpinWidget, QDateTimeEdit, QLineEdit,
    3015     QListBox, QListView, editable QTextEdit, or one of their
    3016     subclasses.
    3017 */
    3018 
    3019 /*!
    3020     \obsolete
    3021     Sets the focus rectangle policy of \a w. The \a policy can be one of
    3022     \l{QMacStyle::FocusRectPolicy}.
    3023 
    3024     This is now simply an interface to the Qt::WA_MacShowFocusRect attribute and the
    3025     FocusDefault value does nothing anymore. If you want to set a widget back
    3026     to its default value, you must save the old value of the attribute before
    3027     you change it.
    3028 
    3029     \sa focusRectPolicy() QWidget::setAttribute()
    3030 */
     2749
    30312750void QMacStyle::setFocusRectPolicy(QWidget *w, FocusRectPolicy policy)
    30322751{
     
    30412760}
    30422761
    3043 /*!
    3044     \obsolete
    3045     Returns the focus rectangle policy for the widget \a w.
    3046 
    3047     The focus rectangle policy can be one of \l{QMacStyle::FocusRectPolicy}.
    3048 
    3049     In 4.3 and up this function will simply test for the
    3050     Qt::WA_MacShowFocusRect attribute and will never return
    3051     QMacStyle::FocusDefault.
    3052 
    3053     \sa setFocusRectPolicy(), QWidget::testAttribute()
    3054 */
    30552762QMacStyle::FocusRectPolicy QMacStyle::focusRectPolicy(const QWidget *w)
    30562763{
     
    30582765}
    30592766
    3060 /*!
    3061     \obsolete
    3062 
    3063     Call QWidget::setAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize,
    3064     or Qt::WA_MacNormalSize instead.
    3065 */
    30662767void QMacStyle::setWidgetSizePolicy(const QWidget *widget, WidgetSizePolicy policy)
    30672768{
     
    30722773}
    30732774
    3074 /*!
    3075     \obsolete
    3076 
    3077     Call QWidget::testAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize,
    3078     or Qt::WA_MacNormalSize instead.
    3079 */
    30802775QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget)
    30812776{
     
    30932788}
    30942789
    3095 /*! \reimp */
    30962790void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
    30972791                              const QWidget *w) const
     
    31642858                break;
    31652859            }
    3166             drawPrimitive(PE_FrameTabWidget, &twf, p, w);
     2860            proxy()->drawPrimitive(PE_FrameTabWidget, &twf, p, w);
    31672861            p->restore();
    31682862        }
     
    32622956            // In HITheme, up is down, down is up and hamburgers eat people.
    32632957            if (header->sortIndicator != QStyleOptionHeader::None)
    3264                 drawPrimitive(
     2958                proxy()->drawPrimitive(
    32652959                    (header->sortIndicator == QStyleOptionHeader::SortDown) ?
    32662960                    PE_IndicatorArrowUp : PE_IndicatorArrowDown, header, p, w);
     
    33963090                int lw = frame->lineWidth;
    33973091                if (lw <= 0)
    3398                     lw = pixelMetric(PM_DefaultFrameWidth, frame, w);
     3092                    lw = proxy()->pixelMetric(PM_DefaultFrameWidth, frame, w);
    33993093                { //clear to base color
    34003094                    p->save();
     
    34213115                = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
    34223116            HIRect hirect = qt_hirectForQRect(twf->rect);
    3423 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
    3424             if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
    3425                 HIThemeTabPaneDrawInfo tpdi;
    3426                 tpdi.version = qt_mac_hitheme_tab_version();
    3427                 tpdi.state = tds;
    3428                 tpdi.direction = getTabDirection(twf->shape);
    3429                 tpdi.size = kHIThemeTabSizeNormal;
    3430                 if (tpdi.version == 1) {
    3431                     tpdi.kind = kHIThemeTabKindNormal;
    3432                     tpdi.adornment = kHIThemeTabPaneAdornmentNormal;
    3433                 }
    3434                 HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal);
    3435             } else
    3436 #endif
    3437             {
    3438                 HIThemeGroupBoxDrawInfo gdi;
    3439                 gdi.version = qt_mac_hitheme_version;
    3440                 gdi.state = tds;
    3441                 gdi.kind = kHIThemeGroupBoxKindSecondary;
    3442                 HIThemeDrawGroupBox(&hirect, &gdi, cg, kHIThemeOrientationNormal);
    3443             }
     3117            HIThemeTabPaneDrawInfo tpdi;
     3118            tpdi.version = qt_mac_hitheme_tab_version();
     3119            tpdi.state = tds;
     3120            tpdi.direction = getTabDirection(twf->shape);
     3121            tpdi.size = kHIThemeTabSizeNormal;
     3122            tpdi.kind = kHIThemeTabKindNormal;
     3123            tpdi.adornment = kHIThemeTabPaneAdornmentNormal;
     3124            HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal);
    34443125        }
    34453126        break;
     
    34653146            break;
    34663147        }
    3467 
    34683148        // Use the Leopard style only if the status bar is the status bar for a
    34693149        // QMainWindow with a unifed toolbar.
     
    35263206
    35273207
    3528 /*! \reimp */
    35293208void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p,
    35303209                            const QWidget *w) const
     
    36103289                if (opt->state & State_Enabled)
    36113290                    mode = QIcon::Normal;
    3612                 QPixmap pixmap = header->icon.pixmap(pixelMetric(PM_SmallIconSize), mode);
     3291                QPixmap pixmap = header->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), mode);
    36133292
    36143293                QRect pixr = header->rect;
    36153294                pixr.setY(header->rect.center().y() - (pixmap.height() - 1) / 2);
    3616                 drawItemPixmap(p, pixr, Qt::AlignVCenter, pixmap);
     3295                proxy()->drawItemPixmap(p, pixr, Qt::AlignVCenter, pixmap);
    36173296                textr.translate(pixmap.width() + 2, 0);
    36183297            }
    36193298
    3620             drawItemText(p, textr, header->textAlignment | Qt::AlignVCenter, header->palette,
    3621                          header->state & State_Enabled, header->text, QPalette::ButtonText);
     3299            proxy()->drawItemText(p, textr, header->textAlignment | Qt::AlignVCenter, header->palette,
     3300                                       header->state & State_Enabled, header->text, QPalette::ButtonText);
    36223301        }
    36233302        break;
     
    36303309                int shiftX = 0;
    36313310                int shiftY = 0;
    3632                 if (tb->state & (State_Sunken | State_On)) {
    3633                     shiftX = pixelMetric(PM_ButtonShiftHorizontal, tb, w);
    3634                     shiftY = pixelMetric(PM_ButtonShiftVertical, tb, w);
     3311                bool needText = false;
     3312                int alignment = 0;
     3313                bool down = tb->state & (State_Sunken | State_On);
     3314                if (down) {
     3315                    shiftX = proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, w);
     3316                    shiftY = proxy()->pixelMetric(PM_ButtonShiftVertical, tb, w);
    36353317                }
    36363318                // The down state is special for QToolButtons in a toolbar on the Mac
     
    36383320                // This doesn't really fit into any particular case in QIcon, so we
    36393321                // do the majority of the work ourselves.
    3640                 if (tb->state & State_Sunken
    3641                         && !(tb->features & QStyleOptionToolButton::Arrow)) {
     3322                if (!(tb->features & QStyleOptionToolButton::Arrow)) {
    36423323                    Qt::ToolButtonStyle tbstyle = tb->toolButtonStyle;
    36433324                    if (tb->icon.isNull() && !tb->text.isEmpty())
     
    36453326
    36463327                    switch (tbstyle) {
    3647                     case Qt::ToolButtonTextOnly:
    3648                         drawItemText(p, cr, Qt::AlignCenter, tb->palette,
    3649                                      tb->state & State_Enabled, tb->text);
    3650                         break;
     3328                    case Qt::ToolButtonTextOnly: {
     3329                        needText = true;
     3330                        alignment = Qt::AlignCenter;
     3331                        break; }
    36513332                    case Qt::ToolButtonIconOnly:
    36523333                    case Qt::ToolButtonTextBesideIcon:
     
    36543335                        QRect pr = cr;
    36553336                        QIcon::Mode iconMode = (tb->state & State_Enabled) ? QIcon::Normal
    3656                                                                                    : QIcon::Disabled;
     3337                                                                            : QIcon::Disabled;
    36573338                        QIcon::State iconState = (tb->state & State_On) ? QIcon::On
    3658                                                                                 : QIcon::Off;
     3339                                                                         : QIcon::Off;
    36593340                        QPixmap pixmap = tb->icon.pixmap(tb->rect.size().boundedTo(tb->iconSize), iconMode, iconState);
    36603341
    36613342                        // Draw the text if it's needed.
    36623343                        if (tb->toolButtonStyle != Qt::ToolButtonIconOnly) {
    3663                             int alignment = 0;
     3344                            needText = true;
    36643345                            if (tb->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
    3665                                 pr.setHeight(pixmap.size().height() + 6);
    3666                                 cr.adjust(0, pr.bottom(), 0, -3);
     3346                                pr.setHeight(pixmap.size().height());
     3347                                cr.adjust(0, pr.bottom() + 1, 0, 1);
    36673348                                alignment |= Qt::AlignCenter;
    36683349                            } else {
     
    36713352                                alignment |= Qt::AlignLeft | Qt::AlignVCenter;
    36723353                            }
     3354                        }
     3355                        if (opt->state & State_Sunken) {
     3356                            pr.translate(shiftX, shiftY);
     3357                            pixmap = darkenPixmap(pixmap);
     3358                        }
     3359                        proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pixmap);
     3360                        break; }
     3361                    default:
     3362                        Q_ASSERT(false);
     3363                        break;
     3364                    }
     3365
     3366                    if (needText) {
     3367                        QPalette pal = tb->palette;
     3368                        QPalette::ColorRole role = QPalette::NoRole;
     3369                        if (down)
    36733370                            cr.translate(shiftX, shiftY);
    3674                             drawItemText(p, cr, alignment, tb->palette,
    3675                                          tb->state & State_Enabled, tb->text);
    3676                             cr.adjust(0, 3, 0, -3); // the drop shadow
    3677                             drawItemText(p, cr, alignment, tb->palette,
    3678                                          tb->state & State_Enabled, tb->text);
     3371                        if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5
     3372                            && (tbstyle == Qt::ToolButtonTextOnly
     3373                                || (tbstyle != Qt::ToolButtonTextOnly && !down))) {
     3374                            QPen pen = p->pen();
     3375                            QColor light = down ? Qt::black : Qt::white;
     3376                            light.setAlphaF(0.375f);
     3377                            p->setPen(light);
     3378                            p->drawText(cr.adjusted(0, 1, 0, 1), alignment, tb->text);
     3379                            p->setPen(pen);
     3380                            if (down && tbstyle == Qt::ToolButtonTextOnly) {
     3381                                pal = QApplication::palette("QMenu");
     3382                                pal.setCurrentColorGroup(tb->palette.currentColorGroup());
     3383                                role = QPalette::HighlightedText;
     3384                            }
    36793385                        }
    3680                         pr.translate(shiftX, shiftY);
    3681                         pixmap = darkenPixmap(pixmap);
    3682                         drawItemPixmap(p, pr, Qt::AlignCenter, pixmap);
    3683                         break; }
     3386                        drawItemText(p, cr, alignment, pal,
     3387                                     tb->state & State_Enabled, tb->text, role);
     3388                        if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 &&
     3389                            (tb->state & State_Sunken)) {
     3390                            // Draw a "drop shadow" in earlier versions.
     3391                            drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment,
     3392                                         tb->palette, tb->state & State_Enabled, tb->text);
     3393                        }
    36843394                    }
    36853395                } else {
     
    37313441
    37323442            if (btn->features & QStyleOptionButton::HasMenu) {
    3733                 int mbi = pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w);
     3443                int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w);
    37343444                QRect ir = btn->rect;
    37353445                HIRect arrowRect = CGRectMake(ir.right() - mbi - PushButtonRightOffset,
     
    38183528                        int contentW = textRect.width();
    38193529                        if (hasMenu)
    3820                             contentW += pixelMetric(PM_MenuButtonIndicator) + 4;
     3530                            contentW += proxy()->pixelMetric(PM_MenuButtonIndicator) + 4;
    38213531                        QIcon::Mode mode = btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
    38223532                        if (mode == QIcon::Normal && btn->state & State_HasFocus)
     
    38323542                        QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmap.width(), pixmap.height());
    38333543                        QRect visualIconDestRect = visualRect(btn->direction, freeContentRect, iconDestRect);
    3834                         drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap);
     3544                        proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap);
    38353545                        int newOffset = iconDestRect.x() + iconDestRect.width()
    38363546                                        + PushButtonContentPadding - textRect.x();
     
    38403550                    if (hasText) {
    38413551                        textRect = visualRect(btn->direction, freeContentRect, textRect);
    3842                         drawItemText(p, textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, btn->palette,
    3843                                      (btn->state & State_Enabled), btn->text, QPalette::ButtonText);
     3552                        proxy()->drawItemText(p, textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, btn->palette,
     3553                                                   (btn->state & State_Enabled), btn->text, QPalette::ButtonText);
    38443554                    }
    38453555                }
     
    38663576                }
    38673577            }
    3868 
    3869 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
    3870             if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_3) {
    3871                 HIThemeTabDrawInfo tdi;
    3872                 tdi.version = 1;
    3873                 tdi.style = kThemeTabNonFront;
    3874                 tdi.direction = getTabDirection(tabOpt->shape);
    3875                 switch (d->aquaSizeConstrain(opt, w)) {
     3578            HIThemeTabDrawInfo tdi;
     3579            tdi.version = 1;
     3580            tdi.style = kThemeTabNonFront;
     3581            tdi.direction = getTabDirection(tabOpt->shape);
     3582            switch (d->aquaSizeConstrain(opt, w)) {
     3583            default:
     3584            case QAquaSizeUnknown:
     3585            case QAquaSizeLarge:
     3586                tdi.size = kHIThemeTabSizeNormal;
     3587                break;
     3588            case QAquaSizeSmall:
     3589                tdi.size = kHIThemeTabSizeSmall;
     3590                break;
     3591            case QAquaSizeMini:
     3592                tdi.size = kHIThemeTabSizeMini;
     3593                break;
     3594            }
     3595            bool verticalTabs = tdi.direction == kThemeTabWest || tdi.direction == kThemeTabEast;
     3596            QRect tabRect = tabOpt->rect;
     3597
     3598            bool selected = tabOpt->state & State_Selected;
     3599            if (selected) {
     3600                if (!(tabOpt->state & State_Active))
     3601                    tdi.style = kThemeTabFrontUnavailable;
     3602                else if (!(tabOpt->state & State_Enabled))
     3603                    tdi.style = kThemeTabFrontInactive;
     3604                else
     3605                    tdi.style = kThemeTabFront;
     3606            } else if (!(tabOpt->state & State_Active)) {
     3607                tdi.style = kThemeTabNonFrontUnavailable;
     3608            } else if (!(tabOpt->state & State_Enabled)) {
     3609                tdi.style = kThemeTabNonFrontInactive;
     3610            } else if (tabOpt->state & State_Sunken) {
     3611                tdi.style = kThemeTabFrontInactive; // (should be kThemeTabNonFrontPressed)
     3612            }
     3613            if (tabOpt->state & State_HasFocus)
     3614                tdi.adornment = kHIThemeTabAdornmentFocus;
     3615            else
     3616                tdi.adornment = kHIThemeTabAdornmentNone;
     3617            tdi.kind = kHIThemeTabKindNormal;
     3618            if (!verticalTabs)
     3619                tabRect.setY(tabRect.y() - 1);
     3620            else
     3621                tabRect.setX(tabRect.x() - 1);
     3622            QStyleOptionTab::TabPosition tp = tabOpt->position;
     3623            QStyleOptionTab::SelectedPosition sp = tabOpt->selectedPosition;
     3624            if (tabOpt->direction == Qt::RightToLeft && !verticalTabs) {
     3625                if (sp == QStyleOptionTab::NextIsSelected)
     3626                    sp = QStyleOptionTab::PreviousIsSelected;
     3627                else if (sp == QStyleOptionTab::PreviousIsSelected)
     3628                    sp = QStyleOptionTab::NextIsSelected;
     3629                switch (tp) {
     3630                case QStyleOptionTab::Beginning:
     3631                    tp = QStyleOptionTab::End;
     3632                    break;
     3633                case QStyleOptionTab::End:
     3634                    tp = QStyleOptionTab::Beginning;
     3635                    break;
    38763636                default:
    3877                 case QAquaSizeUnknown:
    3878                 case QAquaSizeLarge:
    3879                     tdi.size = kHIThemeTabSizeNormal;
    38803637                    break;
    3881                 case QAquaSizeSmall:
    3882                     tdi.size = kHIThemeTabSizeSmall;
    3883                     break;
    3884                 case QAquaSizeMini:
    3885                     tdi.size = kHIThemeTabSizeMini;
    3886                     break;
    3887                 }
    3888                 bool verticalTabs = tdi.direction == kThemeTabWest || tdi.direction == kThemeTabEast;
    3889                 QRect tabRect = tabOpt->rect;
    3890 
    3891                 if ((!verticalTabs && tabRect.height() > 21 || verticalTabs && tabRect.width() > 21)) {
    3892                     d->drawPantherTab(tabOpt, p, w);
    3893                     break;
    3894                 }
    3895 
    3896                 bool selected = tabOpt->state & State_Selected;
    3897                 if (selected) {
    3898                     if (!(tabOpt->state & State_Active))
    3899                         tdi.style = kThemeTabFrontUnavailable;
    3900                     else if (!(tabOpt->state & State_Enabled))
    3901                         tdi.style = kThemeTabFrontInactive;
    3902                     else
    3903                         tdi.style = kThemeTabFront;
    3904                 } else if (!(tabOpt->state & State_Active)) {
    3905                     tdi.style = kThemeTabNonFrontUnavailable;
    3906                 } else if (!(tabOpt->state & State_Enabled)) {
    3907                     tdi.style = kThemeTabNonFrontInactive;
    3908                 } else if (tabOpt->state & State_Sunken) {
    3909                     tdi.style = kThemeTabFrontInactive; // (should be kThemeTabNonFrontPressed)
    3910                 }
    3911                 if (tabOpt->state & State_HasFocus)
    3912                     tdi.adornment = kHIThemeTabAdornmentFocus;
    3913                 else
    3914                     tdi.adornment = kHIThemeTabAdornmentNone;
    3915                 tdi.kind = kHIThemeTabKindNormal;
    3916                 if (!verticalTabs)
    3917                     tabRect.setY(tabRect.y() - 1);
    3918                 else
    3919                     tabRect.setX(tabRect.x() - 1);
    3920                 QStyleOptionTab::TabPosition tp = tabOpt->position;
    3921                 QStyleOptionTab::SelectedPosition sp = tabOpt->selectedPosition;
    3922                 if (tabOpt->direction == Qt::RightToLeft && !verticalTabs) {
    3923                     if (sp == QStyleOptionTab::NextIsSelected)
    3924                         sp = QStyleOptionTab::PreviousIsSelected;
    3925                     else if (sp == QStyleOptionTab::PreviousIsSelected)
    3926                         sp = QStyleOptionTab::NextIsSelected;
    3927                     switch (tp) {
    3928                         case QStyleOptionTab::Beginning:
    3929                             tp = QStyleOptionTab::End;
    3930                             break;
    3931                         case QStyleOptionTab::End:
    3932                             tp = QStyleOptionTab::Beginning;
    3933                             break;
    3934                         default:
    3935                             break;
    3936                     }
    3937                 }
    3938                 switch (tp) {
    3939                     case QStyleOptionTab::Beginning:
    3940                         tdi.position = kHIThemeTabPositionFirst;
    3941                         if (sp != QStyleOptionTab::NextIsSelected)
    3942                             tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
    3943                         break;
    3944                     case QStyleOptionTab::Middle:
    3945                         tdi.position = kHIThemeTabPositionMiddle;
    3946                         if (selected)
    3947                             tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
    3948                         if (sp != QStyleOptionTab::NextIsSelected)  // Also when we're selected.
    3949                             tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
    3950                         break;
    3951                     case QStyleOptionTab::End:
    3952                         tdi.position = kHIThemeTabPositionLast;
    3953                         if (selected)
    3954                             tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
    3955                         break;
    3956                     case QStyleOptionTab::OnlyOneTab:
    3957                         tdi.position = kHIThemeTabPositionOnly;
    3958                         break;
    3959                 }
     3638                }
     3639            }
     3640            bool stretchTabs = (!verticalTabs && tabRect.height() > 22 || verticalTabs && tabRect.width() > 22);
     3641
     3642            switch (tp) {
     3643            case QStyleOptionTab::Beginning:
     3644                tdi.position = kHIThemeTabPositionFirst;
     3645                if (sp != QStyleOptionTab::NextIsSelected || stretchTabs)
     3646                    tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
     3647                break;
     3648            case QStyleOptionTab::Middle:
     3649                tdi.position = kHIThemeTabPositionMiddle;
     3650                if (selected)
     3651                    tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
     3652                if (sp != QStyleOptionTab::NextIsSelected || stretchTabs)  // Also when we're selected.
     3653                    tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
     3654                break;
     3655            case QStyleOptionTab::End:
     3656                tdi.position = kHIThemeTabPositionLast;
     3657                if (selected)
     3658                    tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
     3659                break;
     3660            case QStyleOptionTab::OnlyOneTab:
     3661                tdi.position = kHIThemeTabPositionOnly;
     3662                break;
     3663            }
     3664            // HITheme doesn't stretch its tabs. Therefore we have to cheat and do the job ourselves.
     3665            if (stretchTabs) {
     3666                HIRect hirect = CGRectMake(0, 0, 23, 23);
     3667                QPixmap pm(23, 23);
     3668                pm.fill(Qt::transparent);
     3669                {
     3670                    QMacCGContext pmcg(&pm);
     3671                    HIThemeDrawTab(&hirect, &tdi, pmcg, kHIThemeOrientationNormal, 0);
     3672                }
     3673                QStyleHelper::drawBorderPixmap(pm, p, tabRect, 7, 7, 7, 7);
     3674            } else {
    39603675                HIRect hirect = qt_hirectForQRect(tabRect);
    39613676                HIThemeDrawTab(&hirect, &tdi, cg, kHIThemeOrientationNormal, 0);
    3962             } else
    3963 #endif
    3964             {
    3965                 d->drawPantherTab(tabOpt, p, w);
    39663677            }
    39673678        }
     
    39983709                    nr.moveTop(+1);
    39993710                    int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic;
    4000                     drawItemText(p, nr, alignment, np, tab->state & State_Enabled, tab->text, QPalette::WindowText);
     3711                    proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled,
     3712                                               tab->text, QPalette::WindowText);
    40013713                    p->restore();
    40023714                }
     
    41213833        break;
    41223834    case CE_FocusFrame: {
    4123         int xOff = pixelMetric(PM_FocusFrameHMargin, opt, w) + 1;
    4124         int yOff = pixelMetric(PM_FocusFrameVMargin, opt, w) + 1;
     3835        int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w) + 1;
     3836        int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w) + 1;
    41253837        HIRect hirect = CGRectMake(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff,
    41263838                                   opt->rect.height() - 2 * yOff);
     
    42453957                                                               : QIcon::Disabled;
    42463958                // Always be normal or disabled to follow the Mac style.
    4247                 int smallIconSize = pixelMetric(PM_SmallIconSize);
     3959                int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize);
    42483960                QSize iconSize(smallIconSize, smallIconSize);
    42493961                if (const QComboBox *comboBox = qobject_cast<const QComboBox *>(w)) {
     
    42803992                const int xm = macItemFrame + maxpmw + macItemHMargin;
    42813993                QFont myFont = mi->font;
    4282                 if (mi->state & QStyle::State_Mini)
    4283                     myFont.setPointSize(mi->font.pointSize());
     3994                // myFont may not have any "hard" flags set. We override
     3995                // the point size so that when it is resolved against the device, this font will win.
     3996                // This is mainly to handle cases where someone sets the font on the window
     3997                // and then the combo inherits it and passes it onward. At that point the resolve mask
     3998                // is very, very weak. This makes it stonger.
     3999                myFont.setPointSizeF(QFontInfo(mi->font).pointSizeF());
    42844000                p->setFont(myFont);
    42854001                p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth + 1,
     
    43554071                                  Qt::AlignCenter | Qt::TextHideMnemonic | Qt::TextDontClip
    43564072                                  | Qt::TextSingleLine,
    4357                                   mi->icon.pixmap(pixelMetric(PM_SmallIconSize),
     4073                                  mi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize),
    43584074                          (mi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled));
    43594075            } else {
     
    44154131            else
    44164132                tdi.enableState = kThemeTrackActive;
    4417             HIThemeDrawTrack(&tdi, 0, cg, kHIThemeOrientationNormal);
     4133            HIThemeOrientation drawOrientation = kHIThemeOrientationNormal;
     4134            if (reverse) {
     4135                if (vertical) {
     4136                    drawOrientation = kHIThemeOrientationInverted;
     4137                } else {
     4138                    CGContextSaveGState(cg);
     4139                    CGContextTranslateCTM(cg, pb->rect.width(), 0);
     4140                    CGContextScaleCTM(cg, -1, 1);
     4141                }
     4142            }
     4143            HIThemeDrawTrack(&tdi, 0, cg, drawOrientation);
     4144            if (reverse && !vertical)
     4145                CGContextRestoreGState(cg);
    44184146        }
    44194147        break;
     
    45034231        // For unified tool bars, draw nothing.
    45044232        if (w) {
    4505             if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window()))
     4233            if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window())) {
    45064234                if (mainWindow->unifiedTitleAndToolBarOnMac())
    45074235                    break;
     4236                }
    45084237        }
    45094238
     
    45504279    }
    45514280}
    4552 /*! \reimp */
     4281
    45534282QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
    45544283                                const QWidget *widget) const
     
    48444573}
    48454574
    4846 /*! \reimp */
    48474575void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
    48484576                                   const QWidget *widget) const
     
    48754603                        // because on Tiger I only "fake" the reverse stuff.
    48764604                        bool reverseHorizontal = (slider->direction == Qt::RightToLeft
    4877                                                   && slider->orientation == Qt::Horizontal
    4878                                                   && (!slider->upsideDown
    4879                                                       || (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4
    4880                                                           && slider->upsideDown)));
     4605                                                  && slider->orientation == Qt::Horizontal);
    48814606                        if ((reverseHorizontal
    48824607                             && slider->activeSubControls == SC_ScrollBarAddLine)
     
    49134638            // there is not enough space for them.
    49144639            if (cc == CC_ScrollBar) {
    4915                 const int scrollBarLenght = (slider->orientation == Qt::Horizontal)
     4640                const int scrollBarLength = (slider->orientation == Qt::Horizontal)
    49164641                    ? slider->rect.width() : slider->rect.height();
    49174642                const QMacStyle::WidgetSizePolicy sizePolicy = widgetSizePolicy(widget);
    4918                 if (scrollBarLenght < scrollButtonsCutoffSize(thumbIndicatorCutoff, sizePolicy))
     4643                if (scrollBarLength < scrollButtonsCutoffSize(thumbIndicatorCutoff, sizePolicy))
    49194644                    tdi.attributes &= ~kThemeTrackShowThumb;
    4920                 if (scrollBarLenght < scrollButtonsCutoffSize(scrollButtonsCutoff, sizePolicy))
     4645                if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, sizePolicy))
    49214646                    tdi.enableState = kThemeTrackNothingToScroll;
    49224647            }
     
    49804705                        if (item.state & State_Open)
    49814706                            treeOpt.state |= State_Open;
    4982                         drawPrimitive(PE_IndicatorBranch, &treeOpt, p, widget);
     4707                        proxy()->drawPrimitive(PE_IndicatorBranch, &treeOpt, p, widget);
    49834708                    }
    49844709                    y += item.totalHeight;
     
    49944719                GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size);
    49954720
    4996                 QRect lineeditRect = subControlRect(CC_SpinBox, sb, SC_SpinBoxEditField, widget);
     4721                QRect lineeditRect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxEditField, widget);
    49974722                lineeditRect.adjust(-frame_size, -frame_size, +frame_size, +frame_size);
    49984723
     
    50154740                        break;
    50164741                    case QAquaSizeMini:
     4742                        bdi.kind = kThemeIncDecButtonMini;
     4743                        break;
    50174744                    case QAquaSizeSmall:
    5018                         if (aquaSize == QAquaSizeMini)
    5019                             bdi.kind = kThemeIncDecButtonMini;
    5020                         else
    5021                             bdi.kind = kThemeIncDecButtonSmall;
     4745                        bdi.kind = kThemeIncDecButtonSmall;
    50224746                        break;
    50234747                }
     
    50394763                bdi.adornment = kThemeAdornmentNone;
    50404764
    5041                 QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp,
    5042                                                  widget);
    5043                 updown |= subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
     4765                QRect updown = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
     4766
     4767                updown |= proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
    50444768                HIRect newRect = qt_hirectForQRect(updown);
    50454769                QRect off_rct;
     
    50504774                                int(outRect.size.width - newRect.size.width),
    50514775                                int(outRect.size.height - newRect.size.height));
    5052 
    5053                 // HIThemeGetButtonBackgroundBounds offsets non-focused normal sized
    5054                 // buttons by one in de y direction, account for that here.
    5055                 if (bdi.adornment == kThemeAdornmentNone && bdi.kind == kThemeIncDecButton)
    5056                     off_rct.adjust(0, 1, 0, 0);
    5057 
    5058                 // Adjust the rect for small buttos also.
    5059                 if (bdi.adornment == kThemeAdornmentFocus && bdi.kind == kThemeIncDecButtonSmall)
    5060                     off_rct.adjust(0, 0, 0, -1);
    50614776
    50624777                newRect = qt_hirectForQRect(updown, off_rct);
     
    51294844                ThemeTitleBarWidget tbw = kThemeWidgetCollapseBox;
    51304845                bool active = titlebar->state & State_Active;
    5131                 int border = 2;
    5132                 titleBarRect.origin.x += border;
    5133                 titleBarRect.origin.y -= border;
     4846                if (qMacVersion() < QSysInfo::MV_10_6) {
     4847                    int border = 2;
     4848                    titleBarRect.origin.x += border;
     4849                    titleBarRect.origin.y -= border;
     4850                }
    51344851
    51354852                while (sc <= SC_TitleBarCloseButton) {
     
    51634880                    ptrHIShapeGetBounds(titleRegion2, &tmpRect);
    51644881                    if (tmpRect.size.width != 1) {
    5165                         int iconExtent = pixelMetric(PM_SmallIconSize);
     4882                        int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
    51664883                        iw = titlebar->icon.actualSize(QSize(iconExtent, iconExtent)).width();
    51674884                    }
     
    51814898                        x += br.width() / 2 - p->fontMetrics().width(titlebar->text) / 2;
    51824899                    if (iw)
    5183                         p->drawPixmap(x - iw, y, titlebar->icon.pixmap(pixelMetric(PM_SmallIconSize), QIcon::Normal));
     4900                        p->drawPixmap(x - iw, y,
     4901                                      titlebar->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), QIcon::Normal));
    51844902                    drawItemText(p, br, Qt::AlignCenter, opt->palette, tds == kThemeStateActive,
    51854903                                    titlebar->text, QPalette::Text);
     
    52184936                tti.truncationMaxLines = 1 + groupBox->text.count(QLatin1Char('\n'));
    52194937                QCFString groupText = qt_mac_removeMnemonics(groupBox->text);
    5220                 QRect r = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
     4938                QRect r = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
    52214939                HIRect bounds = qt_hirectForQRect(r);
    52224940                HIThemeDrawTextBox(groupText, &bounds, &tti, cg, kHIThemeOrientationNormal);
     
    52314949                if (tb->subControls & SC_ToolButtonMenu) {
    52324950                    QStyleOption arrowOpt(0);
    5233                     arrowOpt.rect = subControlRect(cc, tb, SC_ToolButtonMenu, widget);
     4951                    arrowOpt.rect = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget);
    52344952                    arrowOpt.rect.setY(arrowOpt.rect.y() + arrowOpt.rect.height() / 2);
    52354953                    arrowOpt.rect.setHeight(arrowOpt.rect.height() / 2);
    52364954                    arrowOpt.state = tb->state;
    52374955                    arrowOpt.palette = tb->palette;
    5238                     drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
    5239                 } else if (tb->features & QStyleOptionToolButton::HasMenu) {
     4956                    proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
     4957                } else if ((tb->features & QStyleOptionToolButton::HasMenu)
     4958                            && (tb->toolButtonStyle != Qt::ToolButtonTextOnly && !tb->icon.isNull())) {
    52404959                    drawToolbarButtonArrow(tb->rect, tds, cg);
    52414960                }
    52424961                if (tb->state & State_On) {
    5243                     QPen oldPen = p->pen();
    5244                     p->setPen(QColor(0, 0, 0, 0x3a));
    5245                     p->fillRect(tb->rect.adjusted(1, 1, -1, -1), QColor(0, 0, 0, 0x12));
    5246                     p->drawLine(tb->rect.left() + 1, tb->rect.top(),
    5247                                 tb->rect.right() - 1, tb->rect.top());
    5248                     p->drawLine(tb->rect.left() + 1, tb->rect.bottom(),
    5249                                 tb->rect.right() - 1, tb->rect.bottom());
    5250                     p->drawLine(tb->rect.topLeft(), tb->rect.bottomLeft());
    5251                     p->drawLine(tb->rect.topRight(), tb->rect.bottomRight());
    5252                     p->setPen(oldPen);
    5253                 }
    5254                 drawControl(CE_ToolButtonLabel, opt, p, widget);
     4962                    if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
     4963                        static QPixmap pm(QLatin1String(":/trolltech/mac/style/images/leopard-unified-toolbar-on.png"));
     4964                        p->setRenderHint(QPainter::SmoothPixmapTransform);
     4965                        QStyleHelper::drawBorderPixmap(pm, p, tb->rect, 2, 2, 2, 2);
     4966                    } else {
     4967                        QPen oldPen = p->pen();
     4968                        p->setPen(QColor(0, 0, 0, 0x3a));
     4969                        p->fillRect(tb->rect.adjusted(1, 1, -1, -1), QColor(0, 0, 0, 0x12));
     4970                        p->drawLine(tb->rect.left() + 1, tb->rect.top(),
     4971                                    tb->rect.right() - 1, tb->rect.top());
     4972                        p->drawLine(tb->rect.left() + 1, tb->rect.bottom(),
     4973                                    tb->rect.right() - 1, tb->rect.bottom());
     4974                        p->drawLine(tb->rect.topLeft(), tb->rect.bottomLeft());
     4975                        p->drawLine(tb->rect.topRight(), tb->rect.bottomRight());
     4976                        p->setPen(oldPen);
     4977                    }
     4978                }
     4979                proxy()->drawControl(CE_ToolButtonLabel, opt, p, widget);
    52554980            } else {
    52564981                ThemeButtonKind bkind = kThemeBevelButton;
     
    52614986                    break;
    52624987                case QAquaSizeMini:
    5263 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) && 0
    5264                     if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_3) {
    5265                         bkind = kThemeMiniBevelButton;
    5266                         break;
    5267                     }
    5268 #endif
    52694988                case QAquaSizeSmall:
    52704989                    bkind = kThemeSmallBevelButton;
     
    52734992
    52744993                QRect button, menuarea;
    5275                 button   = subControlRect(cc, tb, SC_ToolButton, widget);
    5276                 menuarea = subControlRect(cc, tb, SC_ToolButtonMenu, widget);
     4994                button   = proxy()->subControlRect(cc, tb, SC_ToolButton, widget);
     4995                menuarea = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget);
    52774996                State bflags = tb->state,
    52784997                mflags = tb->state;
     
    53375056                    drawToolbarButtonArrow(tb->rect, tds, cg);
    53385057                }
    5339                 QRect buttonRect = subControlRect(CC_ToolButton, tb, SC_ToolButton, widget);
    5340                 int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
     5058                QRect buttonRect = proxy()->subControlRect(CC_ToolButton, tb, SC_ToolButton, widget);
     5059                int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    53415060                QStyleOptionToolButton label = *tb;
    53425061                label.rect = buttonRect.adjusted(fw, fw, -fw, -fw);
    5343                 drawControl(CE_ToolButtonLabel, &label, p, widget);
    5344             }
    5345         }
     5062                proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
     5063            }
     5064        }
     5065        break;
     5066    case CC_Dial:
     5067        if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt))
     5068            QStyleHelper::drawDial(dial, p);
    53465069        break;
    53475070    default:
     
    53515074}
    53525075
    5353 /*! \reimp */
    53545076QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc,
    53555077                                                    const QStyleOptionComplex *opt,
     
    53925114            // The arrow buttons are not drawn if the scroll bar is to short,
    53935115            // exclude them from the hit test.
    5394             const int scrollBarLenght = (sb->orientation == Qt::Horizontal)
     5116            const int scrollBarLength = (sb->orientation == Qt::Horizontal)
    53955117                ? sb->rect.width() : sb->rect.height();
    5396             if (scrollBarLenght < scrollButtonsCutoffSize(scrollButtonsCutoff, widgetSizePolicy(widget)))
     5118            if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, widgetSizePolicy(widget)))
    53975119                sbi.enableState = kThemeTrackNothingToScroll;
    53985120
     
    54825204}
    54835205
    5484 /*! \reimp */
    54855206QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc,
    54865207                                const QWidget *widget) const
     
    55135234                                                            : kControlDownButtonPart;
    55145235                    if (slider->direction == Qt::RightToLeft
    5515                         && slider->orientation == Qt::Horizontal
    5516                         && (!slider->upsideDown
    5517                             || (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4
    5518                                 && slider->upsideDown))
    5519                         ) {
     5236                        && slider->orientation == Qt::Horizontal) {
    55205237                        if (cpc == kControlDownButtonPart)
    55215238                            cpc = kControlUpButtonPart;
     
    55705287                wrc = kWindowTitleTextRgn;
    55715288            else if (sc == SC_TitleBarSysMenu)
    5572                 ret.setRect(-1024, -1024, 10, pixelMetric(PM_TitleBarHeight,
     5289                ret.setRect(-1024, -1024, 10, proxy()->pixelMetric(PM_TitleBarHeight,
    55735290                                                             titlebar, widget));
    55745291            if (wrc != kWindowGlobalPortRgn) {
     
    56065323                ret = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi);
    56075324                ret.setX(ret.x() + ret.width());
    5608                 ret.setWidth(combo->rect.width() - ret.width() - ret.x());
     5325                ret.setWidth(combo->rect.right() - ret.right());
    56095326                break; }
    56105327            case SC_ComboBoxListBoxPopup:{
     
    56125329                    HIRect inner = QMacStylePrivate::comboboxInnerBounds(qt_hirectForQRect(combo->rect), bdi.kind);
    56135330                    QRect editRect = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi);
    5614                     ret.adjust(qRound(inner.origin.x), 0, qRound(inner.origin.x + inner.size.width), editRect.y() + editRect.height() + 2);
     5331                    const int comboTop = combo->rect.top();
     5332                    ret = QRect(qRound(inner.origin.x),
     5333                                comboTop,
     5334                                qRound(inner.origin.x - combo->rect.left() + inner.size.width),
     5335                                editRect.bottom() - comboTop + 2);
    56155336                } else {
    56165337                    QRect editRect = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi);
    5617                     ret.adjust(4 - 11, 1, editRect.width() + 10 + 11, 1);
     5338                    ret = QRect(combo->rect.x() + 4 - 11,
     5339                                combo->rect.y() + 1,
     5340                                editRect.width() + 10 + 11,
     5341                                1);
    56185342                 }
    56195343                break; }
     
    56675391                QRect labelRect = alignedRect(groupBox->direction, groupBox->textAlignment,
    56685392                                              QSize(tw, h), ret);
    5669                 int indicatorWidth = pixelMetric(PM_IndicatorWidth, opt, widget);
     5393                int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, opt, widget);
    56705394                bool rtl = groupBox->direction == Qt::RightToLeft;
    56715395                if (sc == SC_GroupBoxLabel) {
     
    56895413                    int left = rtl ? labelRect.right() - indicatorWidth : labelRect.left();
    56905414                    ret.setRect(left, ret.top(),
    5691                                 indicatorWidth, pixelMetric(PM_IndicatorHeight, opt, widget));
     5415                                indicatorWidth, proxy()->pixelMetric(PM_IndicatorHeight, opt, widget));
    56925416                }
    56935417                break;
     
    57245448    case CC_SpinBox:
    57255449        if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
    5726             const int spinner_w = 14,
    5727                       fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
     5450            QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget);
     5451            int spinner_w;
     5452            int spinBoxSep;
     5453            int fw = proxy()->pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
     5454            switch (aquaSize) {
     5455            default:
     5456            case QAquaSizeUnknown:
     5457            case QAquaSizeLarge:
     5458                spinner_w = 14;
     5459                spinBoxSep = 2;
     5460                break;
     5461            case QAquaSizeSmall:
     5462                spinner_w = 12;
     5463                spinBoxSep = 2;
     5464                break;
     5465            case QAquaSizeMini:
     5466                spinner_w = 10;
     5467                spinBoxSep = 1;
     5468                break;
     5469            }
     5470
    57285471            switch (sc) {
    57295472            case SC_SpinBoxUp:
     
    57315474                if (spin->buttonSymbols == QAbstractSpinBox::NoButtons)
    57325475                    break;
    5733                 const int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
    5734                 const int spinner_w = 18;
    5735                 const int y = frameWidth;
    5736                 const int x = spin->rect.width() - spinner_w + frameWidth;
     5476
     5477                const int y = fw;
     5478                const int x = spin->rect.width() - spinner_w;
    57375479                ret.setRect(x + spin->rect.x(), y + spin->rect.y(), spinner_w, spin->rect.height() - y * 2);
    57385480                HIThemeButtonDrawInfo bdi;
    57395481                bdi.version = qt_mac_hitheme_version;
    57405482                bdi.kind = kThemeIncDecButton;
    5741                 QAquaWidgetSize aquaSize = d->aquaSizeConstrain(opt, widget);
     5483                int hackTranslateX;
    57425484                switch (aquaSize) {
    5743                     case QAquaSizeUnknown:
    5744                     case QAquaSizeLarge:
    5745                         bdi.kind = kThemeIncDecButton;
    5746                         break;
    5747                     case QAquaSizeMini:
    5748                     case QAquaSizeSmall:
    5749                         if (aquaSize == QAquaSizeMini)
    5750                             bdi.kind = kThemeIncDecButtonMini;
    5751                         else
    5752                             bdi.kind = kThemeIncDecButtonSmall;
    5753                         break;
     5485                default:
     5486                case QAquaSizeUnknown:
     5487                case QAquaSizeLarge:
     5488                    bdi.kind = kThemeIncDecButton;
     5489                    hackTranslateX = 0;
     5490                    break;
     5491                case QAquaSizeSmall:
     5492                    bdi.kind = kThemeIncDecButtonSmall;
     5493                    hackTranslateX = -2;
     5494                    break;
     5495                case QAquaSizeMini:
     5496                    bdi.kind = kThemeIncDecButtonMini;
     5497                    hackTranslateX = -1;
     5498                    break;
    57545499                }
    57555500                bdi.state = kThemeStateActive;
     
    57575502                bdi.adornment = kThemeAdornmentNone;
    57585503                HIRect hirect = qt_hirectForQRect(ret);
     5504
    57595505                HIRect outRect;
    57605506                HIThemeGetButtonBackgroundBounds(&hirect, &bdi, &outRect);
     
    57715517                    break;
    57725518                }
    5773                 ret.translate(-1, -2); // hack: position the buttons correctly (weird that we need this)
     5519                ret.translate(hackTranslateX, 0); // hack: position the buttons correctly (weird that we need this)
    57745520                ret = visualRect(spin->direction, spin->rect, ret);
    57755521                break;
    57765522            }
    57775523            case SC_SpinBoxEditField:
    5778                 ret.setRect(fw, fw,
    5779                             spin->rect.width() - spinner_w - fw * 2 - macSpinBoxSep + 1,
    5780                             spin->rect.height() - fw * 2);
     5524                if (spin->buttonSymbols == QAbstractSpinBox::NoButtons) {
     5525                    ret.setRect(fw, fw,
     5526                                spin->rect.width() - fw * 2,
     5527                                spin->rect.height() - fw * 2);
     5528                } else {
     5529                    ret.setRect(fw, fw,
     5530                                spin->rect.width() - fw * 2 - spinBoxSep - spinner_w,
     5531                                spin->rect.height() - fw * 2);
     5532                }
    57815533                ret = visualRect(spin->direction, spin->rect, ret);
    57825534                break;
     
    58005552}
    58015553
    5802 /*! \reimp */
    58035554QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
    58045555                                  const QSize &csz, const QWidget *widget) const
     
    58095560    switch (ct) {
    58105561    case QStyle::CT_SpinBox:
    5811         sz.setWidth(sz.width() + macSpinBoxSep);
    5812         sz.setHeight(sz.height() - 3); // hack to work around horrible sizeHint() code in QAbstractSpinBox
     5562         // hack to work around horrible sizeHint() code in QAbstractSpinBox
     5563        sz.setHeight(sz.height() - 3);
    58135564        break;
    58145565    case QStyle::CT_TabBarTab:
    58155566        if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) {
    5816             bool newStyleTabs =
    5817 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
    5818                 QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4 ? true :
    5819 #endif
    5820                 false;
    58215567            const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget);
    58225568            const bool differentFont = (widget && widget->testAttribute(Qt::WA_SetFont))
     
    58265572            if (vertTabs)
    58275573                sz.transpose();
    5828             if (newStyleTabs) {
    5829                 int defaultTabHeight;
    5830                 int defaultExtraSpace = pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK)
    5831                 QFontMetrics fm = opt->fontMetrics;
    5832                 switch (AquaSize) {
    5833                 case QAquaSizeUnknown:
    5834                 case QAquaSizeLarge:
    5835                     if (tab->documentMode)
    5836                         defaultTabHeight = 23;
    5837                     else
    5838                         defaultTabHeight = 21;
    5839                     break;
    5840                 case QAquaSizeSmall:
    5841                     defaultTabHeight = 18;
    5842                     break;
    5843                 case QAquaSizeMini:
    5844                     defaultTabHeight = 16;
    5845                     break;
    5846                 }
    5847 
    5848                 bool setWidth = false;
    5849                 if (differentFont || !tab->icon.isNull()) {
    5850                     sz.rheight() = qMax(defaultTabHeight, sz.height());
    5851                 } else {
    5852                     QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
    5853                     sz.rheight() = qMax(defaultTabHeight, textSize.height());
    5854                     sz.rwidth() = textSize.width() + defaultExtraSpace;
    5855                     setWidth = true;
    5856                 }
    5857 
    5858                 if (vertTabs)
    5859                     sz.transpose();
    5860 
    5861                 int maxWidgetHeight = qMax(tab->leftButtonSize.height(), tab->rightButtonSize.height());
    5862                 int maxWidgetWidth = qMax(tab->leftButtonSize.width(), tab->rightButtonSize.width());
    5863 
    5864                 int widgetWidth = 0;
    5865                 int widgetHeight = 0;
    5866                 int padding = 0;
    5867                 if (tab->leftButtonSize.isValid()) {
    5868                     padding += 8;
    5869                     widgetWidth += tab->leftButtonSize.width();
    5870                     widgetHeight += tab->leftButtonSize.height();
    5871                 }
    5872                 if (tab->rightButtonSize.isValid()) {
    5873                     padding += 8;
    5874                     widgetWidth += tab->rightButtonSize.width();
    5875                     widgetHeight += tab->rightButtonSize.height();
    5876                 }
    5877 
    5878                 if (vertTabs) {
    5879                     sz.setHeight(sz.height() + widgetHeight + padding);
    5880                     sz.setWidth(qMax(sz.width(), maxWidgetWidth));
    5881                 } else {
    5882                     if (setWidth)
    5883                         sz.setWidth(sz.width() + widgetWidth + padding);
    5884                     sz.setHeight(qMax(sz.height(), maxWidgetHeight));
    5885                 }
     5574            int defaultTabHeight;
     5575            int defaultExtraSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK)
     5576            QFontMetrics fm = opt->fontMetrics;
     5577            switch (AquaSize) {
     5578            case QAquaSizeUnknown:
     5579            case QAquaSizeLarge:
     5580                if (tab->documentMode)
     5581                    defaultTabHeight = 23;
     5582                else
     5583                    defaultTabHeight = 21;
     5584                break;
     5585            case QAquaSizeSmall:
     5586                defaultTabHeight = 18;
     5587                break;
     5588            case QAquaSizeMini:
     5589                defaultTabHeight = 16;
     5590                break;
     5591            }
     5592            bool setWidth = false;
     5593            if (differentFont || !tab->icon.isNull()) {
     5594                sz.rheight() = qMax(defaultTabHeight, sz.height());
    58865595            } else {
    5887                 SInt32 tabh = sz.height();
    5888                 SInt32 overlap = 0;
    5889                 switch (AquaSize) {
    5890                 default:
    5891                 case QAquaSizeUnknown:
    5892                 case QAquaSizeLarge:
    5893                     GetThemeMetric(kThemeLargeTabHeight, &tabh);
    5894                     GetThemeMetric(kThemeMetricTabFrameOverlap, &overlap);
    5895                     break;
    5896                 case QAquaSizeMini:
    5897                     GetThemeMetric(kThemeMetricMiniTabHeight, &tabh);
    5898                     GetThemeMetric(kThemeMetricMiniTabFrameOverlap, &overlap);
    5899                     break;
    5900                 case QAquaSizeSmall:
    5901                     GetThemeMetric(kThemeSmallTabHeight, &tabh);
    5902                     GetThemeMetric(kThemeMetricSmallTabFrameOverlap, &overlap);
    5903                     break;
    5904                 }
    5905                 tabh += overlap;
    5906                 if (sz.height() < tabh)
    5907                     sz.rheight() = tabh;
     5596                QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
     5597                sz.rheight() = qMax(defaultTabHeight, textSize.height());
     5598                sz.rwidth() = textSize.width() + defaultExtraSpace;
     5599                setWidth = true;
     5600            }
     5601
     5602            if (vertTabs)
     5603                sz.transpose();
     5604
     5605            int maxWidgetHeight = qMax(tab->leftButtonSize.height(), tab->rightButtonSize.height());
     5606            int maxWidgetWidth = qMax(tab->leftButtonSize.width(), tab->rightButtonSize.width());
     5607
     5608            int widgetWidth = 0;
     5609            int widgetHeight = 0;
     5610            int padding = 0;
     5611            if (tab->leftButtonSize.isValid()) {
     5612                padding += 8;
     5613                widgetWidth += tab->leftButtonSize.width();
     5614                widgetHeight += tab->leftButtonSize.height();
     5615            }
     5616            if (tab->rightButtonSize.isValid()) {
     5617                padding += 8;
     5618                widgetWidth += tab->rightButtonSize.width();
     5619                widgetHeight += tab->rightButtonSize.height();
     5620            }
     5621
     5622            if (vertTabs) {
     5623                sz.setHeight(sz.height() + widgetHeight + padding);
     5624                sz.setWidth(qMax(sz.width(), maxWidgetWidth));
     5625            } else {
     5626                if (setWidth)
     5627                    sz.setWidth(sz.width() + widgetWidth + padding);
     5628                sz.setHeight(qMax(sz.height(), maxWidgetHeight));
    59085629            }
    59095630        }
     
    59355656                        maxpmw = qMax(maxpmw, iconSize.width());
    59365657                    } else {
    5937                         int iconExtent = pixelMetric(PM_SmallIconSize);
     5658                        int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
    59385659                        h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4);
    59395660                    }
     
    59645685        break;
    59655686    case CT_ToolButton:
     5687        if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) {
     5688            sz.rwidth() += 4;
     5689            if (sz.height() <= 32) {
     5690                // Workaround strange HIToolBar bug when getting constraints.
     5691                sz.rheight() += 1;
     5692            }
     5693            return sz;
     5694        }
    59665695        sz.rwidth() += 10;
    59675696        sz.rheight() += 10;
     
    59745703        QStyleOption myOption = *opt;
    59755704        myOption.rect.setSize(sz);
    5976         if (styleHint(SH_Menu_Mask, &myOption, widget, &menuMask)) {
     5705        if (proxy()->styleHint(SH_Menu_Mask, &myOption, widget, &menuMask)) {
    59775706            sz = menuMask.region.boundingRect().size();
    59785707        }
     
    60875816}
    60885817
    6089 /*!
    6090     \reimp
    6091 */
    60925818void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal,
    60935819                             bool enabled, const QString &text, QPalette::ColorRole textRole) const
     
    60985824}
    60995825
    6100 /*!
    6101   \reimp
    6102 */
    61035826bool QMacStyle::event(QEvent *e)
    61045827{
     
    61495872}
    61505873
    6151 void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon, QStyle::StandardPixmap standardIcon = QStyle::SP_CustomBase)
    6152 {
    6153     int size = 16;
    6154     while (size <= 128) {
    6155 
    6156         const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size);
    6157         QPixmap mainIcon;
    6158         if (standardIcon >= QStyle::SP_CustomBase) {
    6159             mainIcon = qt_mac_convert_iconref(icon, size, size);
    6160         } else if (QPixmapCache::find(cacheKey, mainIcon) == false) {
    6161             mainIcon = qt_mac_convert_iconref(icon, size, size);
    6162             QPixmapCache::insert(cacheKey, mainIcon);
    6163         }
    6164 
    6165         if (overlayIcon) {
    6166             int littleSize = size / 2;
    6167             QPixmap overlayPix = qt_mac_convert_iconref(overlayIcon, littleSize, littleSize);
    6168             QPainter painter(&mainIcon);
    6169             painter.drawPixmap(size - littleSize, size - littleSize, overlayPix);
    6170         }
    6171 
    6172         retIcon->addPixmap(mainIcon);
    6173         size += size;  // 16 -> 32 -> 64 -> 128
    6174     }
    6175 }
    6176 
    6177 /*!
    6178     \internal
    6179 */
    61805874QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt,
    61815875                                            const QWidget *widget) const
    61825876{
    6183     OSType iconType = 0;
    61845877    switch (standardIcon) {
    6185     case QStyle::SP_MessageBoxQuestion:
    6186     case QStyle::SP_MessageBoxInformation:
    6187     case QStyle::SP_MessageBoxWarning:
    6188     case QStyle::SP_MessageBoxCritical:
    6189         iconType = kGenericApplicationIcon;
    6190         break;
    6191     case SP_DesktopIcon:
    6192         iconType = kDesktopIcon;
    6193         break;
    6194     case SP_TrashIcon:
    6195         iconType = kTrashIcon;
    6196         break;
    6197 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
    6198     case SP_ComputerIcon:
    6199         iconType = kComputerIcon;
    6200         break;
    6201 #endif
    6202     case SP_DriveFDIcon:
    6203         iconType = kGenericFloppyIcon;
    6204         break;
    6205     case SP_DriveHDIcon:
    6206         iconType = kGenericHardDiskIcon;
    6207         break;
    6208     case SP_DriveCDIcon:
    6209     case SP_DriveDVDIcon:
    6210         iconType = kGenericCDROMIcon;
    6211         break;
    6212     case SP_DriveNetIcon:
    6213         iconType = kGenericNetworkIcon;
    6214         break;
    6215     case SP_DirOpenIcon:
    6216         iconType = kOpenFolderIcon;
    6217         break;
    6218     case SP_DirClosedIcon:
    6219     case SP_DirLinkIcon:
    6220         iconType = kGenericFolderIcon;
    6221         break;
    6222     case SP_FileLinkIcon:
    6223     case SP_FileIcon:
    6224         iconType = kGenericDocumentIcon;
    6225         break;
     5878    default:
     5879        return QWindowsStyle::standardIconImplementation(standardIcon, opt, widget);
    62265880    case SP_ToolBarHorizontalExtensionButton:
    62275881    case SP_ToolBarVerticalExtensionButton: {
     
    62375891        }
    62385892        return pixmap;
    6239         }
    6240         break;
    6241     case SP_DirIcon: {
    6242         // A rather special case
    6243         QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, opt, widget);
    6244         QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, opt, widget);
    6245         closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On);
    6246         closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On);
    6247         closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On);
    6248         closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On);
    6249         return closeIcon;
    6250     }
    6251     case SP_TitleBarNormalButton:
    6252     case SP_TitleBarCloseButton: {
    6253         QIcon titleBarIcon;
    6254         if (standardIcon == SP_TitleBarCloseButton) {
    6255             titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png"));
    6256             titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
    6257         } else {
    6258             titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png"));
    6259             titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
    6260         }
    6261         return titleBarIcon;
    6262     }
    6263     default:
    6264         break;
    6265     }
    6266     if (iconType != 0) {
    6267         QIcon retIcon;
    6268         IconRef icon;
    6269         IconRef overlayIcon = 0;
    6270         if (iconType != kGenericApplicationIcon) {
    6271             GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
    6272         } else {
    6273             FSRef fsRef;
    6274             ProcessSerialNumber psn = { 0, kCurrentProcess };
    6275             GetProcessBundleLocation(&psn, &fsRef);
    6276             GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
    6277             if (standardIcon == SP_MessageBoxCritical) {
    6278                 overlayIcon = icon;
    6279                 GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
    6280             }
    6281         }
    6282         if (icon) {
    6283             qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon);
    6284             ReleaseIconRef(icon);
    6285         }
    6286         if (overlayIcon)
    6287             ReleaseIconRef(overlayIcon);
    6288         return retIcon;
    6289     }
    6290     return QWindowsStyle::standardIconImplementation(standardIcon, opt, widget);
    6291 }
    6292 
    6293 /*!
    6294   \internal
    6295 */
     5893    }
     5894    }
     5895}
     5896
    62965897int QMacStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1,
    62975898                                           QSizePolicy::ControlType control2,
  • trunk/src/gui/styles/qmacstylepixmaps_mac_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5050// We mean it.
    5151//
    52 
    53 static const char *const qt_mac_tabnrm_left[]={
    54 "6 22 71 2",
    55 "#a c #5f5f5f",
    56 "## c #6d6d6d",
    57 ".c c #737373",
    58 ".d c #757575",
    59 ".b c #7c7c7c",
    60 ".n c #7d7d7d",
    61 ".r c #828282",
    62 ".f c #838383",
    63 "#. c #878787",
    64 ".7 c #8c8c8c",
    65 ".v c #8e8e8e",
    66 ".4 c #939393",
    67 ".1 c #969696",
    68 ".j c #979797",
    69 ".a c #9a9a9a",
    70 ".6 c #9b9b9b",
    71 ".A c #a0a0a0",
    72 ".Z c #a6a6a6",
    73 ".C c #aaaaaa",
    74 ".3 c #aeaeae",
    75 ".E c #afafaf",
    76 ".J c #b3b3b3",
    77 ".8 c #b7b7b7",
    78 ".o c #b8b8b8",
    79 ".g c #b9b9b9",
    80 ".P c #bcbcbc",
    81 ".R c #bfbfbf",
    82 ".T c #c2c2c2",
    83 ".s c #c4c4c4",
    84 "#e c #c6c6c6",
    85 ".V c #c7c7c7",
    86 ".w c #c9c9c9",
    87 ".B c #cacaca",
    88 "#d c #cbcbcb",
    89 ".z c #cecece",
    90 ".F c #cfcfcf",
    91 ".5 c #d1d1d1",
    92 "#c c #d3d3d3",
    93 ".K c #d4d4d4",
    94 ".G c #d5d5d5",
    95 ".Q c #d6d6d6",
    96 ".S c #d8d8d8",
    97 ".U c #dadada",
    98 ".2 c #dbdbdb",
    99 ".L c #dcdcdc",
    100 ".H c #dedede",
    101 ".I c #dfdfdf",
    102 ".M c #e0e0e0",
    103 ".X c #e1e1e1",
    104 ".D c #e2e2e2",
    105 "#b c #e3e3e3",
    106 ".O c #e4e4e4",
    107 ".N c #e6e6e6",
    108 ".9 c #e7e7e7",
    109 ".e c #e8e8e8",
    110 ".# c #e9e9e9",
    111 ".t c #ebebeb",
    112 "Qt c #ececec",
    113 ".p c #ededed",
    114 ".x c #eeeeee",
    115 ".y c #efefef",
    116 ".u c #f1f1f1",
    117 ".k c #f2f2f2",
    118 ".q c #f3f3f3",
    119 ".W c #f6f6f6",
    120 ".l c #f7f7f7",
    121 ".m c #f8f8f8",
    122 ".Y c #f9f9f9",
    123 ".h c #fcfcfc",
    124 ".i c #fdfdfd",
    125 ".0 c #ffffff",
    126 "Qt.#.a.b.c.d",
    127 ".e.f.gQt.h.i",
    128 ".j.a.k.l.m.m",
    129 ".n.o.p.k.q.q",
    130 ".r.s.t.u.u.u",
    131 ".v.w.t.x.y.y",
    132 ".a.z.#.p.x.x",
    133 ".A.B.#.t.x.p",
    134 ".C.B.D.t.x.x",
    135 ".E.F.G.H.I.I",
    136 ".J.K.L.M.N.O",
    137 ".P.Q.D.#.e.#",
    138 ".R.S.O.p.x.p",
    139 ".T.U.#.u.u.k",
    140 ".V.I.t.q.W.W",
    141 ".P.X.k.W.Y.Y",
    142 ".Z.M.u.Y.0.0",
    143 ".1.2.l.0.0.0",
    144 ".3.4.m.0.0.0",
    145 ".5.6.7.8.9.0",
    146 ".X.5.3#.###a",
    147 ".O#b.L#c#d#e"};
    148 
    149 static const char *const qt_mac_tabnrm_mid[]={
    150 "6 22 18 1",
    151 "n c #585858",
    152 ". c #777777",
    153 "p c #c2c2c2",
    154 "o c #c3c3c3",
    155 "g c #dedede",
    156 "h c #e5e5e5",
    157 "i c #e8e8e8",
    158 "f c #ededed",
    159 "e c #eeeeee",
    160 "d c #efefef",
    161 "c c #f1f1f1",
    162 "b c #f3f3f3",
    163 "j c #f6f6f6",
    164 "a c #f8f8f8",
    165 "k c #f9f9f9",
    166 "# c #fdfdfd",
    167 "l c #fefefe",
    168 "m c #ffffff",
    169 "......",
    170 "######",
    171 "aaaaaa",
    172 "bbbbbb",
    173 "cccccc",
    174 "dddddd",
    175 "eeeeee",
    176 "ffffff",
    177 "eeeeee",
    178 "gggggg",
    179 "hhhhhh",
    180 "iiiiii",
    181 "eeeeee",
    182 "cccccc",
    183 "jjjjjj",
    184 "kkkkkk",
    185 "llllll",
    186 "mmmmmm",
    187 "mmmmmm",
    188 "mmmmmm",
    189 "nnnnnn",
    190 "oppooo"};
    191 
    192 static const char *const qt_mac_tabnrm_right[]={
    193 "6 22 70 2",
    194 ".9 c #5f5f5f",
    195 "#. c #6d6d6d",
    196 ".# c #747474",
    197 "Qt c #757575",
    198 ".a c #7c7c7c",
    199 ".p c #7d7d7d",
    200 ".t c #828282",
    201 ".h c #838383",
    202 "## c #888888",
    203 ".6 c #8c8c8c",
    204 ".x c #8e8e8e",
    205 ".3 c #929292",
    206 ".2 c #969696",
    207 ".l c #979797",
    208 ".b c #9a9a9a",
    209 ".7 c #9b9b9b",
    210 ".A c #a0a0a0",
    211 ".0 c #a6a6a6",
    212 ".C c #aaaaaa",
    213 "#a c #aeaeae",
    214 ".H c #afafaf",
    215 ".N c #b3b3b3",
    216 ".5 c #b7b7b7",
    217 ".o c #b8b8b8",
    218 ".g c #b9b9b9",
    219 ".Q c #bcbcbc",
    220 ".S c #bfbfbf",
    221 ".U c #c2c2c2",
    222 ".s c #c4c4c4",
    223 "#b c #c6c6c6",
    224 ".W c #c7c7c7",
    225 ".w c #c9c9c9",
    226 ".z c #cacaca",
    227 ".y c #cecece",
    228 ".G c #cfcfcf",
    229 ".8 c #d1d1d1",
    230 "#c c #d3d3d3",
    231 ".M c #d4d4d4",
    232 ".F c #d5d5d5",
    233 ".P c #d6d6d6",
    234 ".R c #d8d8d8",
    235 ".T c #dadada",
    236 ".1 c #dbdbdb",
    237 ".L c #dcdcdc",
    238 ".E c #dedede",
    239 ".D c #dfdfdf",
    240 ".K c #e0e0e0",
    241 ".Y c #e1e1e1",
    242 ".B c #e2e2e2",
    243 ".I c #e4e4e4",
    244 "#d c #e5e5e5",
    245 ".J c #e6e6e6",
    246 ".4 c #e7e7e7",
    247 ".O c #e8e8e8",
    248 ".c c #e9e9e9",
    249 ".r c #ebebeb",
    250 ".d c #ececec",
    251 ".n c #ededed",
    252 ".v c #eeeeee",
    253 ".u c #efefef",
    254 ".q c #f1f1f1",
    255 ".k c #f2f2f2",
    256 ".m c #f3f3f3",
    257 ".V c #f6f6f6",
    258 ".j c #f7f7f7",
    259 ".i c #f8f8f8",
    260 ".X c #f9f9f9",
    261 ".f c #fcfcfc",
    262 ".e c #fdfdfd",
    263 ".Z c #ffffff",
    264 "Qt.#.a.b.c.d",
    265 ".e.f.d.g.h.c",
    266 ".i.i.j.k.b.l",
    267 ".m.m.k.n.o.p",
    268 ".q.q.q.r.s.t",
    269 ".u.u.v.r.w.x",
    270 ".v.v.n.c.y.b",
    271 ".n.v.r.c.z.A",
    272 ".v.v.r.B.z.C",
    273 ".D.D.E.F.G.H",
    274 ".I.J.K.L.M.N",
    275 ".c.O.c.B.P.Q",
    276 ".n.v.n.I.R.S",
    277 ".k.q.q.c.T.U",
    278 ".V.V.m.r.D.W",
    279 ".X.X.V.k.Y.Q",
    280 ".Z.Z.X.q.K.0",
    281 ".Z.Z.Z.j.1.2",
    282 ".Z.Z.Z.i.3.H",
    283 ".Z.4.5.6.7.8",
    284 ".9#.###a.8.B",
    285 "#b.z#c.L.I#d"};
    286 
    287 static const char *const qt_mac_tabselected_active_left[]={
    288 "6 22 130 2",
    289 ".d c #000069",
    290 ".C c #0042b4",
    291 ".I c #0157bb",
    292 ".w c #0c28a0",
    293 ".l c #101094",
    294 ".O c #1163c4",
    295 ".c c #1a1a6e",
    296 ".U c #1e6ec9",
    297 ".r c #214eb7",
    298 ".x c #256cc9",
    299 ".0 c #2877ce",
    300 ".6 c #347fd1",
    301 ".D c #3981d2",
    302 "#a c #3a81d2",
    303 "#g c #418ad7",
    304 ".J c #4288d4",
    305 ".q c #45459b",
    306 ".V c #458cd5",
    307 ".g c #46469f",
    308 ".P c #4a8dd7",
    309 ".1 c #4a90db",
    310 "#m c #4b91db",
    311 "#s c #4e91dc",
    312 "#y c #4f8dcd",
    313 ".7 c #5195df",
    314 ".b c #525280",
    315 "#E c #5984b2",
    316 "#b c #5b9be1",
    317 "#R c #5c7e9f",
    318 ".2 c #5d9de6",
    319 "#5 c #5f5f5f",
    320 "#Y c #627c8d",
    321 "#h c #65a4e7",
    322 ".3 c #65a6e8",
    323 ".8 c #67a6eb",
    324 "#n c #69a6e8",
    325 "#c c #6cabed",
    326 "#4 c #6d6d6d",
    327 ".4 c #6dacee",
    328 ".5 c #6eabee",
    329 "#K c #6f87a1",
    330 "#L c #70aff1",
    331 ".9 c #70aff2",
    332 "#t c #71aced",
    333 "#z c #72afee",
    334 "#F c #72afef",
    335 ".f c #757592",
    336 "#i c #75b3f4",
    337 "#d c #75b4f3",
    338 "#Z c #77a6b3",
    339 "#. c #77b1f4",
    340 "## c #7ab4f4",
    341 ".W c #7cb0e7",
    342 "#o c #7cb8f9",
    343 "#f c #80bdf9",
    344 "#e c #81bbf9",
    345 "#j c #81bbfc",
    346 "#u c #86c1ff",
    347 "#3 c #878787",
    348 "#k c #89c2fd",
    349 "#A c #89c3ff",
    350 ".Q c #8bb9e8",
    351 "#l c #8bc4ff",
    352 "#p c #8bc6ff",
    353 "#G c #8dc7ff",
    354 ".K c #8ebae8",
    355 "#S c #8ecbff",
    356 "#q c #91c8ff",
    357 "#M c #92ccff",
    358 "#v c #93ccff",
    359 ".k c #9494b0",
    360 "#r c #94caff",
    361 ".E c #96bde8",
    362 ".X c #96c3ee",
    363 "#w c #96cfff",
    364 "#B c #97cfff",
    365 ".Y c #99c4ee",
    366 "#x c #99d0ff",
    367 ".a c #9a9aa4",
    368 "#X c #9b9b9b",
    369 ".s c #9bbee8",
    370 ".R c #9bc4ee",
    371 ".T c #9cc5ee",
    372 ".Z c #9dc7ef",
    373 "#C c #9dd3ff",
    374 ".y c #9ec3e8",
    375 ".L c #9ec3ed",
    376 ".M c #9ec5ed",
    377 "#H c #9ed6ff",
    378 ".S c #9fc5ee",
    379 "#D c #a1d7ff",
    380 ".N c #a3c8ed",
    381 "#N c #a3daff",
    382 ".F c #a5c8ed",
    383 ".G c #a7c9ed",
    384 "#J c #a7ddff",
    385 "#I c #a7deff",
    386 ".H c #a8caee",
    387 "#T c #a8e0ff",
    388 "#0 c #a8e2e6",
    389 ".z c #a9caed",
    390 "#O c #abe3ff",
    391 ".A c #adcbed",
    392 "#P c #ade3ff",
    393 "#Q c #aeaeae",
    394 ".m c #afbbe7",
    395 ".B c #afccee",
    396 "#U c #b0e9ff",
    397 ".t c #b3d1ed",
    398 "#V c #b5ebff",
    399 ".u c #bad4ee",
    400 ".v c #bbd4ef",
    401 ".h c #bfc2e8",
    402 "#1 c #bffdff",
    403 "a# c #c6c6c6",
    404 "a. c #cbcbcb",
    405 ".n c #cbddf2",
    406 ".o c #cce0f3",
    407 ".p c #cfe1f4",
    408 "#W c #d1d1d1",
    409 "#9 c #d3d3d3",
    410 "#8 c #dcdcdc",
    411 "#2 c #e1e1e1",
    412 "#7 c #e3e3e3",
    413 "#6 c #e4e4e4",
    414 ".i c #e6e9f6",
    415 ".e c #e8e8e8",
    416 ".# c #e9e9e9",
    417 ".j c #e9edf8",
    418 "Qt c #ececec",
    419 "Qt.#.a.b.c.d",
    420 ".e.f.g.h.i.j",
    421 ".k.l.m.n.o.p",
    422 ".q.r.s.t.u.v",
    423 ".w.x.y.z.A.B",
    424 ".C.D.E.F.G.H",
    425 ".I.J.K.L.M.N",
    426 ".O.P.Q.R.S.T",
    427 ".U.V.W.X.Y.Z",
    428 ".0.1.2.3.4.5",
    429 ".6.7.8.9#.##",
    430 "#a#b#c#d#e#f",
    431 "#g#h#i#j#k#l",
    432 "#m#n#o#p#q#r",
    433 "#s#t#u#v#w#x",
    434 "#y#z#A#B#C#D",
    435 "#E#F#G#H#I#J",
    436 "#K#L#M#N#O#P",
    437 "#Q#R#S#T#U#V",
    438 "#W#X#Y#Z#0#1",
    439 "#2#W#Q#3#4#5",
    440 "#6#7#8#9a.a#"};
    441 
    442 static const char *const qt_mac_tabselected_active_mid[]={
    443 "6 22 23 1",
    444 ". c #00006d",
    445 "s c #585858",
    446 "h c #70adef",
    447 "i c #7bb5f5",
    448 "j c #83bcf9",
    449 "k c #8bc3ff",
    450 "l c #93c9ff",
    451 "m c #9ad1ff",
    452 "f c #9ec5ef",
    453 "g c #9ec7f0",
    454 "n c #a0d6ff",
    455 "e c #a2c7ed",
    456 "d c #a8caee",
    457 "o c #a8deff",
    458 "p c #ade2ff",
    459 "c c #afceee",
    460 "q c #b6ecff",
    461 "b c #bbd5f0",
    462 "r c #c1feff",
    463 "u c #c2c2c2",
    464 "t c #c3c3c3",
    465 "a c #cfe1f3",
    466 "# c #e9edf8",
    467 "......",
    468 "######",
    469 "aaaaaa",
    470 "bbbbbb",
    471 "cccccc",
    472 "dddddd",
    473 "eeeeee",
    474 "ffffff",
    475 "gggggg",
    476 "hhhhhh",
    477 "iiiiii",
    478 "jjjjjj",
    479 "kkkkkk",
    480 "llllll",
    481 "mmmmmm",
    482 "nnnnnn",
    483 "oooooo",
    484 "pppppp",
    485 "qqqqqq",
    486 "rrrrrr",
    487 "ssssss",
    488 "ttttuu"};
    489 
    490 static const char *const qt_mac_tabselected_active_right[]={
    491 "6 22 128 2",
    492 "Qt c #000069",
    493 ".G c #0042b4",
    494 ".M c #0157bb",
    495 ".A c #0c28a0",
    496 ".n c #101094",
    497 ".S c #1163c4",
    498 ".# c #1b1b6e",
    499 ".Y c #1e6ec9",
    500 ".t c #214eb7",
    501 ".z c #256cc9",
    502 ".4 c #2877ce",
    503 "#. c #347fd1",
    504 ".F c #3981d2",
    505 "#e c #3a81d2",
    506 "#k c #418ad7",
    507 ".L c #4288d4",
    508 ".u c #45459b",
    509 ".X c #458cd5",
    510 ".h c #46469f",
    511 ".R c #4a8dd7",
    512 ".3 c #4a90db",
    513 "#q c #4b91db",
    514 "#w c #4e91dc",
    515 "#C c #4f8dcd",
    516 ".9 c #5195df",
    517 ".a c #525280",
    518 "#I c #5984b2",
    519 "#T c #5b7d9f",
    520 "#d c #5b9be1",
    521 ".2 c #5d9de6",
    522 "#1 c #5f5f5f",
    523 "#Y c #627c8d",
    524 "#j c #65a4e7",
    525 ".1 c #65a6e8",
    526 ".8 c #67a6eb",
    527 "#p c #69a6e8",
    528 "#c c #6cabed",
    529 "#2 c #6d6d6d",
    530 ".0 c #6dacee",
    531 ".Z c #6eabee",
    532 "#O c #6f87a1",
    533 "#N c #70aff1",
    534 ".7 c #70aff2",
    535 "#v c #71aced",
    536 "#B c #72afee",
    537 "#H c #72afef",
    538 ".i c #757592",
    539 "#i c #75b3f4",
    540 "#b c #75b4f3",
    541 "#X c #77a6b3",
    542 ".6 c #77b1f4",
    543 ".5 c #7ab4f4",
    544 ".W c #7cb0e7",
    545 "#o c #7cb8f9",
    546 "## c #80bdf9",
    547 "#a c #81bbf9",
    548 "#h c #81bbfc",
    549 "#u c #86c1ff",
    550 "#3 c #888888",
    551 "#g c #89c2fd",
    552 "#A c #89c3ff",
    553 ".Q c #8bb9e8",
    554 "#f c #8bc4ff",
    555 "#n c #8bc6ff",
    556 "#G c #8dc7ff",
    557 ".K c #8ebae8",
    558 "#S c #8ecbff",
    559 "#m c #91c8ff",
    560 "#M c #92ccff",
    561 "#t c #93ccff",
    562 ".o c #9494b0",
    563 "#l c #94caff",
    564 ".E c #96bde8",
    565 ".V c #96c3ee",
    566 "#s c #96cfff",
    567 "#z c #97cfff",
    568 ".U c #99c4ee",
    569 "#r c #99d0ff",
    570 ".b c #9a9aa4",
    571 "#Z c #9b9b9b",
    572 ".s c #9bbee8",
    573 ".P c #9bc4ee",
    574 ".N c #9cc5ee",
    575 ".T c #9dc7ef",
    576 "#y c #9dd3ff",
    577 ".y c #9ec3e8",
    578 ".J c #9ec3ed",
    579 ".I c #9ec5ed",
    580 "#F c #9ed6ff",
    581 ".O c #9fc5ee",
    582 "#x c #a1d7ff",
    583 ".H c #a3c8ed",
    584 "#L c #a3daff",
    585 ".D c #a5c8ed",
    586 ".C c #a7c9ed",
    587 "#D c #a7ddff",
    588 "#E c #a7deff",
    589 ".B c #a8caee",
    590 "#R c #a8e0ff",
    591 "#W c #a8e2e6",
    592 ".x c #a9caed",
    593 "#K c #abe3ff",
    594 ".w c #adcbed",
    595 "#J c #ade3ff",
    596 "#U c #aeaeae",
    597 ".m c #afbbe7",
    598 ".v c #afccee",
    599 "#Q c #b0e9ff",
    600 ".r c #b3d1ed",
    601 "#P c #b5ebff",
    602 ".q c #bad4ee",
    603 ".p c #bbd4ef",
    604 ".g c #bfc2e8",
    605 "#V c #bffdff",
    606 "#5 c #c6c6c6",
    607 "#6 c #cacaca",
    608 ".l c #cbddf2",
    609 ".k c #cce0f3",
    610 ".j c #cfe1f4",
    611 "#0 c #d1d1d1",
    612 "#7 c #d3d3d3",
    613 "#8 c #dcdcdc",
    614 "#4 c #e2e2e2",
    615 "#9 c #e4e4e4",
    616 ".f c #e6e9f6",
    617 ".c c #e9e9e9",
    618 ".e c #e9edf8",
    619 ".d c #ececec",
    620 "Qt.#.a.b.c.d",
    621 ".e.f.g.h.i.c",
    622 ".j.k.l.m.n.o",
    623 ".p.q.r.s.t.u",
    624 ".v.w.x.y.z.A",
    625 ".B.C.D.E.F.G",
    626 ".H.I.J.K.L.M",
    627 ".N.O.P.Q.R.S",
    628 ".T.U.V.W.X.Y",
    629 ".Z.0.1.2.3.4",
    630 ".5.6.7.8.9#.",
    631 "###a#b#c#d#e",
    632 "#f#g#h#i#j#k",
    633 "#l#m#n#o#p#q",
    634 "#r#s#t#u#v#w",
    635 "#x#y#z#A#B#C",
    636 "#D#E#F#G#H#I",
    637 "#J#K#L#M#N#O",
    638 "#P#Q#R#S#T#U",
    639 "#V#W#X#Y#Z#0",
    640 "#1#2#3#U#0#4",
    641 "#5#6#7#8#9#9"};
    642 
    643 static const char *const qt_mac_tabselected_inactive_left[]={
    644 "6 22 64 1",
    645 "9 c #656565",
    646 "8 c #737373",
    647 "c c #767676",
    648 "b c #808080",
    649 "n c #818181",
    650 "q c #828282",
    651 "e c #888888",
    652 "7 c #8b8b8b",
    653 "u c #8d8d8d",
    654 "3 c #939393",
    655 "k c #979797",
    656 "0 c #989898",
    657 "j c #9b9b9b",
    658 "A c #9d9d9d",
    659 "a c #9e9e9e",
    660 "4 c #9f9f9f",
    661 "Y c #a3a3a3",
    662 "C c #a6a6a6",
    663 "E c #aaaaaa",
    664 "J c #aeaeae",
    665 "6 c #b0b0b0",
    666 "2 c #b1b1b1",
    667 "o c #b2b2b2",
    668 "f c #b3b3b3",
    669 "O c #b6b6b6",
    670 "Q c #b9b9b9",
    671 "S c #bbbbbb",
    672 "r c #bdbdbd",
    673 "U c #c0c0c0",
    674 "v c #c2c2c2",
    675 "B c #c3c3c3",
    676 "y c #c6c6c6",
    677 "F c #c7c7c7",
    678 "K c #cccccc",
    679 "G c #cdcdcd",
    680 "R c #cfcfcf",
    681 "T c #d1d1d1",
    682 "1 c #d2d2d2",
    683 "L c #d3d3d3",
    684 "H c #d5d5d5",
    685 "I c #d6d6d6",
    686 "W c #d7d7d7",
    687 "D c #d8d8d8",
    688 "N c #dadada",
    689 "M c #dcdcdc",
    690 "5 c #dddddd",
    691 "P c #dedede",
    692 "z c #dfdfdf",
    693 "s c #e0e0e0",
    694 "g c #e1e1e1",
    695 "p c #e2e2e2",
    696 "w c #e3e3e3",
    697 "x c #e4e4e4",
    698 "t c #e6e6e6",
    699 "l c #e7e7e7",
    700 "d c #e8e8e8",
    701 "# c #e9e9e9",
    702 "V c #eaeaea",
    703 "m c #ebebeb",
    704 ". c #ececec",
    705 "X c #ededed",
    706 "h c #f0f0f0",
    707 "i c #f1f1f1",
    708 "Z c #f2f2f2",
    709 ".#abcc",
    710 "defghi",
    711 "jklm..",
    712 "nopldd",
    713 "qrsttt",
    714 "uvswxx",
    715 "kyzpww",
    716 "ABzswp",
    717 "CBDsww",
    718 "EFGHII",
    719 "JKLIMN",
    720 "OGDzPz",
    721 "QRNpwp",
    722 "STzttl",
    723 "UIsdVV",
    724 "OWlVXX",
    725 "YItXZZ",
    726 "01mZZZ",
    727 "23.ZZZ",
    728 "T4uo5Z",
    729 "gT6789",
    730 "xwMLKF"};
    731 
    732 static const char *const qt_mac_tabselected_inactive_mid[]={
    733 "6 22 17 1",
    734 "m c #5f5f5f",
    735 ". c #787878",
    736 "o c #c3c3c3",
    737 "n c #c4c4c4",
    738 "g c #d5d5d5",
    739 "h c #dbdbdb",
    740 "i c #dedede",
    741 "f c #e2e2e2",
    742 "e c #e3e3e3",
    743 "d c #e4e4e4",
    744 "c c #e6e6e6",
    745 "b c #e8e8e8",
    746 "j c #eaeaea",
    747 "a c #ececec",
    748 "k c #ededed",
    749 "# c #f1f1f1",
    750 "l c #f2f2f2",
    751 "......",
    752 "######",
    753 "aaaaaa",
    754 "bbbbbb",
    755 "cccccc",
    756 "dddddd",
    757 "eeeeee",
    758 "ffffff",
    759 "eeeeee",
    760 "gggggg",
    761 "hhhhhh",
    762 "iiiiii",
    763 "eeeeee",
    764 "cccccc",
    765 "jjjjjj",
    766 "kkkkkk",
    767 "llllll",
    768 "llllll",
    769 "llllll",
    770 "llllll",
    771 "mmmmmm",
    772 "nnnnno"};
    773 
    774 static const char *const qt_mac_tabselected_inactive_right[]={
    775 "6 22 65 2",
    776 ".6 c #656565",
    777 ".7 c #737373",
    778 "Qt c #767676",
    779 ".# c #808080",
    780 ".p c #818181",
    781 ".t c #828282",
    782 ".h c #888888",
    783 ".8 c #8c8c8c",
    784 ".x c #8d8d8d",
    785 ".2 c #929292",
    786 ".k c #979797",
    787 ".1 c #989898",
    788 ".l c #9b9b9b",
    789 ".B c #9d9d9d",
    790 ".a c #9e9e9e",
    791 ".5 c #9f9f9f",
    792 ".Z c #a3a3a3",
    793 ".D c #a6a6a6",
    794 ".I c #aaaaaa",
    795 ".N c #aeaeae",
    796 ".9 c #b0b0b0",
    797 ".3 c #b1b1b1",
    798 ".o c #b2b2b2",
    799 ".g c #b3b3b3",
    800 ".P c #b6b6b6",
    801 ".R c #b9b9b9",
    802 ".T c #bbbbbb",
    803 ".s c #bdbdbd",
    804 ".V c #c0c0c0",
    805 ".w c #c2c2c2",
    806 ".A c #c3c3c3",
    807 ".z c #c6c6c6",
    808 ".H c #c7c7c7",
    809 "#. c #cbcbcb",
    810 ".M c #cccccc",
    811 ".G c #cdcdcd",
    812 ".Q c #cfcfcf",
    813 ".S c #d1d1d1",
    814 ".0 c #d2d2d2",
    815 ".L c #d3d3d3",
    816 ".F c #d5d5d5",
    817 ".E c #d6d6d6",
    818 ".X c #d7d7d7",
    819 ".C c #d8d8d8",
    820 ".J c #dadada",
    821 ".K c #dcdcdc",
    822 ".4 c #dddddd",
    823 ".O c #dedede",
    824 ".y c #dfdfdf",
    825 ".r c #e0e0e0",
    826 ".f c #e1e1e1",
    827 ".n c #e2e2e2",
    828 ".v c #e3e3e3",
    829 ".u c #e4e4e4",
    830 ".q c #e6e6e6",
    831 ".j c #e7e7e7",
    832 ".m c #e8e8e8",
    833 ".b c #e9e9e9",
    834 ".U c #eaeaea",
    835 ".i c #ebebeb",
    836 ".c c #ececec",
    837 ".W c #ededed",
    838 ".e c #f0f0f0",
    839 ".d c #f1f1f1",
    840 ".Y c #f2f2f2",
    841 "QtQt.#.a.b.c",
    842 ".d.e.f.g.h.b",
    843 ".c.c.i.j.k.l",
    844 ".m.m.j.n.o.p",
    845 ".q.q.q.r.s.t",
    846 ".u.u.v.r.w.x",
    847 ".v.v.n.y.z.k",
    848 ".n.v.r.y.A.B",
    849 ".v.v.r.C.A.D",
    850 ".E.E.F.G.H.I",
    851 ".J.K.E.L.M.N",
    852 ".y.O.y.C.G.P",
    853 ".n.v.n.J.Q.R",
    854 ".j.q.q.y.S.T",
    855 ".U.U.m.r.E.V",
    856 ".W.W.U.j.X.P",
    857 ".Y.Y.W.q.E.Z",
    858 ".Y.Y.Y.i.0.1",
    859 ".Y.Y.Y.c.2.3",
    860 ".Y.4.o.x.5.S",
    861 ".6.7.8.9.S.n",
    862 ".H#..L.K.u.u"};
    863 
    864 static const char * const qt_mac_tab_selected_active_graph_left[]={
    865 "6 22 126 2",
    866 ".d c #15283d",
    867 ".c c #283348",
    868 ".w c #374459",
    869 ".l c #435364",
    870 ".B c #465568",
    871 ".q c #4d5367",
    872 ".b c #525763",
    873 ".H c #536271",
    874 ".N c #5d6a79",
    875 "#1 c #5f5f5f",
    876 ".T c #647181",
    877 "#N c #656e77",
    878 ".r c #677282",
    879 "#B c #687380",
    880 "#U c #697077",
    881 ".Z c #6c7885",
    882 ".5 c #6c7988",
    883 "#0 c #6d6d6d",
    884 "#H c #6f767f",
    885 ".x c #727e8a",
    886 "## c #757f8d",
    887 ".f c #76767d",
    888 "#v c #76838f",
    889 "#e c #778292",
    890 "#k c #7b8694",
    891 ".U c #7b8794",
    892 ".C c #7b8795",
    893 ".O c #7c8893",
    894 ".I c #7d8896",
    895 ".g c #7e8895",
    896 ".0 c #7e8b99",
    897 "#q c #818c98",
    898 ".6 c #85909e",
    899 "#Z c #878787",
    900 "#a c #8a96a3",
    901 "#f c #8d99a7",
    902 ".1 c #8e99a6",
    903 "#V c #929ca5",
    904 "#l c #939daa",
    905 ".k c #949499",
    906 ".7 c #96a0ad",
    907 ".2 c #98a3af",
    908 "#r c #99a5b0",
    909 ".a c #9a9a9b",
    910 "#I c #9aa4b1",
    911 "#T c #9b9b9b",
    912 ".3 c #9ba6b1",
    913 "#b c #9ba6b3",
    914 ".8 c #9ca7b4",
    915 ".4 c #9da6b1",
    916 "#w c #9da7b5",
    917 "#C c #9ea9b5",
    918 ".V c #a0a9b4",
    919 "#g c #a0abb8",
    920 "#. c #a3acb8",
    921 ".9 c #a4adba",
    922 "#c c #a6afbc",
    923 "#m c #a8b1bd",
    924 "#d c #a9b3bf",
    925 ".J c #abb3bc",
    926 ".P c #adb4bb",
    927 "#h c #adb8c3",
    928 "#M c #aeaeae",
    929 "#j c #aeb8c4",
    930 ".W c #b0b8c2",
    931 "#i c #b0bac6",
    932 ".D c #b3bac3",
    933 "#x c #b3bcc8",
    934 "#n c #b3bdc9",
    935 ".Q c #b4bac2",
    936 "#D c #b5bfc9",
    937 ".y c #b6bdc5",
    938 "#o c #b6becb",
    939 "#s c #b7c2ce",
    940 ".K c #b8bdc6",
    941 ".X c #b8bfc8",
    942 "#p c #b8c1ce",
    943 ".S c #b9bec7",
    944 ".R c #b9bfc8",
    945 ".Y c #b9c1c7",
    946 ".M c #b9c1c8",
    947 "#J c #bac5cf",
    948 ".L c #bbbfc8",
    949 "#O c #bbc7d4",
    950 ".s c #bcc3ca",
    951 "#t c #bcc5d1",
    952 "#u c #bcc6d2",
    953 ".E c #bdc3ca",
    954 "#y c #bdc7d2",
    955 ".G c #bec3cb",
    956 ".F c #bec5cb",
    957 ".z c #c2c7ce",
    958 "#E c #c2cad6",
    959 ".A c #c3c9d0",
    960 "#z c #c3ccd7",
    961 "#A c #c3ced7",
    962 ".m c #c5c9d0",
    963 "#7 c #c6c6c6",
    964 "#K c #c7d2dd",
    965 ".t c #c8ced3",
    966 "#F c #c8d3de",
    967 "#G c #c9d3df",
    968 "#6 c #cbcbcb",
    969 ".u c #cbd1d6",
    970 ".v c #ccd2d7",
    971 ".h c #ced2d6",
    972 "#W c #ced8e4",
    973 "#L c #d0dae3",
    974 "#S c #d1d1d1",
    975 "#P c #d1dbe6",
    976 "#5 c #d3d3d3",
    977 ".n c #d5dadc",
    978 "#Q c #d5deea",
    979 ".o c #d7dbdf",
    980 "#R c #d7e1ec",
    981 ".p c #dadde0",
    982 "#4 c #dcdcdc",
    983 ".i c #e0e2e6",
    984 "#Y c #e1e1e1",
    985 "#3 c #e3e3e3",
    986 "#2 c #e4e4e4",
    987 ".j c #e6e8ea",
    988 ".e c #e8e8e8",
    989 ".# c #e9e9e9",
    990 "#X c #e9f4ff",
    991 "Qt c #ececec",
    992 "Qt.#.a.b.c.d",
    993 ".e.f.g.h.i.j",
    994 ".k.l.m.n.o.p",
    995 ".q.r.s.t.u.v",
    996 ".w.x.y.z.A.A",
    997 ".B.C.D.E.F.G",
    998 ".H.I.J.K.L.M",
    999 ".N.O.P.Q.R.S",
    1000 ".T.U.V.W.X.Y",
    1001 ".Z.0.1.2.3.4",
    1002 ".5.6.7.8.9#.",
    1003 "###a#b#c#d#d",
    1004 "#e#f#g#h#i#j",
    1005 "#k#l#m#n#o#p",
    1006 "#q#r#h#s#t#u",
    1007 "#v#w#x#y#z#A",
    1008 "#B#C#D#E#F#G",
    1009 "#H#I#J#K#L#L",
    1010 "#M#N#O#P#Q#R",
    1011 "#S#T#U#V#W#X",
    1012 "#Y#S#M#Z#0#1",
    1013 "#2#3#4#5#6#7"};
    1014 
    1015 static const char * const qt_mac_tab_selected_active_graph_mid[]={
    1016 "6 22 41 1",
    1017 ". c #15273d",
    1018 "# c #16283e",
    1019 "a c #17293e",
    1020 "b c #192a3f",
    1021 "c c #1a2b40",
    1022 "K c #585858",
    1023 "p c #9ea8b4",
    1024 "q c #a4adb9",
    1025 "r c #aab4bf",
    1026 "s c #afb9c6",
    1027 "o c #b6bcc6",
    1028 "n c #b8bec6",
    1029 "t c #b8c2ce",
    1030 "m c #bbc2c8",
    1031 "u c #bbc5d0",
    1032 "l c #bec4cb",
    1033 "v c #bfcad4",
    1034 "L c #c2c2c2",
    1035 "k c #c2c9ce",
    1036 "M c #c3c3c3",
    1037 "w c #c7d1dd",
    1038 "i c #cad0d5",
    1039 "j c #cbd0d5",
    1040 "x c #ccd5e1",
    1041 "y c #cdd6e2",
    1042 "z c #ced6e2",
    1043 "A c #d5dfeb",
    1044 "B c #d6e0ec",
    1045 "C c #d7e1ed",
    1046 "e c #d8dbe0",
    1047 "f c #d8dce0",
    1048 "g c #d9dce0",
    1049 "D c #d9e2ee",
    1050 "h c #dadce0",
    1051 "E c #dae2ef",
    1052 "d c #e7e9eb",
    1053 "J c #e9f2ff",
    1054 "I c #eaf3ff",
    1055 "H c #ebf5ff",
    1056 "G c #ecf6ff",
    1057 "F c #edf6ff",
    1058 "..#abc",
    1059 "dddddd",
    1060 "eeefgh",
    1061 "iiiiij",
    1062 "kkkkkk",
    1063 "llllll",
    1064 "mmmmmm",
    1065 "nnnnnn",
    1066 "oooooo",
    1067 "pppppp",
    1068 "qqqqqq",
    1069 "rrrrrr",
    1070 "ssssss",
    1071 "tttttt",
    1072 "uuuuuu",
    1073 "vvvvvv",
    1074 "wwwwww",
    1075 "xxxxyz",
    1076 "AABCDE",
    1077 "FFGHIJ",
    1078 "KKKKKK",
    1079 "LLLLMM"};
    1080 
    1081 static const char * const qt_mac_tab_selected_active_graph_right[]={
    1082 "6 22 124 2",
    1083 "Qt c #15283d",
    1084 ".# c #293448",
    1085 ".z c #374459",
    1086 ".n c #435364",
    1087 ".F c #465568",
    1088 ".u c #4d5367",
    1089 ".a c #525763",
    1090 ".L c #536271",
    1091 ".R c #5d6a79",
    1092 "#X c #5f5f5f",
    1093 "#P c #646d77",
    1094 ".X c #647181",
    1095 ".t c #677282",
    1096 "#F c #687380",
    1097 "#U c #697077",
    1098 ".3 c #6c7885",
    1099 ".9 c #6c7988",
    1100 "#Y c #6d6d6d",
    1101 "#K c #6f767f",
    1102 ".y c #727e8a",
    1103 "#c c #757f8d",
    1104 ".i c #76767d",
    1105 "#z c #76838f",
    1106 "#i c #778292",
    1107 "#o c #7b8694",
    1108 ".W c #7b8794",
    1109 ".E c #7b8795",
    1110 ".Q c #7c8893",
    1111 ".K c #7d8896",
    1112 ".h c #7e8895",
    1113 ".2 c #7e8b99",
    1114 "#t c #818c98",
    1115 ".8 c #85909e",
    1116 "#Z c #888888",
    1117 "#b c #8a96a3",
    1118 "#h c #8d99a7",
    1119 ".1 c #8e99a6",
    1120 "#T c #929ca5",
    1121 "#n c #939daa",
    1122 ".o c #949499",
    1123 ".7 c #96a0ad",
    1124 ".0 c #98a3af",
    1125 "#s c #99a5b0",
    1126 ".b c #9a9a9b",
    1127 "#J c #9aa4b1",
    1128 "#V c #9b9b9b",
    1129 ".Z c #9ba6b1",
    1130 "#a c #9ba6b3",
    1131 ".6 c #9ca7b4",
    1132 ".Y c #9da6b1",
    1133 "#y c #9da7b5",
    1134 "#E c #9ea9b5",
    1135 ".V c #a0a9b4",
    1136 "#g c #a0abb8",
    1137 ".4 c #a3acb8",
    1138 ".5 c #a4adba",
    1139 "## c #a6afbc",
    1140 "#m c #a8b1bd",
    1141 "#. c #a9b3bf",
    1142 ".J c #abb3bc",
    1143 ".P c #adb4bb",
    1144 "#f c #adb8c3",
    1145 "#Q c #aeaeae",
    1146 "#d c #aeb8c4",
    1147 ".U c #b0b8c2",
    1148 "#e c #b0bac6",
    1149 ".D c #b3bac3",
    1150 "#x c #b3bcc8",
    1151 "#l c #b3bdc9",
    1152 ".O c #b4bac2",
    1153 "#D c #b5bfc9",
    1154 ".x c #b6bdc5",
    1155 "#k c #b6becb",
    1156 "#r c #b7c2ce",
    1157 ".I c #b8bdc6",
    1158 ".T c #b8bfc8",
    1159 "#j c #b8c1ce",
    1160 ".M c #b9bec7",
    1161 ".N c #b9bfc8",
    1162 ".S c #b9c1c7",
    1163 ".G c #b9c1c8",
    1164 "#I c #bac5cf",
    1165 ".H c #bbbfc8",
    1166 "#O c #bbc7d4",
    1167 ".s c #bcc3ca",
    1168 "#q c #bcc5d1",
    1169 "#p c #bcc6d2",
    1170 ".C c #bdc3ca",
    1171 "#w c #bdc7d2",
    1172 ".A c #bec3cb",
    1173 ".B c #bec5cb",
    1174 ".w c #c2c7ce",
    1175 "#C c #c2cad6",
    1176 ".v c #c3c9d0",
    1177 "#v c #c3ccd7",
    1178 "#u c #c3ced7",
    1179 ".m c #c5c9d0",
    1180 "#1 c #c6c6c6",
    1181 "#H c #c7d2dd",
    1182 ".r c #c8ced3",
    1183 "#B c #c8d3de",
    1184 "#A c #c9d3df",
    1185 "#2 c #cacaca",
    1186 ".q c #cbd1d6",
    1187 ".p c #ccd2d7",
    1188 ".g c #ced2d6",
    1189 "#S c #ced8e4",
    1190 "#G c #d0dae3",
    1191 "#W c #d1d1d1",
    1192 "#N c #d1dbe6",
    1193 "#3 c #d3d3d3",
    1194 ".l c #d5dadc",
    1195 "#M c #d5deea",
    1196 ".k c #d7dbdf",
    1197 "#L c #d7e1ec",
    1198 ".j c #dadde0",
    1199 "#4 c #dcdcdc",
    1200 ".f c #e0e2e6",
    1201 "#0 c #e2e2e2",
    1202 "#5 c #e4e4e4",
    1203 ".e c #e6e8ea",
    1204 ".c c #e9e9e9",
    1205 "#R c #e9f4ff",
    1206 ".d c #ececec",
    1207 "Qt.#.a.b.c.d",
    1208 ".e.f.g.h.i.c",
    1209 ".j.k.l.m.n.o",
    1210 ".p.q.r.s.t.u",
    1211 ".v.v.w.x.y.z",
    1212 ".A.B.C.D.E.F",
    1213 ".G.H.I.J.K.L",
    1214 ".M.N.O.P.Q.R",
    1215 ".S.T.U.V.W.X",
    1216 ".Y.Z.0.1.2.3",
    1217 ".4.5.6.7.8.9",
    1218 "#.#.###a#b#c",
    1219 "#d#e#f#g#h#i",
    1220 "#j#k#l#m#n#o",
    1221 "#p#q#r#f#s#t",
    1222 "#u#v#w#x#y#z",
    1223 "#A#B#C#D#E#F",
    1224 "#G#G#H#I#J#K",
    1225 "#L#M#N#O#P#Q",
    1226 "#R#S#T#U#V#W",
    1227 "#X#Y#Z#Q#W#0",
    1228 "#1#2#3#4#5#5"};
    1229 
    1230 static const char * const qt_mac_tab_press_left[]={
    1231 "6 22 65 2",
    1232 ".8 c #5c5c5c",
    1233 ".c c #696969",
    1234 ".d c #6a6a6a",
    1235 ".b c #767676",
    1236 ".f c #7e7e7e",
    1237 ".t c #808080",
    1238 ".4 c #828282",
    1239 ".7 c #838383",
    1240 ".2 c #888888",
    1241 ".k c #8b8b8b",
    1242 ".0 c #8c8c8c",
    1243 ".z c #909090",
    1244 ".j c #919191",
    1245 ".a c #959595",
    1246 ".Y c #989898",
    1247 ".B c #999999",
    1248 ".D c #9e9e9e",
    1249 ".I c #a1a1a1",
    1250 ".n c #a6a6a6",
    1251 ".g c #a7a7a7",
    1252 ".6 c #a8a8a8",
    1253 ".O c #aaaaaa",
    1254 ".1 c #ababab",
    1255 ".R c #acacac",
    1256 ".T c #afafaf",
    1257 ".q c #b1b1b1",
    1258 ".V c #b3b3b3",
    1259 ".u c #b5b5b5",
    1260 ".A c #b6b6b6",
    1261 ".x c #bababa",
    1262 ".E c #bbbbbb",
    1263 "#. c #bebebe",
    1264 ".J c #bfbfbf",
    1265 ".F c #c0c0c0",
    1266 ".P c #c1c1c1",
    1267 ".S c #c3c3c3",
    1268 ".U c #c5c5c5",
    1269 ".K c #c6c6c6",
    1270 ".G c #c8c8c8",
    1271 ".H c #c9c9c9",
    1272 ".L c #cacaca",
    1273 ".X c #cbcbcb",
    1274 ".C c #cccccc",
    1275 ".3 c #cdcdcd",
    1276 ".N c #cecece",
    1277 ".M c #cfcfcf",
    1278 ".5 c #d0d0d0",
    1279 ".Q c #d1d1d1",
    1280 ".y c #d2d2d2",
    1281 ".r c #d4d4d4",
    1282 ".h c #d5d5d5",
    1283 ".o c #d6d6d6",
    1284 ".v c #d7d7d7",
    1285 ".w c #d8d8d8",
    1286 ".s c #d9d9d9",
    1287 ".l c #dadada",
    1288 ".p c #dbdbdb",
    1289 ".9 c #dcdcdc",
    1290 ".W c #dedede",
    1291 ".m c #dfdfdf",
    1292 ".e c #e0e0e0",
    1293 ".# c #e1e1e1",
    1294 ".i c #e3e3e3",
    1295 "Qt c #e4e4e4",
    1296 ".Z c #e6e6e6",
    1297 "Qt.#.a.b.c.d",
    1298 ".e.f.g.h.iQt",
    1299 ".j.k.l.m.e.e",
    1300 ".b.n.o.l.p.p",
    1301 ".b.q.r.s.s.s",
    1302 ".t.u.r.v.w.w",
    1303 ".k.x.y.o.v.v",
    1304 ".z.A.y.r.v.o",
    1305 ".B.A.C.r.v.v",
    1306 ".D.E.F.G.H.H",
    1307 ".I.J.K.L.M.N",
    1308 ".O.P.C.y.Q.y",
    1309 ".R.S.N.o.v.o",
    1310 ".T.U.y.s.s.l",
    1311 ".V.H.r.p.W.W",
    1312 ".O.X.l.W.#.#",
    1313 ".Y.L.s.#.Z.Z",
    1314 ".0.K.m.Z.Z.Z",
    1315 ".1.2.e.Z.Z.Z",
    1316 ".3.Y.4.n.5.Z",
    1317 ".s.H.6.7.d.8",
    1318 ".9.l.r.L.S#."};
    1319 
    1320 static const char * const qt_mac_tab_press_mid[]={
    1321 "7 22 19 1",
    1322 "o c #555555",
    1323 ". c #6b6b6b",
    1324 "p c #bbbbbb",
    1325 "q c #bcbcbc",
    1326 "g c #c8c8c8",
    1327 "h c #cecece",
    1328 "i c #d1d1d1",
    1329 "f c #d6d6d6",
    1330 "e c #d7d7d7",
    1331 "d c #d8d8d8",
    1332 "c c #d9d9d9",
    1333 "j c #dadada",
    1334 "b c #dbdbdb",
    1335 "k c #dedede",
    1336 "a c #e0e0e0",
    1337 "l c #e1e1e1",
    1338 "# c #e4e4e4",
    1339 "m c #e5e5e5",
    1340 "n c #e6e6e6",
    1341 ".......",
    1342 "#######",
    1343 "aaaaaaa",
    1344 "bbbbbbb",
    1345 "ccccccc",
    1346 "ddddddd",
    1347 "eeeeeee",
    1348 "fffffff",
    1349 "eeeeeee",
    1350 "ggggggg",
    1351 "hhhhhhh",
    1352 "iiiiiii",
    1353 "eeeeeee",
    1354 "jjjjjjj",
    1355 "kkkkkkk",
    1356 "lllllll",
    1357 "mmmmmmm",
    1358 "nnnnnnn",
    1359 "nnnnnnn",
    1360 "nnnnnnn",
    1361 "ooooooo",
    1362 "ppppqqq"};
    1363 
    1364 static const char * const qt_mac_tab_press_right[]={
    1365 "6 22 64 1",
    1366 "5 c #5c5c5c",
    1367 ". c #6a6a6a",
    1368 "# c #767676",
    1369 "g c #7e7e7e",
    1370 "v c #808080",
    1371 "3 c #828282",
    1372 "6 c #848484",
    1373 "0 c #888888",
    1374 "k c #8b8b8b",
    1375 "Z c #8c8c8c",
    1376 "z c #909090",
    1377 "l c #919191",
    1378 "a c #959595",
    1379 "Y c #989898",
    1380 "B c #999999",
    1381 "G c #9e9e9e",
    1382 "M c #a1a1a1",
    1383 "o c #a6a6a6",
    1384 "f c #a7a7a7",
    1385 "7 c #a8a8a8",
    1386 "P c #aaaaaa",
    1387 "1 c #ababab",
    1388 "R c #acacac",
    1389 "T c #afafaf",
    1390 "r c #b1b1b1",
    1391 "V c #b3b3b3",
    1392 "u c #b5b5b5",
    1393 "y c #b6b6b6",
    1394 "x c #bababa",
    1395 "F c #bbbbbb",
    1396 "8 c #bebebe",
    1397 "L c #bfbfbf",
    1398 "E c #c0c0c0",
    1399 "O c #c1c1c1",
    1400 "9 c #c2c2c2",
    1401 "Q c #c3c3c3",
    1402 "S c #c5c5c5",
    1403 "K c #c6c6c6",
    1404 "D c #c8c8c8",
    1405 "C c #c9c9c9",
    1406 "J c #cacaca",
    1407 "W c #cbcbcb",
    1408 "A c #cccccc",
    1409 "4 c #cdcdcd",
    1410 "H c #cecece",
    1411 "I c #cfcfcf",
    1412 "2 c #d0d0d0",
    1413 "N c #d1d1d1",
    1414 "w c #d2d2d2",
    1415 "q c #d4d4d4",
    1416 "e c #d5d5d5",
    1417 "n c #d6d6d6",
    1418 "t c #d7d7d7",
    1419 "s c #d8d8d8",
    1420 "p c #d9d9d9",
    1421 "j c #dadada",
    1422 "m c #dbdbdb",
    1423 "U c #dedede",
    1424 "i c #dfdfdf",
    1425 "h c #e0e0e0",
    1426 "b c #e1e1e1",
    1427 "d c #e3e3e3",
    1428 "c c #e4e4e4",
    1429 "X c #e6e6e6",
    1430 "..#abc",
    1431 "cdefgb",
    1432 "hhijkl",
    1433 "mmjno#",
    1434 "pppqr#",
    1435 "sstquv",
    1436 "ttnwxk",
    1437 "ntqwyz",
    1438 "ttqAyB",
    1439 "CCDEFG",
    1440 "HIJKLM",
    1441 "wNwAOP",
    1442 "ntnHQR",
    1443 "jppwST",
    1444 "UUmqCV",
    1445 "bbUjWP",
    1446 "XXbpJY",
    1447 "XXXiKZ",
    1448 "XXXh01",
    1449 "X2o3Y4",
    1450 "5.67Cj",
    1451 "89Jqmm"};
    145252
    145353static const char * const qt_mac_toolbar_ext[]={
  • trunk/src/gui/styles/qmotifstyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    299299    QCommonStyle::unpolish(widget);
    300300#ifndef QT_NO_PROGRESSBAR
    301     if (qobject_cast<QProgressBar *>(widget))
     301    if (qobject_cast<QProgressBar *>(widget)) {
     302        Q_D(QMotifStyle);
    302303        widget->removeEventFilter(this);
     304        d->bars.removeAll(static_cast<QProgressBar*>(widget));
     305     }
    303306#endif
    304307}
     
    384387    case PE_FrameTabWidget:
    385388    case PE_FrameWindow:
    386         qDrawShadePanel(p, opt->rect, opt->palette, QStyle::State_None, pixelMetric(PM_DefaultFrameWidth));
     389        qDrawShadePanel(p, opt->rect, opt->palette, QStyle::State_None, proxy()->pixelMetric(PM_DefaultFrameWidth));
    387390        break;
    388391    case PE_FrameFocusRect:
     
    473476         if ((opt->state & State_Enabled || opt->state & State_On) || !(opt->state & State_AutoRaise))
    474477             qDrawShadePanel(p, opt->rect, opt->palette, bool(opt->state & (State_Sunken | State_On)),
    475                              pixelMetric(PM_DefaultFrameWidth), &fill);
     478                             proxy()->pixelMetric(PM_DefaultFrameWidth), &fill);
    476479        break; }
    477480
     
    488491        } else {
    489492            qDrawShadePanel(p, opt->rect, opt->palette, !showUp,
    490                             pixelMetric(PM_DefaultFrameWidth), &fill);
    491         }
    492         if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
     493                            proxy()->pixelMetric(PM_DefaultFrameWidth), &fill);
     494        }
     495        if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
    493496            p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern));
    494497        break; }
     
    543546        a.translate(opt->rect.x(), opt->rect.y());
    544547        p->drawPolyline(a);
    545         if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
     548        if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
    546549            p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern));
    547550        p->setPen(oldPen);
     
    734737#undef CTOP
    735738#undef CBOT
    736         if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
     739        if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
    737740            p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern));
    738741        break; }
     
    740743    case PE_IndicatorDockWidgetResizeHandle: {
    741744        const int motifOffset = 10;
    742         int sw = pixelMetric(PM_SplitterWidth);
     745        int sw = proxy()->pixelMetric(PM_SplitterWidth);
    743746        if (opt->state & State_Horizontal) {
    744747            int yPos = opt->rect.y() + opt->rect.height() / 2;
     
    767770        int posX = opt->rect.x() + (opt->rect.width()  - markW) / 2 - 1;
    768771        int posY = opt->rect.y() + (opt->rect.height() - markH) / 2;
    769         int dfw = pixelMetric(PM_DefaultFrameWidth);
     772        int dfw = proxy()->pixelMetric(PM_DefaultFrameWidth);
    770773
    771774        if (dfw < 2) {
     
    841844        else
    842845            handleOpt.state |= State_Horizontal;
    843         drawPrimitive(PE_IndicatorDockWidgetResizeHandle, &handleOpt, p, widget);
     846        proxy()->drawPrimitive(PE_IndicatorDockWidgetResizeHandle, &handleOpt, p, widget);
    844847        break; }
    845848
     
    853856        QStyleOption arrowOpt = *opt;
    854857        arrowOpt.state |= State_Enabled;
    855         drawPrimitive(pe, &arrowOpt, p, widget);
    856         if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) {
    857             int fw = pixelMetric(PM_DefaultFrameWidth);
     858        proxy()->drawPrimitive(pe, &arrowOpt, p, widget);
     859        if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) {
     860            int fw = proxy()->pixelMetric(PM_DefaultFrameWidth);
    858861            p->fillRect(opt->rect.adjusted(fw, fw, -fw, -fw), QBrush(p->background().color(), Qt::Dense5Pattern));
    859862        }
     
    871874        p->save();
    872875        p->setBrushOrigin(bevelOpt.rect.topLeft());
    873         drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);
     876        proxy()->drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);
    874877        p->restore();
    875         if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
     878        if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
    876879            p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern));
    877880        break; }
     
    884887            subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
    885888                                         : SE_CheckBoxIndicator, btn, widget);
    886             drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
     889            proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
    887890                          &subopt, p, widget);
    888891            subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
    889892                                         : SE_CheckBoxContents, btn, widget);
    890             drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget);
     893            proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget);
    891894            if ((btn->state & State_HasFocus) && (!focus || !focus->isVisible())) {
    892895                QStyleOptionFocusRect fropt;
     
    894897                fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
    895898                                            : SE_CheckBoxFocusRect, btn, widget);
    896                 drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
     899                proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
    897900            }
    898901        }
     
    900903    case CE_PushButton:
    901904        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
    902             drawControl(CE_PushButtonBevel, btn, p, widget);
     905            proxy()->drawControl(CE_PushButtonBevel, btn, p, widget);
    903906            QStyleOptionButton subopt = *btn;
    904907            subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
    905             drawControl(CE_PushButtonLabel, &subopt, p, widget);
     908            proxy()->drawControl(CE_PushButtonLabel, &subopt, p, widget);
    906909            if ((btn->state & State_HasFocus) && (!focus || !focus->isVisible())) {
    907910                QStyleOptionFocusRect fropt;
    908911                fropt.QStyleOption::operator=(*btn);
    909912                fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget);
    910                 drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
     913                proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
    911914            }
    912915        }
     
    917920            p->setPen(opt->palette.foreground().color());
    918921            p->setBrush(QBrush(opt->palette.button().color(), Qt::NoBrush));
    919             diw = pixelMetric(PM_ButtonDefaultIndicator);
     922            diw = proxy()->pixelMetric(PM_ButtonDefaultIndicator);
    920923            opt->rect.getCoords(&x1, &y1, &x2, &y2);
    921924            if (btn->features & (QStyleOptionButton::AutoDefaultButton|QStyleOptionButton::DefaultButton)) {
     
    946949                newOpt.rect = QRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
    947950                p->setBrushOrigin(p->brushOrigin());
    948                 drawPrimitive(PE_PanelButtonCommand, &newOpt, p, widget);
     951                proxy()->drawPrimitive(PE_PanelButtonCommand, &newOpt, p, widget);
    949952            }
    950953            if (btn->features & QStyleOptionButton::HasMenu) {
    951                 int mbi = pixelMetric(PM_MenuButtonIndicator, btn, widget);
     954                int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget);
    952955                QRect ir = btn->rect;
    953956                QStyleOptionButton newBtn = *btn;
    954957                newBtn.rect = QRect(ir.right() - mbi - 3, ir.y() + 4,  mbi, ir.height() - 8);
    955                 drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
     958                proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
    956959            }
    957960            break;
     
    961964    case CE_TabBarTabShape:
    962965        if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
    963             const int default_frame = pixelMetric(PM_DefaultFrameWidth, tab, widget);
     966            const int default_frame = proxy()->pixelMetric(PM_DefaultFrameWidth, tab, widget);
    964967            const int frame_offset =  (default_frame > 1) ? 1 : 0;
    965968
     
    10791082                p->setTransform(m, true);
    10801083            }
    1081             const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, opt, widget);
     1084            const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, opt, widget);
    10821085            int u = rect.width() / unit_width;
    10831086            int p_v = pb->progress - pb->minimum;
     
    11481151                    p->setFont(menuitem->font);
    11491152                    p->fillRect(x, y, w, h, opt->palette.brush(QPalette::Button));
    1150                     drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
     1153                    proxy()->drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
    11511154                                 menuitem->palette, menuitem->state & State_Enabled, menuitem->text,
    11521155                                 QPalette::Text);
    11531156                    textWidth = menuitem->fontMetrics.width(menuitem->text) + 10;
    1154                     y += menuitem->fontMetrics.lineSpacing() / 2;
     1157                    y += menuitem->fontMetrics.height() / 2;
    11551158                    p->setFont(oldFont);
    11561159                }
     
    12181221                if (menuitem->checkType & QStyleOptionMenuItem::Exclusive) {
    12191222                    newMenuItem.rect.setRect(xvis + 2, y + motifItemFrame + mh / 4, 11, 11);
    1220                     drawPrimitive(PE_IndicatorRadioButton, &newMenuItem, p, widget);
     1223                    proxy()->drawPrimitive(PE_IndicatorRadioButton, &newMenuItem, p, widget);
    12211224                } else {
    12221225                    newMenuItem.rect.setRect(xvis + 5, y + motifItemFrame + mh / 4, 9, 9);
    1223                     drawPrimitive(PE_IndicatorCheckBox, &newMenuItem, p, widget);
     1226                    proxy()->drawPrimitive(PE_IndicatorCheckBox, &newMenuItem, p, widget);
    12241227                }
    12251228            }
     
    12561259                    QRect tr(xv, y+m, menuitem->tabWidth, h-2*m);
    12571260                    p->drawText(tr, text_flags, s.mid(t+1));
    1258                     if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
     1261                    if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
    12591262                        p->fillRect(tr, QBrush(p->background().color(), Qt::Dense5Pattern));
    12601263                    s = s.left(t);
     
    12631266                p->drawText(tr, text_flags, s.left(t));
    12641267                p->setFont(oldFont);
    1265                 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
     1268                if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
    12661269                    p->fillRect(tr, QBrush(p->background().color(), Qt::Dense5Pattern));
    12671270            }
     
    12771280                else
    12781281                    arrowOpt.state = ((opt->state & State_Enabled) ? State_Enabled : State_None);
    1279                 drawPrimitive(arrow, &arrowOpt, p, widget);
     1282                proxy()->drawPrimitive(arrow, &arrowOpt, p, widget);
    12801283            }
    12811284            break; }
     
    12941297        p->setBrushOrigin(opt->rect.topLeft());
    12951298        qDrawShadePanel(p, opt->rect, opt->palette, bool(opt->state & (State_Sunken|State_On)),
    1296                         pixelMetric(PM_DefaultFrameWidth),
     1299                        proxy()->pixelMetric(PM_DefaultFrameWidth),
    12971300                        &opt->palette.brush((opt->state & State_Sunken) ? QPalette::Mid : QPalette::Button));
    12981301        p->restore();
     
    14291432            = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
    14301433            QRect button, menuarea;
    1431             button = subControlRect(cc, toolbutton, SC_ToolButton, widget);
    1432             menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
     1434            button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget);
     1435            menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
    14331436
    14341437            State bflags = toolbutton->state & ~State_Sunken;
     
    14511454                    tool.rect = button;
    14521455                    tool.state = bflags;
    1453                     drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     1456                    proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    14541457                }
    14551458            }
     
    14591462                fr.QStyleOption::operator=(*toolbutton);
    14601463                fr.rect = toolbutton->rect.adjusted(3, 3, -3, -3);
    1461                 drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
     1464                proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
    14621465            }
    14631466            QStyleOptionToolButton label = *toolbutton;
    14641467            label.state = bflags;
    1465             int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
     1468            int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    14661469            label.rect = button.adjusted(fw, fw, -fw, -fw);
    1467             drawControl(CE_ToolButtonLabel, &label, p, widget);
     1470            proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
    14681471
    14691472            if (toolbutton->subControls & SC_ToolButtonMenu) {
     
    14711474                tool.state = mflags;
    14721475                if (mflags & (State_Sunken | State_On | State_Raised))
    1473                     drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
    1474                 drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
     1476                    proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
     1477                proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
    14751478            } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
    1476                 int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
     1479                int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
    14771480                QRect ir = toolbutton->rect;
    14781481                QStyleOptionToolButton newBtn = *toolbutton;
    14791482                newBtn.rect = QRect(ir.right() + 5 - mbi, ir.height() - mbi + 4, mbi - 6, mbi - 6);
    1480                 drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
     1483                proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
    14811484            }
    14821485        }
     
    14891492
    14901493            if (spinbox->frame && (spinbox->subControls & SC_SpinBoxFrame)) {
    1491                 QRect r = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxFrame, widget);
    1492                 qDrawShadePanel(p, r, opt->palette, false, pixelMetric(PM_SpinBoxFrameWidth));
    1493 
    1494                 int fw = pixelMetric(QStyle::PM_DefaultFrameWidth);
    1495                 r = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxEditField, widget).adjusted(-fw,-fw,fw,fw);
     1494                QRect r = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxFrame, widget);
     1495                qDrawShadePanel(p, r, opt->palette, false, proxy()->pixelMetric(PM_SpinBoxFrameWidth));
     1496
     1497                int fw = proxy()->pixelMetric(QStyle::PM_DefaultFrameWidth);
     1498                r = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxEditField, widget).adjusted(-fw,-fw,fw,fw);
    14961499                QStyleOptionFrame lineOpt;
    14971500                lineOpt.QStyleOption::operator=(*opt);
     
    15001503                lineOpt.midLineWidth = 0;
    15011504                lineOpt.state |= QStyle::State_Sunken;
    1502                 drawPrimitive(QStyle::PE_FrameLineEdit, &lineOpt, p, widget);
     1505                proxy()->drawPrimitive(QStyle::PE_FrameLineEdit, &lineOpt, p, widget);
    15031506            }
    15041507
     
    15231526                      : PE_IndicatorSpinUp);
    15241527
    1525                 copy.rect = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxUp, widget);
    1526                 drawPrimitive(pe, &copy, p, widget);
     1528                copy.rect = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxUp, widget);
     1529                proxy()->drawPrimitive(pe, &copy, p, widget);
    15271530            }
    15281531
     
    15471550                      : PE_IndicatorSpinDown);
    15481551
    1549                 copy.rect = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxDown, widget);
    1550                 drawPrimitive(pe, &copy, p, widget);
     1552                copy.rect = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxDown, widget);
     1553                proxy()->drawPrimitive(pe, &copy, p, widget);
    15511554            }
    15521555        }
     
    15561559    case CC_Slider:
    15571560        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    1558             QRect groove = subControlRect(CC_Slider, opt, SC_SliderGroove, widget),
    1559                   handle = subControlRect(CC_Slider, opt, SC_SliderHandle, widget);
     1561            QRect groove = proxy()->subControlRect(CC_Slider, opt, SC_SliderGroove, widget),
     1562                  handle = proxy()->subControlRect(CC_Slider, opt, SC_SliderHandle, widget);
    15601563
    15611564            if ((opt->subControls & SC_SliderGroove) && groove.isValid()) {
    1562                 qDrawShadePanel(p, groove, opt->palette, true, pixelMetric(PM_DefaultFrameWidth),
     1565                qDrawShadePanel(p, groove, opt->palette, true, proxy()->pixelMetric(PM_DefaultFrameWidth),
    15631566                                &opt->palette.brush((opt->state & State_Enabled) ? QPalette::Mid : QPalette::Window));
    15641567                if ((opt->state & State_HasFocus) && (!focus || !focus->isVisible())) {
    15651568                    QStyleOption focusOpt = *opt;
    15661569                    focusOpt.rect = subElementRect(SE_SliderFocusRect, opt, widget);
    1567                     drawPrimitive(PE_FrameFocusRect, &focusOpt, p, widget);
     1570                    proxy()->drawPrimitive(PE_FrameFocusRect, &focusOpt, p, widget);
    15681571                }
    15691572            }
     
    15751578                p->save();
    15761579                p->setBrushOrigin(bevelOpt.rect.topLeft());
    1577                 drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);
     1580                proxy()->drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);
    15781581                p->restore();
    15791582
     
    15871590                                   true, 1);
    15881591                }
    1589                 if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
     1592                if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
    15901593                    p->fillRect(handle, QBrush(p->background().color(), Qt::Dense5Pattern));
    15911594            }
     
    15941597                QStyleOptionSlider tmpSlider = *slider;
    15951598                tmpSlider.subControls = SC_SliderTickmarks;
    1596                 int frameWidth = pixelMetric(PM_DefaultFrameWidth);
     1599                int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth);
    15971600                tmpSlider.rect.translate(frameWidth - 1, 0);
    15981601                QCommonStyle::drawComplexControl(cc, &tmpSlider, p, widget);
     
    16051608            if (opt->subControls & SC_ComboBoxArrow) {
    16061609                int awh, ax, ay, sh, sy, dh, ew;
    1607                 int fw = cb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
     1610                int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
    16081611
    16091612                if (cb->frame) {
     
    16111614                    btn.QStyleOption::operator=(*cb);
    16121615                    btn.state |= QStyle::State_Raised;
    1613                     drawPrimitive(PE_PanelButtonCommand, &btn, p, widget);
     1616                    proxy()->drawPrimitive(PE_PanelButtonCommand, &btn, p, widget);
    16141617                } else {
    16151618                    p->fillRect(opt->rect, opt->palette.brush(QPalette::Button));
     
    16251628                arrowOpt.rect = ar;
    16261629                arrowOpt.state |= State_Enabled;
    1627                 drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
     1630                proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
    16281631
    16291632
     
    16411644                    focus.rect = subElementRect(SE_ComboBoxFocusRect, opt, widget);
    16421645                    focus.backgroundColor = opt->palette.button().color();
    1643                     drawPrimitive(PE_FrameFocusRect, &focus, p, widget);
     1646                    proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget);
    16441647                }
    16451648            }
     
    16471650            if (opt->subControls & SC_ComboBoxEditField) {
    16481651                if (cb->editable) {
    1649                     QRect er = subControlRect(CC_ComboBox, opt, SC_ComboBoxEditField, widget);
     1652                    QRect er = proxy()->subControlRect(CC_ComboBox, opt, SC_ComboBoxEditField, widget);
    16501653                    er.adjust(-1, -1, 1, 1);
    16511654                    qDrawShadePanel(p, er, opt->palette, true, 1,
     
    16611664        if (opt->subControls & SC_ScrollBarGroove)
    16621665            qDrawShadePanel(p, opt->rect, opt->palette, true,
    1663                             pixelMetric(PM_DefaultFrameWidth, opt, widget),
     1666                            proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget),
    16641667                            &opt->palette.brush((opt->state & State_Enabled) ? QPalette::Mid : QPalette::Window));
    16651668
     
    17961799
    17971800    case PM_ToolBarFrameWidth:
    1798         ret = pixelMetric(PM_DefaultFrameWidth);
     1801        ret = proxy()->pixelMetric(PM_DefaultFrameWidth);
    17991802        break;
    18001803
     
    18171820
    18181821    case PM_SliderThickness:
    1819         ret = 16 + 4 * pixelMetric(PM_DefaultFrameWidth);
     1822        ret = 16 + 4 * proxy()->pixelMetric(PM_DefaultFrameWidth);
    18201823        break;
    18211824#ifndef QT_NO_SLIDER
     
    18471850        if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    18481851            if (sl->orientation == Qt::Horizontal)
    1849                 ret = sl->rect.width() - pixelMetric(PM_SliderLength, opt, widget) - 2 * pixelMetric(PM_DefaultFrameWidth, opt, widget);
     1852                ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, opt, widget) - 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    18501853            else
    1851                 ret = sl->rect.height() - pixelMetric(PM_SliderLength, opt, widget) - 2 * pixelMetric(PM_DefaultFrameWidth, opt, widget);
     1854                ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, opt, widget) - 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    18521855        }
    18531856        break;
     
    18991902    case CC_SpinBox:
    19001903        if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
    1901             int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
     1904            int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
    19021905            QSize bs;
    19031906            bs.setHeight(opt->rect.height()/2 - fw);
     
    19421945        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    19431946            if (sc == SC_SliderHandle) {
    1944                 int tickOffset = pixelMetric(PM_SliderTickmarkOffset, opt, widget);
    1945                 int thickness = pixelMetric(PM_SliderControlThickness, opt, widget);
     1947                int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, opt, widget);
     1948                int thickness = proxy()->pixelMetric(PM_SliderControlThickness, opt, widget);
    19461949                bool horizontal = slider->orientation == Qt::Horizontal;
    1947                 int len = pixelMetric(PM_SliderLength, opt, widget);
    1948                 int motifBorder = pixelMetric(PM_DefaultFrameWidth);
     1950                int len = proxy()->pixelMetric(PM_SliderLength, opt, widget);
     1951                int motifBorder = proxy()->pixelMetric(PM_DefaultFrameWidth);
    19491952                int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition,
    19501953                                                        horizontal ? slider->rect.width() - len - 2 * motifBorder
     
    19651968    case CC_ScrollBar:
    19661969        if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    1967             int dfw = pixelMetric(PM_DefaultFrameWidth);
     1970            int dfw = proxy()->pixelMetric(PM_DefaultFrameWidth);
    19681971            QRect rect =  visualRect(scrollbar->direction, scrollbar->rect,
    19691972                                     QCommonStyle::subControlRect(cc, scrollbar, sc, widget));
     
    19891992            case SC_ComboBoxArrow: {
    19901993                int ew, awh, sh, dh, ax, ay, sy;
    1991                 int fw = cb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
     1994                int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
    19921995                QRect cr = opt->rect;
    19931996                cr.adjust(fw, fw, -fw, -fw);
     
    19972000
    19982001            case SC_ComboBoxEditField: {
    1999                 int fw = cb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
     2002                int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
    20002003                QRect rect = opt->rect;
    20012004                rect.adjust(fw, fw, -fw, -fw);
     
    20272030
    20282031    switch(ct) {
    2029     case CT_Splitter:
    2030         sz = QSize(10, 10);
    2031         break;
    2032 
    20332032    case CT_RadioButton:
    20342033    case CT_CheckBox:
     
    20582057            if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
    20592058                w = 10;
    2060                 h = (mi->text.isEmpty()) ? motifSepHeight : mi->fontMetrics.lineSpacing();
     2059                h = (mi->text.isEmpty()) ? motifSepHeight : mi->fontMetrics.height();
    20612060            }
    20622061
     
    21172116    {
    21182117        int awh, ax, ay, sh, sy, dh, ew;
    2119         int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
     2118        int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
    21202119        QRect tr = opt->rect;
    21212120
     
    26852684        ret = '*';
    26862685        break;
     2686    case SH_DialogButtonBox_ButtonsHaveIcons:
     2687        ret = 0;
     2688        break;
    26872689    default:
    26882690        ret = QCommonStyle::styleHint(hint, opt, widget, returnData);
  • trunk/src/gui/styles/qmotifstyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qmotifstyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qplastiquestyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4444#if !defined(QT_NO_STYLE_PLASTIQUE) || defined(QT_PLUGIN)
    4545
    46 static bool UsePixmapCache = true;
    4746static const bool AnimateBusyProgressBar = true;
    4847static const bool AnimateProgressBar = false;
     
    5251
    5352#include "qwindowsstyle_p.h"
     53#include <private/qstylehelper_p.h>
    5454#include <qapplication.h>
    5555#include <qbitmap.h>
     
    9999static const int windowsArrowHMargin     =  6; // arrow horizontal margin
    100100static const int windowsTabSpacing       = 12; // space between text and tab
    101 static const int windowsCheckMarkHMargin =  2; // horiz. margins of check mark
    102101static const int windowsRightBorder      = 15; // right border on windows
    103102static const int windowsCheckMarkWidth   = 12; // checkmarks width on windows
     
    491490        QPixmap pixmap;
    492491        QString name = QString::fromLatin1("qbrushtexture-alpha-%1-%2").arg(alpha).arg(texture.cacheKey());
    493         if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
     492        if (!QPixmapCache::find(name, pixmap)) {
    494493            QImage image = texture.toImage();
    495494            QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
     
    552551        QPixmap pixmap;
    553552        QString name = QString::fromLatin1("qbrushtexture-light-%1-%2").arg(light).arg(texture.cacheKey());
    554         if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
     553        if (!QPixmapCache::find(name, pixmap)) {
    555554            QImage image = texture.toImage();
    556555            QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
     
    611610        QPixmap pixmap;
    612611        QString name = QString::fromLatin1("qbrushtexture-dark-%1-%2").arg(dark).arg(brush.texture().cacheKey());
    613         if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
     612        if (!QPixmapCache::find(name, pixmap)) {
    614613            QImage image = texture.toImage();
    615614            QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
     
    731730}
    732731
    733 static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
    734 {
    735     QString tmp;
    736     const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
    737     tmp.sprintf("%s-%d-%d-%d-%lld-%dx%d", key.toLatin1().constData(), uint(option->state),
    738                 option->direction, complexOption ? uint(complexOption->activeSubControls) : uint(0),
    739                 option->palette.cacheKey(), size.width(), size.height());
    740     return tmp;
    741 }
    742 
    743732static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart,
    744733                                       const QColor &gradientStop)
     
    750739    QRect r = rect;
    751740
    752     bool doPixmapCache = UsePixmapCache
    753         && painter->deviceTransform().isIdentity()
     741    bool doPixmapCache = painter->deviceTransform().isIdentity()
    754742        && painter->worldMatrix().isIdentity();
    755743    if (doPixmapCache && QPixmapCache::find(gradientName, cache)) {
     
    1006994#endif
    1007995{
    1008     if (!qgetenv("QT_STYLE_NO_PIXMAPCACHE").isNull())
    1009         UsePixmapCache = false;
    1010996}
    1011997
     
    10711057    frameOpt.lineWidth = q->pixelMetric(QStyle::PM_DefaultFrameWidth);
    10721058    frameOpt.midLineWidth = 0;
    1073     frameOpt.state |= QStyle::State_Sunken;
     1059    frameOpt.state = option->state | QStyle::State_Sunken;
     1060    frameOpt.palette = option->palette;
    10741061    q->drawPrimitive(QStyle::PE_PanelLineEdit, &frameOpt, painter, widget);
    10751062    painter->restore();
     
    11081095    QColor gradientStartColor = option->palette.button().color().lighter(104);
    11091096    QColor gradientStopColor = option->palette.button().color().darker(105);
    1110     QColor baseGradientStartColor = option->palette.base().color().darker(101);
    1111     QColor baseGradientStopColor = option->palette.base().color().darker(106);
    11121097    QColor highlightedGradientStartColor = option->palette.button().color().lighter(101);
    11131098    QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85);
     
    11331118    switch (element) {
    11341119    case PE_IndicatorButtonDropDown:
    1135         drawPrimitive(PE_PanelButtonTool, option, painter, widget);
     1120        proxy()->drawPrimitive(PE_PanelButtonTool, option, painter, widget);
    11361121        break;
    11371122    case PE_FrameDefaultButton: {
     
    11791164            }
    11801165
    1181             int borderThickness = pixelMetric(PM_TabBarBaseOverlap, twf, widget);
     1166            int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, twf, widget);
    11821167            bool reverse = (twf->direction == Qt::RightToLeft);
    11831168
     
    13581343            } else {
    13591344                frameV2.state &= ~(State_Sunken | State_HasFocus);
    1360                 drawPrimitive(PE_Frame, &frameV2, painter, widget);
     1345                proxy()->drawPrimitive(PE_Frame, &frameV2, painter, widget);
    13611346            }
    13621347        }
     
    15161501        }
    15171502#endif
    1518         QString pixmapName = uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
    1519         if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
     1503        QString pixmapName = QStyleHelper::uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
     1504        if (!QPixmapCache::find(pixmapName, cache)) {
    15201505            cache = QPixmap(rect.size());
    15211506            cache.fill(Qt::transparent);
     
    15471532            }
    15481533            cachePainter.end();
    1549             if (UsePixmapCache)
    1550                 QPixmapCache::insert(pixmapName, cache);
     1534            QPixmapCache::insert(pixmapName, cache);
    15511535        }
    15521536        painter->drawPixmap(rect.topLeft(), cache);
     
    18581842        button.QStyleOption::operator=(*option);
    18591843        button.state &= ~State_MouseOver;
    1860         drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
     1844        proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
    18611845        break;
    18621846    }
     
    18641848        painter->save();
    18651849        bool active = (option->state & State_Active);
    1866         int titleBarStop = option->rect.top() + pixelMetric(PM_TitleBarHeight, option, widget);
     1850        int titleBarStop = option->rect.top() + proxy()->pixelMetric(PM_TitleBarHeight, option, widget);
    18671851
    18681852        QPalette palette = option->palette;
     
    19931977                               adjustedRect.right() - adjustedRect.left() - 1,
    19941978                               adjustedRect.bottom() - adjustedRect.top() - 1);
    1995             qt_plastique_draw_gradient(painter, gradientRect, baseGradientStartColor, baseGradientStopColor);
     1979            if (option->palette.base().style() == Qt::SolidPattern) {
     1980                QColor baseGradientStartColor = option->palette.base().color().darker(101);
     1981                QColor baseGradientStopColor = option->palette.base().color().darker(106);
     1982                qt_plastique_draw_gradient(painter, gradientRect, baseGradientStartColor, baseGradientStopColor);
     1983            } else {
     1984                painter->fillRect(gradientRect, option->palette.base());
     1985            }
    19961986            // draw "+" or "-"
    19971987            painter->setPen(alphaTextColor);
     
    20742064            bool reverseShadow = false;
    20752065
    2076             int borderThickness = pixelMetric(PM_TabBarBaseOverlap, tab, widget);
     2066            int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
    20772067            int marginLeft = 0;
    20782068            if ((atBeginning && !selected) || (selected && leftCornerWidget && ((tab->position == QStyleOptionTab::Beginning) || onlyTab))) {
     
    25862576            }
    25872577
    2588             double vc6_workaround = ((bar->progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * rect.width());
    2589             int progressIndicatorPos = int(vc6_workaround);
     2578            int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum) * rect.width();
    25902579
    25912580            bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted)
     
    26472636            if (vertical) {
    26482637                rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
    2649                 QTransform m;
    2650                 m.translate(rect.height()-1, 0);
     2638                QTransform m = QTransform::fromTranslate(rect.height()-1, 0);
    26512639                m.rotate(90.0);
    26522640                painter->setTransform(m, true);
     
    27832771            painter->setPen(QPen());
    27842772
    2785             QString progressBarName = uniqueName(QLatin1String("progressBarContents"),
     2773            QString progressBarName = QStyleHelper::uniqueName(QLatin1String("progressBarContents"),
    27862774                                                 option, rect.size());
    27872775            QPixmap cache;
    2788             if ((!UsePixmapCache || !QPixmapCache::find(progressBarName, cache)) && rect.height() > 7) {
     2776            if (!QPixmapCache::find(progressBarName, cache) && rect.height() > 7) {
    27892777                QSize size = rect.size();
    27902778                cache = QPixmap(QSize(size.width() - 6 + 30, size.height() - 6));
     
    28192807                }
    28202808
    2821                 if (UsePixmapCache)
    2822                     QPixmapCache::insert(progressBarName, cache);
     2809                QPixmapCache::insert(progressBarName, cache);
    28232810            }
    28242811            painter->setClipRect(progressBar.adjusted(1, 0, -1, -1));
     
    28442831        if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
    28452832            QPixmap cache;
    2846             QString pixmapName = uniqueName(QLatin1String("headersection"), option, option->rect.size());
    2847             pixmapName += QLatin1String("-") + QString::number(int(header->position));
    2848             pixmapName += QLatin1String("-") + QString::number(int(header->orientation));
    2849 
    2850             if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
     2833            QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size());
     2834            pixmapName += QString::number(- int(header->position));
     2835            pixmapName += QString::number(- int(header->orientation));
     2836
     2837            if (!QPixmapCache::find(pixmapName, cache)) {
    28512838                cache = QPixmap(option->rect.size());
    28522839                cache.fill(Qt::white);
     
    28922879
    28932880                cachePainter.end();
    2894                 if (UsePixmapCache)
    2895                     QPixmapCache::insert(pixmapName, cache);
     2881                QPixmapCache::insert(pixmapName, cache);
    28962882            }
    28972883            painter->drawPixmap(option->rect.topLeft(), cache);
     
    29162902                if (!menuItem->text.isEmpty()) {
    29172903                    painter->setFont(menuItem->font);
    2918                     drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
     2904                    proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
    29192905                                 menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
    29202906                                 QPalette::Text);
     
    29592945                        button.state |= State_On;
    29602946                    button.palette = menuItem->palette;
    2961                     drawPrimitive(PE_IndicatorRadioButton, &button, painter, widget);
     2947                    proxy()->drawPrimitive(PE_IndicatorRadioButton, &button, painter, widget);
    29622948                } else {
    29632949                    if (menuItem->icon.isNull()) {
     
    29682954                            button.state |= State_On;
    29692955                        button.palette = menuItem->palette;
    2970                         drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
     2956                        proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
    29712957                    } else if (checked) {
    29722958                        int iconSize = qMax(menuItem->maxIconWidth, 20);
     
    30803066                else
    30813067                    newMI.palette.setColor(QPalette::ButtonText, textBrush.color());
    3082                 drawPrimitive(arrow, &newMI, painter, widget);
     3068                proxy()->drawPrimitive(arrow, &newMI, painter, widget);
    30833069            }
    30843070
     
    30923078        if ((option->state & State_Selected)) {
    30933079            QPixmap cache;
    3094             QString pixmapName = uniqueName(QLatin1String("menubaritem"), option, option->rect.size());
    3095             if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
     3080            QString pixmapName = QStyleHelper::uniqueName(QLatin1String("menubaritem"), option, option->rect.size());
     3081            if (!QPixmapCache::find(pixmapName, cache)) {
    30963082                cache = QPixmap(option->rect.size());
    30973083                cache.fill(Qt::white);
     
    31433129                cachePainter.drawLines(lines, 2);
    31443130                cachePainter.end();
    3145                 if (UsePixmapCache)
    3146                     QPixmapCache::insert(pixmapName, cache);
     3131                QPixmapCache::insert(pixmapName, cache);
    31473132            }
    31483133            painter->drawPixmap(option->rect.topLeft(), cache);
     
    33293314            // Draw the text centered
    33303315            QFont font = painter->font();
    3331             font.setPointSize(font.pointSize() - 1);
     3316            font.setPointSize(QFontInfo(font).pointSize() - 1);
    33323317            painter->setFont(font);
    33333318            painter->setPen(dockWidget->palette.windowText().color());
     
    34563441            bool sunken = scrollBar->state & State_Sunken;
    34573442
    3458             QString addLinePixmapName = uniqueName(QLatin1String("scrollbar_addline"), option, option->rect.size());
     3443            QString addLinePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_addline"), option, option->rect.size());
    34593444            QPixmap cache;
    3460             if (!UsePixmapCache || !QPixmapCache::find(addLinePixmapName, cache)) {
     3445            if (!QPixmapCache::find(addLinePixmapName, cache)) {
    34613446                cache = QPixmap(option->rect.size());
    34623447                cache.fill(Qt::white);
     
    35173502                }
    35183503                addLinePainter.end();
    3519                 if (UsePixmapCache)
    3520                     QPixmapCache::insert(addLinePixmapName, cache);
     3504                QPixmapCache::insert(addLinePixmapName, cache);
    35213505            }
    35223506            painter->drawPixmap(option->rect.topLeft(), cache);
     
    35293513            bool horizontal = scrollBar->orientation == Qt::Horizontal;
    35303514
    3531             QString groovePixmapName = uniqueName(QLatin1String("scrollbar_groove"), option, option->rect.size());
     3515            QString groovePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_groove"), option, option->rect.size());
    35323516            if (sunken)
    35333517                groovePixmapName += QLatin1String("-sunken");
     
    35363520
    35373521            QPixmap cache;
    3538             if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
     3522            if (!QPixmapCache::find(groovePixmapName, cache)) {
    35393523                cache = QPixmap(option->rect.size());
    35403524                cache.fill(option->palette.background().color());
     
    35623546
    35633547                groovePainter.end();
    3564                 if (UsePixmapCache)
    3565                     QPixmapCache::insert(groovePixmapName, cache);
     3548                QPixmapCache::insert(groovePixmapName, cache);
    35663549            }
    35673550            painter->drawPixmap(option->rect.topLeft(), cache);
     
    35803563            QRect button1;
    35813564            QRect button2;
    3582             int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget);
     3565            int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget);
    35833566            if (horizontal) {
    35843567                button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(), scrollBarExtent, scrollBarSubLine.height());
     
    35893572            }
    35903573
    3591             QString subLinePixmapName = uniqueName(QLatin1String("scrollbar_subline"), option, button1.size());
     3574            QString subLinePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_subline"), option, button1.size());
    35923575            QPixmap cache;
    3593             if (!UsePixmapCache || !QPixmapCache::find(subLinePixmapName, cache)) {
     3576            if (!QPixmapCache::find(subLinePixmapName, cache)) {
    35943577                cache = QPixmap(button1.size());
    35953578                cache.fill(Qt::white);
     
    36513634                }
    36523635                subLinePainter.end();
    3653                 if (UsePixmapCache)
    3654                     QPixmapCache::insert(subLinePixmapName, cache);
     3636                QPixmapCache::insert(subLinePixmapName, cache);
    36553637            }
    36563638            painter->drawPixmap(button1.topLeft(), cache);
     
    36653647            // The slider
    36663648            if (option->rect.isValid()) {
    3667                 QString sliderPixmapName = uniqueName(QLatin1String("scrollbar_slider"), option, option->rect.size());
     3649                QString sliderPixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_slider"), option, option->rect.size());
    36683650                if (horizontal)
    36693651                    sliderPixmapName += QLatin1String("-horizontal");
    36703652
    36713653                QPixmap cache;
    3672                 if (!UsePixmapCache || !QPixmapCache::find(sliderPixmapName, cache)) {
     3654                if (!QPixmapCache::find(sliderPixmapName, cache)) {
    36733655                    cache = QPixmap(option->rect.size());
    36743656                    cache.fill(Qt::white);
     
    37213703                    sliderPainter.drawLines(lines, 2);
    37223704
    3723                     int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
     3705                    int sliderMinLength = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
    37243706                    if ((horizontal && scrollBar->rect.width() > sliderMinLength)
    37253707                        || (!horizontal && scrollBar->rect.height() > sliderMinLength)) {
     
    37413723                    sliderPainter.end();
    37423724                    // insert the slider into the cache
    3743                     if (UsePixmapCache)
    3744                         QPixmapCache::insert(sliderPixmapName, cache);
     3725                    QPixmapCache::insert(sliderPixmapName, cache);
    37453726                }
    37463727                painter->drawPixmap(option->rect.topLeft(), cache);
     
    37613742            } else if (!comboBox->currentIcon.isNull()) {
    37623743                {
    3763                     QRect editRect = subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget);
     3744                    QRect editRect = proxy()->subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget);
    37643745                    if (comboBox->direction == Qt::RightToLeft)
    37653746                        editRect.adjust(0, 2, -2, -2);
     
    37743755                        QRect iconRect(editRect);
    37753756                        iconRect.setWidth(comboBox->iconSize.width() + 5);
    3776                         iconRect = alignedRect(QApplication::layoutDirection(),
     3757                        iconRect = alignedRect(comboBox->direction,
    37773758                                               Qt::AlignLeft | Qt::AlignVCenter,
    37783759                                               iconRect.size(), editRect);
    37793760                        painter->fillRect(iconRect, option->palette.brush(QPalette::Base));
    3780                         drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
     3761                        proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
    37813762                    }
    37823763                    painter->restore();
     
    38213802    case CC_Slider:
    38223803        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    3823             QRect grooveRegion = subControlRect(CC_Slider, option, SC_SliderGroove, widget);
    3824             QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget);
    3825             QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
     3804            QRect grooveRegion = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
     3805            QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
     3806            QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
    38263807            bool horizontal = slider->orientation == Qt::Horizontal;
    38273808            bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
     
    38863867
    38873868            if ((option->subControls & SC_SliderHandle) && handle.isValid()) {
    3888                 QString handlePixmapName = uniqueName(QLatin1String("slider_handle"), option, handle.size());
     3869                QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size());
    38893870                if (ticksAbove && !ticksBelow)
    38903871                    handlePixmapName += QLatin1String("-flipped");
     
    38923873                    handlePixmapName += QLatin1String("-sunken");
    38933874
    3894                 if (!UsePixmapCache || !QPixmapCache::find(handlePixmapName, cache)) {
     3875                if (!QPixmapCache::find(handlePixmapName, cache)) {
    38953876                    cache = QPixmap(handle.size());
    38963877                    cache.fill(Qt::white);
     
    39753956                    handlePainter.drawImage(pixmapRect, image);
    39763957                    handlePainter.end();
    3977                     if (UsePixmapCache)
    3978                         QPixmapCache::insert(handlePixmapName, cache);
     3958                    QPixmapCache::insert(handlePixmapName, cache);
    39793959                }
    39803960
     
    39853965                    fropt.QStyleOption::operator=(*slider);
    39863966                    fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
    3987                     drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
     3967                    proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
    39883968                }
    39893969            }
     
    39923972                QPen oldPen = painter->pen();
    39933973                painter->setPen(borderColor);
    3994                 int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
    3995                 int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
     3974                int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
     3975                int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
    39963976                int interval = slider->tickInterval;
    39973977                if (interval <= 0) {
     
    40073987
    40083988                int v = slider->minimum;
    4009                 int len = pixelMetric(PM_SliderLength, slider, widget);
     3989                int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
    40103990                QVarLengthArray<QLine, 32> lines;
    40113991                while (v <= slider->maximum + 1) {
     
    40624042
    40634043            // Rects
    4064             QRect upRect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
    4065             QRect downRect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
     4044            QRect upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
     4045            QRect downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
    40664046            QRect buttonRect = upRect | downRect;
    40674047
     
    40844064                d->drawPartialFrame(painter,
    40854065                                    option,
    4086                                     subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget),
     4066                                    proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget),
    40874067                                    widget);
    40884068            }
     
    44244404                d->drawPartialFrame(painter,
    44254405                                option,
    4426                                 subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget),
     4406                                proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget),
    44274407                                widget);
    44284408
     
    45484528                    buttonOption.state &= ~State_Sunken;
    45494529                }
    4550                 drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget);
     4530                proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget);
    45514531
    45524532                // Draw the menu button separator line
     
    45814561
    45824562            // Draw the focus rect
    4583             if (((option->state & State_HasFocus) && (option->state & State_KeyboardFocusChange)) && !comboBox->editable) {
     4563            if ((option->state & State_HasFocus) && !comboBox->editable
     4564                && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) {
    45844565                QStyleOptionFocusRect focus;
    4585                 focus.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget)
     4566                focus.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget)
    45864567                             .adjusted(-2, 0, 2, 0);
    4587                 drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
     4568                proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
    45884569            }
    45894570
     
    46154596                dockwidget.QStyleOption::operator=(*option);
    46164597                dockwidget.title = titleBar->text;
    4617                 drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
     4598                proxy()->drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
    46184599            } else
    46194600#endif // QT3_SUPPORT
     
    46884669                }
    46894670                // draw title
    4690                 QRect textRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
     4671                QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
    46914672
    46924673                QFont font = painter->font();
     
    47154696                bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
    47164697
    4717                 QRect minButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
     4698                QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
    47184699                qt_plastique_draw_mdibutton(painter, titleBar, minButtonRect, hover, sunken);
    47194700
     
    47594740                bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
    47604741
    4761                 QRect maxButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
     4742                QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
    47624743                qt_plastique_draw_mdibutton(painter, titleBar, maxButtonRect, hover, sunken);
    47634744
     
    47844765                bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
    47854766
    4786                 QRect closeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
     4767                QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
    47874768                qt_plastique_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken);
    47884769
     
    48304811                bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken);
    48314812
    4832                 QRect normalButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
     4813                QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
    48334814                qt_plastique_draw_mdibutton(painter, titleBar, normalButtonRect, hover, sunken);
    48344815                int xoffset = int(normalButtonRect.width() / 3.5);
     
    48764857                bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
    48774858
    4878                 QRect contextHelpButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
     4859                QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
    48794860
    48804861                qt_plastique_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken);
     
    49034884                bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
    49044885
    4905                 QRect shadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
     4886                QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
    49064887                qt_plastique_draw_mdibutton(painter, titleBar, shadeButtonRect, hover, sunken);
    49074888
     
    49274908                bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
    49284909
    4929                 QRect unshadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
     4910                QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
    49304911                qt_plastique_draw_mdibutton(painter, titleBar, unshadeButtonRect, hover, sunken);
    49314912
     
    49524933                bool sunken = (titleBar->activeSubControls & SC_TitleBarSysMenu) && (titleBar->state & State_Sunken);
    49534934
    4954                 QRect iconRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
     4935                QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
    49554936                if (hover)
    49564937                    qt_plastique_draw_mdibutton(painter, titleBar, iconRect, hover, sunken);
     
    49644945                    tool.rect = iconRect;
    49654946                    painter->save();
    4966                     drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
     4947                    proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
    49674948                    painter->restore();
    49684949                }
     
    49714952        }
    49724953        break;
     4954#ifndef QT_NO_DIAL
     4955    case CC_Dial:
     4956        if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
     4957            QStyleHelper::drawDial(dial, painter);
     4958        break;
     4959#endif // QT_NO_DIAL
    49734960    default:
    49744961        QWindowsStyle::drawComplexControl(control, option, painter, widget);
     
    49934980    case CT_Slider:
    49944981        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    4995             int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
     4982            int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
    49964983            if (slider->tickPosition & QSlider::TicksBelow) {
    49974984                if (slider->orientation == Qt::Horizontal)
     
    50124999    case CT_ScrollBar:
    50135000        if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    5014             int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget);
    5015             int scrollBarSliderMinimum = pixelMetric(PM_ScrollBarSliderMin, option, widget);
     5001            int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget);
     5002            int scrollBarSliderMinimum = proxy()->pixelMetric(PM_ScrollBarSliderMin, option, widget);
    50165003            if (scrollBar->orientation == Qt::Horizontal) {
    50175004                newSize = QSize(scrollBarExtent * 3 + scrollBarSliderMinimum, scrollBarExtent);
     
    50455032        if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
    50465033            if (menuItem->menuItemType == QStyleOptionMenuItem::Separator)
    5047                 newSize.setHeight(menuItem->text.isEmpty() ? 2 : menuItem->fontMetrics.lineSpacing());
     5034                newSize.setHeight(menuItem->text.isEmpty() ? 2 : menuItem->fontMetrics.height());
    50485035        }
    50495036        break;
     
    50945081    case CC_Slider:
    50955082        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    5096             int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
     5083            int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
    50975084
    50985085            switch (subControl) {
     
    51475134    case CC_ScrollBar:
    51485135        if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    5149             int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, scrollBar, widget);
     5136            int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollBar, widget);
    51505137            int sliderMaxLength = ((scrollBar->orientation == Qt::Horizontal) ?
    51515138                                   scrollBar->rect.width() : scrollBar->rect.height()) - (scrollBarExtent * 3);
    5152             int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
     5139            int sliderMinLength = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
    51535140            int sliderLength;
    51545141
     
    52725259        case SC_ComboBoxEditField: {
    52735260            if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
    5274                 int frameWidth = pixelMetric(PM_DefaultFrameWidth);
     5261                int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth);
    52755262                rect = visualRect(option->direction, option->rect, rect);
    52765263
     
    54545441        ret = 96; // from Plastik
    54555442        break;
     5443#ifdef Q_WS_X11
     5444    case SH_DialogButtonBox_ButtonsHaveIcons:
     5445        ret = true;
     5446        break;
     5447#endif
     5448#ifndef Q_OS_WIN
     5449    case SH_Menu_AllowActiveAndDisabled:
     5450        ret = false;
     5451        break;
     5452#endif
    54565453    default:
    54575454        ret = QWindowsStyle::styleHint(hint, option, widget, returnData);
     
    54725469    case CC_ScrollBar:
    54735470        if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    5474             QRect slider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
     5471            QRect slider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
    54755472            if (slider.contains(pos)) {
    54765473                ret = SC_ScrollBarSlider;
     
    54785475            }
    54795476
    5480             QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
     5477            QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
    54815478            if (scrollBarAddLine.contains(pos)) {
    54825479                ret = SC_ScrollBarAddLine;
     
    54845481            }
    54855482
    5486             QRect scrollBarSubPage = subControlRect(control, scrollBar, SC_ScrollBarSubPage, widget);
     5483            QRect scrollBarSubPage = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubPage, widget);
    54875484            if (scrollBarSubPage.contains(pos)) {
    54885485                ret = SC_ScrollBarSubPage;
     
    54905487            }
    54915488
    5492             QRect scrollBarAddPage = subControlRect(control, scrollBar, SC_ScrollBarAddPage, widget);
     5489            QRect scrollBarAddPage = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddPage, widget);
    54935490            if (scrollBarAddPage.contains(pos)) {
    54945491                ret = SC_ScrollBarAddPage;
     
    54965493            }
    54975494
    5498             QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
     5495            QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
    54995496            if (scrollBarSubLine.contains(pos)) {
    55005497                ret = SC_ScrollBarSubLine;
     
    55225519        ret = 0;
    55235520        break;
    5524     case PM_ToolBarIconSize:
    5525         ret = 24;
    5526         break;
    55275521    case PM_ButtonShiftHorizontal:
    55285522    case PM_ButtonShiftVertical:
     
    56155609        if (widget && widget->inherits("Q3DockWindowTitleBar")) {
    56165610            // Q3DockWindow has smaller title bars than QDockWidget
    5617             ret = qMax(widget->fontMetrics().lineSpacing(), 20);
     5611            ret = qMax(widget->fontMetrics().height(), 20);
    56185612        } else
    56195613#endif
    5620         ret = qMax(widget ? widget->fontMetrics().lineSpacing() :
    5621                    (option ? option->fontMetrics.lineSpacing() : 0), 30);
     5614        ret = qMax(widget ? widget->fontMetrics().height() :
     5615                   (option ? option->fontMetrics.height() : 0), 30);
    56225616        break;
    56235617    case PM_MaximumDragDistance:
  • trunk/src/gui/styles/qplastiquestyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qstyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    169169    \section1 Creating a Custom Style
    170170
    171     If you want to design a custom look and feel for your application,
    172     the first step is to pick one of the styles provided with Qt to
    173     build your custom style from. The choice will depend on which
    174     existing style resembles your style the most. The most general
    175     class that you can use as base is QCommonStyle (and not QStyle).
    176     This is because Qt requires its styles to be \l{QCommonStyle}s.
     171    You can create a custom look and feel for your application by
     172    creating a custom style. There are two approaches to creating a
     173    custom style. In the static approach, you either choose an
     174    existing QStyle class, subclass it, and reimplement virtual
     175    functions to provide the custom behavior, or you create an entire
     176    QStyle class from scratch. In the dynamic approach, you modify the
     177    behavior of your system style at runtime. The static approach is
     178    described below. The dynamic approach is described in QProxyStyle.
     179
     180    The first step in the static approach is to pick one of the styles
     181    provided by Qt from which you will build your custom style. Your
     182    choice of QStyle class will depend on which style resembles your
     183    desired style the most. The most general class that you can use as
     184    a base is QCommonStyle (not QStyle). This is because Qt requires
     185    its styles to be \l{QCommonStyle}s.
    177186
    178187    Depending on which parts of the base style you want to change,
     
    223232
    224233    There are several ways of using a custom style in a Qt
    225     application. The simplest way is call the
     234    application. The simplest way is to pass the custom style to the
    226235    QApplication::setStyle() static function before creating the
    227236    QApplication object:
     
    233242    set using the \c -style command-line option, is respected.
    234243
    235     You may want to make your style available for use in other
    236     applications, some of which may not be yours and are not available for
     244    You may want to make your custom style available for use in other
     245    applications, which may not be yours and hence not available for
    237246    you to recompile. The Qt Plugin system makes it possible to create
    238247    styles as plugins. Styles created as plugins are loaded as shared
     
    326335    : QObject(*new QStylePrivate)
    327336{
    328 }
    329 
     337    Q_D(QStyle);
     338    d->proxyStyle = this;
     339}
    330340
    331341/*!
     
    337347    : QObject(dd)
    338348{
     349  Q_D(QStyle);
     350  d->proxyStyle = this;
    339351}
    340352
     
    452464    if (!text.isEmpty()) {
    453465        result = metrics.boundingRect(x, y, w, h, alignment, text);
    454         if (!enabled && styleHint(SH_EtchDisabledText)) {
     466        if (!enabled && proxy()->styleHint(SH_EtchDisabledText)) {
    455467            result.setWidth(result.width()+1);
    456468            result.setHeight(result.height()+1);
     
    514526    }
    515527    if (!enabled) {
    516         if (styleHint(SH_DitherDisabledText)) {
    517             painter->drawText(rect, alignment, text);
    518             painter->fillRect(painter->boundingRect(rect, alignment, text), QBrush(painter->background().color(), Qt::Dense5Pattern));
     528        if (proxy()->styleHint(SH_DitherDisabledText)) {
     529            QRect br;
     530            painter->drawText(rect, alignment, text, &br);
     531            painter->fillRect(br, QBrush(painter->background().color(), Qt::Dense5Pattern));
    519532            return;
    520         } else if (styleHint(SH_EtchDisabledText)) {
     533        } else if (proxy()->styleHint(SH_EtchDisabledText)) {
    521534            QPen pen = painter->pen();
    522535            painter->setPen(pal.light().color());
     
    552565    \enum QStyle::PrimitiveElement
    553566
    554     This enum describes that various primitive elements. A
     567    This enum describes the various primitive elements. A
    555568    primitive element is a common GUI element, such as a checkbox
    556569    indicator or button bevel.
     
    10491062    \value SE_TabBarTabText Area for the text on a tab in a tab bar.
    10501063
     1064    \value SE_ToolBarHandle Area for the handle of a tool bar.
     1065
    10511066    \sa subElementRect()
    10521067*/
     
    10941109    \value CC_Slider            A slider, like QSlider.
    10951110    \value CC_ToolButton        A tool button, like QToolButton.
    1096     \value CC_TitleBar          A Title bar, like those used in QWorkspace.
     1111    \value CC_TitleBar          A Title bar, like those used in QMdiSubWindow.
    10971112    \value CC_Q3ListView        Used for drawing the Q3ListView class.
    10981113    \value CC_GroupBox          A group box, like QGroupBox.
     
    11781193    \value SC_All  Special value that matches all sub-controls.
    11791194    \omitvalue SC_Q3ListViewBranch
     1195    \omitvalue SC_CustomBase
    11801196
    11811197    \sa ComplexControl
     
    13311347
    13321348    \value PM_MaximumDragDistance The maximum allowed distance between
    1333     the mouse and a slider when dragging. Exceeding the specified
     1349    the mouse and a scrollbar when dragging. Exceeding the specified
    13341350    distance will cause the slider to jump back to the original
    13351351    position; a value of -1 disables this behavior.
     
    15711587
    15721588/*!
     1589    \enum QStyle::RequestSoftwareInputPanel
     1590
     1591    This enum describes under what circumstances a software input panel will be
     1592    requested by input capable widgets.
     1593
     1594    \value RSIP_OnMouseClickAndAlreadyFocused Requests an input panel if the user
     1595           clicks on the widget, but only if it is already focused.
     1596    \value RSIP_OnMouseClick Requests an input panel if the user clicks on the
     1597           widget.
     1598
     1599    \sa QEvent::RequestSoftwareInputPanel, QInputContext
     1600*/
     1601
     1602/*!
    15731603    \enum QStyle::StyleHint
    15741604
     
    18511881    \value SH_DockWidget_ButtonsHaveFrame Determines if dockwidget buttons should have frames. Default is true.
    18521882
     1883    \value SH_ToolButtonStyle Determines the default system style for tool buttons that uses Qt::ToolButtonFollowStyle.
     1884
     1885    \value SH_RequestSoftwareInputPanel Determines when a software input panel should
     1886           be requested by input widgets. Returns an enum of type QStyle::RequestSoftwareInputPanel.
     1887
    18531888    \omitvalue SH_UnderlineAccelerator
    18541889
     
    18631898    the given \a widget described by the provided style \a option.
    18641899
    1865     Note that currently, the \a returnData and \a widget parameters
    1866     are not used; they are provided for future enhancement. In
    1867     addition, the \a option parameter is used only in case of the
    1868     SH_ComboBox_Popup, SH_ComboBox_LayoutDirection, and
    1869     SH_GroupBox_TextLabelColor style hints.
     1900    \a returnData is used when the querying widget needs more detailed data than
     1901    the integer that styleHint() returns. See the QStyleHintReturn class
     1902    description for details.
    18701903*/
    18711904
     
    18771910
    18781911    \value SP_TitleBarMinButton  Minimize button on title bars (e.g.,
    1879         in QWorkspace).
     1912        in QMdiSubWindow).
    18801913    \value SP_TitleBarMenuButton Menu button on a title bar.
    18811914    \value SP_TitleBarMaxButton  Maximize button on title bars.
     
    19491982    custom values must be greater than this value.
    19501983
    1951     \sa standardPixmap() standardIcon()
    1952 */
    1953 
    1954 /*###
    1955   \enum QStyle::IconMode
    1956 
    1957   This enum represents the effects performed on a pixmap to achieve a
    1958   GUI style's perferred way of representing the image in different
    1959   states.
    1960 
    1961   \value IM_Disabled  A disabled pixmap (drawn on disabled widgets)
    1962   \value IM_Active  An active pixmap (drawn on active tool buttons and menu items)
    1963   \value IM_CustomBase  Base value for custom PixmapTypes; custom
    1964   values must be greater than this value
    1965 
    1966   \sa generatedIconPixmap()
     1984    \sa standardIcon()
    19671985*/
    19681986
     
    22472265    dynamically detect the slot and call it.
    22482266
    2249     \sa standardIconImplementation(), standardPixmap()
     2267    \sa standardIconImplementation()
    22502268*/
    22512269QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option,
     
    22722290    standardIcon() function (introduced in Qt 4.1) is not
    22732291    virtual. Instead, standardIcon() will dynamically detect and call
    2274     \e this slot.  The default implementation simply calls the
    2275     standardPixmap() function with the given parameters.
     2292    \e this slot.
    22762293
    22772294    The \a standardIcon is a standard pixmap which can follow some
     
    24012418}
    24022419
    2403 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
    24042420QT_BEGIN_INCLUDE_NAMESPACE
    24052421#include <QDebug>
     
    24082424QDebug operator<<(QDebug debug, QStyle::State state)
    24092425{
     2426#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
    24102427    debug << "QStyle::State(";
    24112428
     
    24382455    qSort(states);
    24392456    debug << states.join(QLatin1String(" | "));
    2440     debug << ")";
     2457    debug << ')';
     2458#endif
    24412459    return debug;
    24422460}
    2443 #endif
     2461
     2462/*!
     2463    \since 4.6
     2464
     2465    \fn const QStyle *QStyle::proxy() const
     2466
     2467    This function returns the current proxy for this style.
     2468    By default most styles will return themselves. However
     2469    when a proxy style is in use, it will allow the style to
     2470    call back into its proxy.
     2471*/
     2472const QStyle * QStyle::proxy() const
     2473{
     2474    Q_D(const QStyle);
     2475    return d->proxyStyle;
     2476}
     2477
     2478/* \internal
     2479
     2480    This function sets the base style that style calls will be
     2481    redirected to. Note that ownership is not transferred.
     2482*/
     2483void QStyle::setProxy(QStyle *style)
     2484{
     2485    Q_D(QStyle);
     2486    d->proxyStyle = style;
     2487}
    24442488
    24452489QT_END_NAMESPACE
  • trunk/src/gui/styles/qstyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    374374        SE_ShapedFrameContents,
    375375
     376        SE_ToolBarHandle,
     377
    376378        // do not add any values below/greater than this
    377379        SE_CustomBase = 0xf0000000
     
    454456        SC_MdiCloseButton   =      0x00000004,
    455457
     458        SC_CustomBase =            0xf0000000,
    456459        SC_All =                   0xffffffff
    457460    };
     
    629632    virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
    630633                                   const QSize &contentsSize, const QWidget *w = 0) const = 0;
     634
     635    enum RequestSoftwareInputPanel {
     636        RSIP_OnMouseClickAndAlreadyFocused,
     637        RSIP_OnMouseClick
     638    };
    631639
    632640    enum StyleHint {
     
    728736        SH_TabBar_CloseButtonPosition,
    729737        SH_DockWidget_ButtonsHaveFrame,
    730 
     738        SH_ToolButtonStyle,
     739        SH_RequestSoftwareInputPanel,
    731740        // Add new style hint values here
    732741
     
    846855                              QStyleOption *option = 0, QWidget *widget = 0) const;
    847856
     857    const QStyle * proxy() const;
     858
    848859protected Q_SLOTS:
    849860    QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0,
     
    860871    friend class QWidgetPrivate;
    861872    friend class QApplication;
     873    friend class QProxyStyle;
     874    friend class QProxyStylePrivate;
     875    void setProxy(QStyle *style);
    862876};
    863877
     
    865879Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
    866880
    867 #if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DEBUG)
    868881Q_GUI_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
    869 #endif
    870882
    871883QT_END_NAMESPACE
  • trunk/src/gui/styles/qstyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4444
    4545#include "private/qobject_p.h"
     46#include "private/qstylehelper_p.h"
     47#include <QtGui/qstyle.h>
    4648
    4749QT_BEGIN_NAMESPACE
     
    5254//
    5355// This file is not part of the Qt API.  It exists for the convenience
    54 // of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp.  This header
    55 // file may change from version to version without notice, or even be removed.
     56// of qstyle_*.cpp.  This header file may change from version to version
     57// without notice, or even be removed.
    5658//
    5759// We mean it.
     
    6062// Private class
    6163
     64class QStyle;
     65
    6266class QStylePrivate: public QObjectPrivate
    6367{
     
    6569public:
    6670    inline QStylePrivate()
    67         : layoutSpacingIndex(-1)
    68     { }
     71        : layoutSpacingIndex(-1), proxyStyle(0) {}
    6972    mutable int layoutSpacingIndex;
     73    QStyle *proxyStyle;
    7074};
    7175
     
    7680    QImage imageCache; \
    7781    QPainter *p = painter; \
    78     QString unique = uniqueName((a), option, option->rect.size()); \
     82    QString unique = QStyleHelper::uniqueName((a), option, option->rect.size()); \
    7983    int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
    80     bool doPixmapCache = UsePixmapCache && txType <= QTransform::TxTranslate; \
     84    bool doPixmapCache = txType <= QTransform::TxTranslate; \
    8185    if (doPixmapCache && QPixmapCache::find(unique, internalPixmapCache)) { \
    8286        painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
     
    8892            p = new QPainter(&imageCache); \
    8993        }
     94
    9095
    9196
  • trunk/src/gui/styles/qstylefactory.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6969#ifndef QT_NO_STYLE_WINDOWSMOBILE
    7070#include "qwindowsmobilestyle.h"
     71#endif
     72#ifndef QT_NO_STYLE_S60
     73#include "qs60style.h"
    7174#endif
    7275
     
    155158    else
    156159#endif
     160#ifndef QT_NO_STYLE_S60
     161    if (style == QLatin1String("s60"))
     162        ret = new QS60Style;
     163    else
     164#endif
    157165#ifndef QT_NO_STYLE_PLASTIQUE
    158166    if (style == QLatin1String("plastique"))
     
    171179#endif
    172180#ifndef QT_NO_STYLE_MAC
    173     if (style.left(9) == QLatin1String("macintosh")) {
     181    if (style.startsWith(QLatin1String("macintosh"))) {
    174182        ret = new QMacStyle;
    175183#  ifdef Q_WS_MAC
     
    234242        list << QLatin1String("CDE");
    235243#endif
     244#ifndef QT_NO_STYLE_S60
     245    if (!list.contains(QLatin1String("S60")))
     246        list << QLatin1String("S60");
     247#endif
    236248#ifndef QT_NO_STYLE_PLASTIQUE
    237249    if (!list.contains(QLatin1String("Plastique")))
  • trunk/src/gui/styles/qstylefactory.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qstyleoption.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4646# include "qmacstyle_mac.h"
    4747#endif
    48 #ifndef QT_NO_DEBUG
    4948#include <qdebug.h>
    50 #endif
     49#include <QtCore/qmath.h>
    5150
    5251QT_BEGIN_NAMESPACE
     
    657656    \enum QStyleOptionFrameV2::FrameFeature
    658657
    659     This enum describles the different types of features a frame can have.
     658    This enum describes the different types of features a frame can have.
    660659
    661660    \value None Indicates a normal frame.
     
    712711*/
    713712QStyleOptionFrameV3::QStyleOptionFrameV3()
    714     : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame)
     713    : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame), unused(0)
    715714{
    716715}
     
    726725*/
    727726QStyleOptionFrameV3::QStyleOptionFrameV3(int version)
    728     : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame)
     727    : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame), unused(0)
    729728{
    730729}
     
    899898    \enum QStyleOptionViewItemV2::ViewItemFeature
    900899
    901     This enum describles the different types of features an item can have.
     900    This enum describes the different types of features an item can have.
    902901
    903902    \value None      Indicates a normal item.
     
    954953*/
    955954QStyleOptionViewItemV3::QStyleOptionViewItemV3()
    956     : QStyleOptionViewItemV2(Version)
     955    : QStyleOptionViewItemV2(Version), widget(0)
    957956{
    958957}
     
    962961*/
    963962QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItem &other)
    964     : QStyleOptionViewItemV2(Version)
     963    : QStyleOptionViewItemV2(Version), widget(0)
    965964{
    966965    (void)QStyleOptionViewItemV3::operator=(other);
     
    991990*/
    992991QStyleOptionViewItemV3::QStyleOptionViewItemV3(int version)
    993     : QStyleOptionViewItemV2(version)
     992    : QStyleOptionViewItemV2(version), widget(0)
    994993{
    995994}
     
    12541253
    12551254    The frame is flat by default.
    1256    
     1255
    12571256    \sa QStyleOptionFrameV2::FrameFeature
    12581257*/
     
    28282827/*!
    28292828    \variable QStyleOptionComplex::subControls
    2830     \brief a bitwise OR of the various sub-controls that need to be
    2831     drawn for the complex control
     2829
     2830    This variable holds a bitwise OR of the \l{QStyle::SubControl}
     2831    {sub-controls} to be drawn for the complex control.
    28322832
    28332833    The default value is QStyle::SC_All.
     
    28382838/*!
    28392839    \variable QStyleOptionComplex::activeSubControls
    2840     \brief a bitwise OR of the various sub-controls that are active
    2841     (pressed) for the complex control
     2840
     2841    This variable holds a bitwise OR of the \l{QStyle::SubControl}
     2842    {sub-controls} that are active for the complex control.
    28422843
    28432844    The default value is QStyle::SC_None.
     
    35423543
    35433544QStyleOptionDockWidget::QStyleOptionDockWidget()
    3544     : QStyleOption(Version, SO_DockWidget), movable(false)
     3545    : QStyleOption(Version, SO_DockWidget), closable(false),
     3546      movable(false), floatable(false)
    35453547{
    35463548}
     
    42574259
    42584260    QStyleOptionTitleBar contains all the information that QStyle
    4259     functions need to draw the title bars of QWorkspace's MDI
    4260     children.
     4261    functions need to draw the title bar of a QMdiSubWindow.
    42614262
    42624263    For performance reasons, the access to the member variables is
     
    42684269    the \l {widgets/styles}{Styles} example.
    42694270
    4270     \sa QStyleOption, QStyleOptionComplex, QWorkspace
     4271    \sa QStyleOption, QStyleOptionComplex, QMdiSubWindow
    42714272*/
    42724273
     
    46564657    The default value is QSize(-1, -1), i.e. an invalid size.
    46574658*/
     4659
     4660
     4661/*!
     4662
     4663    \class QStyleOptionTabWidgetFrameV2
     4664    \brief The QStyleOptionTabWidgetFrameV2 class is used to describe the
     4665    parameters for drawing the frame around a tab widget.
     4666
     4667    QStyleOptionTabWidgetFrameV2 contains all the information that
     4668    QStyle functions need to draw the frame around QTabWidget.
     4669
     4670    For performance reasons, the access to the member variables is
     4671    direct (i.e., using the \c . or \c -> operator). This low-level feel
     4672    makes the structures straightforward to use and emphasizes that
     4673    these are simply parameters used by the style functions.
     4674
     4675    For an example demonstrating how style options can be used, see
     4676    the \l {widgets/styles}{Styles} example.
     4677
     4678    \sa QStyleOption, QTabWidget
     4679*/
     4680
     4681
     4682/*!
     4683    \variable QStyleOptionTabWidgetFrameV2::tabBarRect
     4684    \brief the rectangle containing all the tabs
     4685
     4686    The default value is a null rectangle, i.e. a rectangle with both
     4687    the width and the height set to 0.
     4688*/
     4689
     4690/*!
     4691    \variable QStyleOptionTabWidgetFrameV2::selectedTabRect
     4692    \brief the rectangle containing the selected tab
     4693
     4694    This rectangle is contained within the tabBarRect. The default
     4695    value is a null rectangle, i.e. a rectangle with both the width
     4696    and the height set to 0.
     4697*/
     4698
     4699
     4700/*!
     4701    Constructs a QStyleOptionTabWidgetFrameV2, initializing the members
     4702    variables to their default values.
     4703*/
     4704
     4705QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2()
     4706    : QStyleOptionTabWidgetFrame(Version)
     4707{
     4708}
     4709
     4710
     4711/*! \internal */
     4712QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(int version)
     4713    : QStyleOptionTabWidgetFrame(version)
     4714{
     4715}
     4716
     4717
     4718/*! \fn QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other)
     4719    Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option.
     4720
     4721    If the \a other style option's version is 1, the new style option's \l
     4722    selectedTabRect and tabBarRect will contain null rects
     4723
     4724    \sa version
     4725*/
     4726
     4727/*!
     4728    Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option.
     4729
     4730    If the \a other style option's version is 1, the new style option's \l
     4731    selectedTabRect and tabBarRect will contain null rects
     4732
     4733    \sa version
     4734*/
     4735QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other)
     4736{
     4737    QStyleOptionTabWidgetFrameV2::operator=(other);
     4738
     4739}
     4740
     4741
     4742/*!
     4743    Assigns the \a other style option to this style option. The \a
     4744    other style option can be either of the QStyleOptionFrameV2 or
     4745    QStyleOptionFrame types.
     4746
     4747    If the \a{other} style option's version is 1, this style option's
     4748    QStyleOptionFrameV2::FrameFeature value is set to
     4749    QStyleOptionFrameV2::None. If its version is 2, its
     4750    \l{QStyleOptionFrameV2::}{FrameFeature} value is simply copied to
     4751    this style option.
     4752*/
     4753QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QStyleOptionTabWidgetFrame &other)
     4754{
     4755    QStyleOptionTabWidgetFrame::operator=(other);
     4756    if (const QStyleOptionTabWidgetFrameV2 *f2 = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2 *>(&other)) {
     4757        selectedTabRect = f2->selectedTabRect;
     4758        tabBarRect = f2->tabBarRect;
     4759    }
     4760    return *this;
     4761}
     4762
     4763
     4764/*!
     4765    \enum QStyleOptionTabWidgetFrameV2::StyleOptionVersion
     4766
     4767    This enum is used to hold information about the version of the style option, and
     4768    is defined for each QStyleOption subclass.
     4769
     4770    \value Version 2
     4771
     4772    The version is used by QStyleOption subclasses to implement
     4773    extensions without breaking compatibility. If you use
     4774    qstyleoption_cast(), you normally do not need to check it.
     4775
     4776    \sa StyleOptionType
     4777*/
     4778
     4779
    46584780#endif // QT_NO_TABWIDGET
    46594781
     
    48454967/*! \internal */
    48464968QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(int version)
    4847     : QStyleOptionTabBarBase(version)
     4969    : QStyleOptionTabBarBase(version), documentMode(false)
    48484970{
    48494971}
     
    49375059    the parameters needed to draw a QGraphicsItem.
    49385060    \since 4.2
    4939     \ingroup multimedia
     5061    \ingroup graphicsview-api
    49405062
    49415063    For performance reasons, the access to the member variables is
     
    49825104
    49835105/*!
    4984     Constructs a QStyleOptionGraphicsItem. The levelOfDetail parameter is
    4985     initialized to 1.
     5106    Constructs a QStyleOptionGraphicsItem.
    49865107*/
    49875108QStyleOptionGraphicsItem::QStyleOptionGraphicsItem()
     
    49965117    : QStyleOption(version, Type), levelOfDetail(1)
    49975118{
     5119}
     5120
     5121/*!
     5122    \since 4.6
     5123
     5124    Returns the level of detail from the \a worldTransform.
     5125
     5126    Its value represents the maximum value of the height and
     5127    width of a unity rectangle, mapped using the \a worldTransform
     5128    of the painter used to draw the item. By default, if no
     5129    transformations are applied, its value is 1. If zoomed out 1:2, the level
     5130    of detail will be 0.5, and if zoomed in 2:1, its value is 2.
     5131*/
     5132qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &worldTransform)
     5133{
     5134    if (worldTransform.type() <= QTransform::TxTranslate)
     5135        return 1; // Translation only? The LOD is 1.
     5136
     5137    // Two unit vectors.
     5138    QLineF v1(0, 0, 1, 0);
     5139    QLineF v2(0, 0, 0, 1);
     5140    // LOD is the transformed area of a 1x1 rectangle.
     5141    return qSqrt(worldTransform.map(v1).length() * worldTransform.map(v2).length());
    49985142}
    49995143
     
    50115155    item are exposed. If the whole item is exposed, this rectangle will be the
    50125156    same as QGraphicsItem::boundingRect().
     5157
     5158    This member is only initialized for items that have the
     5159    QGraphicsItem::ItemUsesExtendedStyleOption flag set.
    50135160*/
    50145161
     
    50165163     \variable QStyleOptionGraphicsItem::matrix
    50175164     \brief the complete transformation matrix for the item
    5018 
    5019      This matrix is the sum of the item's scene matrix and the matrix of the
    5020      painter used for drawing the item. It is provided for convenience,
     5165     \obsolete
     5166
     5167     The QMatrix provided through this member does include information about
     5168     any perspective transformations applied to the view or item. To get the
     5169     correct transformation matrix, use QPainter::transform() on the painter
     5170     passed into the QGraphicsItem::paint() implementation.
     5171
     5172     This matrix is the combination of the item's scene matrix and the matrix
     5173     of the painter used for drawing the item. It is provided for convenience,
    50215174     allowing anvanced level-of-detail metrics that can be used to speed up
    50225175     item drawing.
    50235176
    5024      To find the dimentions of an item in screen coordinates (i.e., pixels),
     5177     To find the dimensions of an item in screen coordinates (i.e., pixels),
    50255178     you can use the mapping functions of QMatrix, such as QMatrix::map().
    50265179
    5027      \sa QStyleOptionGraphicsItem::levelOfDetail
     5180     This member is only initialized for items that have the
     5181     QGraphicsItem::ItemUsesExtendedStyleOption flag set.
     5182
     5183     \sa QStyleOptionGraphicsItem::levelOfDetailFromTransform()
    50285184*/
    50295185
    50305186/*!
    50315187    \variable QStyleOptionGraphicsItem::levelOfDetail
    5032     \brief a simple metric for determining an item's level of detail
    5033 
    5034     This simple metric provides an easy way to determine the level of detail
    5035     for an item. Its value represents the maximum value of the height and
    5036     width of a unity rectangle, mapped using the complete transformation
    5037     matrix of the painter used to draw the item. By default, if no
    5038     transformations are applied, its value is 1. If zoomed out 1:2, the level
    5039     of detail will be 0.5, and if zoomed in 2:1, its value is 2.
    5040 
    5041     For more advanced level-of-detail metrics, use
    5042     QStyleOptionGraphicsItem::matrix directly.
    5043 
    5044     \sa QStyleOptionGraphicsItem::matrix
     5188    \obsolete
     5189
     5190    Use QStyleOptionGraphicsItem::levelOfDetailFromTransform()
     5191    together with QPainter::worldTransform() instead.
    50455192*/
    50465193
     
    52735420*/
    52745421
     5422QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
     5423{
    52755424#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
    5276 QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
    5277 {
    52785425    switch (optionType) {
    52795426    case QStyleOption::SO_Default:
     
    53365483        debug << "SO_GraphicsItem"; break;
    53375484    }
     5485#endif
    53385486    return debug;
    53395487}
     
    53415489QDebug operator<<(QDebug debug, const QStyleOption &option)
    53425490{
     5491#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
    53435492    debug << "QStyleOption(";
    53445493    debug << QStyleOption::OptionType(option.type);
    5345     debug << "," << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
    5346     debug << "," << option.state;
    5347     debug << "," << option.rect;
    5348     debug << ")";
     5494    debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
     5495    debug << ',' << option.state;
     5496    debug << ',' << option.rect;
     5497    debug << ')';
     5498#endif
    53495499    return debug;
    53505500}
    5351 #endif
    53525501
    53535502QT_END_NAMESPACE
  • trunk/src/gui/styles/qstyleoption.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    193193    QStyleOptionTabWidgetFrame(int version);
    194194};
     195
     196class Q_GUI_EXPORT QStyleOptionTabWidgetFrameV2 : public QStyleOptionTabWidgetFrame
     197{
     198public:
     199    enum StyleOptionVersion { Version = 2 };
     200
     201    QRect tabBarRect;
     202    QRect selectedTabRect;
     203
     204    QStyleOptionTabWidgetFrameV2();
     205    QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other) :
     206            QStyleOptionTabWidgetFrame(Version) { *this = other; }
     207    QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other);
     208    QStyleOptionTabWidgetFrameV2 &operator=(const QStyleOptionTabWidgetFrame &other);
     209
     210protected:
     211    QStyleOptionTabWidgetFrameV2(int version);
     212};
     213
    195214#endif
     215
    196216
    197217#ifndef QT_NO_TABBAR
     
    857877    QStyleOptionGraphicsItem();
    858878    QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; }
     879    static qreal levelOfDetailFromTransform(const QTransform &worldTransform);
    859880protected:
    860881    QStyleOptionGraphicsItem(int version);
     
    938959}
    939960
    940 #if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DEBUG)
    941961Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType);
    942962Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option);
    943 #endif
    944963
    945964QT_END_NAMESPACE
  • trunk/src/gui/styles/qstyleplugin.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qstyleplugin.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qstylesheetstyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8282#include <QAbstractSpinBox>
    8383#include <QLabel>
     84#include "qdrawutil.h"
    8485
    8586#include <limits.h>
     87#include <QtGui/qtoolbar.h>
    8688
    8789QT_BEGIN_NAMESPACE
     
    214216    PseudoElement_ViewItemIndicator,
    215217    PseudoElement_ScrollAreaCorner,
     218    PseudoElement_TabBarTabCloseButton,
    216219    NumPseudoElements
    217220};
     
    223226
    224227static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = {
    225     { QStyle::SC_None, "", },
     228    { QStyle::SC_None, "" },
    226229    { QStyle::SC_None, "down-arrow" },
    227230    { QStyle::SC_None, "up-arrow" },
     
    300303    { QStyle::SC_None, "icon" },
    301304    { QStyle::SC_None, "text" },
    302     { QStyle::SC_None, "indicator" } ,
    303     { QStyle::SC_None, "corner" }
     305    { QStyle::SC_None, "indicator" },
     306    { QStyle::SC_None, "corner" },
     307    { QStyle::SC_None, "close-button" },
    304308};
    305309
     
    313317            cuts[i] = -1;
    314318    }
    315     QPixmap topEdge, bottomEdge, leftEdge, rightEdge, middle;
    316     QRect topEdgeRect, bottomEdgeRect, leftEdgeRect, rightEdgeRect, middleRect;
    317     QRect topLeftCorner, topRightCorner, bottomRightCorner, bottomLeftCorner;
    318319    int cuts[4];
    319320    QPixmap pixmap;
    320321    QImage image;
    321322    QCss::TileMode horizStretch, vertStretch;
    322 
    323     void cutBorderImage();
    324323};
    325324
     
    872871: features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0)
    873872{
    874     QPalette palette = qApp->palette(); // ###: ideally widget's palette
     873    QPalette palette = QApplication::palette(); // ###: ideally widget's palette
    875874    ValueExtractor v(declarations, palette);
    876875    features = v.extractStyleFeatures();
     
    11231122            bi->cuts[i] = int(border()->borders[i]);
    11241123    }
    1125     bi->cutBorderImage();
    1126 }
    1127 
    1128 void QStyleSheetBorderImageData::cutBorderImage()
    1129 {
    1130     const int w = pixmap.width();
    1131     const int h = pixmap.height();
    1132     const int &l = cuts[LeftEdge], &r = cuts[RightEdge],
    1133               &t = cuts[TopEdge], &b = cuts[BottomEdge];
    1134 
    1135     topEdgeRect = QRect(l, 0, w - r - l, t);
    1136     bottomEdgeRect = QRect(l, h - b, w - l - r, b);
    1137     if (horizStretch != TileMode_Stretch) {
    1138         if (topEdgeRect.isValid())
    1139             topEdge = pixmap.copy(topEdgeRect).scaledToHeight(t);
    1140         if (bottomEdgeRect.isValid())
    1141             bottomEdge = pixmap.copy(bottomEdgeRect).scaledToHeight(b);
    1142     }
    1143 
    1144     leftEdgeRect = QRect(0, t, l, h - b - t);
    1145     rightEdgeRect = QRect(w - r, t, r, h - t- b);
    1146     if (vertStretch != TileMode_Stretch) {
    1147         if (leftEdgeRect.isValid())
    1148             leftEdge = pixmap.copy(leftEdgeRect).scaledToWidth(l);
    1149         if (rightEdgeRect.isValid())
    1150             rightEdge = pixmap.copy(rightEdgeRect).scaledToWidth(r);
    1151     }
    1152 
    1153     middleRect = QRect(l, t, w - r -l, h - t - b);
    1154     if (middleRect.isValid()
    1155         && !(horizStretch == TileMode_Stretch && vertStretch == TileMode_Stretch)) {
    1156         middle = pixmap.copy(middleRect);
    1157     }
    1158 }
    1159 
    1160 static void qDrawCenterTiledPixmap(QPainter *p, const QRectF& r, const QPixmap& pix)
    1161 {
    1162     p->drawTiledPixmap(r, pix, QPoint(pix.width() - int(r.width())%pix.width(),
    1163                                       pix.height() - int(r.height())%pix.height()));
    1164 }
    1165 
    1166 // Note: Round is not supported
     1124}
     1125
    11671126void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect)
    11681127{
    1169     setClip(p, rect);
    1170     const QRectF br(rect);
    1171     const int *borders = border()->borders;
    1172     const int &l = borders[LeftEdge], &r = borders[RightEdge],
    1173               &t = borders[TopEdge],  &b = borders[BottomEdge];
    1174     QRectF pr = br.adjusted(l, t, -r, -b);
     1128    static const Qt::TileRule tileMode2TileRule[] = {
     1129        Qt::StretchTile, Qt::RoundTile, Qt::StretchTile, Qt::RepeatTile, Qt::StretchTile };
     1130
     1131    const QStyleSheetBorderImageData *borderImageData = border()->borderImage();
     1132    const int *targetBorders = border()->borders;
     1133    const int *sourceBorders = borderImageData->cuts;
     1134    QMargins sourceMargins(sourceBorders[LeftEdge], sourceBorders[TopEdge],
     1135                           sourceBorders[RightEdge], sourceBorders[BottomEdge]);
     1136    QMargins targetMargins(targetBorders[LeftEdge], targetBorders[TopEdge],
     1137                           targetBorders[RightEdge], targetBorders[BottomEdge]);
    11751138
    11761139    bool wasSmoothPixmapTransform = p->renderHints() & QPainter::SmoothPixmapTransform;
    11771140    p->setRenderHint(QPainter::SmoothPixmapTransform);
    1178 
    1179     const QStyleSheetBorderImageData *bi = border()->borderImage();
    1180     const QPixmap& pix = bi->pixmap;
    1181     const int *c = bi->cuts;
    1182     QRectF tlc(0, 0, c[LeftEdge], c[TopEdge]);
    1183     if (tlc.isValid())
    1184         p->drawPixmap(QRectF(br.topLeft(), QSizeF(l, t)), pix, tlc);
    1185     QRectF trc(pix.width() - c[RightEdge], 0, c[RightEdge], c[TopEdge]);
    1186     if (trc.isValid())
    1187         p->drawPixmap(QRectF(br.left() + br.width() - r, br.y(), r, t), pix, trc);
    1188     QRectF blc(0, pix.height() - c[BottomEdge], c[LeftEdge], c[BottomEdge]);
    1189     if (blc.isValid())
    1190         p->drawPixmap(QRectF(br.x(), br.y() + br.height() - b, l, b), pix, blc);
    1191     QRectF brc(pix.width() - c[RightEdge], pix.height() - c[BottomEdge],
    1192                c[RightEdge], c[BottomEdge]);
    1193     if (brc.isValid())
    1194         p->drawPixmap(QRectF(br.x() + br.width() - r, br.y() + br.height() - b, r, b),
    1195                       pix, brc);
    1196 
    1197     QRectF topEdgeRect(br.x() + l, br.y(), pr.width(), t);
    1198     QRectF bottomEdgeRect(br.x() + l, br.y() + br.height() - b, pr.width(), b);
    1199 
    1200     switch (bi->horizStretch) {
    1201     case TileMode_Stretch:
    1202         if (bi->topEdgeRect.isValid())
    1203             p->drawPixmap(topEdgeRect, pix, bi->topEdgeRect);
    1204         if (bi->bottomEdgeRect.isValid())
    1205             p->drawPixmap(bottomEdgeRect, pix, bi->bottomEdgeRect);
    1206         if (bi->middleRect.isValid()) {
    1207             if (bi->vertStretch == TileMode_Stretch)
    1208                 p->drawPixmap(pr, pix, bi->middleRect);
    1209             else if (bi->vertStretch == TileMode_Repeat) {
    1210                 QPixmap scaled = bi->middle.scaled(int(pr.width()), bi->middle.height());
    1211                 qDrawCenterTiledPixmap(p, pr, scaled);
    1212             }
    1213         }
    1214         break;
    1215     case TileMode_Repeat:
    1216         if (!bi->topEdge.isNull() && !topEdgeRect.isEmpty()) {
    1217             QPixmap scaled = bi->topEdge.scaled(bi->topEdge.width(), t);
    1218             qDrawCenterTiledPixmap(p, topEdgeRect, scaled);
    1219         }
    1220         if (!bi->bottomEdge.isNull() && !bottomEdgeRect.isEmpty()) {
    1221             QPixmap scaled = bi->bottomEdge.scaled(bi->bottomEdge.width(), b);
    1222             qDrawCenterTiledPixmap(p, bottomEdgeRect, scaled);
    1223         }
    1224         if (bi->middleRect.isValid()) {
    1225             if (bi->vertStretch == TileMode_Repeat) {
    1226                 qDrawCenterTiledPixmap(p, pr, bi->middle);
    1227             } else if (bi->vertStretch == TileMode_Stretch) {
    1228                 QPixmap scaled = bi->middle.scaled(bi->middle.width(), int(pr.height()));
    1229                 qDrawCenterTiledPixmap(p, pr, scaled);
    1230             }
    1231         }
    1232         break;
    1233     case TileMode_Round:
    1234         if (!bi->topEdge.isNull()) {
    1235             int rwh = (int)pr.width()/ceil(pr.width()/bi->topEdge.width());
    1236             QPixmap scaled = bi->topEdge.scaled(rwh, bi->topEdge.height());
    1237             int blank = int(pr.width()) % rwh;
    1238             p->drawTiledPixmap(QRectF(br.x() + l + blank/2, br.y(), pr.width() - blank, t),
    1239                                scaled);
    1240         }
    1241         if (!bi->bottomEdge.isNull()) {
    1242             int rwh = (int) pr.width()/ceil(pr.width()/bi->bottomEdge.width());
    1243             QPixmap scaled = bi->bottomEdge.scaled(rwh, bi->bottomEdge.height());
    1244             int blank = int(pr.width()) % rwh;
    1245             p->drawTiledPixmap(QRectF(br.x() + l+ blank/2, br.y()+br.height()-b,
    1246                                       pr.width() - blank, b), scaled);
    1247         }
    1248         break;
    1249     default:
    1250         break;
    1251     }
    1252 
    1253     QRectF leftEdgeRect(br.x(), br.y() + t, l, pr.height());
    1254     QRectF rightEdgeRect(br.x() + br.width()- r, br.y() + t, r, pr.height());
    1255 
    1256     switch (bi->vertStretch) {
    1257     case TileMode_Stretch:
    1258          if (bi->leftEdgeRect.isValid())
    1259               p->drawPixmap(leftEdgeRect, pix, bi->leftEdgeRect);
    1260         if (bi->rightEdgeRect.isValid())
    1261             p->drawPixmap(rightEdgeRect, pix, bi->rightEdgeRect);
    1262         break;
    1263     case TileMode_Repeat:
    1264         if (!bi->leftEdge.isNull() && !leftEdgeRect.isEmpty()) {
    1265             QPixmap scaled = bi->leftEdge.scaled(l, bi->leftEdge.height());
    1266             qDrawCenterTiledPixmap(p, leftEdgeRect, scaled);
    1267         }
    1268         if (!bi->rightEdge.isNull() && !rightEdgeRect.isEmpty()) {
    1269             QPixmap scaled = bi->rightEdge.scaled(r, bi->rightEdge.height());
    1270             qDrawCenterTiledPixmap(p, rightEdgeRect, scaled);
    1271         }
    1272         break;
    1273     case TileMode_Round:
    1274         if (!bi->leftEdge.isNull()) {
    1275             int rwh = (int) pr.height()/ceil(pr.height()/bi->leftEdge.height());
    1276             QPixmap scaled = bi->leftEdge.scaled(bi->leftEdge.width(), rwh);
    1277             int blank = int(pr.height()) % rwh;
    1278             p->drawTiledPixmap(QRectF(br.x(), br.y() + t + blank/2, l, pr.height() - blank),
    1279                                scaled);
    1280         }
    1281         if (!bi->rightEdge.isNull()) {
    1282             int rwh = (int) pr.height()/ceil(pr.height()/bi->rightEdge.height());
    1283             QPixmap scaled = bi->rightEdge.scaled(bi->rightEdge.width(), rwh);
    1284             int blank = int(pr.height()) % rwh;
    1285             p->drawTiledPixmap(QRectF(br.x() + br.width() - r, br.y()+t+blank/2, r,
    1286                                       pr.height() - blank), scaled);
    1287         }
    1288         break;
    1289     default:
    1290         break;
    1291     }
    1292 
     1141    qDrawBorderPixmap(p, rect, targetMargins, borderImageData->pixmap,
     1142                      QRect(QPoint(), borderImageData->pixmap.size()), sourceMargins,
     1143                      QTileRules(tileMode2TileRule[borderImageData->horizStretch], tileMode2TileRule[borderImageData->vertStretch]));
    12931144    p->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothPixmapTransform);
    1294     unsetClip(p);
    12951145}
    12961146
     
    13311181    QRect r = originRect(rect, background()->origin);
    13321182    QRect aligned = QStyle::alignedRect(Qt::LeftToRight, background()->position, bgp.size(), r);
    1333     QRect inter = aligned.intersected(r);
     1183    QRect inter = aligned.translated(-off).intersected(r);
    13341184
    13351185    switch (background()->repeat) {
     
    14521302void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& off)
    14531303{
    1454     setClip(p, borderRect(rect));
    14551304    QBrush brush = hasBackground() ? background()->brush : QBrush();
    14561305    if (brush.style() == Qt::NoBrush)
     
    14601309        Origin origin = hasBackground() ? background()->clip : Origin_Border;
    14611310        // ### fix for  gradients
    1462         p->fillRect(originRect(rect, origin), brush);
     1311        const QPainterPath &borderPath = borderClip(originRect(rect, origin));
     1312        if (!borderPath.isEmpty()) {
     1313            // Drawn intead of being used as clipping path for better visual quality
     1314            bool wasAntialiased = p->renderHints() & QPainter::Antialiasing;
     1315            p->setRenderHint(QPainter::Antialiasing);
     1316            p->fillPath(borderPath, brush);
     1317            p->setRenderHint(QPainter::Antialiasing, wasAntialiased);
     1318        } else {
     1319            p->fillRect(originRect(rect, origin), brush);
     1320        }
    14631321    }
    14641322
    14651323    drawBackgroundImage(p, rect, off);
    1466     unsetClip(p);
    14671324}
    14681325
     
    15261383         * to be transparent when we have a transparent background or border image */
    15271384        if ((hasBackground() && background()->isTransparent())
    1528             || (hasBorder() && border()->hasBorderImage() && border()->borderImage()->middleRect.isValid()))
     1385            || (hasBorder() && border()->hasBorderImage() && !border()->borderImage()->pixmap.isNull()))
    15291386            p->setBrush(cg, w->backgroundRole(), Qt::NoBrush);
    15301387    }
     
    17091566            parser.init(wid->styleSheet());
    17101567            if (!parser.parse(&ss)) {
    1711                 parser.init(QLatin1String("* {") + wid->styleSheet() + QLatin1String("}"));
     1568                parser.init(QLatin1String("* {") + wid->styleSheet() + QLatin1Char('}'));
    17121569                if (!parser.parse(&ss))
    17131570                   qWarning("Could not parse stylesheet of widget %p", wid);
     
    19031760
    19041761            if (!(complex->activeSubControls & subControl))
    1905                 state = QStyle::State(state & (QStyle::State_Enabled | QStyle::State_Horizontal));
     1762                state &= (QStyle::State_Enabled | QStyle::State_Horizontal | QStyle::State_HasFocus);
    19061763        }
    19071764
     
    21582015        } else
    21592016#endif
    2160         { } // required for the above ifdef'ery
     2017        if (const QFrame *frm = qobject_cast<const QFrame *>(w)) {
     2018            if (frm->lineWidth() == 0)
     2019                extraClass |= PseudoClass_Frameless;
     2020        }
    21612021    }
    21622022
     
    27382598        widget->style()->polish(widget);
    27392599        QEvent event(QEvent::StyleChange);
    2740         qApp->sendEvent(widget, &event);
     2600        QApplication::sendEvent(widget, &event);
    27412601        widget->update();
    27422602        widget->updateGeometry();
     
    27842644    if (base)
    27852645        return base;
    2786     if (QStyleSheetStyle *me = qobject_cast<QStyleSheetStyle *>(qApp->style()))
     2646    if (QStyleSheetStyle *me = qobject_cast<QStyleSheetStyle *>(QApplication::style()))
    27872647        return me->base;
    2788     return qApp->style();
     2648    return QApplication::style();
    27892649}
    27902650
     
    28562716        if ((rule.hasBorder() && rule.border()->hasBorderImage())
    28572717            || (rule.hasBackground() && !rule.background()->pixmap.isNull())) {
    2858             QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
    2859                              sa, SLOT(update()));
    2860             QObject::disconnect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)),
    2861                              sa, SLOT(update()));
    28622718            QObject::connect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
    2863                              sa, SLOT(update()));
     2719                             sa, SLOT(update()), Qt::UniqueConnection);
    28642720            QObject::connect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)),
    2865                              sa, SLOT(update()));
     2721                             sa, SLOT(update()), Qt::UniqueConnection);
    28662722        }
    28672723    }
     
    28772733    if (rule.hasDrawable() || rule.hasBox()) {
    28782734        if (w->metaObject() == &QWidget::staticMetaObject
    2879 #ifndef QT_NO_MENUBAR
    2880               || qobject_cast<QMenuBar *>(w)
    2881 #endif
    2882 #ifndef QT_NO_MENU
    2883               || qobject_cast<QMenu *>(w)
    2884 #endif
    28852735#ifndef QT_NO_ITEMVIEWS
    28862736              || qobject_cast<QHeaderView *>(w)
     
    28972747#ifndef QT_NO_MDIAREA
    28982748              || qobject_cast<QMdiSubWindow *>(w)
     2749#endif
     2750#ifndef QT_NO_MENUBAR
     2751              || qobject_cast<QMenuBar *>(w)
    28992752#endif
    29002753              || qobject_cast<QDialog *>(w)) {
     
    30142867                rule.configurePalette(&cmbOpt.palette, QPalette::ButtonText, QPalette::Button);
    30152868                bool customDropDown = (opt->subControls & QStyle::SC_ComboBoxArrow)
    3016                                       && hasStyleRule(w, PseudoElement_ComboBoxDropDown);
     2869                                && (hasStyleRule(w, PseudoElement_ComboBoxDropDown) || hasStyleRule(w, PseudoElement_ComboBoxArrow));
    30172870                if (customDropDown)
    30182871                    cmbOpt.subControls &= ~QStyle::SC_ComboBoxArrow;
     
    30512904            QStyleOptionSpinBox spinOpt(*spin);
    30522905            rule.configurePalette(&spinOpt.palette, QPalette::ButtonText, QPalette::Button);
     2906            rule.configurePalette(&spinOpt.palette, QPalette::Text, QPalette::Base);
    30532907            spinOpt.rect = rule.borderRect(opt->rect);
    30542908            bool customUp = true, customDown = true;
    30552909            QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
    30562910            QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);
    3057             bool upRuleMatch = upRule.hasGeometry();
    3058             bool downRuleMatch = downRule.hasGeometry();
     2911            bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();
     2912            bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition();
    30592913            if (rule.hasNativeBorder() && !upRuleMatch && !downRuleMatch) {
    30602914                rule.drawBackgroundImage(p, spinOpt.rect);
    30612915                customUp = (opt->subControls & QStyle::SC_SpinBoxUp)
    3062                            && hasStyleRule(w, PseudoElement_SpinBoxUpButton);
     2916                        && (hasStyleRule(w, PseudoElement_SpinBoxUpButton) || hasStyleRule(w, PseudoElement_UpArrow));
    30632917                if (customUp)
    30642918                    spinOpt.subControls &= ~QStyle::SC_SpinBoxUp;
    30652919                customDown = (opt->subControls & QStyle::SC_SpinBoxDown)
    3066                              && hasStyleRule(w, PseudoElement_SpinBoxDownButton);
     2920                        && (hasStyleRule(w, PseudoElement_SpinBoxDownButton) || hasStyleRule(w, PseudoElement_DownArrow));
    30672921                if (customDown)
    30682922                    spinOpt.subControls &= ~QStyle::SC_SpinBoxDown;
     
    31903044            QStyleOptionToolButton toolOpt(*tool);
    31913045            rule.configurePalette(&toolOpt.palette, QPalette::ButtonText, QPalette::Button);
     3046            toolOpt.font = rule.font.resolve(toolOpt.font);
    31923047            toolOpt.rect = rule.borderRect(opt->rect);
    31933048            bool customArrow = (tool->features & (QStyleOptionToolButton::HasMenu | QStyleOptionToolButton::MenuButtonPopup));
     
    32823137            rule.drawRule(p, opt->rect);
    32833138
    3284             QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove);
    3285             if (!subRule.hasDrawable()) {
    3286                 baseStyle()->drawComplexControl(cc, slider, p, w);
    3287                 return;
     3139            QRenderRule grooveSubRule = renderRule(w, opt, PseudoElement_SliderGroove);
     3140            QRenderRule handleSubRule = renderRule(w, opt, PseudoElement_SliderHandle);
     3141            if (!grooveSubRule.hasDrawable()) {
     3142                QStyleOptionSlider slOpt(*slider);
     3143                bool handleHasRule = handleSubRule.hasDrawable();
     3144                // If the style specifies a different handler rule, draw the groove without the handler.
     3145                if (handleHasRule)
     3146                    slOpt.subControls &= ~SC_SliderHandle;
     3147                baseStyle()->drawComplexControl(cc, &slOpt, p, w);
     3148                if (!handleHasRule)
     3149                    return;
    32883150            }
    32893151
    32903152            QRect gr = subControlRect(cc, opt, SC_SliderGroove, w);
    32913153            if (slider->subControls & SC_SliderGroove) {
    3292                 subRule.drawRule(p, gr);
     3154                grooveSubRule.drawRule(p, gr);
    32933155            }
    32943156
    32953157            if (slider->subControls & SC_SliderHandle) {
    3296                 QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderHandle);
    32973158                QRect hr = subControlRect(cc, opt, SC_SliderHandle, w);
    32983159
     
    33153176                }
    33163177
    3317                 subRule.drawRule(p, subRule.boxRect(hr, Margin));
     3178                handleSubRule.drawRule(p, grooveSubRule.boxRect(hr, Margin));
    33183179            }
    33193180
     
    33493210                    QRect rect = subRule.boxRect(subControlRect(CC_MdiControls, opt, control, w), Margin);
    33503211                    subRule.drawRule(p, rect);
    3351                     QIcon icon = standardIcon(subControlIcon(layoutButton));
     3212                    QIcon icon = standardIcon(subControlIcon(layoutButton), opt);
    33523213                    icon.paint(p, subRule.contentsRect(rect), Qt::AlignCenter);
    33533214                } else {
     
    34653326
    34663327    case CE_PushButton:
    3467         ParentStyle::drawControl(ce, opt, p, w);
    3468         return;
    3469 
     3328        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
     3329            if (rule.hasDrawable() || rule.hasBox() || rule.hasPosition() || rule.hasPalette() ||
     3330                    ((btn->features & QStyleOptionButton::HasMenu) && hasStyleRule(w, PseudoElement_PushButtonMenuIndicator))) {
     3331                ParentStyle::drawControl(ce, opt, p, w);
     3332                return;
     3333            }
     3334        }
     3335        break;
    34703336    case CE_PushButtonBevel:
    34713337        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
     
    35103376                Qt::Alignment textAlignment = rule.position()->textAlignment;
    35113377                QRect textRect = button->rect;
    3512                 uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
     3378                uint tf = Qt::TextShowMnemonic;
     3379                const uint verticalAlignMask = Qt::AlignVCenter | Qt::AlignTop | Qt::AlignLeft;
     3380                tf |= (textAlignment & verticalAlignMask) ? (textAlignment & verticalAlignMask) : Qt::AlignVCenter;
    35133381                if (!styleHint(SH_UnderlineShortcut, button, w))
    35143382                    tf |= Qt::TextHideMnemonic;
     
    36193487    case CE_MenuBarEmptyArea:
    36203488        if (rule.hasDrawable()) {
     3489            // Drawn by PE_Widget
    36213490            return;
    36223491        }
     
    37363605                    drawPrimitive(arrow, &mi, p, w);
    37373606                }
    3738             } else if (hasStyleRule(w, PseudoElement_MenuCheckMark)) {
     3607            } else if (hasStyleRule(w, PseudoElement_MenuCheckMark) || hasStyleRule(w, PseudoElement_MenuRightArrow)) {
    37393608                QWindowsStyle::drawControl(ce, &mi, p, w);
     3609                if (mi.checkType != QStyleOptionMenuItem::NotCheckable && !mi.checked) {
     3610                    // We have a style defined, but QWindowsStyle won't draw anything if not checked.
     3611                    // So we mimick what QWindowsStyle would do.
     3612                    int checkcol = qMax<int>(mi.maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth);
     3613                    QRect vCheckRect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x(), mi.rect.y(), checkcol, mi.rect.height()));
     3614                    if (mi.state.testFlag(State_Enabled) && mi.state.testFlag(State_Selected)) {
     3615                        qDrawShadePanel(p, vCheckRect, mi.palette, true, 1, &mi.palette.brush(QPalette::Button));
     3616                    } else {
     3617                        QBrush fill(mi.palette.light().color(), Qt::Dense4Pattern);
     3618                        qDrawShadePanel(p, vCheckRect, mi.palette, true, 1, &fill);
     3619                    }
     3620                    QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark);
     3621                    if (subSubRule.hasDrawable()) {
     3622                        QStyleOptionMenuItem newMi(mi);
     3623                        newMi.rect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x() + QWindowsStylePrivate::windowsItemFrame,
     3624                                                                               mi.rect.y() + QWindowsStylePrivate::windowsItemFrame,
     3625                                                                               checkcol - 2 * QWindowsStylePrivate::windowsItemFrame,
     3626                                                                               mi.rect.height() - 2 * QWindowsStylePrivate::windowsItemFrame));
     3627                        drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, w);
     3628                    }
     3629                }
    37403630            } else {
    37413631                if (rule.hasDrawable() && !subRule.hasDrawable() && !(opt->state & QStyle::State_Selected)) {
     
    37693659                QCommonStyle::drawControl(ce, &mi, p, w);
    37703660            } else {
     3661                if (rule.hasDrawable() && !(opt->state & QStyle::State_Selected)) {
     3662                    // So that the menu bar background is not hidden by the items
     3663                    mi.palette.setColor(QPalette::Window, Qt::transparent);
     3664                    mi.palette.setColor(QPalette::Button, Qt::transparent);
     3665                }
    37713666                baseStyle()->drawControl(ce, &mi, p, w);
    37723667            }
     
    37903685                QRect iconRect(editRect);
    37913686                iconRect.setWidth(cb->iconSize.width());
    3792                 iconRect = alignedRect(QApplication::layoutDirection(),
    3793                                                            Qt::AlignLeft | Qt::AlignVCenter,
    3794                                                            iconRect.size(), editRect);
     3687                iconRect = alignedRect(cb->direction,
     3688                                       Qt::AlignLeft | Qt::AlignVCenter,
     3689                                       iconRect.size(), editRect);
    37953690                drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
    37963691
     
    38023697            if (!cb->currentText.isEmpty() && !cb->editable) {
    38033698                drawItemText(p, editRect.adjusted(0, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->palette,
    3804                              cb->state & State_Enabled, cb->currentText);
     3699                             cb->state & State_Enabled, cb->currentText, QPalette::Text);
    38053700            }
    38063701            p->restore();
     
    40933988            if (subRule.hasFont)
    40943989                p->setFont(subRule.font);
    4095             if (subRule.hasBox()) {
     3990            if (subRule.hasBox() || !subRule.hasNativeBorder()) {
    40963991                tabCopy.rect = ce == CE_TabBarTabShape ? subRule.borderRect(r)
    40973992                                                       : subRule.contentsRect(r);
     
    41654060                frmOpt.rect = rule.borderRect(frmOpt.rect);
    41664061                baseStyle()->drawControl(ce, &frmOpt, p, w);
    4167             } else {
    4168                 rule.drawBorder(p, rule.borderRect(opt->rect));
    4169             }
     4062            }
     4063            // else, borders are already drawn in PE_Widget
    41704064        }
    41714065        return;
     
    42214115
    42224116    switch (pe) {
    4223     case PE_PanelStatusBar:
    4224         if (rule.hasDrawable()) {
    4225             rule.drawRule(p, opt->rect);
    4226             return;
    4227         }
    4228         break;
    42294117
    42304118    case PE_FrameStatusBar: {
     
    43174205                if (!spinboxRule.hasNativeBorder() || !spinboxRule.baseStyleCanDraw())
    43184206                    return;
     4207                rule = spinboxRule;
    43194208            }
    43204209#endif
     
    43384227
    43394228    case PE_Widget:
    4340         if (!rule.hasBackground()) {
     4229        if (!rule.hasDrawable()) {
    43414230            QWidget *container = containerWidget(w);
    43424231            if (autoFillDisabledWidgets->contains(container)
     
    43484237            break;
    43494238        }
    4350 
    43514239#ifndef QT_NO_SCROLLAREA
    43524240        if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) {
    43534241            const QAbstractScrollAreaPrivate *sap = sa->d_func();
    43544242            rule.drawBackground(p, opt->rect, sap->contentsOffset());
    4355         } else
     4243            if (rule.hasBorder())
     4244                rule.drawBorder(p, rule.borderRect(opt->rect));
     4245            break;
     4246        }
    43564247#endif
    4357         {
    4358             rule.drawBackground(p, opt->rect);
    4359         }
    4360 
     4248    //fall tghought
     4249    case PE_PanelMenu:
     4250    case PE_PanelStatusBar:
     4251        if(rule.hasDrawable()) {
     4252            rule.drawRule(p, opt->rect);
     4253            return;
     4254        }
     4255    break;
     4256
     4257    case PE_PanelMenuBar:
     4258    if (rule.hasDrawable()) {
     4259        // Drawn by PE_Widget
    43614260        return;
    4362 
    4363     case PE_FrameMenu:
    4364     case PE_PanelMenuBar:
    4365         if (!rule.hasNativeBorder()) {
    4366             rule.drawBorder(p, rule.borderRect(opt->rect));
    4367             return;
    4368         }
    4369         break;
     4261    }
     4262    break;
    43704263
    43714264    case PE_IndicatorToolBarSeparator:
     
    44114304                subRule.drawRule(p, opt->rect);
    44124305            } else {
    4413                 QStyleOptionViewItemV2 v2Copy(*v2);
    4414                 if (v2->showDecorationSelected) {
    4415                     QRenderRule subRule2 = renderRule(w, opt, PseudoElement_ViewItem);
    4416                     if (v2->state & QStyle::State_Selected) {
    4417                         subRule2.configurePalette(&v2Copy.palette, QPalette::NoRole, QPalette::Highlight);
    4418                     } else if (v2->features & QStyleOptionViewItemV2::Alternate) {
    4419                         subRule2.configurePalette(&v2Copy.palette, QPalette::NoRole, QPalette::AlternateBase);
    4420                     } else if (subRule2.hasBackground()) {
    4421                         p->fillRect(v2->rect, subRule2.background()->brush);
    4422                     }
    4423                 } else if (v2->features & QStyleOptionViewItemV2::Alternate) {
    4424                     quint64 pc = v2->state & QStyle::State_Enabled ? PseudoClass_Enabled : PseudoClass_Disabled;
    4425                     pc |= PseudoClass_Alternate;
    4426                     QRenderRule subRule2 = renderRule(w, PseudoElement_ViewItem, pc);
    4427                     subRule2.configurePalette(&v2Copy.palette, QPalette::NoRole, QPalette::AlternateBase);
    4428                 }
    4429                 baseStyle()->drawPrimitive(pe, &v2Copy, p, w);
     4306                baseStyle()->drawPrimitive(pe, v2, p, w);
    44304307            }
    44314308        }
     
    44614338            if (subRule.hasNativeBorder()) {
    44624339                subRule.drawBackground(p, opt->rect);
    4463                 QStyleOptionTabWidgetFrame frmCopy(*frm);
     4340                QStyleOptionTabWidgetFrameV2 frmCopy(*frm);
    44644341                subRule.configurePalette(&frmCopy.palette, QPalette::WindowText, QPalette::Window);
    44654342                baseStyle()->drawPrimitive(pe, &frmCopy, p, w);
     
    44924369
    44934370    case PE_PanelItemViewItem:
    4494         if (!styleHint(SH_ItemView_ShowDecorationSelected, opt, w)) {
    4495             rect = subElementRect(QStyle::SE_ItemViewItemText,  opt, w)
    4496                    | subElementRect(QStyle::SE_ItemViewItemDecoration, opt, w)
    4497                    | subElementRect(QStyle::SE_ItemViewItemCheckIndicator, opt, w);
    4498         }
    4499         pseudoElement = PseudoElement_ViewItem;
    4500         break;
    4501 
    4502     case PE_PanelItemViewRow:
    4503         ParentStyle::drawPrimitive(pe, opt, p, w);
    4504         if (!styleHint(SH_ItemView_ShowDecorationSelected, opt, w))
    4505             return;
    45064371        pseudoElement = PseudoElement_ViewItem;
    45074372        break;
     
    45104375        pseudoElement = PseudoElement_ScrollAreaCorner;
    45114376        break;
     4377
     4378    case PE_IndicatorSpinDown:
     4379    case PE_IndicatorSpinMinus:
     4380        pseudoElement = PseudoElement_SpinBoxDownArrow;
     4381        break;
     4382
     4383    case PE_IndicatorSpinUp:
     4384    case PE_IndicatorSpinPlus:
     4385        pseudoElement = PseudoElement_SpinBoxUpArrow;
     4386        break;
     4387#ifndef QT_NO_TABBAR
     4388    case PE_IndicatorTabClose:
     4389        if (w)
     4390            w = w->parentWidget(); //match on the QTabBar instead of the CloseButton
     4391        pseudoElement = PseudoElement_TabBarTabCloseButton;
     4392#endif
    45124393
    45134394    default:
     
    47574638        break;
    47584639
     4640#ifndef QT_NO_TABWIDGET
    47594641    case PM_TabBarTabHSpace:
    47604642    case PM_TabBarTabVSpace:
     
    47804662        break;
    47814663
    4782     case PM_TabBarBaseOverlap:
    4783         if (hasStyleRule(w->parentWidget(), PseudoElement_TabWidgetPane)) {
     4664    case PM_TabBarBaseOverlap: {
     4665        const QWidget *tabWidget = qobject_cast<const QTabWidget *>(w) ? w : w->parentWidget();
     4666        if (hasStyleRule(tabWidget, PseudoElement_TabWidgetPane)) {
    47844667            return 0;
    47854668        }
    47864669        break;
     4670    }
     4671#endif // QT_NO_TABWIDGET
    47874672
    47884673    case PM_SliderThickness: // horizontal slider's height (sizeHint)
     
    48424727        else if (subRule.hasBox() || subRule.hasBorder()) {
    48434728            QFontMetrics fm = opt ?  opt->fontMetrics : w->fontMetrics();
    4844             return subRule.size(QSize(0, fm.lineSpacing())).height();
     4729            return subRule.size(QSize(0, fm.height())).height();
    48454730        }
    48464731        break;
     
    49274812#ifndef QT_NO_SPINBOX
    49284813        // ### hopelessly broken QAbstractSpinBox (part 2)
    4929         if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w->parentWidget())) {
     4814        if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0)) {
    49304815            QRenderRule rule = renderRule(spinBox, opt);
    49314816            if (rule.hasBox() || !rule.hasNativeBorder())
     
    49744859                return QSize(sz.width(), subRule.size().height());
    49754860            } else if ((pe == PseudoElement_Item) && (subRule.hasBox() || subRule.hasBorder())) {
    4976                 int width = csz.width(), height = qMax(csz.height(), mi->fontMetrics.height());
    4977                 if (!mi->icon.isNull()) {
    4978                     int iconExtent = pixelMetric(PM_SmallIconSize);
    4979                     height = qMax(height, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height());
    4980                 }
    4981                 width += mi->tabWidth;
    4982                return subRule.boxSize(csz.expandedTo(subRule.minimumContentsSize()));
     4861                int width = csz.width();
     4862                if (mi->text.contains(QLatin1Char('\t')))
     4863                    width += 12; //as in QCommonStyle
     4864                return subRule.boxSize(subRule.adjustSize(QSize(width, csz.height())));
    49834865            }
    49844866        }
     
    52475129            s = QLatin1String("alignment");
    52485130            break;
     5131#ifndef QT_NO_TABBAR
     5132        case SH_TabBar_CloseButtonPosition:
     5133            rule = renderRule(w, opt, PseudoElement_TabBarTabCloseButton);
     5134            if (rule.hasPosition()) {
     5135                Qt::Alignment align = rule.position()->position;
     5136                if (align & Qt::AlignLeft || align & Qt::AlignTop)
     5137                    return QTabBar::LeftSide;
     5138                if (align & Qt::AlignRight || align & Qt::AlignBottom)
     5139                    return QTabBar::RightSide;
     5140            }
     5141            break;
     5142#endif
    52495143        case SH_TabBar_ElideMode: s = QLatin1String("tabbar-elide-mode"); break;
    52505144        case SH_TabBar_PreferNoArrows: s = QLatin1String("tabbar-prefer-no-arrows"); break;
     
    52535147            if (qobject_cast<const QComboBox *>(w)) {
    52545148                QAbstractItemView *view = qFindChild<QAbstractItemView *>(w);
    5255                 QRenderRule subRule = renderRule(view, PseudoElement_None);
    5256                 if (subRule.hasBox() || !subRule.hasNativeBorder())
    5257                     return QFrame::NoFrame;
     5149                if (view) {
     5150                    view->ensurePolished();
     5151                    QRenderRule subRule = renderRule(view, PseudoElement_None);
     5152                    if (subRule.hasBox() || !subRule.hasNativeBorder())
     5153                        return QFrame::NoFrame;
     5154                }
    52585155            }
    52595156#endif // QT_NO_COMBOBOX
     
    53295226            QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);
    53305227            bool ruleMatch = rule.hasBox() || !rule.hasNativeBorder();
    5331             bool upRuleMatch = upRule.hasGeometry();
    5332             bool downRuleMatch = downRule.hasGeometry();
     5228            bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();
     5229            bool downRuleMatch = downRule.hasGeometry() || upRule.hasPosition();
    53335230            if (ruleMatch || upRuleMatch || downRuleMatch) {
    53345231                switch (sc) {
     
    58225719        break;
    58235720    }
     5721    case SE_TabBarTabText:
     5722    case SE_TabBarTabLeftButton:
     5723    case SE_TabBarTabRightButton: {
     5724        QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);
     5725        if (subRule.hasBox() || !subRule.hasNativeBorder()) {
     5726            return ParentStyle::subElementRect(se, opt, w);
     5727        }
     5728        break;
     5729    }
    58245730#endif // QT_NO_TABBAR
    58255731
     
    58435749bool QStyleSheetStyle::event(QEvent *e)
    58445750{
    5845     return baseStyle()->event(e) || ParentStyle::event(e);
     5751    return (baseStyle()->event(e) && e->isAccepted()) || ParentStyle::event(e);
    58465752}
    58475753
     
    58885794}
    58895795
    5890 // Returns the palette that should be used when the particular widget is focused.
    5891 // This needs to be called by some widgets that do drawing themselves instead
    5892 // of through the style.
    5893 // ### This should be removed ideally by Qt 4.5, and at least by Qt 5, and fixed
    5894 // for good by letting the style draw everything.
     5796// Polish palette that should be used for a particular widget, with particular states
     5797// (eg. :focus, :hover, ...)
     5798// this is called by widgets that paint themself in their paint event
    58955799// Returns true if there is a new palette in pal.
    5896 bool QStyleSheetStyle::focusPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal)
     5800bool QStyleSheetStyle::styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal)
    58975801{
    58985802    if (!w || !opt || !pal)
  • trunk/src/gui/styles/qstylesheetstyle_default.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    155155    Pseudo pseudo;
    156156    AttributeSelector attr;
    157    
     157
    158158    // pixmap based style doesn't support any features
    159159    bool styleIsPixmapBased = baseStyle()->inherits("QMacStyle")
    160160                           || baseStyle()->inherits("QWindowsXPStyle")
    161                            || baseStyle()->inherits("QGtkStyle");
     161                           || baseStyle()->inherits("QGtkStyle")
     162                           || baseStyle()->inherits("QS60Style");
    162163
    163164
     
    198199        SET_PROPERTY(QLatin1String("border"), Border);
    199200        ADD_VALUE(Value::KnownIdentifier, Value_None);
    200         ADD_DECLARATION;
    201 
    202         ADD_STYLE_RULE;
    203     }
    204 
    205     /*QLineEdit[style="QCleanlooksStyle"] {
    206         padding-top: 2px;
    207         padding-bottom: 2px;
    208     }*/
    209     if (baseStyle()->inherits("QCleanlooksStyle"))
    210     {
    211         SET_ELEMENT_NAME(QLatin1String("QLineEdit"));
    212         ADD_BASIC_SELECTOR;
    213         ADD_SELECTOR;
    214 
    215        
    216         SET_PROPERTY(QLatin1String("padding-top"), PaddingTop);
    217         ADD_VALUE(Value::Identifier, QString::fromLatin1("2px"));
    218         ADD_DECLARATION;
    219 
    220         SET_PROPERTY(QLatin1String("padding-bottom"), PaddingBottom);
    221         ADD_VALUE(Value::Identifier, QString::fromLatin1("2px"));
    222         ADD_DECLARATION;
    223 
    224         ADD_STYLE_RULE;
    225     }
    226 
    227     /*QLineEdit[style="QWindowsXPStyle"],
    228       QLineEdit[style="QWindowsVistaStyle"],
    229       QLineEdit[style="QGtkStyle"] {
    230         padding-top: 1px;
    231         padding-bottom: 1px;
    232     }*/
    233     if (baseStyle()->inherits("QWindowsXPStyle") || baseStyle()->inherits("QGtkStyle"))
    234     {
    235         SET_ELEMENT_NAME(QLatin1String("QLineEdit"));
    236 
    237         SET_PROPERTY(QLatin1String("padding-top"), PaddingTop);
    238         ADD_VALUE(Value::Identifier, QString::fromLatin1("1px"));
    239         ADD_DECLARATION;
    240 
    241         SET_PROPERTY(QLatin1String("padding-bottom"), PaddingBottom);
    242         ADD_VALUE(Value::Identifier, QString::fromLatin1("1px"));
    243201        ADD_DECLARATION;
    244202
  • trunk/src/gui/styles/qstylesheetstyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    132132    void clearWidgetFont(QWidget* w) const;
    133133
    134     bool focusPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal);
     134    bool styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal);
    135135
    136136protected Q_SLOTS:
  • trunk/src/gui/styles/qwindowscestyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5757
    5858static const int windowsItemFrame        =  2; // menu item frame width
    59 static const int windowsSepHeight        =  9; // separator item height
    6059static const int windowsItemHMargin      =  3; // menu item hor text margin
    6160static const int windowsItemVMargin      =  2; // menu item ver text margin
     
    19521951                break;
    19531952          case SC_SpinBoxEditField:
    1954                 rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw);
     1953                if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) {
     1954                    rect = QRect(lx, fw, spinbox->rect.width() - 2*fw - 2, spinbox->rect.height() - 2*fw);
     1955                } else {
     1956                    rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw);
     1957                }
    19551958                break;
    19561959          case SC_SpinBoxFrame:
     
    22922295    case SH_EtchDisabledText:
    22932296        ret = false;
     2297    case SH_RequestSoftwareInputPanel:
     2298        ret = RSIP_OnMouseClick;
     2299        break;
    22942300    default:
    22952301        ret = QWindowsStyle::styleHint(hint, opt, widget, returnData);
  • trunk/src/gui/styles/qwindowscestyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qwindowscestyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qwindowsmobilestyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7373#include "qtabwidget.h"
    7474
    75 #ifdef Q_OS_WINCE
     75#ifdef Q_WS_WINCE
    7676#include "qt_windows.h"
    7777#include "qguifunctions_wince.h"
    78 extern bool qt_wince_is_high_dpi();   //defined in qguifunctions_wince.cpp
    79 extern bool qt_wince_is_smartphone(); //defined in qguifunctions_wince.cpp
    80 #endif // Q_OS_WINCE
     78extern bool qt_wince_is_high_dpi();          //defined in qguifunctions_wince.cpp
     79extern bool qt_wince_is_smartphone();        //defined in qguifunctions_wince.cpp
     80extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp
     81#endif // Q_WS_WINCE
    8182
    8283QT_BEGIN_NAMESPACE
    8384
    8485static const int windowsItemFrame        =  1; // menu item frame width
    85 static const int windowsItemHMargin      =  2; // menu item hor text margin
    86 static const int windowsItemVMargin      =  2; // menu item ver text margin
    87 static const int windowsArrowHMargin     =  6; // arrow horizontal margin
    88 static const int windowsRightBorder      = 15; // right border on windows
    89 static const int windowsCheckMarkWidth   = 14; // checkmarks width on windows
    9086
    9187static const int windowsMobileitemViewCheckBoxSize   = 13;
     
    670666"              "};
    671667
     668#ifdef Q_WS_WINCE_WM
     669
     670static char * sbhandleup_xpm[] = {
     671"26 41 45 1",
     672"       c None",
     673".      c #000000",
     674"+      c #E7E7E7",
     675"@      c #D6D7D6",
     676"#      c #949294",
     677"$      c #737573",
     678"%      c #636563",
     679"&      c #636163",
     680"*      c #5A5D5A",
     681"=      c #5A595A",
     682"-      c #525552",
     683";      c #525152",
     684">      c #4A4D4A",
     685",      c #7B797B",
     686"'      c #CECFCE",
     687")      c #CED3CE",
     688"!      c #6B6D6B",
     689"~      c #6B696B",
     690"{      c #737173",
     691"]      c #7B7D7B",
     692"^      c #848684",
     693"/      c #848284",
     694"(      c #8C8A8C",
     695"_      c #8C8E8C",
     696":      c #B5B2B5",
     697"<      c #FFFFFF",
     698"[      c #949694",
     699"}      c #B5B6B5",
     700"|      c #9C9A9C",
     701"1      c #ADAEAD",
     702"2      c #9C9E9C",
     703"3      c #BDBABD",
     704"4      c #BDBEBD",
     705"5      c #F7F3F7",
     706"6      c #C6C3C6",
     707"7      c #C6C7C6",
     708"8      c #A5A2A5",
     709"9      c #CECBCE",
     710"0      c #FFFBFF",
     711"a      c #ADAAAD",
     712"b      c #A5A6A5",
     713"c      c #D6D3D6",
     714"d      c #B5BAB5",
     715"e      c #DEDFDE",
     716"f      c #DEDBDE",
     717"..........................",
     718"+@#$%%&&&**===---;;;;>=,'+",
     719"+@#$%%&&&**===---;;;;>=$'+",
     720")$!!~~%%&&&**===---;;;;>;'",
     721"#{$]],,$${{{!!~~%%%&&&*-;]",
     722"#{$]],,$${{{!!~~%%%&&&*-;]",
     723",$^//]],,$${{{!!~~%%%&&*;*",
     724",,(^^//]],$${!!!!!~~%%%&-*",
     725",,(^^//]],$${!!!!!~~%%%&-*",
     726"]]_((^^//]$!%%~!{{!!~~%%-*",
     727"//#__((^^]{:<<:~!{{{!!~~=*",
     728"//#__((^^]{:<<:~!{{{!!~~=&",
     729"//###__(/$:<<<<:~{${{!!~*&",
     730"^^[[##_^]:<<<<<<}!{$${{!*%",
     731"^^[[##_^]:<<<<<<}!{$${{!*%",
     732"((|[[#_/:<<<<<<<<}!$$${{&~",
     733"((||[#^1<<<<1:<<<<}!$$$$&~",
     734"((||[#^1<<<<1:<<<<}!$$$$&~",
     735"__2|#(1<<<<}],}<<<<}{$,$%~",
     736"##2|_1<<<<}^((]3<<<<}{$,~!",
     737"##2|_1<<<<}^((]3<<<<}{$,~!",
     738"##2#1<<<<3^###(/4<<<<}{,~{",
     739"##2#1<<<<3^###(/4<<<<}{,~!",
     740"[[2_5<<<4(#|[[#_/6<<<<,,!{",
     741"[|2_5<<4_[||||[[_/7<<<,]{$",
     742"[|2_5<<4_[||||[[_/7<<<,]{$",
     743"||8_5<6#|2222|||[_/9<<,]{$",
     744"228#06[28888222||[_/'<,/$,",
     745"228#06[28888222||[_/'<,/$,",
     746"22a|6[8bbbb88822||[(/c](,]",
     747"881b8baaabbbb88222|[(^(_,]",
     748"881b8baaabbbb88222|[(^(_,]",
     749"88111111aaabbb88822|[###]/",
     750"bb:::11111aaabbb8822||[[/^",
     751"bb:::11111aaabbb8822||[[//",
     752"bb:::::1111aaabbb8822||[/(",
     753"3a1::::::1111aaabb8822|_^8",
     754"da1::::::1111aaabb8822|_^8",
     755"e1aaabbbb888822||[[##__((@",
     756"+e4:aaabbbb88822||[[[#[b@+",
     757"+e4:aaabbbb88822||[[[#[bf+"};
     758
     759static char * sbhandledown_xpm[] = {
     760"26 40 46 1",
     761"       c None",
     762".      c #E7E7E7",
     763"+      c #DEDFDE",
     764"@      c #BDBEBD",
     765"#      c #B5B2B5",
     766"$      c #ADAAAD",
     767"%      c #A5A6A5",
     768"&      c #A5A2A5",
     769"*      c #9C9E9C",
     770"=      c #9C9A9C",
     771"-      c #949694",
     772";      c #949294",
     773">      c #D6D7D6",
     774",      c #DEDBDE",
     775"'      c #D6DBD6",
     776")      c #ADAEAD",
     777"!      c #8C8E8C",
     778"~      c #8C8A8C",
     779"{      c #BDBABD",
     780"]      c #848684",
     781"^      c #B5BAB5",
     782"/      c #848284",
     783"(      c #848A84",
     784"_      c #7B7D7B",
     785":      c #7B797B",
     786"<      c #C6C3C6",
     787"[      c #D6D3D6",
     788"}      c #FFFBFF",
     789"|      c #CECFCE",
     790"1      c #FFFFFF",
     791"2      c #737573",
     792"3      c #F7F3F7",
     793"4      c #CECBCE",
     794"5      c #737173",
     795"6      c #C6C7C6",
     796"7      c #6B6D6B",
     797"8      c #B5B6B5",
     798"9      c #6B696B",
     799"0      c #636563",
     800"a      c #636163",
     801"b      c #5A5D5A",
     802"c      c #5A595A",
     803"d      c #525552",
     804"e      c #525152",
     805"f      c #4A4D4A",
     806"g      c #C6CBC6",
     807".+@#$$$%%%%&&&**==---;-%>.",
     808".+@#$$$%%%%&&&**==---;-%,.",
     809"')$$$%%%%&&&&**==--;;!!~~>",
     810"{$)######))))$$$%%&&**=!]&",
     811"^$)######))))$$$%%&&**=!]&",
     812"%%#####))))$$$%%%&&**==-/(",
     813"%%###)))))$$$%%%&&**==--/]",
     814"%%###)))))$$$%%%&&**==--//",
     815"&&))))))$$$%%%&&&**=-;;;_/",
     816"&&)%&%$$$%%%%&&***=-~]~!:_",
     817"&&)%&%$$$%%%%&&***=-~]~!:_",
     818"**$=<-&%%%%&&&**==-~/[_~:_",
     819"**&;}<-*&&&&***==-!/|1:/2:",
     820"**&;}<-*&&&&***==-!/|1:/2:",
     821"==&!31<;=****===-!/411:_5:",
     822"-=*!311@!-====--!/6111:_52",
     823"-=*!311@!-====--!/6111:_52",
     824"--*!3111@~;=--;!/<1111::75",
     825";;*;)1111{];;;~/@111185:95",
     826";;*;)1111{];;;~/@111185:97",
     827";;*=!)11118]~~_{1111852:97",
     828";;*=!)11118]~~_{1111852:97",
     829"!!*=;~)11118_:81111852:207",
     830"~~==-;])1111)#1111872222a9",
     831"~~==-;])1111)#1111872222a9",
     832"~~=--;!/#111111118722255a0",
     833"]]--;;!]_#11111187522557b0",
     834"]]--;;!]_#11111187522557b0",
     835"//;;;!!~/2#1111#95255779ba",
     836"//;!!~~]]_5#11#975557799cb",
     837"//;!!~~]]_5#11#975557799ca",
     838"__!~~]]//_27009755779900db",
     839"::~]]//__:2257777799000adb",
     840"::~]]//__:2257777799000adb",
     841":2]//__::225557799000aabeb",
     842";52__::225557799000aaabde_",
     843";52__::225557799000aaabde_",
     844"[2779900aaabbcccdddeeeefeg",
     845".>;200aaabbcccdddeeeefc:|.",
     846".>;200aaabbcccdddeeeefc2|."};
     847
     848static char * sbgripdown_xpm[] = {
     849"26 34 39 1",
     850"       c None",
     851".      c #949294",
     852"+      c #9C9E9C",
     853"@      c #9C9A9C",
     854"#      c #949694",
     855"$      c #8C8E8C",
     856"%      c #8C8A8C",
     857"&      c #848684",
     858"*      c #848284",
     859"=      c #7B7D7B",
     860"-      c #7B797B",
     861";      c #6B696B",
     862">      c #636563",
     863",      c #737573",
     864"'      c #636163",
     865")      c #737173",
     866"!      c #5A5D5A",
     867"~      c #6B6D6B",
     868"{      c #5A595A",
     869"]      c #B5B6B5",
     870"^      c #BDBEBD",
     871"/      c #ADAEAD",
     872"(      c #BDBABD",
     873"_      c #525552",
     874":      c #313031",
     875"<      c #525152",
     876"[      c #ADAAAD",
     877"}      c #BDBAB5",
     878"|      c #4A4D4A",
     879"1      c #4A494A",
     880"2      c #C6C3C6",
     881"3      c #C6CBC6",
     882"4      c #E7E7E7",
     883"5      c #DEDFDE",
     884"6      c #E7E3E7",
     885"7      c #DEE3DE",
     886"8      c #CECBCE",
     887"9      c #8C928C",
     888"0      c #CECFCE",
     889"..+++@@@###...$$%&&**==-;>",
     890"$.++@@@@##...$$%%&**==-->>",
     891"$$+@@@@###..$$%%&&*==--,>>",
     892"$$@@@@###..$$%%&&**==-,,>'",
     893"%%@@@###..$$$%&&**==--,,''",
     894"%%@@###..$$$%&&**==--,,)''",
     895"%%@###...$$%%&&*==--,,))'!",
     896"&&###...$$%%&&**==--,)))!!",
     897"&&##...$$%%&&**==--,,))~!!",
     898"&&#...$$%%&&**==--,,))~~!{",
     899"**...$$%%&&**==--,,))~~;!{",
     900"**..$$%%&&**===--,)))~~;{{",
     901"**.$$%%&]^&===//,,))~~;;{{",
     902"==$$%%&&]^*==-((,))~~;;>{_",
     903"==$%%&&***::--,,::~~;;;>__",
     904"==%%&&&**=::-,,)::~~;;>>__",
     905"--%&&&**==--,,)))~~;;>>>__",
     906"--&&&**==--,,)))~~;;>>>'_<",
     907",-&&**==]^-,))[[~;;>>>''<<",
     908",,&**==-]^-)))}};;>>>'''<<",
     909",,**==--,,::)~~;::>>'''!<<",
     910"))*==--,,)::~~;;::>'''!!<|",
     911"))==--,,)))~~;;;>>'''!!!||",
     912"))=--,,)))~~;;;>>'''!!!{||",
     913"~~--,,)))~~;;;>>'''!!!{{||",
     914"~~-,,)))~~;;>>>'''!!!{{{|1",
     915";;,,)))~~;;>>>'''!!!{{{_1<",
     916"~;,)))~~;;>>>'''!!!{{{__1'",
     917"%>~))~~;;>>>'''!!!{{{__|1$",
     918"2>>~~~;;>>>''!!!{{{{__<113",
     919"4%'';;;>>>''!!!{{{{__<11%4",
     920"45-!!'>>>''!!!{{{{_<|11)64",
     921"447+!{{___<<<||||1111|+444",
     922"444489~__<<<||||111>$04444"};
     923
     924static char * sbgripup_xpm[] = {
     925"26 34 38 1",
     926"       c None",
     927".      c #E7E7E7",
     928"+      c #D6DBD6",
     929"@      c #C6C7C6",
     930"#      c #B5B6B5",
     931"$      c #ADAEAD",
     932"%      c #ADAAAD",
     933"&      c #A5A6A5",
     934"*      c #A5A2A5",
     935"=      c #BDBEBD",
     936"-      c #DEDFDE",
     937";      c #C6CBC6",
     938">      c #9C9E9C",
     939",      c #E7E3E7",
     940"'      c #BDBABD",
     941")      c #B5B2B5",
     942"!      c #9C9A9C",
     943"~      c #DEE3DE",
     944"{      c #949694",
     945"]      c #D6D7D6",
     946"^      c #949294",
     947"/      c #DEDBDE",
     948"(      c #8C8E8C",
     949"_      c #8C8A8C",
     950":      c #848684",
     951"<      c #D6D3CE",
     952"[      c #CECBCE",
     953"}      c #D6D3D6",
     954"|      c #848284",
     955"1      c #313031",
     956"2      c #7B7D7B",
     957"3      c #CECFCE",
     958"4      c #CECBC6",
     959"5      c #7B797B",
     960"6      c #737573",
     961"7      c #737173",
     962"8      c #6B6D6B",
     963"9      c #6B696B",
     964"....+@#$$%%%%&&&***$=-....",
     965"...;$$$$$%%%&&&&**>>>>@...",
     966".,'$$)#'#####)))$$$%*!!$~.",
     967".=$)#'''####))))$$$%%*!{'.",
     968"]$$''''#####)))$$$%%%&*{^/",
     969"=$#'''#####)))$$$$%%&&&!^#",
     970"$$'''#####))))$$$%%%&&*>(!",
     971"$$''#####))))$$$%%%&&&*>(^",
     972"$$######))))$$$$%%&&&**>(_",
     973"%$#####))))$$$$%%%&&***>__",
     974"%$####))))$$$$%%%&&&**>>__",
     975"%%###)))))$$$%%%&&&**>>>_:",
     976"%%##))))<])$$%[[&&***>>!::",
     977"%%#)))))<]$$%%}<&&**>>!!:|",
     978"&%)))))$$$11%%&&11*>>>!!:|",
     979"&&))))$$$$11%&&&11*>>!!{||",
     980"&&)))$$$$$%%%&&&**>>!!!{|2",
     981"&&))$$$$$%%%&&&**>>>!!{{|2",
     982"*&)$$$$$3]%&&&4@*>>!!{{{22",
     983"**$$$$$%3]%&&&<<>>!!!{{^25",
     984"**$$$$%%%%11&**>11!!{{^^25",
     985"**$$$%%%%&11***>11!!{{^^55",
     986"**$$%%%%&&&***>>!!!{{^^(55",
     987">>$%%%%&&&***>>>!!{{^^((56",
     988">>%%%%&&&&***>>!!!{{^^((66",
     989">>%%%&&&&***>>!!!{{^^((_67",
     990"!>%%&&&&***>>>!!{{{^^(__67",
     991"!!%&&&&***>>>!!!{{^^((_:77",
     992"!!&&&&***>>>!!!{{^^((__:77",
     993"!!&&&****>>!!!{{^^^(__::78",
     994"{!&&****>>>!!{{{^^((_::|88",
     995"{{&****>>>!!!{{^^((__:||88",
     996"{{****>>>!!!{{^^^(__::|289",
     997"{{***>>>!!!{{{^^((_::||289"};
     998
     999static char * sbgripmiddle_xpm[] = {
     1000"26 2 12 1",
     1001"       c None",
     1002".      c #949294",
     1003"+      c #A5A2A5",
     1004"@      c #9C9E9C",
     1005"#      c #9C9A9C",
     1006"$      c #949694",
     1007"%      c #8C8E8C",
     1008"&      c #8C8A8C",
     1009"*      c #848684",
     1010"=      c #848284",
     1011"-      c #7B7D7B",
     1012";      c #6B696B",
     1013"..++@@@###$$$..%%&&*==--;;",
     1014"..++@@@###$$$..%%&&*==--;;"};
     1015
     1016
     1017static char * listviewhighmiddle_xpm[] = {
     1018"8 46 197 2",
     1019"       c None",
     1020".      c #66759E",
     1021"+      c #6C789D",
     1022"@      c #6A789E",
     1023"#      c #6B789E",
     1024"$      c #6A779D",
     1025"%      c #6C789C",
     1026"&      c #6F7D9B",
     1027"*      c #6F7D9A",
     1028"=      c #9DB6EE",
     1029"-      c #9DB6ED",
     1030";      c #9CB6ED",
     1031">      c #A1B6EF",
     1032",      c #A2B6F0",
     1033"'      c #93AAE9",
     1034")      c #95ABEA",
     1035"!      c #94ABEA",
     1036"~      c #94A9E8",
     1037"{      c #8BA8EA",
     1038"]      c #8BA7EA",
     1039"^      c #8AA7EA",
     1040"/      c #8EAAE8",
     1041"(      c #8FAAE8",
     1042"_      c #88A2E7",
     1043":      c #8CA3E8",
     1044"<      c #8BA3E7",
     1045"[      c #8BA3E8",
     1046"}      c #8BA2E7",
     1047"|      c #8CA2E7",
     1048"1      c #8DA2E7",
     1049"2      c #87A1E8",
     1050"3      c #87A1E9",
     1051"4      c #86A0E8",
     1052"5      c #86A1E7",
     1053"6      c #87A2E7",
     1054"7      c #859EE9",
     1055"8      c #849DE9",
     1056"9      c #869EE9",
     1057"0      c #869FE9",
     1058"a      c #7C9BEA",
     1059"b      c #7C9CEA",
     1060"c      c #7B9CEA",
     1061"d      c #7C9BE9",
     1062"e      c #7E9CE9",
     1063"f      c #7B9AEA",
     1064"g      c #7C99E9",
     1065"h      c #7C9AEA",
     1066"i      c #7B9AE8",
     1067"j      c #7A9AEA",
     1068"k      c #7996E1",
     1069"l      c #7C96E4",
     1070"m      c #7B96E3",
     1071"n      c #7B95E3",
     1072"o      c #7E95E5",
     1073"p      c #7E95E6",
     1074"q      c #7292E1",
     1075"r      c #7490DF",
     1076"s      c #7591E0",
     1077"t      c #7590DF",
     1078"u      c #7392E1",
     1079"v      c #6D8CDE",
     1080"w      c #6F8EDD",
     1081"x      c #6E8DDD",
     1082"y      c #6E8DDE",
     1083"z      c #6F8EDE",
     1084"A      c #6E8EDE",
     1085"B      c #718EDD",
     1086"C      c #728EDD",
     1087"D      c #6B89E0",
     1088"E      c #6C89DF",
     1089"F      c #6D89E0",
     1090"G      c #6D89DF",
     1091"H      c #6C88DF",
     1092"I      c #6D88DF",
     1093"J      c #6D86DD",
     1094"K      c #6086E0",
     1095"L      c #6686E0",
     1096"M      c #6586E0",
     1097"N      c #6486E0",
     1098"O      c #6485E0",
     1099"P      c #6786DF",
     1100"Q      c #5F85E0",
     1101"R      c #6583DE",
     1102"S      c #6683DE",
     1103"T      c #6682DD",
     1104"U      c #6086DF",
     1105"V      c #5F86E0",
     1106"W      c #567ED7",
     1107"X      c #567ED8",
     1108"Y      c #557DD7",
     1109"Z      c #5A7FD8",
     1110"`      c #6281DA",
     1111" .     c #5379D9",
     1112"..     c #5278D9",
     1113"+.     c #547BD8",
     1114"@.     c #4C73D7",
     1115"#.     c #4B72D2",
     1116"$.     c #4C73D4",
     1117"%.     c #4C73D3",
     1118"&.     c #4B72D4",
     1119"*.     c #4F75D3",
     1120"=.     c #5074D2",
     1121"-.     c #4971D0",
     1122";.     c #4871D0",
     1123">.     c #335ECF",
     1124",.     c #325ECB",
     1125"'.     c #335ECD",
     1126").     c #335ECE",
     1127"!.     c #325DCD",
     1128"~.     c #2E59C9",
     1129"{.     c #3059C9",
     1130"].     c #2F59C9",
     1131"^.     c #2F59C8",
     1132"/.     c #2B59CA",
     1133"(.     c #3355C6",
     1134"_.     c #3354C5",
     1135":.     c #3156C7",
     1136"<.     c #3056C7",
     1137"[.     c #3355C7",
     1138"}.     c #3355C5",
     1139"|.     c #254EBF",
     1140"1.     c #1F51C1",
     1141"2.     c #234FC0",
     1142"3.     c #234FBF",
     1143"4.     c #2350C0",
     1144"5.     c #1E50BE",
     1145"6.     c #1D50C0",
     1146"7.     c #264DBE",
     1147"8.     c #264CBD",
     1148"9.     c #254DBE",
     1149"0.     c #244EBF",
     1150"a.     c #254DBF",
     1151"b.     c #234CBF",
     1152"c.     c #244CC0",
     1153"d.     c #244BC0",
     1154"e.     c #234BC0",
     1155"f.     c #234BBF",
     1156"g.     c #234CBE",
     1157"h.     c #2049B7",
     1158"i.     c #2A49B5",
     1159"j.     c #2749B5",
     1160"k.     c #2749B6",
     1161"l.     c #2D49B4",
     1162"m.     c #2649B6",
     1163"n.     c #2946B5",
     1164"o.     c #2A48B6",
     1165"p.     c #2947B5",
     1166"q.     c #2946B6",
     1167"r.     c #2848B6",
     1168"s.     c #2549B5",
     1169"t.     c #2648B6",
     1170"u.     c #2744B5",
     1171"v.     c #2744B4",
     1172"w.     c #2744AF",
     1173"x.     c #2543B4",
     1174"y.     c #2543B2",
     1175"z.     c #2442B2",
     1176"A.     c #2442B3",
     1177"B.     c #2442B5",
     1178"C.     c #2543B3",
     1179"D.     c #1F40B1",
     1180"E.     c #1E40B1",
     1181"F.     c #243EAE",
     1182"G.     c #273BAC",
     1183"H.     c #263DAC",
     1184"I.     c #253CAB",
     1185"J.     c #273CAB",
     1186"K.     c #273CAC",
     1187"L.     c #263BAA",
     1188"M.     c #253CAE",
     1189"N.     c #263BA6",
     1190"O.     c #253BA5",
     1191"P.     c #253AA5",
     1192"Q.     c #253BA6",
     1193"R.     c #253CA7",
     1194"S.     c #263AA6",
     1195"T.     c #243CA6",
     1196"U.     c #253CA5",
     1197"V.     c #273BA8",
     1198"W.     c #2F4DA4",
     1199"X.     c #2F4DA3",
     1200"Y.     c #1B2F85",
     1201"Z.     c #B5B5B6",
     1202"`.     c #B5B5B5",
     1203" +     c #B5B6B6",
     1204".+     c #B5B4B6",
     1205"++     c #C2C3C5",
     1206"@+     c #C0C3C3",
     1207"#+     c #C1C3C4",
     1208"$+     c #E3E3E3",
     1209"%+     c #E3E3E4",
     1210"&+     c #E4E3E4",
     1211"*+     c #E2E3E4",
     1212"=+     c #ECEEEB",
     1213"-+     c #EBEDEA",
     1214";+     c #EEF0ED",
     1215">+     c #EFF0EE",
     1216". + @ @ # # $ % ",
     1217"& & * & & & & & ",
     1218"= = - = = ; > , ",
     1219"' ) ! ! ! ) ' ~ ",
     1220"{ ] { { { ^ / ( ",
     1221"_ : < [ : } | 1 ",
     1222"2 2 2 3 2 4 5 6 ",
     1223"7 7 7 7 7 8 9 0 ",
     1224"a b a a a c d e ",
     1225"f g h h h h i j ",
     1226"k l m m m n o p ",
     1227"q q q q q q q q ",
     1228"r r s s s t q u ",
     1229"v w x y z A B C ",
     1230"D E F F G F H I ",
     1231"J K L M N O P Q ",
     1232"R R S S S T U V ",
     1233"W W X X X Y Z ` ",
     1234" . . . . ...+.W ",
     1235" . . . . ..... .",
     1236"@.#.$.$.%.&.*.=.",
     1237"-.-.;.-.-.-.-.-.",
     1238">.,.'.).).!.!.>.",
     1239"~.{.].^.].^././.",
     1240"(.(.(.(.(._.:.<.",
     1241"(.(.[.[.[.[.(.}.",
     1242"|.1.2.3.3.4.5.6.",
     1243"7.7.7.7.7.8.9.0.",
     1244"a.b.c.d.c.e.f.g.",
     1245"h.i.j.k.j.k.l.m.",
     1246"n.o.p.q.r.p.s.t.",
     1247"u.u.v.u.u.u.u.u.",
     1248"w.x.y.z.A.y.B.C.",
     1249"D.D.E.D.D.D.D.D.",
     1250"D.D.E.D.D.D.D.D.",
     1251"F.G.H.I.J.K.L.M.",
     1252"N.N.O.N.N.P.Q.R.",
     1253"N.N.S.N.N.N.N.N.",
     1254"T.N.T.T.T.U.N.V.",
     1255"W.W.X.W.W.W.W.W.",
     1256"W.W.W.W.W.W.W.W.",
     1257"Y.Y.Y.Y.Y.Y.Y.Y.",
     1258"Z.`. + +.+Z.`.`.",
     1259"++@+#+#+#+#+@+@+",
     1260"$+%+&+&+*+%+%+%+",
     1261"=+-+;+-+-+>+-+-+"};
     1262
     1263
     1264
     1265static char * listviewhighcornerleft_xpm[] = {
     1266"100 46 1475 2",
     1267"       c None",
     1268".      c #FBFBFC",
     1269"+      c #E8EAE7",
     1270"@      c #758DC3",
     1271"#      c #42599E",
     1272"$      c #28418A",
     1273"%      c #19418F",
     1274"&      c #3F5695",
     1275"*      c #415896",
     1276"=      c #435A98",
     1277"-      c #445C99",
     1278";      c #465E9B",
     1279">      c #48609B",
     1280",      c #49629C",
     1281"'      c #4A639D",
     1282")      c #49639D",
     1283"!      c #4A629D",
     1284"~      c #4B639D",
     1285"{      c #4B649D",
     1286"]      c #4C659D",
     1287"^      c #4D669D",
     1288"/      c #4E689D",
     1289"(      c #506A9D",
     1290"_      c #516A9D",
     1291":      c #536B9C",
     1292"<      c #546C9C",
     1293"[      c #566D9B",
     1294"}      c #576D9B",
     1295"|      c #586E9C",
     1296"1      c #5B6F9D",
     1297"2      c #61739D",
     1298"3      c #63749E",
     1299"4      c #64749E",
     1300"5      c #68769E",
     1301"6      c #6A779E",
     1302"7      c #6B789E",
     1303"8      c #66759E",
     1304"9      c #6C789D",
     1305"0      c #EEF0ED",
     1306"a      c #D0D3DC",
     1307"b      c #3E51A3",
     1308"c      c #28428B",
     1309"d      c #29428C",
     1310"e      c #425996",
     1311"f      c #455C99",
     1312"g      c #485F9C",
     1313"h      c #49619E",
     1314"i      c #4A63A0",
     1315"j      c #4B64A1",
     1316"k      c #4B65A1",
     1317"l      c #4C66A2",
     1318"m      c #4D67A2",
     1319"n      c #4F69A1",
     1320"o      c #516AA1",
     1321"p      c #536CA0",
     1322"q      c #556DA1",
     1323"r      c #576EA0",
     1324"s      c #586F9F",
     1325"t      c #586E9F",
     1326"u      c #596F9E",
     1327"v      c #5A6F9E",
     1328"w      c #5C709E",
     1329"x      c #5E719E",
     1330"y      c #5F729F",
     1331"z      c #62739F",
     1332"A      c #63739E",
     1333"B      c #64749D",
     1334"C      c #65749E",
     1335"D      c #69769D",
     1336"E      c #6C799E",
     1337"F      c #6D799F",
     1338"G      c #707D9F",
     1339"H      c #717F9E",
     1340"I      c #6E7AA1",
     1341"J      c #6C789E",
     1342"K      c #6F7C9C",
     1343"L      c #6F7D9B",
     1344"M      c #2A4AA0",
     1345"N      c #4971D0",
     1346"O      c #4C72D8",
     1347"P      c #5472C0",
     1348"Q      c #5573BF",
     1349"R      c #5774BF",
     1350"S      c #5875BF",
     1351"T      c #5976C1",
     1352"U      c #5A76C1",
     1353"V      c #5C78C2",
     1354"W      c #5E7AC2",
     1355"X      c #607CC3",
     1356"Y      c #627EC3",
     1357"Z      c #637FC4",
     1358"`      c #6581C5",
     1359" .     c #6682C6",
     1360"..     c #6783C7",
     1361"+.     c #6984C8",
     1362"@.     c #6B85C9",
     1363"#.     c #6D87CA",
     1364"$.     c #6F89CB",
     1365"%.     c #718CCD",
     1366"&.     c #748ECF",
     1367"*.     c #7690D0",
     1368"=.     c #7992D2",
     1369"-.     c #7A93D3",
     1370";.     c #7C95D5",
     1371">.     c #7F98D7",
     1372",.     c #8099D8",
     1373"'.     c #859CDB",
     1374").     c #8AA0DD",
     1375"!.     c #8DA3DF",
     1376"~.     c #8FA5E0",
     1377"{.     c #90A5E0",
     1378"].     c #91A6E1",
     1379"^.     c #91A5E1",
     1380"/.     c #90A4E0",
     1381"(.     c #8EA3DE",
     1382"_.     c #92A6E2",
     1383":.     c #8FA4DF",
     1384"<.     c #90A5DE",
     1385"[.     c #90A5DC",
     1386"}.     c #90A6DB",
     1387"|.     c #91A6E0",
     1388"1.     c #93A7E2",
     1389"2.     c #95AAE6",
     1390"3.     c #99AEEA",
     1391"4.     c #9AB2EA",
     1392"5.     c #99B1E9",
     1393"6.     c #99B1E7",
     1394"7.     c #98AFE6",
     1395"8.     c #93A8E2",
     1396"9.     c #97ACE7",
     1397"0.     c #9AB3EB",
     1398"a.     c #9DB5ED",
     1399"b.     c #9DB6EE",
     1400"c.     c #375095",
     1401"d.     c #4056AD",
     1402"e.     c #506DCD",
     1403"f.     c #4360CC",
     1404"g.     c #345ED6",
     1405"h.     c #335ECF",
     1406"i.     c #355ED6",
     1407"j.     c #355FD6",
     1408"k.     c #365FD6",
     1409"l.     c #355FD0",
     1410"m.     c #3760D5",
     1411"n.     c #3A63D4",
     1412"o.     c #3C63D1",
     1413"p.     c #3B63CD",
     1414"q.     c #3B63C9",
     1415"r.     c #3B62C9",
     1416"s.     c #3D63C8",
     1417"t.     c #4065C5",
     1418"u.     c #4567C5",
     1419"v.     c #496BC5",
     1420"w.     c #4F70C7",
     1421"x.     c #5273C8",
     1422"y.     c #5475CA",
     1423"z.     c #5777CB",
     1424"A.     c #5879CD",
     1425"B.     c #5A7BCE",
     1426"C.     c #5D7DCF",
     1427"D.     c #5F7ECF",
     1428"E.     c #617FD0",
     1429"F.     c #6381D1",
     1430"G.     c #6583D2",
     1431"H.     c #6785D2",
     1432"I.     c #6886D3",
     1433"J.     c #6A88D4",
     1434"K.     c #6C89D5",
     1435"L.     c #6E8BD6",
     1436"M.     c #708CD7",
     1437"N.     c #718DD8",
     1438"O.     c #738EDA",
     1439"P.     c #748FDB",
     1440"Q.     c #7691DC",
     1441"R.     c #7893DD",
     1442"S.     c #7994DD",
     1443"T.     c #7A96DE",
     1444"U.     c #7B97DF",
     1445"V.     c #7C98E0",
     1446"W.     c #7E9AE2",
     1447"X.     c #7F9BE3",
     1448"Y.     c #829DE4",
     1449"Z.     c #849FE5",
     1450"`.     c #87A0E6",
     1451" +     c #88A1E7",
     1452".+     c #89A2E6",
     1453"++     c #8CA3E7",
     1454"@+     c #8EA5E9",
     1455"#+     c #8EA6E9",
     1456"$+     c #8FA7E9",
     1457"%+     c #8FA8E8",
     1458"&+     c #8FA9E8",
     1459"*+     c #91A9E8",
     1460"=+     c #90A7E8",
     1461"-+     c #8FA8EA",
     1462";+     c #90AAEA",
     1463">+     c #93ABEA",
     1464",+     c #95ABEA",
     1465"'+     c #93ABE9",
     1466")+     c #94ABEA",
     1467"!+     c #90A9EA",
     1468"~+     c #93AAE9",
     1469"{+     c #273E7E",
     1470"]+     c #345ED5",
     1471"^+     c #3D60CE",
     1472"/+     c #3D60CF",
     1473"(+     c #345ECF",
     1474"_+     c #335ED0",
     1475":+     c #355FD3",
     1476"<+     c #3A60CE",
     1477"[+     c #3A5FCB",
     1478"}+     c #385FC9",
     1479"|+     c #3B60C8",
     1480"1+     c #3C63CB",
     1481"2+     c #3E64CB",
     1482"3+     c #4166CA",
     1483"4+     c #4568C9",
     1484"5+     c #4A6CC7",
     1485"6+     c #4F71C8",
     1486"7+     c #5172CA",
     1487"8+     c #5475CE",
     1488"9+     c #5678D3",
     1489"0+     c #597CD6",
     1490"a+     c #5C7ED7",
     1491"b+     c #5E7FD8",
     1492"c+     c #6181D9",
     1493"d+     c #6383DA",
     1494"e+     c #6585DA",
     1495"f+     c #6786DB",
     1496"g+     c #6988DC",
     1497"h+     c #6B8ADD",
     1498"i+     c #6D8BDE",
     1499"j+     c #6F8DDE",
     1500"k+     c #718EDF",
     1501"l+     c #728FE0",
     1502"m+     c #7390E1",
     1503"n+     c #7390E2",
     1504"o+     c #7491E3",
     1505"p+     c #7592E4",
     1506"q+     c #7693E4",
     1507"r+     c #7794E5",
     1508"s+     c #7894E5",
     1509"t+     c #7995E6",
     1510"u+     c #7B96E6",
     1511"v+     c #7C97E7",
     1512"w+     c #7D9AE8",
     1513"x+     c #7F9CE9",
     1514"y+     c #829DE9",
     1515"z+     c #849EE9",
     1516"A+     c #859EE9",
     1517"B+     c #87A0E7",
     1518"C+     c #8AA2E7",
     1519"D+     c #8BA3E8",
     1520"E+     c #89A2E7",
     1521"F+     c #8CA6EA",
     1522"G+     c #8BA6EA",
     1523"H+     c #8BA7EA",
     1524"I+     c #8CA3E8",
     1525"J+     c #8BA8EA",
     1526"K+     c #8CA7EA",
     1527"L+     c #8CA8EA",
     1528"M+     c #4659C7",
     1529"N+     c #355ECF",
     1530"O+     c #3660CF",
     1531"P+     c #3860CE",
     1532"Q+     c #3961CD",
     1533"R+     c #3B61CB",
     1534"S+     c #3B61CA",
     1535"T+     c #3D62CA",
     1536"U+     c #3D63CA",
     1537"V+     c #4165CB",
     1538"W+     c #456ACB",
     1539"X+     c #4B6FCD",
     1540"Y+     c #5174CE",
     1541"Z+     c #5275D1",
     1542"`+     c #5477D4",
     1543" @     c #5678D9",
     1544".@     c #587ADB",
     1545"+@     c #597BDB",
     1546"@@     c #5B7DDC",
     1547"#@     c #5E7FDC",
     1548"$@     c #6081DD",
     1549"%@     c #6283DE",
     1550"&@     c #6484DF",
     1551"*@     c #6787E0",
     1552"=@     c #6989E1",
     1553"-@     c #6B8BE1",
     1554";@     c #6D8DE2",
     1555">@     c #6F8EE3",
     1556",@     c #718FE4",
     1557"'@     c #7290E4",
     1558")@     c #7491E5",
     1559"!@     c #7692E6",
     1560"~@     c #7793E5",
     1561"{@     c #7894E6",
     1562"]@     c #7895E7",
     1563"^@     c #7996E8",
     1564"/@     c #7A97E8",
     1565"(@     c #7B98E9",
     1566"_@     c #7D99E8",
     1567":@     c #7F9AE8",
     1568"<@     c #7F9BE9",
     1569"[@     c #7F9CEA",
     1570"}@     c #859EE8",
     1571"|@     c #859FE8",
     1572"1@     c #85A0E9",
     1573"2@     c #869FE9",
     1574"3@     c #86A1E7",
     1575"4@     c #86A0E9",
     1576"5@     c #87A1E7",
     1577"6@     c #88A2E7",
     1578"7@     c #87A1E9",
     1579"8@     c #5A6FCA",
     1580"9@     c #365FCF",
     1581"0@     c #345ED0",
     1582"a@     c #385FCC",
     1583"b@     c #385FCE",
     1584"c@     c #3A61CC",
     1585"d@     c #3B62CD",
     1586"e@     c #3E64CD",
     1587"f@     c #4167CF",
     1588"g@     c #4469CF",
     1589"h@     c #486CD1",
     1590"i@     c #4D71D2",
     1591"j@     c #5175D4",
     1592"k@     c #5376D6",
     1593"l@     c #5578DA",
     1594"m@     c #5679DC",
     1595"n@     c #587BDD",
     1596"o@     c #5A7DDE",
     1597"p@     c #5D80DE",
     1598"q@     c #5F82DF",
     1599"r@     c #6284DF",
     1600"s@     c #6585E0",
     1601"t@     c #6787E1",
     1602"u@     c #6988E2",
     1603"v@     c #6B8AE2",
     1604"w@     c #6D8CE3",
     1605"x@     c #6E8DE3",
     1606"y@     c #708EE4",
     1607"z@     c #718FE3",
     1608"A@     c #7391E4",
     1609"B@     c #7592E5",
     1610"C@     c #7895E5",
     1611"D@     c #7996E6",
     1612"E@     c #7A97E6",
     1613"F@     c #7B98E7",
     1614"G@     c #7A98E8",
     1615"H@     c #7B99E9",
     1616"I@     c #7E9AE9",
     1617"J@     c #7D9AE9",
     1618"K@     c #7E9AEA",
     1619"L@     c #809CE9",
     1620"M@     c #819DE8",
     1621"N@     c #7F9BEA",
     1622"O@     c #819DE9",
     1623"P@     c #819CE9",
     1624"Q@     c #839EE9",
     1625"R@     c #839EE8",
     1626"S@     c #839DEA",
     1627"T@     c #859FE9",
     1628"U@     c #87A0E8",
     1629"V@     c #86A0E8",
     1630"W@     c #87A1E8",
     1631"X@     c #3760CF",
     1632"Y@     c #3A61CE",
     1633"Z@     c #3A62CD",
     1634"`@     c #3F66CE",
     1635" #     c #4368D0",
     1636".#     c #466CD2",
     1637"+#     c #496DD5",
     1638"@#     c #4E72D6",
     1639"##     c #5175D8",
     1640"$#     c #5276DA",
     1641"%#     c #5578DC",
     1642"&#     c #577ADC",
     1643"*#     c #597CDD",
     1644"=#     c #5B7DDD",
     1645"-#     c #5D7FDE",
     1646";#     c #5E81DE",
     1647">#     c #6183DF",
     1648",#     c #6386DF",
     1649"'#     c #6687E0",
     1650")#     c #6888E0",
     1651"!#     c #6A89E1",
     1652"~#     c #6C8AE1",
     1653"{#     c #6E8CE2",
     1654"]#     c #6F8DE2",
     1655"^#     c #7390E4",
     1656"/#     c #7390E3",
     1657"(#     c #7491E4",
     1658"_#     c #7693E5",
     1659":#     c #7895E6",
     1660"<#     c #7896E6",
     1661"[#     c #7997E7",
     1662"}#     c #7B97E7",
     1663"|#     c #7B98E8",
     1664"1#     c #7C98E8",
     1665"2#     c #7E9BE9",
     1666"3#     c #809CEA",
     1667"4#     c #819CEA",
     1668"5#     c #839DE9",
     1669"6#     c #365FD0",
     1670"7#     c #3660D0",
     1671"8#     c #3961CF",
     1672"9#     c #3B63CF",
     1673"0#     c #3D64D0",
     1674"a#     c #4067D0",
     1675"b#     c #4469D2",
     1676"c#     c #466BD3",
     1677"d#     c #496ED5",
     1678"e#     c #4C71D6",
     1679"f#     c #4E72D8",
     1680"g#     c #5074D9",
     1681"h#     c #5376DB",
     1682"i#     c #5578DB",
     1683"j#     c #587ADC",
     1684"k#     c #5B7CDC",
     1685"l#     c #5D7EDD",
     1686"m#     c #5F80DD",
     1687"n#     c #6081DE",
     1688"o#     c #6383DE",
     1689"p#     c #6686DF",
     1690"q#     c #6887E0",
     1691"r#     c #6988E0",
     1692"s#     c #6B89E1",
     1693"t#     c #6C8AE0",
     1694"u#     c #6E8CE1",
     1695"v#     c #708EE2",
     1696"w#     c #718FE2",
     1697"x#     c #7290E3",
     1698"y#     c #7391E2",
     1699"z#     c #7492E1",
     1700"A#     c #7592E2",
     1701"B#     c #7691E3",
     1702"C#     c #7591E3",
     1703"D#     c #7692E3",
     1704"E#     c #7693E3",
     1705"F#     c #7793E4",
     1706"G#     c #7893E4",
     1707"H#     c #7994E5",
     1708"I#     c #7D97E8",
     1709"J#     c #7E98E8",
     1710"K#     c #7D98E8",
     1711"L#     c #7D99E9",
     1712"M#     c #7D9BEA",
     1713"N#     c #7D9CEA",
     1714"O#     c #7E99E8",
     1715"P#     c #7D9AEA",
     1716"Q#     c #7C9BEA",
     1717"R#     c #7C9CEA",
     1718"S#     c #355FCF",
     1719"T#     c #3860D0",
     1720"U#     c #3A62D0",
     1721"V#     c #3C64D1",
     1722"W#     c #4167D1",
     1723"X#     c #4369D3",
     1724"Y#     c #466BD4",
     1725"Z#     c #486DD5",
     1726"`#     c #4A6ED7",
     1727" $     c #4C70D8",
     1728".$     c #5478D9",
     1729"+$     c #577BDA",
     1730"@$     c #597DDB",
     1731"#$     c #5B7EDB",
     1732"$$     c #5D7FDC",
     1733"%$     c #6182DE",
     1734"&$     c #6284DE",
     1735"*$     c #6485DF",
     1736"=$     c #6586DF",
     1737"-$     c #6787DF",
     1738";$     c #6888DF",
     1739">$     c #6A8ADF",
     1740",$     c #6C8BE0",
     1741"'$     c #6D8CE0",
     1742")$     c #6E8DE1",
     1743"!$     c #6F8DE1",
     1744"~$     c #708EE1",
     1745"{$     c #718FE0",
     1746"]$     c #728FE1",
     1747"^$     c #7390E0",
     1748"/$     c #738FE0",
     1749"($     c #7490E1",
     1750"_$     c #7590E1",
     1751":$     c #7591E1",
     1752"<$     c #7592E1",
     1753"[$     c #7692E2",
     1754"}$     c #7794E2",
     1755"|$     c #7894E3",
     1756"1$     c #7996E3",
     1757"2$     c #7A96E5",
     1758"3$     c #7B98E6",
     1759"4$     c #7B9AE8",
     1760"5$     c #7C99E8",
     1761"6$     c #7C96E5",
     1762"7$     c #7D97E7",
     1763"8$     c #7C99E9",
     1764"9$     c #7B9AE9",
     1765"0$     c #7B9AEA",
     1766"a$     c #5B6DCF",
     1767"b$     c #305EC8",
     1768"c$     c #335ECE",
     1769"d$     c #305ECA",
     1770"e$     c #345FCF",
     1771"f$     c #3761D0",
     1772"g$     c #3A62D1",
     1773"h$     c #3C64D2",
     1774"i$     c #4066D3",
     1775"j$     c #466BD5",
     1776"k$     c #486ED6",
     1777"l$     c #4A6ED6",
     1778"m$     c #4D71D8",
     1779"n$     c #4F72D9",
     1780"o$     c #5073D9",
     1781"p$     c #4F72D8",
     1782"q$     c #5074D8",
     1783"r$     c #5276D9",
     1784"s$     c #587ADA",
     1785"t$     c #5B7CDB",
     1786"u$     c #5D7EDC",
     1787"v$     c #5F7FDD",
     1788"w$     c #6081DC",
     1789"x$     c #6182DD",
     1790"y$     c #6283DD",
     1791"z$     c #6484DE",
     1792"A$     c #6585DD",
     1793"B$     c #6787DE",
     1794"C$     c #6988DF",
     1795"D$     c #6A89DE",
     1796"E$     c #6C8ADF",
     1797"F$     c #6D8BDF",
     1798"G$     c #6E8CE0",
     1799"H$     c #6F8DE0",
     1800"I$     c #718EE0",
     1801"J$     c #728FDF",
     1802"K$     c #728FDE",
     1803"L$     c #7290E0",
     1804"M$     c #7190E0",
     1805"N$     c #7291E0",
     1806"O$     c #7191E0",
     1807"P$     c #7392E1",
     1808"Q$     c #7493E1",
     1809"R$     c #7594E1",
     1810"S$     c #7594E2",
     1811"T$     c #7694E2",
     1812"U$     c #7695E2",
     1813"V$     c #7A96E4",
     1814"W$     c #7895E2",
     1815"X$     c #7A96E2",
     1816"Y$     c #7A96E3",
     1817"Z$     c #7B96E3",
     1818"`$     c #7996E1",
     1819" %     c #7C96E4",
     1820".%     c #305EC9",
     1821"+%     c #315ECC",
     1822"@%     c #325ECE",
     1823"#%     c #3760D0",
     1824"$%     c #3962D1",
     1825"%%     c #3E66D3",
     1826"&%     c #4268D4",
     1827"*%     c #446BD5",
     1828"=%     c #476CD6",
     1829"-%     c #496ED7",
     1830";%     c #4B6FD7",
     1831">%     c #4C70D7",
     1832",%     c #4E71D7",
     1833"'%     c #5074D7",
     1834")%     c #5276D8",
     1835"!%     c #5376D8",
     1836"~%     c #5779DA",
     1837"{%     c #597ADA",
     1838"]%     c #5A7BDB",
     1839"^%     c #5B7CDA",
     1840"/%     c #5D7EDB",
     1841"(%     c #5E7FDB",
     1842"_%     c #6182DB",
     1843":%     c #6384DC",
     1844"<%     c #6586DD",
     1845"[%     c #6686DC",
     1846"}%     c #6887DD",
     1847"|%     c #6988DD",
     1848"1%     c #6A8ADE",
     1849"2%     c #6B8BDE",
     1850"3%     c #6C8CDE",
     1851"4%     c #6E8DDF",
     1852"5%     c #6E8CDF",
     1853"6%     c #6D8DDF",
     1854"7%     c #6C8BDF",
     1855"8%     c #6F8DDF",
     1856"9%     c #718FDF",
     1857"0%     c #7290DF",
     1858"a%     c #7391E0",
     1859"b%     c #7491E0",
     1860"c%     c #7292E1",
     1861"d%     c #3959C5",
     1862"e%     c #345BC5",
     1863"f%     c #315EC8",
     1864"g%     c #355BC5",
     1865"h%     c #325EC8",
     1866"i%     c #315ECB",
     1867"j%     c #345DCC",
     1868"k%     c #335ECD",
     1869"l%     c #345ECD",
     1870"m%     c #355FCE",
     1871"n%     c #3862D0",
     1872"o%     c #3E66D2",
     1873"p%     c #456BD5",
     1874"q%     c #476CD5",
     1875"r%     c #4B6ED7",
     1876"s%     c #4B6FD6",
     1877"t%     c #4B6FD5",
     1878"u%     c #4D71D6",
     1879"v%     c #5073D7",
     1880"w%     c #5174D7",
     1881"x%     c #5275D8",
     1882"y%     c #5577D8",
     1883"z%     c #5678D8",
     1884"A%     c #5779D9",
     1885"B%     c #587AD8",
     1886"C%     c #597CD9",
     1887"D%     c #5B7DD9",
     1888"E%     c #5D7FDA",
     1889"F%     c #5F80DB",
     1890"G%     c #6182DC",
     1891"H%     c #6484DC",
     1892"I%     c #6585DC",
     1893"J%     c #6787DD",
     1894"K%     c #6988DE",
     1895"L%     c #6B8ADE",
     1896"M%     c #6B8ADF",
     1897"N%     c #6989DE",
     1898"O%     c #6B89DE",
     1899"P%     c #6E8BDF",
     1900"Q%     c #708CDE",
     1901"R%     c #708DDF",
     1902"S%     c #708FDF",
     1903"T%     c #728EDF",
     1904"U%     c #6F8EDD",
     1905"V%     c #728EDD",
     1906"W%     c #7390DF",
     1907"X%     c #7490DF",
     1908"Y%     c #335DC8",
     1909"Z%     c #3759C5",
     1910"`%     c #3859C5",
     1911" &     c #335EC8",
     1912".&     c #325DCA",
     1913"+&     c #345CCB",
     1914"@&     c #335DCC",
     1915"#&     c #345DCD",
     1916"$&     c #355FCD",
     1917"%&     c #3861D0",
     1918"&&     c #3B64D1",
     1919"*&     c #3E65D2",
     1920"=&     c #4168D3",
     1921"-&     c #456AD5",
     1922";&     c #4B6ED5",
     1923">&     c #4C6FD4",
     1924",&     c #4D70D5",
     1925"'&     c #4F72D6",
     1926")&     c #5173D6",
     1927"!&     c #5375D7",
     1928"~&     c #5476D8",
     1929"{&     c #5577D7",
     1930"]&     c #5477D8",
     1931"^&     c #5677D8",
     1932"/&     c #5879D9",
     1933"(&     c #597AD9",
     1934"_&     c #5C7DDA",
     1935":&     c #6080DC",
     1936"<&     c #6080DB",
     1937"[&     c #6181DC",
     1938"}&     c #6282DC",
     1939"|&     c #6383DD",
     1940"1&     c #6484DD",
     1941"2&     c #6686DE",
     1942"3&     c #6685DE",
     1943"4&     c #6786DE",
     1944"5&     c #6687DE",
     1945"6&     c #6887DE",
     1946"7&     c #6987DE",
     1947"8&     c #6788DF",
     1948"9&     c #6785DF",
     1949"0&     c #6B89DF",
     1950"a&     c #6C89DF",
     1951"b&     c #6F8DDD",
     1952"c&     c #6D8CDE",
     1953"d&     c #445BBB",
     1954"e&     c #3759BE",
     1955"f&     c #375AC6",
     1956"g&     c #355CC8",
     1957"h&     c #345CCA",
     1958"i&     c #355ECC",
     1959"j&     c #365FCD",
     1960"k&     c #3761CE",
     1961"l&     c #3A63D0",
     1962"m&     c #3D65D1",
     1963"n&     c #466AD4",
     1964"o&     c #476BD4",
     1965"p&     c #486CD3",
     1966"q&     c #4A6ED4",
     1967"r&     c #4B6ED4",
     1968"s&     c #4E71D6",
     1969"t&     c #4F71D5",
     1970"u&     c #5072D6",
     1971"v&     c #5274D7",
     1972"w&     c #5273D7",
     1973"x&     c #5274D6",
     1974"y&     c #5476D7",
     1975"z&     c #5779D8",
     1976"A&     c #587AD9",
     1977"B&     c #5A7CDA",
     1978"C&     c #5C7DDB",
     1979"D&     c #5D7EDA",
     1980"E&     c #6081DA",
     1981"F&     c #6181DB",
     1982"G&     c #6283DC",
     1983"H&     c #6483DD",
     1984"I&     c #6483DE",
     1985"J&     c #6585DE",
     1986"K&     c #6786DF",
     1987"L&     c #6886DE",
     1988"M&     c #6887DF",
     1989"N&     c #6987DF",
     1990"O&     c #6A88DF",
     1991"P&     c #6786E0",
     1992"Q&     c #6A86DE",
     1993"R&     c #6B89E0",
     1994"S&     c #365BC8",
     1995"T&     c #365CC8",
     1996"U&     c #375DCA",
     1997"V&     c #375FCB",
     1998"W&     c #3860CD",
     1999"X&     c #3C63D0",
     2000"Y&     c #4167D2",
     2001"Z&     c #4268D2",
     2002"`&     c #4368D2",
     2003" *     c #4367D2",
     2004".*     c #4568D2",
     2005"+*     c #466AD2",
     2006"@*     c #496CD3",
     2007"#*     c #4A6DD3",
     2008"$*     c #4A6DD4",
     2009"%*     c #4D70D4",
     2010"&*     c #4F72D5",
     2011"**     c #4C70D4",
     2012"=*     c #4E72D5",
     2013"-*     c #5173D5",
     2014";*     c #5375D6",
     2015">*     c #597BDA",
     2016",*     c #5B7DDA",
     2017"'*     c #5C7EDB",
     2018")*     c #5D7FDB",
     2019"!*     c #5E80DB",
     2020"~*     c #5E81DA",
     2021"{*     c #5F81DB",
     2022"]*     c #5F82DB",
     2023"^*     c #6384DD",
     2024"/*     c #6384DE",
     2025"(*     c #6585DF",
     2026"_*     c #6486E0",
     2027":*     c #6583DD",
     2028"<*     c #6386E0",
     2029"[*     c #6686E0",
     2030"}*     c #6B86DD",
     2031"|*     c #6D86DD",
     2032"1*     c #6086E0",
     2033"2*     c #5573CD",
     2034"3*     c #3959C3",
     2035"4*     c #3959C4",
     2036"5*     c #3759C0",
     2037"6*     c #375BC7",
     2038"7*     c #365CC7",
     2039"8*     c #395FCC",
     2040"9*     c #3B62CE",
     2041"0*     c #3E64D0",
     2042"a*     c #4066D1",
     2043"b*     c #4166D1",
     2044"c*     c #4064CF",
     2045"d*     c #4065CF",
     2046"e*     c #4266D0",
     2047"f*     c #4468D1",
     2048"g*     c #4569D1",
     2049"h*     c #476BD2",
     2050"i*     c #466AD1",
     2051"j*     c #476AD2",
     2052"k*     c #456AD1",
     2053"l*     c #496DD2",
     2054"m*     c #4A6FD3",
     2055"n*     c #496ED2",
     2056"o*     c #4B70D4",
     2057"p*     c #4D71D4",
     2058"q*     c #4E72D4",
     2059"r*     c #5073D4",
     2060"s*     c #5174D5",
     2061"t*     c #5175D5",
     2062"u*     c #5276D6",
     2063"v*     c #5377D6",
     2064"w*     c #5478D7",
     2065"x*     c #5579D7",
     2066"y*     c #567AD8",
     2067"z*     c #577BD9",
     2068"A*     c #597CD8",
     2069"B*     c #5A7DD9",
     2070"C*     c #5A7ED9",
     2071"D*     c #5B7FDA",
     2072"E*     c #5C80DA",
     2073"F*     c #5D80DA",
     2074"G*     c #5E81DB",
     2075"H*     c #5D80DB",
     2076"I*     c #6082DC",
     2077"J*     c #6183DD",
     2078"K*     c #6183DE",
     2079"L*     c #6082DB",
     2080"M*     c #6282DE",
     2081"N*     c #6682DE",
     2082"O*     c #6583DE",
     2083"P*     c #3759BF",
     2084"Q*     c #375AC2",
     2085"R*     c #375AC1",
     2086"S*     c #375AC4",
     2087"T*     c #395DCA",
     2088"U*     c #3A5ECA",
     2089"V*     c #3C60CC",
     2090"W*     c #3D61CD",
     2091"X*     c #3D61CC",
     2092"Y*     c #3C61CD",
     2093"Z*     c #3E62CD",
     2094"`*     c #3F64CE",
     2095" =     c #4266CF",
     2096".=     c #4468D0",
     2097"+=     c #4267CF",
     2098"@=     c #4166CE",
     2099"#=     c #4065CE",
     2100"$=     c #4166CD",
     2101"%=     c #4267CE",
     2102"&=     c #456AD0",
     2103"*=     c #4368CE",
     2104"==     c #4468CF",
     2105"-=     c #4569D0",
     2106";=     c #486BD1",
     2107">=     c #4B6FD3",
     2108",=     c #4C70D3",
     2109"'=     c #4F73D4",
     2110")=     c #5275D5",
     2111"!=     c #5477D6",
     2112"~=     c #577BD7",
     2113"{=     c #587CD8",
     2114"]=     c #577CD8",
     2115"^=     c #597DD9",
     2116"/=     c #5A7DDA",
     2117"(=     c #597DDA",
     2118"_=     c #587CDA",
     2119":=     c #5A7EDA",
     2120"<=     c #567BD8",
     2121"[=     c #557AD9",
     2122"}=     c #567BD9",
     2123"|=     c #577CD9",
     2124"1=     c #587DD9",
     2125"2=     c #587ED9",
     2126"3=     c #577ED8",
     2127"4=     c #587DD8",
     2128"5=     c #587ED8",
     2129"6=     c #567ED7",
     2130"7=     c #526ABD",
     2131"8=     c #3759C1",
     2132"9=     c #385BC7",
     2133"0=     c #395CC8",
     2134"a=     c #3B5DC9",
     2135"b=     c #3B5ECA",
     2136"c=     c #3A5FCA",
     2137"d=     c #3B60CC",
     2138"e=     c #3C61CC",
     2139"f=     c #3D62CD",
     2140"g=     c #3E63CD",
     2141"h=     c #3C61CB",
     2142"i=     c #3C61CA",
     2143"j=     c #3D62CB",
     2144"k=     c #3F64CC",
     2145"l=     c #4065CD",
     2146"m=     c #4669D0",
     2147"n=     c #476AD0",
     2148"o=     c #496BD1",
     2149"p=     c #4A6DD2",
     2150"q=     c #4B6ED2",
     2151"r=     c #4D71D3",
     2152"s=     c #4E73D4",
     2153"t=     c #4F74D4",
     2154"u=     c #5075D5",
     2155"v=     c #5276D5",
     2156"w=     c #5377D7",
     2157"x=     c #5278D7",
     2158"y=     c #5277D6",
     2159"z=     c #5378D7",
     2160"A=     c #5379D8",
     2161"B=     c #5379D9",
     2162"C=     c #5278D8",
     2163"D=     c #5178D7",
     2164"E=     c #3355C0",
     2165"F=     c #3556C1",
     2166"G=     c #395AC6",
     2167"H=     c #385AC7",
     2168"I=     c #395BC7",
     2169"J=     c #395EC9",
     2170"K=     c #395FCA",
     2171"L=     c #3B60CA",
     2172"M=     c #3B60CB",
     2173"N=     c #375DC7",
     2174"O=     c #385EC8",
     2175"P=     c #395FC9",
     2176"Q=     c #3A60CA",
     2177"R=     c #3D63CC",
     2178"S=     c #4367CF",
     2179"T=     c #476BD1",
     2180"U=     c #4A6ED2",
     2181"V=     c #4B6FD2",
     2182"W=     c #4C6FD2",
     2183"X=     c #4D70D1",
     2184"Y=     c #4E71D2",
     2185"Z=     c #4E72D2",
     2186"`=     c #4E74D4",
     2187" -     c #4E75D5",
     2188".-     c #4E75D4",
     2189"+-     c #4F75D3",
     2190"@-     c #5075D2",
     2191"#-     c #5075D3",
     2192"$-     c #5177D7",
     2193"%-     c #5178D8",
     2194"&-     c #4F75D5",
     2195"*-     c #5076D5",
     2196"=-     c #4F76D6",
     2197"--     c #5279D9",
     2198";-     c #3C52B1",
     2199">-     c #3656C3",
     2200",-     c #3757C5",
     2201"'-     c #3758C6",
     2202")-     c #3759C6",
     2203"!-     c #375BC6",
     2204"~-     c #385CC7",
     2205"{-     c #385DC8",
     2206"]-     c #365CC6",
     2207"^-     c #355BC6",
     2208"/-     c #355CC6",
     2209"(-     c #365DC7",
     2210"_-     c #375EC8",
     2211":-     c #375CC6",
     2212"<-     c #385EC6",
     2213"[-     c #3A5FC7",
     2214"}-     c #3C60C8",
     2215"|-     c #3D61C9",
     2216"1-     c #3E62CA",
     2217"2-     c #4063CC",
     2218"3-     c #4165CE",
     2219"4-     c #4268D0",
     2220"5-     c #4269D1",
     2221"6-     c #436AD2",
     2222"7-     c #446AD2",
     2223"8-     c #456BD2",
     2224"9-     c #496CD1",
     2225"0-     c #4C6CD0",
     2226"a-     c #4D6CCF",
     2227"b-     c #4E6DD0",
     2228"c-     c #4F6ECF",
     2229"d-     c #4E6FCF",
     2230"e-     c #4C70CF",
     2231"f-     c #4A71D0",
     2232"g-     c #4F6FCF",
     2233"h-     c #4B71D0",
     2234"i-     c #4A72D1",
     2235"j-     c #4B73D4",
     2236"k-     c #4F70D0",
     2237"l-     c #4C73D3",
     2238"m-     c #4C73D6",
     2239"n-     c #4B72D2",
     2240"o-     c #4B71D1",
     2241"p-     c #4C73D7",
     2242"q-     c #3354C0",
     2243"r-     c #3152BE",
     2244"s-     c #3052BE",
     2245"t-     c #3051BF",
     2246"u-     c #2E4FBF",
     2247"v-     c #2E4FBE",
     2248"w-     c #2E50BF",
     2249"x-     c #2F50BF",
     2250"y-     c #3156C4",
     2251"z-     c #2F56C5",
     2252"A-     c #2E57C5",
     2253"B-     c #2F57C5",
     2254"C-     c #3057C6",
     2255"D-     c #3258C6",
     2256"E-     c #3459C7",
     2257"F-     c #365AC7",
     2258"G-     c #385BC8",
     2259"H-     c #3B5DCA",
     2260"I-     c #3B5DCB",
     2261"J-     c #3C5ECC",
     2262"K-     c #3C60CD",
     2263"L-     c #3C62CE",
     2264"M-     c #3D65D0",
     2265"N-     c #3D66D1",
     2266"O-     c #4166D2",
     2267"P-     c #4667D2",
     2268"Q-     c #4A67D1",
     2269"R-     c #4C68D0",
     2270"S-     c #4C69CF",
     2271"T-     c #4D6BCE",
     2272"U-     c #4E6DCD",
     2273"V-     c #4E6ECE",
     2274"W-     c #4E6DCE",
     2275"X-     c #4970D0",
     2276"Y-     c #4770D0",
     2277"Z-     c #4B6BCE",
     2278"`-     c #4A6CCE",
     2279" ;     c #496DCF",
     2280".;     c #476FD0",
     2281"+;     c #4870D0",
     2282"@;     c #486DCF",
     2283"#;     c #242F79",
     2284"$;     c #2F41AC",
     2285"%;     c #2040B8",
     2286"&;     c #2041B8",
     2287"*;     c #2243B3",
     2288"=;     c #2243B8",
     2289"-;     c #2343B8",
     2290";;     c #2444B8",
     2291">;     c #2445B8",
     2292",;     c #2445B6",
     2293"';     c #2445B7",
     2294");     c #2444B9",
     2295"!;     c #2949BE",
     2296"~;     c #2649BF",
     2297"{;     c #234BBF",
     2298"];     c #224CBF",
     2299"^;     c #224AC0",
     2300"/;     c #244CC0",
     2301"(;     c #254DC0",
     2302"_;     c #254DC1",
     2303":;     c #264DC2",
     2304"<;     c #274EC3",
     2305"[;     c #274CC3",
     2306"};     c #274DC4",
     2307"|;     c #254DC5",
     2308"1;     c #214EC5",
     2309"2;     c #204FC6",
     2310"3;     c #1F50C8",
     2311"4;     c #2151C9",
     2312"5;     c #2B53C8",
     2313"6;     c #3154C7",
     2314"7;     c #3255C6",
     2315"8;     c #2F57C7",
     2316"9;     c #2C58C9",
     2317"0;     c #2D59CA",
     2318"a;     c #2D58C9",
     2319"b;     c #2E5BCC",
     2320"c;     c #325ECC",
     2321"d;     c #325ECB",
     2322"e;     c #1F40B1",
     2323"f;     c #1F40B2",
     2324"g;     c #1F40B3",
     2325"h;     c #2A44BD",
     2326"i;     c #2845BE",
     2327"j;     c #2745BE",
     2328"k;     c #2646BF",
     2329"l;     c #2546BE",
     2330"m;     c #2347BF",
     2331"n;     c #2147BF",
     2332"o;     c #2048C0",
     2333"p;     c #1D48C0",
     2334"q;     c #1C48C0",
     2335"r;     c #1B47C0",
     2336"s;     c #1C48BF",
     2337"t;     c #1E49BE",
     2338"u;     c #214ABD",
     2339"v;     c #244CBD",
     2340"w;     c #264DBE",
     2341"x;     c #254EC0",
     2342"y;     c #214FC2",
     2343"z;     c #1B51C5",
     2344"A;     c #1C51C7",
     2345"B;     c #2250C8",
     2346"C;     c #2A52C8",
     2347"D;     c #3254C6",
     2348"E;     c #3355C5",
     2349"F;     c #3154C8",
     2350"G;     c #3355C6",
     2351"H;     c #2F57C8",
     2352"I;     c #2E58C9",
     2353"J;     c #2E59C9",
     2354"K;     c #3059C9",
     2355"L;     c #2040B6",
     2356"M;     c #2743BB",
     2357"N;     c #2844BC",
     2358"O;     c #2743BD",
     2359"P;     c #2844BE",
     2360"Q;     c #2844BD",
     2361"R;     c #2346BE",
     2362"S;     c #2047BF",
     2363"T;     c #1E48C0",
     2364"U;     c #1D47C0",
     2365"V;     c #1D49BF",
     2366"W;     c #1F49BF",
     2367"X;     c #204ABE",
     2368"Y;     c #254DBF",
     2369"Z;     c #234EC0",
     2370"`;     c #2050C1",
     2371" >     c #1C51C3",
     2372".>     c #1F51C6",
     2373"+>     c #2651C8",
     2374"@>     c #2D53C7",
     2375"#>     c #3155C6",
     2376"$>     c #3155C7",
     2377"%>     c #3355C7",
     2378"&>     c #3254C7",
     2379"*>     c #1E40B1",
     2380"=>     c #2141B8",
     2381"->     c #2442B9",
     2382";>     c #2744BB",
     2383">>     c #2945BB",
     2384",>     c #2A45BB",
     2385"'>     c #2944BA",
     2386")>     c #2745BB",
     2387"!>     c #2545BC",
     2388"~>     c #2246BD",
     2389"{>     c #2047BE",
     2390"]>     c #1F47BD",
     2391"^>     c #1D48BE",
     2392"/>     c #1E49C0",
     2393"(>     c #1F4AC0",
     2394"_>     c #214BBF",
     2395":>     c #244CBE",
     2396"<>     c #254DBE",
     2397"[>     c #244DBE",
     2398"}>     c #224FBF",
     2399"|>     c #2051C1",
     2400"1>     c #2151C3",
     2401"2>     c #2252C5",
     2402"3>     c #2151C1",
     2403"4>     c #2851C6",
     2404"5>     c #2A50C6",
     2405"6>     c #2E54C6",
     2406"7>     c #1F51C2",
     2407"8>     c #1D52C5",
     2408"9>     c #2651C9",
     2409"0>     c #2950C7",
     2410"a>     c #2D40A5",
     2411"b>     c #2040B0",
     2412"c>     c #1F40B0",
     2413"d>     c #223CAE",
     2414"e>     c #233CAE",
     2415"f>     c #253BAC",
     2416"g>     c #253BAD",
     2417"h>     c #233CB0",
     2418"i>     c #213EB2",
     2419"j>     c #1F3FB4",
     2420"k>     c #1E40B6",
     2421"l>     c #1F3FB7",
     2422"m>     c #1E3EB8",
     2423"n>     c #1F3FB8",
     2424"o>     c #2040B7",
     2425"p>     c #2141B6",
     2426"q>     c #2140B7",
     2427"r>     c #2241B6",
     2428"s>     c #2342B5",
     2429"t>     c #2442B6",
     2430"u>     c #2543B5",
     2431"v>     c #2643B4",
     2432"w>     c #2544B6",
     2433"x>     c #2346B8",
     2434"y>     c #2247B9",
     2435"z>     c #2048BC",
     2436"A>     c #1F48BF",
     2437"B>     c #2049C0",
     2438"C>     c #214AC0",
     2439"D>     c #224BBF",
     2440"E>     c #234CBE",
     2441"F>     c #244DBF",
     2442"G>     c #234CBF",
     2443"H>     c #264DC0",
     2444"I>     c #274EBF",
     2445"J>     c #264DBF",
     2446"K>     c #254EBF",
     2447"L>     c #2050C0",
     2448"M>     c #1F51C1",
     2449"N>     c #1E42A4",
     2450"O>     c #263BA6",
     2451"P>     c #253BA7",
     2452"Q>     c #253CA7",
     2453"R>     c #1E41A5",
     2454"S>     c #1F40AF",
     2455"T>     c #273AAC",
     2456"U>     c #1E40B0",
     2457"V>     c #1F40B5",
     2458"W>     c #1F40B6",
     2459"X>     c #1F40B8",
     2460"Y>     c #1E40B8",
     2461"Z>     c #1F3EB8",
     2462"`>     c #203FB7",
     2463" ,     c #2240B6",
     2464".,     c #2341B7",
     2465"+,     c #2345B9",
     2466"@,     c #2147BB",
     2467"#,     c #2148BA",
     2468"$,     c #2049BB",
     2469"%,     c #2049BD",
     2470"&,     c #2049BF",
     2471"*,     c #224BBE",
     2472"=,     c #244DBD",
     2473"-,     c #244CBF",
     2474";,     c #182969",
     2475">,     c #273BAD",
     2476",,     c #2739AB",
     2477"',     c #263AAC",
     2478"),     c #243CAE",
     2479"!,     c #233DAE",
     2480"~,     c #213EAF",
     2481"{,     c #1F3FB0",
     2482"],     c #2040B4",
     2483"^,     c #1F3FB6",
     2484"/,     c #1E3EB7",
     2485"(,     c #2240B7",
     2486"_,     c #2341B6",
     2487":,     c #2543B4",
     2488"<,     c #2644B3",
     2489"[,     c #2544B5",
     2490"},     c #2545B5",
     2491"|,     c #2547B6",
     2492"1,     c #2548B7",
     2493"2,     c #2349BA",
     2494"3,     c #1F49BE",
     2495"4,     c #2149BD",
     2496"5,     c #2049BE",
     2497"6,     c #214BBE",
     2498"7,     c #2249BE",
     2499"8,     c #234CBD",
     2500"9,     c #2149BE",
     2501"0,     c #1E49BF",
     2502"a,     c #253BA9",
     2503"b,     c #253BAB",
     2504"c,     c #263AAB",
     2505"d,     c #213DAF",
     2506"e,     c #203EAF",
     2507"f,     c #1D40AF",
     2508"g,     c #1D40B0",
     2509"h,     c #1E40B4",
     2510"i,     c #2241B7",
     2511"j,     c #2643B6",
     2512"k,     c #2744B5",
     2513"l,     c #2643B5",
     2514"m,     c #2346B6",
     2515"n,     c #2147B7",
     2516"o,     c #2644B6",
     2517"p,     c #2247B7",
     2518"q,     c #2248B8",
     2519"r,     c #2647B7",
     2520"s,     c #2549B7",
     2521"t,     c #2645B7",
     2522"u,     c #2148B8",
     2523"v,     c #2847B6",
     2524"w,     c #2549B6",
     2525"x,     c #2849B6",
     2526"y,     c #2049B7",
     2527"z,     c #2A49B5",
     2528"A,     c #243BA4",
     2529"B,     c #253BA5",
     2530"C,     c #253BA6",
     2531"D,     c #263AA7",
     2532"E,     c #263AA8",
     2533"F,     c #2739AA",
     2534"G,     c #243CAD",
     2535"H,     c #223DAE",
     2536"I,     c #1F3EAF",
     2537"J,     c #1E3FB0",
     2538"K,     c #1D40B1",
     2539"L,     c #1E3FB1",
     2540"M,     c #1F3FB3",
     2541"N,     c #1F3FB5",
     2542"O,     c #2140B6",
     2543"P,     c #2140B8",
     2544"Q,     c #2744B4",
     2545"R,     c #2746B6",
     2546"S,     c #2947B6",
     2547"T,     c #2946B5",
     2548"U,     c #2A48B6",
     2549"V,     c #3551A8",
     2550"W,     c #1F399C",
     2551"X,     c #143D9F",
     2552"Y,     c #263BA5",
     2553"Z,     c #273BA8",
     2554"`,     c #273BAA",
     2555" '     c #263AAD",
     2556".'     c #233CAD",
     2557"+'     c #213DAE",
     2558"@'     c #203FB2",
     2559"#'     c #2342B6",
     2560"$'     c #2443B6",
     2561"%'     c #2543B6",
     2562"&'     c #2644B5",
     2563"*'     c #133D9E",
     2564"='     c #263BA7",
     2565"-'     c #263BA9",
     2566";'     c #273BA9",
     2567">'     c #263AAA",
     2568",'     c #2539AB",
     2569"''     c #2639AB",
     2570")'     c #253AAC",
     2571"!'     c #243BAD",
     2572"~'     c #223DAF",
     2573"{'     c #203FB0",
     2574"]'     c #2040B1",
     2575"^'     c #2140B3",
     2576"/'     c #2543B1",
     2577"('     c #2744AF",
     2578"_'     c #1A3CA0",
     2579":'     c #1D3BA2",
     2580"<'     c #233BA4",
     2581"['     c #263AA5",
     2582"}'     c #253AA5",
     2583"|'     c #263AA6",
     2584"1'     c #263BA4",
     2585"2'     c #243BA5",
     2586"3'     c #263BA8",
     2587"4'     c #223EAF",
     2588"5'     c #3B4CA5",
     2589"6'     c #1D379A",
     2590"7'     c #1E389C",
     2591"8'     c #1E399F",
     2592"9'     c #1F3BA2",
     2593"0'     c #1F3BA3",
     2594"a'     c #213BA4",
     2595"b'     c #233AA3",
     2596"c'     c #243AA3",
     2597"d'     c #2539A4",
     2598"e'     c #253AA6",
     2599"f'     c #243BA7",
     2600"g'     c #253CAA",
     2601"h'     c #253CAC",
     2602"i'     c #253CAD",
     2603"j'     c #253CAE",
     2604"k'     c #243DAE",
     2605"l'     c #213FAF",
     2606"m'     c #223FAF",
     2607"n'     c #2040AF",
     2608"o'     c #253D93",
     2609"p'     c #1D3894",
     2610"q'     c #1F379A",
     2611"r'     c #1E389B",
     2612"s'     c #1D399C",
     2613"t'     c #1C3A9D",
     2614"u'     c #1B3A9D",
     2615"v'     c #183B9E",
     2616"w'     c #163C9E",
     2617"x'     c #153C9E",
     2618"y'     c #163B9D",
     2619"z'     c #173B9D",
     2620"A'     c #193A9D",
     2621"B'     c #1C3A9E",
     2622"C'     c #1F3AA1",
     2623"D'     c #223AA4",
     2624"E'     c #253BA8",
     2625"F'     c #273BA7",
     2626"G'     c #263CAB",
     2627"H'     c #263CAC",
     2628"I'     c #243EAE",
     2629"J'     c #273BAC",
     2630"K'     c #2A3795",
     2631"L'     c #1F389B",
     2632"M'     c #1D389B",
     2633"N'     c #1C399C",
     2634"O'     c #1B399C",
     2635"P'     c #1A3A9D",
     2636"Q'     c #1D399B",
     2637"R'     c #1B399B",
     2638"S'     c #1A3A9C",
     2639"T'     c #1B3A9F",
     2640"U'     c #1D3AA0",
     2641"V'     c #203BA2",
     2642"W'     c #203BA3",
     2643"X'     c #2639A6",
     2644"Y'     c #1B3692",
     2645"Z'     c #1C3794",
     2646"`'     c #1D3796",
     2647" )     c #1E3898",
     2648".)     c #1E389A",
     2649"+)     c #1F399B",
     2650"@)     c #1A399C",
     2651"#)     c #193A9E",
     2652"$)     c #1A3BA0",
     2653"%)     c #1C3BA2",
     2654"&)     c #1D3CA3",
     2655"*)     c #203CA4",
     2656"=)     c #223BA5",
     2657"-)     c #3C4699",
     2658";)     c #2B4595",
     2659">)     c #1C3793",
     2660",)     c #1D3895",
     2661"')     c #1E3897",
     2662"))     c #1F3998",
     2663"!)     c #1F3999",
     2664"~)     c #1F399A",
     2665"{)     c #1E399C",
     2666"])     c #1C3B9E",
     2667"^)     c #1D3BA0",
     2668"/)     c #1E3CA2",
     2669"()     c #223CA5",
     2670"_)     c #243CA6",
     2671":)     c #596FA9",
     2672"<)     c #3B4894",
     2673"[)     c #314993",
     2674"})     c #29499F",
     2675"|)     c #28489E",
     2676"1)     c #2B4BA1",
     2677"2)     c #2C4BA1",
     2678"3)     c #2D4CA2",
     2679"4)     c #2E4CA3",
     2680"5)     c #2F4CA4",
     2681"6)     c #2E4CA4",
     2682"7)     c #2F4DA3",
     2683"8)     c #2F4DA4",
     2684"9)     c #D3D5D2",
     2685"0)     c #3B4794",
     2686"a)     c #314791",
     2687"b)     c #304892",
     2688"c)     c #304893",
     2689"d)     c #2F4995",
     2690"e)     c #2F4997",
     2691"f)     c #2D4A9A",
     2692"g)     c #2A4A9D",
     2693"h)     c #294A9F",
     2694"i)     c #284AA0",
     2695"j)     c #294AA0",
     2696"k)     c #2B4AA1",
     2697"l)     c #2D4CA3",
     2698"m)     c #C9CAC9",
     2699"n)     c #455D9B",
     2700"o)     c #242F78",
     2701"p)     c #1B2F85",
     2702"q)     c #C6C3C8",
     2703"r)     c #B5B2B6",
     2704"s)     c #B5B7B4",
     2705"t)     c #B5B7B3",
     2706"u)     c #B5B2B5",
     2707"v)     c #B5B3B4",
     2708"w)     c #B5B5B4",
     2709"x)     c #B5B6B3",
     2710"y)     c #B5B4B4",
     2711"z)     c #B5B3B5",
     2712"A)     c #B5B4B5",
     2713"B)     c #B5B5B5",
     2714"C)     c #B5B5B3",
     2715"D)     c #B5B5B6",
     2716"E)     c #BAC3BE",
     2717"F)     c #B9C3BD",
     2718"G)     c #C1C3C4",
     2719"H)     c #BFC3C2",
     2720"I)     c #B9C3BE",
     2721"J)     c #BBC3BF",
     2722"K)     c #BDC3C1",
     2723"L)     c #C0C3C3",
     2724"M)     c #BEC3C1",
     2725"N)     c #C2C3C5",
     2726"O)     c #E6E3E8",
     2727"P)     c #E0E2DF",
     2728"Q)     c #E1E1E1",
     2729"R)     c #E2E1E3",
     2730"S)     c #E4E1E6",
     2731"T)     c #E4E2E7",
     2732"U)     c #E4E2E6",
     2733"V)     c #E3E3E4",
     2734"W)     c #E2E3E3",
     2735"X)     c #E1E3E2",
     2736"Y)     c #E3E3E3",
     2737"Z)     c #E3E3E2",
     2738"`)     c #EBEDEA",
     2739" !     c #EAECE9",
     2740".!     c #E9EBE8",
     2741"+!     c #ECEEEB",
     2742". . + @ # $ $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ $ $ $ % $ $ & * = - ; > , , ' ) ! ! ~ { ] ^ / ( _ : < [ } | | 1 2 3 3 4 4 4 4 4 4 4 5 6 4 4 4 5 6 7 8 9 4 5 6 7 8 9 6 7 8 9 ",
     2743"0 a b % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ c d d d d $ $ $ $ $ c d e f g h i i i i j k l m n o p q r s t u v w x y z 4 A B C D 9 9 E 9 E F G H I F J K L L L L J K L L L L L L L L ",
     2744"@ % M N O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O P Q R S T U V W X Y Z `  ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.b.b.b.b.b.",
     2745"c.$ d.O e.f.g.g.g.h.g.g.g.g.g.h.h.g.g.g.g.g.h.h.g.g.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+@+$+%+&+*+=+$+-+;+>+,+'+)+!+;+>+,+~+,+>+,+~+,+",
     2746"$ {+N N f.f.f.f.h.h.h.g.f.f.h.h.h.h.g.f.f.h.h.h.h.]+^+/+(+h._+:+<+[+}+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+A+B+.+C+D+E+D+F+G+H+C+I+F+G+J+K+L+H+F+G+J+K+L+H+J+H+J+H+",
     2747"{+{+N N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.N+N+h.h.(+O+P+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@[@y+}@|@1@A+1@2@3@ +2@4@2@5@C+D+6@D+7@5@C+D+6@I+C+D+6@I+",
     2748"{+{+8@N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.9@9@0@N+a@b@c@d@e@f@g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@q+r+C@D@E@F@G@H@_@I@J@K@<@L@M@N@O@P@Q@R@S@T@A+A+U@V@W@W@A+2@U@V@W@W@U@V@W@W@",
     2749"{+{+8@N f.M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+(+(+9@9@X@Y@Z@e@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#z@^#/#(#p+_#r+:#s+t+<#[#}#|#|#1#_@|#_@_@2#L@3#4#y+y+5#z+z+z+5#z+z+z+z+A+A+A+A+A+",
     2750"{+{+8@8@f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#&@p#q#r#s#t#u#v#w#x#x#y#y#z#A#B#C#D#E#E#F#G#H#F#H#H#u+v+I#J#K#L#J@J@M#N#O#P#M#M#M#N#M#Q#Q#R#",
     2751"$ {+8@e.f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.S#l.7#T#U#V#W#X#Y#Z#`# $f#g###.$+$@$#$$$$@%$&$*$=$-$;$>$,$'$)$!$~$~${$]$^$/$($($_$_$:$<$_$<$[$}$|$|$1$2$2$3$}#4$5$6$7$8$8$9$8$8$8$0$8$",
     2752"$ {+a$e.f.f.h.h.h.h.h.h.h.h.h.b$h.c$c$c$c$c$d$c$c$c$c$c$c$c$c$c$c$e$e$7#f$g$h$i$X#j$k$l$m$n$o$p$q$r$l@s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$I$J$J$K$K$J$L$L$L$L$L$M$N$O$P$Q$R$S$T$U$1$V$T$W$X$Y$1$V$Y$Z$`$ %",
     2753"$ $ a$a$f.f.b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$.%b$b$b$.%d$+%+%@%h.e$l.#%$%h$%%&%*%=%-%;%>%,%'%)%!% @ @~%{%]%^%/%(%w$_%:%<%[%}%|%D$1%2%3%4%5%4%4%6%5%5%4%4%4%5%7%5%8%9%L$0%a%a%a%P$b%P$P$z#z#z#P$c%c%c%",
     2754"$ $ 8@e.f.f.d%b$b$b$b$b$d%b$b$b$b$b$b$e%f%b$b$b$b$b$g%h%b$.%i%i%j%k%l%m%X@n%h$o%&%p%q%`#r%s%t%u%v%w%x%y% @z%A%B%C%D%E%F%G%:%H%I%[%J%}%K%|%D$K%D$D$L%M%M%M%M%M%D$N%O%i+P%j+Q%R%S%T%0%U%V%W%W%W%W%X%X%X%X%",
     2755"$ $ 8@8@f.f.d%d%b$b$b$b$d%d%b$b$b$h%Y%Z%Z%h%f%f%h%Y%`%`% &h%h%.&+&@&#&$&X@%&&&*&=&-&j$Z#+#;&>&,&'&)&)&!&~&{&]&^&/&(&^%_&(%:&<&[&}&|&1&A$A$2&3&4&4&5&B$6&7&B$7&8&9&6&7&0&a&a&i+i+i+b&a&a&j+U%c&U%j+U%c&U%",
     2756"$ $ 8@8@d&e&d%d%d%d%d%d%d%d%d%d%d%`%d%d%d%d%`%`%`%d%d%d%d%`%`%f&g&h&j%i&j&k&l&m&=&X#Y#n&o&p&q&r&>&s&t&t&u&v&w&x&y&{&z&A&B&C&D&(%(%F%F%E&F&}&}&|&G&|&H&1&I%I&A$1&}&z$z$J&K&L&M&N&O&0&P&Q&0&a&R&a&a&a&R&a&",
     2757"{+$ 8@8@e&e&d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%`%f&S&T&U&V&W&Y@X&Y&Z&`& *.*+*@*#*@*r&$*#*r&%*&***=*-*;*y&z%A%z&A&A&>*B&,*,*'*)*!*!*~*{*F&}&{*}&{*]*G%G%y$^*/*J&(*2&_*:*<*=$[*}*<*=$<*|*1*",
     2758"{+{+8@2*e&e&d%d%d%d%d%d%d%d%d%e&3*4*4*4*4*4*5*4*4*4*4*4*4*4*4*4*`%f&6*6*7*8*9*0*a*b*c*d*e*f*g*h*i*j*+*k*h*l*m*n*m*o*p*q*r*s*t*u*v*w*x*y*y*z*A*B*C*D*E*F*G*E*G*F*H*G*F*~*]*{*I*x$J*K*L*G%K*M*o#o#I&N*O*O*",
     2759"{+{+8@2*e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*e&e&e&e&e&e&P*P*e&e&e&P*P*5*Q*R*S*T*U*V*W*X*Y*Z*`*d* =.=+=@=#=$=%=g@&=*===-=i*;=l*>=,=q*'=s*)=k@!=x*~={=]=^=/=(=_=:=(=<=<=]=[=}=|=]=]=1=2=3=|=4=5=2=2=2=3=6=6=6=",
     2760"{+{+7=e.e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*P*8=9=0=a=b=U*c=d=e=f=e@#=g=h=i=i=j=k=k=l=%===m=n=o=p=q=,=r=s=t=u=v=v*w=x=x=y=z=z=A=z=A=B=C=B=D=C=B=x=B=B=B=B=B=B=B=B=B=B=B=B=B=B=",
     2761"{+{+7=7=e&e&e&e&E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=e&e&e&e&E=E=E=F=d%G=G=H=I=J=K=L=M=R+}+N=O=P=Q=j=i=h=R=e@@=S=-=T=h@l*U=V=W=X=Y=Z=`= - - -.-+-@- -#-$-%-$-&-*-$-=-%-----C=$-%---------B=B=B=B=",
     2762"{+{+7=7=;-;-E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=>-,-'-)-!-6*~-{-{-]-^-/-/-(-_-:-N=<-[-}-|-1-2-3- =4-5-6-7-8-9-0-0-a-b-c-d-e-f-g-h-h-i-j-k-h-h-i-j-l-m-n-o-i-j-l-m-n-j-l-p-n-",
     2763"{+{+7=7=;-;-E=E=E=E=E=E=E=E=q-r-s-t-t-u-u-v-v-v-u-w-x-u-u-u-u-u-u-u-u-v-v-u-u-u-u-u-v-v-u-u-u-u-v-v-u-y-z-A-B-C-D-E-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-U-V-W-V-e-X-Y-Z-`- ;.;Y-N N +;@;.;Y-N N N N N N N ",
     2764"#;#;d&d&$;$;%;%;%;%;%;%;%;%;&;*;=;-;-;-;;;>;,;>;>;>;;;>;>;>;>;>;>;>;>;>;';);>;>;>;>;>;';>;>;>;>;>;';);!;~;{;];^;/;(;_;_;:;<;[;};};|;1;2;3;4;5;6;7;8;9;9;0;a;0;0;b;h.a;0;0;b;h.c;h.d;0;b;h.c;h.d;h.c;h.d;",
     2765"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;f;f;f;f;e;e;e;f;f;f;f;f;f;f;f;f;f;f;f;g;%;f;f;f;f;f;g;f;f;f;f;f;g;%;h;i;j;k;l;m;n;o;p;q;r;r;s;t;u;v;w;x;y;z;A;B;C;6;D;E;F;G;G;H;I;F;G;G;H;I;J;J;K;G;H;I;J;J;K;I;J;J;K;",
     2766"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;L;e;e;e;e;e;e;e;e;e;e;e;e;L;M;N;O;P;Q;i;i;k;R;S;T;U;q;q;V;W;X;{;Y;Z;`; >.>+>@>#>+>$>6;#>#>+>%>&>G;G;G;G;G;&>G;G;G;G;G;G;G;G;G;",
     2767"#;#;d.;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;*>e;e;e;e;e;e;e;e;e;e;e;e;*>=>->;>>>,>'>'>)>!>~>{>]>^>^>V;V;/>(>_>:><>[>}>|>1>2>3>2>4>5>6>7>8>9>0>G;G;G;G;9>0>G;G;G;G;G;G;G;G;",
     2768"#;#;d.d.a>a>e;e;e;e;e;e;e;e;e;e;b>b>c>c>c>c>c>b>e;e;e;e;e;e;e;e;e;e;e;e;e;e;d>e>f>g>h>i>j>k>l>l>m>m>n>n>o>o>p>q>r>r>s>t>u>v>v>u>w>';x>y>z>t;A>B>C>D>E>E>F>G>F>H>H>I>F>Y;J>w;K>L>K>M>J>w;K>L>K>M>K>L>K>M>",
     2769"#;#;d.d.a>a>N>e;N>O>O>O>N>e;N>O>O>P>Q>R>S>R>Q>O>O>O>N>e;N>O>O>O>N>e;N>N>O>T>e;e;e;U>U>U>U>f;V>W>o>o>o>o>X>X>Y>Y>n>n>Z>Z>`> ,.,t>t>u>u>w>+,@,#,$,%,A>&,*,=,B>[>-,w;<>C>[>-,w;w;w;w;w;-,w;w;w;w;w;w;w;w;w;",
     2770"#;;,;-;-a>a>N>N>N>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>N>N>N>N>O>>,,,,,,,',g>),!,~,{,{,*>U>e;f;],o>%;o>^,^,/,/,l>q>(,_,t>u>:,<,v>[,},|,1,2,%,%,3,4,5,6,7,8,9,5,6,0,G>G>Y;G>6,0,G>G>Y;G>G>G>Y;G>",
     2771";,;,;-;-O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>P>a,b,',',c,c,f>),e>d,e,{,{,U>U>f,f,U>U>g,g,*>g;h,^,^,`>`>q>i,t>j,k,k,l,w>m,n,o,p,q,r,s,t,p,u,v,w,x,y,z,u,v,w,x,y,z,w,x,y,z,",
     2772";,;,b b O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>A,A,A,B,C,D,E,F,c,',g>G,!,H,~,e,{,I,J,J,K,K,U>f,f,J,L,M,N,L;O,i,P,.,l,Q,k,k,k,k,k,k,R,v,k,k,k,R,v,S,T,U,k,R,v,S,T,U,v,S,T,U,",
     2773";,;,b V,W,W,X,X,O>X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,O>X,X,O>O>O>O>B,B,B,B,Y,O>O>Z,`,T>T> '',g>.'+'e,{,{,e,+'+'e,e,{,J,K,e;@'N,O,#'$'%'%'j,%'j,&'k,k,%'j,&'k,k,k,k,k,&'k,k,k,k,k,k,k,k,k,",
     2774";,;,b V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,*'O>O>O>O>O>O>O>O>B,B,A,A,B,C,='-'`,;'>'>',''')'!'!'e>e>~'~'~,~,{'{,*>*>e;]']']']']']'^'/']']']'^'/':,(':,]'^'/':,(':,/':,(':,",
     2775";,;,V,V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_':'<'['}'|'|'O>O>O>O>O>O>O>Y,Y,1'1'B,B,2'2'C,3'-'>'c,)')'!'),4'{'e;]'e;*>*>e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;",
     2776";,;,5'5'W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,W,6'6'6'7'8'9'0'a'b'c'd'd'}'}'O>O>O>O>O>O>O>O>Y,1'1'['['e'e'f'g'h'i'j'k'G,),!,l'j'm'n'b>b>),m'b>e;e;e;e;e;b>e;e;e;e;e;e;e;e;e;",
     2777";,;,b b o'o'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,q'q'q'r's't'u'v'w'x'y'z'A'B'C'D'2'2'B,B,O>O>O>O>O>O>O>O>O>O>O>Y,Y,C,C,='='='E'F'3'3'3'G'Z,='F'F'G'H'I'J'F'F'G'H'I'J'G'H'I'J'",
     2778";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,W,W,W,W,L'L'q'r'M'N'O'P'u'N's'Q'R'S'A'T'U'C'V'9'0'W'D'}'X'|'O>O>B,B,O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>",
     2779";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'Y'Y'Y'Z'`' ).)+)+)+)W,W,W,W,L'L'q'q'r'r's'M'N'P'@)A'#)$)%)&)*)=)B,|'|'O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>",
     2780"{+;,$ -);)K'p'p'o'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'o'o'p'p'p'p'p'p'p'p'p'p'>)>)Y'Y'>)Z',)')))!)~)+)W,W,W,W,W,W,W,W,W,W,W,L'L'{)s't'])^)/)])/)/)O>()])/)/)O>()O>_)O>/)O>()O>_)O>()O>_)O>",
     2781":);,;,;)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)[)M M M M M M M M M M M M M M M M M M })})|)|)})M M 1)2)3)4)5)6)6)6)7)7)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)",
     2782"9)#;;,;,$ -)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)0)a)a)a)b)c)d)e)f)g)h)i)i)j)j)M M M M M M M M M M M })})})})M k)k)M M k)l)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)",
     2783"+ 9)m)n)$ #;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;o)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)",
     2784"+ + 9)a m)q)r)s)r)s)r)s)r)s)r)r)s)r)s)r)s)r)r)s)r)s)r)s)r)s)r)s)r)s)r)s)r)t)u)v)w)x)x)w)y)z)A)A)B)B)B)B)w)w)C)C)w)w)B)B)B)B)B)w)w)w)w)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)D)B)B)B)B)B)D)B)B)B)D)B)",
     2785". + + 9)9)9)q)E)q)E)q)E)q)E)q)q)E)q)E)q)E)q)q)E)q)E)q)E)q)E)q)E)q)E)q)E)q)F)G)H)E)I)J)K)H)L)L)L)L)L)L)L)H)H)M)M)H)H)L)L)G)L)L)H)H)H)H)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)N)L)L)L)L)L)N)L)L)L)N)L)",
     2786". . 0 . + O)P)O)P)O)P)O)P)O)P)P)O)P)O)P)O)P)P)O)P)O)P)O)P)O)P)O)P)O)P)O)P)O)Q)R)S)T)U)V)W)X)W)W)V)V)V)V)V)V)V)V)Y)Y)Z)Z)Y)Z)Z)Y)Y)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)Y)V)V)V)V)V)Y)V)V)V)Y)V)",
     2787". . . 0 0 0 . 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0 `) !+ + + .! !`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)+!`)`)`)`)`)+!`)`)`)+!`)"};
     2788
     2789
     2790static char * listviewhighcornerright_xpm[] = {
     2791"100 46 780 2",
     2792"       c None",
     2793".      c #6A779D",
     2794"+      c #6C789C",
     2795"@      c #6C789D",
     2796"#      c #6B789D",
     2797"$      c #6A779E",
     2798"%      c #66759E",
     2799"&      c #64749E",
     2800"*      c #63749E",
     2801"=      c #61739D",
     2802"-      c #576D9B",
     2803";      c #556C9C",
     2804">      c #4D679D",
     2805",      c #4A649D",
     2806"'      c #49629D",
     2807")      c #465E9C",
     2808"!      c #40579C",
     2809"~      c #3B5394",
     2810"{      c #2C4E97",
     2811"]      c #314993",
     2812"^      c #2B4595",
     2813"/      c #1B4296",
     2814"(      c #253D93",
     2815"_      c #19418F",
     2816":      c #0F3C96",
     2817"<      c #42599E",
     2818"[      c #758DC3",
     2819"}      c #E8EAE7",
     2820"|      c #EEF0ED",
     2821"1      c #FBFBFC",
     2822"2      c #6F7D9B",
     2823"3      c #6F7D9A",
     2824"4      c #6E7B9C",
     2825"5      c #67759E",
     2826"6      c #63739E",
     2827"7      c #62739D",
     2828"8      c #596F9C",
     2829"9      c #4A639D",
     2830"0      c #47609C",
     2831"a      c #445B9F",
     2832"b      c #3E5697",
     2833"c      c #2E509A",
     2834"d      c #2D509A",
     2835"e      c #2D4F99",
     2836"f      c #2D4F98",
     2837"g      c #28418A",
     2838"h      c #3E51A3",
     2839"i      c #D0D3DC",
     2840"j      c #A1B6EF",
     2841"k      c #A2B6F0",
     2842"l      c #A1B6F0",
     2843"m      c #A3B6F0",
     2844"n      c #A0B6EF",
     2845"o      c #9DB6EE",
     2846"p      c #9CB5EF",
     2847"q      c #9CB2F0",
     2848"r      c #9FB5EE",
     2849"s      c #9CB4EB",
     2850"t      c #9AB3EC",
     2851"u      c #9AB0EC",
     2852"v      c #9DB3EB",
     2853"w      c #9BB4EC",
     2854"x      c #9BB4EE",
     2855"y      c #9BB1EF",
     2856"z      c #9BB0F0",
     2857"A      c #90ACF0",
     2858"B      c #93ABEE",
     2859"C      c #91A8EB",
     2860"D      c #8BA3E8",
     2861"E      c #88A1E7",
     2862"F      c #809DE9",
     2863"G      c #7A99E8",
     2864"H      c #7491E5",
     2865"I      c #698AE4",
     2866"J      c #6184E3",
     2867"K      c #507EDC",
     2868"L      c #4E7CDB",
     2869"M      c #4F7DDC",
     2870"N      c #5479DA",
     2871"O      c #567BDC",
     2872"P      c #577CDD",
     2873"Q      c #5074DA",
     2874"R      c #5174DB",
     2875"S      c #5175DC",
     2876"T      c #5276DD",
     2877"U      c #4D71DE",
     2878"V      c #4C72D8",
     2879"W      c #3A6CE0",
     2880"X      c #2B49A6",
     2881"Y      c #E0E2DF",
     2882"Z      c #93AAE9",
     2883"`      c #94A9E8",
     2884" .     c #94AAE9",
     2885"..     c #93A9E9",
     2886"+.     c #92AAE9",
     2887"@.     c #8DA9E8",
     2888"#.     c #8CA7E9",
     2889"$.     c #92ABE9",
     2890"%.     c #8EAAE9",
     2891"&.     c #8EA9E9",
     2892"*.     c #8FAAE9",
     2893"=.     c #8CA8E9",
     2894"-.     c #8CA2E7",
     2895";.     c #86A1E6",
     2896">.     c #839EE9",
     2897",.     c #7F9CE9",
     2898"'.     c #7A97E8",
     2899").     c #7693E7",
     2900"!.     c #6E8EE8",
     2901"~.     c #678AE9",
     2902"{.     c #5D84E3",
     2903"].     c #577CDF",
     2904"^.     c #4E77DF",
     2905"/.     c #4A70DB",
     2906"(.     c #4870DB",
     2907"_.     c #4870DC",
     2908":.     c #4770E3",
     2909"<.     c #496FDC",
     2910"[.     c #486EDB",
     2911"}.     c #466FE4",
     2912"|.     c #466EE3",
     2913"1.     c #4167D9",
     2914"2.     c #4066D8",
     2915"3.     c #3F66D8",
     2916"4.     c #3D64D7",
     2917"5.     c #3960DA",
     2918"6.     c #476DD9",
     2919"7.     c #446EE5",
     2920"8.     c #305EC8",
     2921"9.     c #8EAAE8",
     2922"0.     c #8FAAE8",
     2923"a.     c #91AAE9",
     2924"b.     c #8FA9E8",
     2925"c.     c #8BA8E8",
     2926"d.     c #8AA7E9",
     2927"e.     c #8BA5EA",
     2928"f.     c #8AA7E8",
     2929"g.     c #87A2E6",
     2930"h.     c #859FE8",
     2931"i.     c #7F9DE8",
     2932"j.     c #7C9AE8",
     2933"k.     c #7B95E7",
     2934"l.     c #7090E8",
     2935"m.     c #6B8BE9",
     2936"n.     c #6386E6",
     2937"o.     c #5881E1",
     2938"p.     c #5479DE",
     2939"q.     c #4D74DE",
     2940"r.     c #476EDB",
     2941"s.     c #446EE1",
     2942"t.     c #446EE0",
     2943"u.     c #446EDF",
     2944"v.     c #446DE0",
     2945"w.     c #426ADF",
     2946"x.     c #3C64DA",
     2947"y.     c #4360CC",
     2948"z.     c #D3D5D2",
     2949"A.     c #E6E3E8",
     2950"B.     c #8DA2E7",
     2951"C.     c #8CA6EA",
     2952"D.     c #8DA3E9",
     2953"E.     c #88A2E7",
     2954"F.     c #87A1E7",
     2955"G.     c #8AA1E7",
     2956"H.     c #849EE9",
     2957"I.     c #7D9AE9",
     2958"J.     c #7B98E8",
     2959"K.     c #7796E5",
     2960"L.     c #7191E7",
     2961"M.     c #688CE9",
     2962"N.     c #6687E5",
     2963"O.     c #5C83E1",
     2964"P.     c #557BDE",
     2965"Q.     c #4F76DE",
     2966"R.     c #4C72DE",
     2967"S.     c #456EDF",
     2968"T.     c #426AD9",
     2969"U.     c #4269D9",
     2970"V.     c #4269D8",
     2971"W.     c #3D64D9",
     2972"X.     c #3A61DA",
     2973"Y.     c #345ED6",
     2974"Z.     c #335ECF",
     2975"`.     c #C6C3C8",
     2976" +     c #86A1E7",
     2977".+     c #87A2E7",
     2978"++     c #87A0E7",
     2979"@+     c #859EE8",
     2980"#+     c #849DE9",
     2981"$+     c #7E9BE9",
     2982"%+     c #7A99E9",
     2983"&+     c #7A95E5",
     2984"*+     c #7593E7",
     2985"=+     c #6F8EE9",
     2986"-+     c #668AE5",
     2987";+     c #6386E0",
     2988">+     c #5B82DF",
     2989",+     c #5379DE",
     2990"'+     c #5075DE",
     2991")+     c #4B6FDC",
     2992"!+     c #446AD7",
     2993"~+     c #4269D6",
     2994"{+     c #4269D5",
     2995"]+     c #3E65D7",
     2996"^+     c #C9CAC9",
     2997"/+     c #869EE9",
     2998"(+     c #859FE9",
     2999"_+     c #849FE9",
     3000":+     c #829DE8",
     3001"<+     c #819DE8",
     3002"[+     c #7B9AE9",
     3003"}+     c #7A96E6",
     3004"|+     c #7290E8",
     3005"1+     c #698CE6",
     3006"2+     c #6689E0",
     3007"3+     c #5D84E0",
     3008"4+     c #587FDF",
     3009"5+     c #5377DD",
     3010"6+     c #4B74DE",
     3011"7+     c #496BD8",
     3012"8+     c #7C9BE9",
     3013"9+     c #7E9CE9",
     3014"0+     c #7D9AEA",
     3015"a+     c #7D9BEA",
     3016"b+     c #7D98E8",
     3017"c+     c #7C98E8",
     3018"d+     c #7796E4",
     3019"e+     c #7592E6",
     3020"f+     c #7390E1",
     3021"g+     c #698DE0",
     3022"h+     c #6588DE",
     3023"i+     c #5E84E0",
     3024"j+     c #5880DF",
     3025"k+     c #5479DC",
     3026"l+     c #4F75DE",
     3027"m+     c #4A6FDB",
     3028"n+     c #436AD7",
     3029"o+     c #3F65D7",
     3030"p+     c #BAC3BE",
     3031"q+     c #7B9AE8",
     3032"r+     c #7B9AEA",
     3033"s+     c #7A9AEA",
     3034"t+     c #7B99E9",
     3035"u+     c #7D97E7",
     3036"v+     c #7D95E6",
     3037"w+     c #7D95E5",
     3038"x+     c #7C95E6",
     3039"y+     c #7493E3",
     3040"z+     c #7290DF",
     3041"A+     c #6C8DDE",
     3042"B+     c #6B89E1",
     3043"C+     c #6486DF",
     3044"D+     c #5D81DF",
     3045"E+     c #567DDE",
     3046"F+     c #4F73DE",
     3047"G+     c #496EDA",
     3048"H+     c #355ED6",
     3049"I+     c #345ED5",
     3050"J+     c #7E95E5",
     3051"K+     c #7C97E8",
     3052"L+     c #7C97E7",
     3053"M+     c #7B94E6",
     3054"N+     c #7A95E4",
     3055"O+     c #7695E5",
     3056"P+     c #7694E4",
     3057"Q+     c #7994E6",
     3058"R+     c #7995E4",
     3059"S+     c #7594E4",
     3060"T+     c #7391E2",
     3061"U+     c #6E8EDE",
     3062"V+     c #6B8ADE",
     3063"W+     c #6688DF",
     3064"X+     c #5F84E0",
     3065"Y+     c #5980E0",
     3066"Z+     c #4D72DD",
     3067"`+     c #456BD7",
     3068" @     c #4168D6",
     3069".@     c #3C64D7",
     3070"+@     c #335ED0",
     3071"@@     c #4659C7",
     3072"#@     c #7292E1",
     3073"$@     c #7392E1",
     3074"%@     c #7492E1",
     3075"&@     c #718FDF",
     3076"*@     c #6F8EDE",
     3077"=@     c #6D8BDE",
     3078"-@     c #6B88DF",
     3079";@     c #597FDF",
     3080">@     c #557ADD",
     3081",@     c #5176DC",
     3082"'@     c #4D74DD",
     3083")@     c #496DDA",
     3084"!@     c #3860D8",
     3085"~@     c #7391E0",
     3086"{@     c #7290DE",
     3087"]@     c #6D8EDD",
     3088"^@     c #6D8DDD",
     3089"/@     c #7190E0",
     3090"(@     c #6C8DDD",
     3091"_@     c #6B89DF",
     3092":@     c #6487E0",
     3093"<@     c #6085DF",
     3094"[@     c #5F81DE",
     3095"}@     c #567EDE",
     3096"|@     c #4F74D9",
     3097"1@     c #466BD7",
     3098"2@     c #4067D5",
     3099"3@     c #3C63D7",
     3100"4@     c #335ED3",
     3101"5@     c #335ED1",
     3102"6@     c #718EDD",
     3103"7@     c #728EDD",
     3104"8@     c #748EDD",
     3105"9@     c #708EDD",
     3106"0@     c #6F8DDD",
     3107"a@     c #6E8DDD",
     3108"b@     c #6C8ADE",
     3109"c@     c #6C89DF",
     3110"d@     c #6988DF",
     3111"e@     c #6387DF",
     3112"f@     c #6282DE",
     3113"g@     c #5681E0",
     3114"h@     c #577BDD",
     3115"i@     c #5277DB",
     3116"j@     c #4D73D8",
     3117"k@     c #4A70D8",
     3118"l@     c #436AD5",
     3119"m@     c #3F66D6",
     3120"n@     c #3C63D8",
     3121"o@     c #3960D8",
     3122"p@     c #3860D7",
     3123"q@     c #335ED2",
     3124"r@     c #345ED4",
     3125"s@     c #6C88DF",
     3126"t@     c #6D88DF",
     3127"u@     c #6B89DE",
     3128"v@     c #6888DF",
     3129"w@     c #6587E0",
     3130"x@     c #6989DF",
     3131"y@     c #6687E0",
     3132"z@     c #6287E0",
     3133"A@     c #6281DD",
     3134"B@     c #5881E0",
     3135"C@     c #557ADB",
     3136"D@     c #5176D9",
     3137"E@     c #4E75D7",
     3138"F@     c #4A6FD8",
     3139"G@     c #476BD6",
     3140"H@     c #4067D6",
     3141"I@     c #3C62D7",
     3142"J@     c #3C60D4",
     3143"K@     c #365ED1",
     3144"L@     c #345ED3",
     3145"M@     c #6786DF",
     3146"N@     c #5F85E0",
     3147"O@     c #5F86E0",
     3148"P@     c #6186DF",
     3149"Q@     c #6286E0",
     3150"R@     c #6284DF",
     3151"S@     c #6384DF",
     3152"T@     c #5B7FDE",
     3153"U@     c #577DDC",
     3154"V@     c #557BDA",
     3155"W@     c #5278D8",
     3156"X@     c #4E76D6",
     3157"Y@     c #4C72D7",
     3158"Z@     c #486DD8",
     3159"`@     c #4469D6",
     3160" #     c #3F62D2",
     3161".#     c #3C60CF",
     3162"+#     c #345ECF",
     3163"@#     c #6086DF",
     3164"##     c #6085E0",
     3165"$#     c #6285DF",
     3166"%#     c #6383DD",
     3167"&#     c #6481DC",
     3168"*#     c #6380DD",
     3169"=#     c #6183DE",
     3170"-#     c #6083DD",
     3171";#     c #6081DC",
     3172">#     c #6080DD",
     3173",#     c #6083DE",
     3174"'#     c #6181DC",
     3175")#     c #6280DD",
     3176"!#     c #577EDB",
     3177"~#     c #557CD7",
     3178"{#     c #4F76D6",
     3179"]#     c #4E74D7",
     3180"^#     c #466CD7",
     3181"/#     c #3B64D6",
     3182"(#     c #4261CD",
     3183"_#     c #375FCE",
     3184":#     c #5A7FD8",
     3185"<#     c #6281DA",
     3186"[#     c #5F81D8",
     3187"}#     c #5C80D8",
     3188"|#     c #557DD7",
     3189"1#     c #577ED8",
     3190"2#     c #567ED7",
     3191"3#     c #587DD8",
     3192"4#     c #577DD8",
     3193"5#     c #587ED8",
     3194"6#     c #567DD8",
     3195"7#     c #5379D9",
     3196"8#     c #5177D7",
     3197"9#     c #4D74D5",
     3198"0#     c #486ED9",
     3199"a#     c #4068D4",
     3200"b#     c #3D65D2",
     3201"c#     c #4361CC",
     3202"d#     c #345ECE",
     3203"e#     c #325DCF",
     3204"f#     c #2C5AD1",
     3205"g#     c #3959C5",
     3206"h#     c #547BD8",
     3207"i#     c #567DD7",
     3208"j#     c #557BD8",
     3209"k#     c #5279D9",
     3210"l#     c #5278D9",
     3211"m#     c #4D74D6",
     3212"n#     c #4B71D8",
     3213"o#     c #496CD8",
     3214"p#     c #4669D7",
     3215"q#     c #3D66D3",
     3216"r#     c #3F62CF",
     3217"s#     c #4260CC",
     3218"t#     c #5379D8",
     3219"u#     c #4E75D4",
     3220"v#     c #4C73D7",
     3221"w#     c #476CD7",
     3222"x#     c #4869D0",
     3223"y#     c #4067D2",
     3224"z#     c #3D64D1",
     3225"A#     c #4261CC",
     3226"B#     c #395FCE",
     3227"C#     c #4F75D3",
     3228"D#     c #5074D2",
     3229"E#     c #5174D1",
     3230"F#     c #5175D1",
     3231"G#     c #4F74D3",
     3232"H#     c #4C73D5",
     3233"I#     c #4C73D4",
     3234"J#     c #4A72D1",
     3235"K#     c #4B70CF",
     3236"L#     c #506CCC",
     3237"M#     c #4D6BCE",
     3238"N#     c #4167D0",
     3239"O#     c #3D65D1",
     3240"P#     c #3F63CF",
     3241"Q#     c #3B5FCD",
     3242"R#     c #3159CD",
     3243"S#     c #4971D0",
     3244"T#     c #4870CF",
     3245"U#     c #4C6FCF",
     3246"V#     c #4E6CCE",
     3247"W#     c #4E6BCE",
     3248"X#     c #4769CF",
     3249"Y#     c #3D66D0",
     3250"Z#     c #3C65D1",
     3251"`#     c #4062CE",
     3252" $     c #3D5FCD",
     3253".$     c #365FCF",
     3254"+$     c #325DCD",
     3255"@$     c #2D5AD0",
     3256"#$     c #3859C5",
     3257"$$     c #355FCF",
     3258"%$     c #355ECF",
     3259"&$     c #335ECE",
     3260"*$     c #305CCD",
     3261"=$     c #2B5ACE",
     3262"-$     c #3056C9",
     3263";$     c #2553C6",
     3264">$     c #2153C8",
     3265",$     c #1F4FC7",
     3266"'$     c #274CC5",
     3267")$     c #214AC7",
     3268"!$     c #1C48C8",
     3269"~$     c #1244C9",
     3270"{$     c #1043C9",
     3271"]$     c #1144C9",
     3272"^$     c #2A45BE",
     3273"/$     c #2744B5",
     3274"($     c #1D49C0",
     3275"_$     c #2B58DE",
     3276":$     c #002D94",
     3277"<$     c #2B59CA",
     3278"[$     c #2A59CA",
     3279"}$     c #2E57C8",
     3280"|$     c #3255C6",
     3281"1$     c #3355C5",
     3282"2$     c #1C52C8",
     3283"3$     c #1D50C7",
     3284"4$     c #234FC6",
     3285"5$     c #264CC5",
     3286"6$     c #1D48C7",
     3287"7$     c #1245C8",
     3288"8$     c #1F44C2",
     3289"9$     c #2945BE",
     3290"0$     c #2A45BD",
     3291"a$     c #2040BF",
     3292"b$     c #3156C7",
     3293"c$     c #3056C7",
     3294"d$     c #3354C5",
     3295"e$     c #3355C6",
     3296"f$     c #3255C5",
     3297"g$     c #3254C5",
     3298"h$     c #1952C7",
     3299"i$     c #1951C8",
     3300"j$     c #2050C7",
     3301"k$     c #274CC4",
     3302"l$     c #244CC6",
     3303"m$     c #1F49C7",
     3304"n$     c #1E47C5",
     3305"o$     c #2045C3",
     3306"p$     c #1C44BF",
     3307"q$     c #2045BE",
     3308"r$     c #2040B8",
     3309"s$     c #3254C6",
     3310"t$     c #3055C6",
     3311"u$     c #2A54C6",
     3312"v$     c #2353C7",
     3313"w$     c #3054C5",
     3314"x$     c #2F55C5",
     3315"y$     c #2A54C5",
     3316"z$     c #2553C5",
     3317"A$     c #2F54C5",
     3318"B$     c #3155C6",
     3319"C$     c #2A54C7",
     3320"D$     c #1A52C8",
     3321"E$     c #204FC2",
     3322"F$     c #264DC6",
     3323"G$     c #234BC5",
     3324"H$     c #1D48C1",
     3325"I$     c #1E48BF",
     3326"J$     c #2646BE",
     3327"K$     c #2B45BD",
     3328"L$     c #1E43BE",
     3329"M$     c #2643BF",
     3330"N$     c #2243BF",
     3331"O$     c #3049BC",
     3332"P$     c #1E50BE",
     3333"Q$     c #1D50C0",
     3334"R$     c #1D50BF",
     3335"S$     c #1852C1",
     3336"T$     c #1E51C0",
     3337"U$     c #214FBF",
     3338"V$     c #2050C0",
     3339"W$     c #244EBF",
     3340"X$     c #2151C0",
     3341"Y$     c #234FBF",
     3342"Z$     c #2350C0",
     3343"`$     c #2351C0",
     3344" %     c #244FBF",
     3345".%     c #2250C0",
     3346"+%     c #2051C0",
     3347"@%     c #1E50C0",
     3348"#%     c #244DBE",
     3349"$%     c #274DBF",
     3350"%%     c #244CBF",
     3351"&%     c #1C48C0",
     3352"*%     c #2247BF",
     3353"=%     c #2C44BD",
     3354"-%     c #1C44BE",
     3355";%     c #1444BF",
     3356">%     c #1841BF",
     3357",%     c #1F40BF",
     3358"'%     c #254DBE",
     3359")%     c #224FBE",
     3360"!%     c #224FBF",
     3361"~%     c #234EBF",
     3362"{%     c #254CBD",
     3363"]%     c #244DBD",
     3364"^%     c #244CBD",
     3365"/%     c #264DBE",
     3366"(%     c #264DBD",
     3367"_%     c #214BC0",
     3368":%     c #1D48C0",
     3369"<%     c #2347BF",
     3370"[%     c #2B44BD",
     3371"}%     c #2444BE",
     3372"|%     c #0F42BF",
     3373"1%     c #0641BF",
     3374"2%     c #0F41BF",
     3375"3%     c #1741BE",
     3376"4%     c #1F40BD",
     3377"5%     c #234BBF",
     3378"6%     c #234CBE",
     3379"7%     c #214BBE",
     3380"8%     c #244CBE",
     3381"9%     c #214ABE",
     3382"0%     c #214ABF",
     3383"a%     c #1F48C0",
     3384"b%     c #2746BE",
     3385"c%     c #1F43BE",
     3386"d%     c #0941BE",
     3387"e%     c #0342BA",
     3388"f%     c #0242BC",
     3389"g%     c #1241B8",
     3390"h%     c #1F40B7",
     3391"i%     c #2F41AC",
     3392"j%     c #2644AE",
     3393"k%     c #2D49B4",
     3394"l%     c #2649B6",
     3395"m%     c #2949B7",
     3396"n%     c #2849B5",
     3397"o%     c #2149B8",
     3398"p%     c #1E49B9",
     3399"q%     c #1F48B8",
     3400"r%     c #1F49B9",
     3401"s%     c #2545B6",
     3402"t%     c #2744B7",
     3403"u%     c #2844B7",
     3404"v%     c #2043B8",
     3405"w%     c #1241B7",
     3406"x%     c #1340B8",
     3407"y%     c #0D41B8",
     3408"z%     c #1941B8",
     3409"A%     c #1F40B8",
     3410"B%     c #203FB8",
     3411"C%     c #2549B5",
     3412"D%     c #2648B6",
     3413"E%     c #2547B7",
     3414"F%     c #2248B7",
     3415"G%     c #2048B7",
     3416"H%     c #2346B6",
     3417"I%     c #2146B6",
     3418"J%     c #2247B7",
     3419"K%     c #2148B7",
     3420"L%     c #2743B4",
     3421"M%     c #2643B5",
     3422"N%     c #2542B6",
     3423"O%     c #1D42B7",
     3424"P%     c #0E42B8",
     3425"Q%     c #0C41B8",
     3426"R%     c #1341B8",
     3427"S%     c #1740B8",
     3428"T%     c #1C41B8",
     3429"U%     c #1F40B1",
     3430"V%     c #2644B5",
     3431"W%     c #2544B5",
     3432"X%     c #2544B4",
     3433"Y%     c #2444B5",
     3434"Z%     c #2444B4",
     3435"`%     c #2744B4",
     3436" &     c #2241B7",
     3437".&     c #1D41B8",
     3438"+&     c #0B42B8",
     3439"@&     c #0942B8",
     3440"#&     c #0C42B8",
     3441"$&     c #0F41B8",
     3442"%&     c #1641B8",
     3443"&&     c #2442B5",
     3444"*&     c #2543B3",
     3445"=&     c #2342B2",
     3446"-&     c #2341B4",
     3447";&     c #2141B3",
     3448">&     c #2141B5",
     3449",&     c #2140B5",
     3450"'&     c #2040B5",
     3451")&     c #1C40B7",
     3452"!&     c #1B41B3",
     3453"~&     c #0142B6",
     3454"{&     c #0E41B7",
     3455"]&     c #1141B7",
     3456"^&     c #1440B2",
     3457"/&     c #113FB0",
     3458"(&     c #1440B0",
     3459"_&     c #213EAF",
     3460":&     c #233DAE",
     3461"<&     c #223EAF",
     3462"[&     c #1E40B1",
     3463"}&     c #173EAD",
     3464"|&     c #1440AF",
     3465"1&     c #0D40AF",
     3466"2&     c #0941B0",
     3467"3&     c #0D3FAE",
     3468"4&     c #1B3CAC",
     3469"5&     c #233CAD",
     3470"6&     c #203FB0",
     3471"7&     c #273BAD",
     3472"8&     c #1D40B0",
     3473"9&     c #2040B1",
     3474"0&     c #1E40B0",
     3475"a&     c #1C40B0",
     3476"b&     c #1B3DAC",
     3477"c&     c #143DAC",
     3478"d&     c #193DAD",
     3479"e&     c #1B3DAD",
     3480"f&     c #173DAD",
     3481"g&     c #153DAC",
     3482"h&     c #1C3CAC",
     3483"i&     c #243CAD",
     3484"j&     c #213FB0",
     3485"k&     c #263BAA",
     3486"l&     c #253CAE",
     3487"m&     c #273AAC",
     3488"n&     c #273AAD",
     3489"o&     c #253BAD",
     3490"p&     c #1D3CAC",
     3491"q&     c #243BAD",
     3492"r&     c #1E3CAC",
     3493"s&     c #263BAD",
     3494"t&     c #1A3DAC",
     3495"u&     c #143DAB",
     3496"v&     c #163DAC",
     3497"w&     c #1A3CAC",
     3498"x&     c #1F3CAD",
     3499"y&     c #263BAB",
     3500"z&     c #263BA6",
     3501"A&     c #1E42A4",
     3502"B&     c #2D40A5",
     3503"C&     c #253BA6",
     3504"D&     c #253CA7",
     3505"E&     c #263AA5",
     3506"F&     c #253BA7",
     3507"G&     c #1E3BA6",
     3508"H&     c #193DA6",
     3509"I&     c #173DA5",
     3510"J&     c #143DA6",
     3511"K&     c #1A3DA7",
     3512"L&     c #133DA6",
     3513"M&     c #123DA5",
     3514"N&     c #1A3CA7",
     3515"O&     c #243BA6",
     3516"P&     c #263AA7",
     3517"Q&     c #273BA7",
     3518"R&     c #263AA6",
     3519"S&     c #223BA6",
     3520"T&     c #1D3BA6",
     3521"U&     c #173CA6",
     3522"V&     c #133DA5",
     3523"W&     c #1B3DA6",
     3524"X&     c #193DA5",
     3525"Y&     c #123DA4",
     3526"Z&     c #163CA5",
     3527"`&     c #213CA6",
     3528" *     c #273BA8",
     3529".*     c #263BA7",
     3530"+*     c #253BA5",
     3531"@*     c #263BA5",
     3532"#*     c #1C3BA6",
     3533"$*     c #1B3BA9",
     3534"%*     c #133BA8",
     3535"&*     c #0A3BA7",
     3536"**     c #083AA6",
     3537"=*     c #123CA5",
     3538"-*     c #0839A8",
     3539";*     c #0239A6",
     3540">*     c #123AA8",
     3541",*     c #1F49C8",
     3542"'*     c #2F4DA4",
     3543")*     c #2E4DA3",
     3544"!*     c #384CA4",
     3545"~*     c #3C4DA7",
     3546"{*     c #394EA7",
     3547"]*     c #3B4CA5",
     3548"^*     c #3C52B1",
     3549"/*     c #3551A8",
     3550"(*     c #3759BE",
     3551"_*     c #4161C7",
     3552":*     c #0033A8",
     3553"<*     c #596FA9",
     3554"[*     c #2F4DA3",
     3555"}*     c #2D4BA5",
     3556"|*     c #2E4CA4",
     3557"1*     c #2C4AA5",
     3558"2*     c #2D4BA4",
     3559"3*     c #354DA4",
     3560"4*     c #3A4BA4",
     3561"5*     c #394DA6",
     3562"6*     c #4056AD",
     3563"7*     c #445BBB",
     3564"8*     c #B5B7B4",
     3565"9*     c #1B2F85",
     3566"0*     c #242F79",
     3567"a*     c #B5B5B5",
     3568"b*     c #B5B2B6",
     3569"c*     c #C0C3C3",
     3570"d*     c #E3E3E4",
     3571"e*     c #EBEDEA",
     3572". + @ + # $ % & # $ % & # $ % & # $ % & & * = - ; > , ' ) ! ~ { { { { { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / / / ( / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / _ _ / / : / < [ } | | | 1 1 ",
     3573"2 2 2 2 3 2 4 @ 3 2 4 @ 3 2 4 @ 3 2 4 @ # 5 6 7 8 ; > 9 0 a b c d e f { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ( ( ( ( ( ( ( ( ( / / / / / / / / / / / / / / / / / _ _ _ _ _ _ _ _ _ _ _ g g _ / / : : : h i } 1 | 1 ",
     3574"j k l m n o p q n o p q r s t u v w x y z A B C D E F G H I J K L M N O P O O Q R S T T T T T T T T T T T T T T T T T T U U U U U U U U U U U U U U U U U U U U U U U U U U U U V V V U U W X : [ Y | | ",
     3575"Z `  . ...+.@.#...+.@.#.Z $.%.&.Z $.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.6.7.8.: h Y } 1 ",
     3576"9.0.a.b.c.c.d.e.f.c.d.e.f.c.d.e.f.c.d.e.g.h.i.j.k.l.m.n.o.p.q.r.s.s.t.u.u.v.w.x.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.y.5.7.6.: / z.A.} ",
     3577"-.B.C.D.-.E.g.F.G.E.g.F.G.E.g.F.G.E.g.F.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.V.U.U.W.X.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.y.Y.7.7.: : `.z.} ",
     3578" +.+g.;.++F.@+#+++F.@+#+++F.@+#+++F.@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+{+{+4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.y.y.5.7.7.: : ^+z.Y ",
     3579"/+(+_+#+H.H.>.:+H.H.>.:+H.H.>.:+H.H.>.<+[+}+*+|+1+2+3+4+5+6+7+{+{+4.4.4.4.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.5.5.5.5.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.y.y.y.y.y.y.7.7.: : ^+i } ",
     3580"8+9+0+0+a+0+0+b+a+0+0+b+a+0+0+b+a+0+0+c+d+e+f+g+h+i+j+k+l+m+n+o+4.4.4.4.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : p+z.Y ",
     3581"q+r+r+s+t+u+v+w+t+u+v+w+t+u+v+w+t+u+x+&+y+z+A+B+C+D+E+5+F+G+~+4.4.4.4.5.5.5.5.5.H+Y.Y.Y.Y.Y.Y.Y.Y.I+Y.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : `.z.A.",
     3582"J+v+K+L+M+N+O+P+Q+R+O+P+Q+R+O+P+Q+R+O+S+T+U+V+W+X+Y+P.T Z+`+ @4.4..@5.5.5.5.5.5.Y.Y.Y.I+I+I+I+I++@+@Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.7.7.: : p+z.Y ",
     3583"#@$@$@%@%@$@#@&@#@#@#@&@#@#@#@&@#@#@#@*@=@-@;+i+;@>@,@'@)@ @4.X.5.5.H+Y.Y.Y.!@Y.Y.I++@+@Z.Z.+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.",
     3584"#@$@~@~@~@{@]@^@/@{@]@^@/@{@]@^@/@{@]@(@_@:@<@[@}@k+|@V 1@2@3@5.5.5.Y.Y.I+4@I+5@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : p+z.Y ",
     3585"6@7@8@9@0@a@b@c@a@a@b@c@a@a@b@c@a@a@b@d@e@<@f@g@h@i@j@k@l@m@n@o@o@p@Y.I+q@q@r@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.",
     3586"s@t@u@_@_@v@w@w@x@v@w@w@x@v@y@y@x@v@:@z@A@B@P C@D@E@F@G@H@I@J@K@5@+@+@+@r@I+L@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.W W : : p+z.Y ",
     3587"M@N@O@P@C+Q@Q@R@C+;+Q@R@C+;+;+S@C+Q@Q@R@T@U@V@W@X@Y@Z@`@4. #.#+#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.Z.Z.Z.Z.8.8.Z.Z.y.@@@@W W : : `.z.A.",
     3588"@#O@O@##$#%#&#*#=#-#;#>#,#-#;#>#,#-#'#)#!#~#W@{#]#k@^#H@/#(#_#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.8.Z.Z.Z.Z.Z.Z.Z.8.8.8.8.8.8.8.8.8.8.8.Z.Z.y.y.@@W W : : p+z.Y ",
     3589":#<#[#}#|#1#2#3#4#5#1#4#4#1#1#4#4#1#1#6#7#8#9#V 0#`+a#b#c#d#e#Z.Z.Z.f#Z.Z.Z.f#f#f#f#f#f#f#f#f#f#g#g#g#g#g#8.8.8.8.8.8.8.8.8.g#g#g#g#8.g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.@@W W : : `.z.A.",
     3590"h#2#i#6#|#j#7#k#|#j#7#7#|#j#7#7#|#j#7#l#8#m#n#n#o#p#q#r#s#d#e#Z.Z.Z.f#f#f#f#Z.f#f#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.y.y.8.8.8.y.y.@@W W : : p+z.Y ",
     3591"l#7#7#l#7#7#7#W@7#7#7#W@7#7#k#W@t#7#7#W@u#v#n#w#x#y#z#A#B#Z.e#f#f#Z.f#f#f#Z.Z.g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#g#g#8.8.g#g#g#g#g#g#8.8.g#8.8.y.8.8.y.y.8.y.y.y.y.@@W W : : `.z.A.",
     3592"C#D#E#F#G#H#I#J#G#H#I#J#G#H#I#J#G#H#I#J#K#L#M#N#O#P#s#Q#+#f#R#f#f#f#f#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@y.y.@@@@y.y.W W : : p+z.Y ",
     3593"S#S#S#S#S#T#S#U#S#T#S#U#S#T#S#U#S#T#S#U#V#W#X#Y#Z#`# $.$+$@$#$g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@@@@@@@@@@@@@@@y.y.W W : : `.z.A.",
     3594"+$Z..$$$%$+$&$*$%$+$&$*$%$+$&$*$%$+$&$*$=$-$;$>$,$'$)$!$~${$]$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$($($_$_$:$:$p+z.Y ",
     3595"<$<$<$<$<$[$}$|$<$[$}$|$<$[$}$|$<$[$}$|$1$2$3$4$5$)$6$7$8$9$0$a$a$a$a$a$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$`.z.A.",
     3596"b$c$c$c$d$e$e$f$g$|$|$1$d$e$e$1$d$e$e$1$h$i$j$k$l$m$n$o$p$9$q$a$a$a$a$a$a$a$a$^$a$a$^$^$^$^$^$^$a$r$r$r$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$p+z.Y ",
     3597"e$1$s$s$1$t$u$v$w$x$y$z$A$x$u$v$g$B$C$>$D$E$F$G$H$I$J$K$L$M$N$a$a$a$a$a$a$a$a$^$r$r$a$^$^$^$a$r$r$r$r$r$/$^$r$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$`.z.A.",
     3598"P$Q$R$S$T$U$V$W$X$Y$Z$W$`$ %.%W$+%U$@%#%$%%%&%($*%=%-%;%>%>%,%r$r$r$r$r$a$a$a$/$/$/$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$p+z.Y ",
     3599"'%W$)%!%~%{%'%]%~%^%'%]%~%^%'%]%~%^%/%(%_%&%:%<%[%}%|%1%2%3%4%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$/$/$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$/$/$/$/$/$O$($_$_$:$:$`.z.A.",
     3600"5%6%'%'%6%7%8%9%6%7%8%9%6%7%8%9%6%7%8%0%&%a%<%b%[%c%d%e%f%g%h%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$r$/$/$r$r$/$r$i%j%O$($_$_$:$:$p+z.Y ",
     3601"k%l%m%n%o%o%p%q%o%o%r%q%o%o%r%q%o%o%p%q%s%t%/$u%v%w%x%y%z%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$r$r$i%i%i%r$r$i%i%i%i%i%i%i%i%i%i%i%i%r$/$/$j%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.",
     3602"C%D%E%F%G%H%I%J%K%H%I%J%K%H%I%J%K%H%I%J%L%M%N%O%P%Q%R%S%T%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$U%U%r$r$i%i%/$/$r$r$/$/$/$/$r$r$i%i%i%i%i%i%i%i%i%i%i%i%i%i%j%i%j%j%j%j%j%j%j%j%j%j%j%j%j%O$($_$_$:$:$p+z.Y ",
     3603"/$/$/$/$V%V%W%X%W%Y%Y%Z%W%W%Y%Z%W%W%W%`%`% &B%.&+&@&#&$&%&A%B%r$r$r$U%U%U%U%r$U%U%U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%/$/$/$i%i%i%i%i%i%i%i%i%j%j%j%j%i%i%i%i%i%j%j%j%i%i%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.",
     3604"&&*&=&-&=&;&>&,&=&;&>&,&=&;&>&,&=&;&>&'&)&!&~&{&]&^&/&(&_&:&<&U%U%U%U%U%U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$($_$_$:$:$p+z.Y ",
     3605"U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%[&}&|&1&2&3&4&5&_&6&U%7&U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$`.z.A.",
     3606"U%U%U%U%U%U%[&8&U%9&[&0&U%9&[&0&U%9&[&a&:&b&c&d&e&f&g&h&i&<&j&U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$p+z.Y ",
     3607"k&l&m&7&7&n&o&p&7&n&q&r&s&s&q&r&s&n&o&p&t&u&u&g&v&w&x&q&n&m&y&7&7&U%U%7&z&7&z&U%A&B&i%i%B&B&i%i%B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&i%B&O$O$_$_$:$:$`.z.A.",
     3608"C&D&E&z&z&E&F&G&z&E&F&G&z&E&F&G&z&E&F&G&H&I&J&K&L&M&N&O&P&Q&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$p+z.Y ",
     3609"z&z&z&z&R&S&T&U&R&S&T&U&R&S&T&U&R&S&T&U&V&V&W&X&Y&Z&`&C&R&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$^+z.A.",
     3610"z& *.*+*@*#*$*%*@*#*$*%*@*#*$*%*@*#*$*%*&***=*-*;*>*k&P&+*z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&z&z&z&B&B&B&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&/$O$O$@@_$,*:$/ ^+z.Y ",
     3611"'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*)*'*!*~*{*]*^*^*^*/*/*/*/*/*/*/*^*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*^*/*/*/*/*/*h h ^*h h ^*^*h h ^*^*^*^*h ^*^*^*^*h ^*^*^*(*_*_*_*_*_$:*:$<*`.z.} ",
     3612"'*'*'*'*'*[*}*|*'*[*}*|*'*[*}*|*'*[*}*|*1*1*2*}*}*2*[*)*3*4*5*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*h h h h h h h h h h h h h h h h 6*7*_*_*_*_*^*:*:$: 8*z.Y } ",
     3613"9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*( <*8*^+z.Y } 1 ",
     3614"a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*8*b*8*b*8*b*8*b*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*8*8*8*b*8*`.z.A.Y | | ",
     3615"c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*p+`.p+`.p+`.p+`.`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+^+`.^+^+z.z.Y Y | | 1 ",
     3616"d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*A.Y A.Y A.Y A.Y Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y } } | | | | 1 1 ",
     3617"e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*} | } | } | } | | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | | | | 1 | | | 1 1 1 "};
     3618
     3619
     3620static char * tabmiddle_xpm[] = {
     3621"33 42 32 1",
     3622"       c None",
     3623".      c #CECFEF",
     3624"+      c #CECBE7",
     3625"@      c #C6C7E7",
     3626"#      c #C6CBE7",
     3627"$      c #BDBEDE",
     3628"%      c #BDC3DE",
     3629"&      c #CECBEF",
     3630"*      c #B5B6D6",
     3631"=      c #ADAECE",
     3632"-      c #ADB2CE",
     3633";      c #BDBAD6",
     3634">      c #B5BAD6",
     3635",      c #C6C3DE",
     3636"'      c #ADAAC6",
     3637")      c #B5B2CE",
     3638"!      c #B5B6CE",
     3639"~      c #A5A2BD",
     3640"{      c #A5A6BD",
     3641"]      c #9C9EB5",
     3642"^      c #9CA2BD",
     3643"/      c #ADAEC6",
     3644"(      c #C6C3E7",
     3645"_      c #9C9AB5",
     3646":      c #A5A6C6",
     3647"<      c #949AAD",
     3648"[      c #A5AAC6",
     3649"}      c #9496AD",
     3650"|      c #BDBADE",
     3651"1      c #BDBED6",
     3652"2      c #9CA2B5",
     3653"3      c #A5AABD",
     3654"..........................+@.#.#.",
     3655"........................$@%&#.#..",
     3656"......................**$$@@&#.#.",
     3657".....................=-;>,%+@.#..",
     3658"....................'')!$$@@&#.#.",
     3659"...................~{=)$$@@&#.#..",
     3660"..................]^'/;;(%&#.#...",
     3661"................._]:/*>,%&@.#.#..",
     3662".................<{[)!$%+@.#.#...",
     3663"................}~{=!$%@@.#......",
     3664"................]^/-|$@@.#.......",
     3665"................]'/*;@@&#........",
     3666"...............<~[)>,%&#.#.......",
     3667"...............]~=)$%+#.#........",
     3668"...............]'/;1@@.#.........",
     3669"...............~{)*,%&#..........",
     3670"...............2/-$$@#...........",
     3671"...............~[*>(@&#..........",
     3672"...............^=)$%+#...........",
     3673"...............{'*>(@.#..........",
     3674"...............^=)$%+#...........",
     3675"...............{'*>(@.#..........",
     3676"...............^=)$%+#...........",
     3677"...............{'*>(@.#..........",
     3678"...............^=)$%+#...........",
     3679"...............{'*>(@.#..........",
     3680"...............^=)$%+#...........",
     3681"...............{'*>@@.#..........",
     3682"...............^=!$%&#...........",
     3683"...............{/*;@@.#..........",
     3684"...............{)!$%&#...........",
     3685"..............]'/;1@@.#..........",
     3686"..............23)>,%&#...........",
     3687"..............~=-$$@@.#..........",
     3688".............]{/*;@@.#...........",
     3689"............<^[)>,%&#............",
     3690"............]{/!$%@@.#...........",
     3691"..........]^[-!$%@@.#............",
     3692".........]^3/!>$@@.#.............",
     3693".......<]^3/!>$@@&#..............",
     3694".....<]2{[/!>$%@&#.#.............",
     3695"}<<_]2{3/-!>$%@&#.#.............."};
     3696
     3697
     3698static char * tabselectedbeginn_xpm[] = {
     3699"33 39 28 1",
     3700"       c None",
     3701".      c #CECFEF",
     3702"+      c #EFF3EF",
     3703"@      c #FFFBFF",
     3704"#      c #F7FBF7",
     3705"$      c #FFFFFF",
     3706"%      c #EFEFEF",
     3707"&      c #F7F7F7",
     3708"*      c #DEDFDE",
     3709"=      c #E7E7E7",
     3710"-      c #D6D3D6",
     3711";      c #DEE3DE",
     3712">      c #EFEBEF",
     3713",      c #F7F3F7",
     3714"'      c #CECBCE",
     3715")      c #CECFCE",
     3716"!      c #D6D7D6",
     3717"~      c #DEDBDE",
     3718"{      c #E7EBE7",
     3719"]      c #C6C7C6",
     3720"^      c #E7E3E7",
     3721"/      c #BDC3BD",
     3722"(      c #CED3CE",
     3723"_      c #BDBABD",
     3724":      c #C6C3C6",
     3725"<      c #C6CBC6",
     3726"[      c #D6DBD6",
     3727"}      c #BDBEBD",
     3728"..........................+@#$#$$",
     3729"........................%%&&@#$#$",
     3730"......................*==%%&&@#$$",
     3731"....................--*;>%,&@#$#$",
     3732"...................')!~={,+@#$#$$",
     3733"...................]-!^=%%&&@#$#$",
     3734"................../'(~;>%&&@#$#$$",
     3735"................._])!*={,&@#$#$$$",
     3736"................_])~*>%&&$#$$$$$$",
     3737"................:<![={&&@#$$$$$$$",
     3738"................:)!^=,+@#$$$$$$$$",
     3739"...............}'(*^%+@#$#$$$$$$$",
     3740"...............:<!*>%&&$#$$$$$$$$",
     3741".............../)!^{,&@#$$$$$$$$$",
     3742"...............](*^%+@#$$$$$$$$$$",
     3743"...............]!~=%&&$$$$$$$$$$$",
     3744"...............'(*=,+@#$$$$$$$$$$",
     3745"...............<!*>%&&$$$$$$$$$$$",
     3746"...............'-^=,+@#$$$$$$$$$$",
     3747"...............<!*>%&#$$$$$$$$$$$",
     3748"...............'-^=,+@#$$$$$$$$$$",
     3749"...............<!*>%&#$$$$$$$$$$$",
     3750"...............'-^=,+@#$$$$$$$$$$",
     3751"...............<!*>%&#$$$$$$$$$$$",
     3752"...............'-^=,+@#$$$$$$$$$$",
     3753"...............<!*>%&#$$$$$$$$$$$",
     3754"...............'!^=,&@#$$$$$$$$$$",
     3755"...............<~*>%&#$$$$$$$$$$$",
     3756"...............)!^{,&@#$$$$$$$$$$",
     3757"..............])~;%+@#$$$$$$$$$$$",
     3758"..............]-[={&&$#$$$$$$$$$$",
     3759".............])!^=,&@#$$$$$$$$$$$",
     3760"............:'-*^%+@#$$$$$$$$$$$$",
     3761"............])~*>%&&$#$$$$$$$$$$$",
     3762"...........:'!*={,&@#$$$$$$$$$$$$",
     3763"..........:'-~^=,+@#$$$$$$$$$$$$$",
     3764".......}]'-~^=%,&@#$$$$$$$$$$$$$$",
     3765".....}:])-~^=%,+@#$#$$$$$$$$$$$$$",
     3766"}}}:]')-!*^=%,&@#$#$$$$$$$$$$$$$$"};
     3767
     3768
     3769static char * tabselectedend_xpm[] = {
     3770"33 42 33 1",
     3771"       c None",
     3772".      c #FFFFFF",
     3773"+      c #CECBE7",
     3774"@      c #C6C7E7",
     3775"#      c #CECFEF",
     3776"$      c #C6CBE7",
     3777"%      c #BDBEDE",
     3778"&      c #BDC3DE",
     3779"*      c #CECBEF",
     3780"=      c #B5B6D6",
     3781"-      c #ADAECE",
     3782";      c #ADB2CE",
     3783">      c #BDBAD6",
     3784",      c #B5BAD6",
     3785"'      c #C6C3DE",
     3786")      c #ADAAC6",
     3787"!      c #B5B2CE",
     3788"~      c #B5B6CE",
     3789"{      c #A5A2BD",
     3790"]      c #A5A6BD",
     3791"^      c #9C9EB5",
     3792"/      c #9CA2BD",
     3793"(      c #ADAEC6",
     3794"_      c #C6C3E7",
     3795":      c #9C9AB5",
     3796"<      c #A5A6C6",
     3797"[      c #949AAD",
     3798"}      c #A5AAC6",
     3799"|      c #9496AD",
     3800"1      c #BDBADE",
     3801"2      c #BDBED6",
     3802"3      c #9CA2B5",
     3803"4      c #A5AABD",
     3804"..........................+@#$#$#",
     3805"........................%@&*$#$##",
     3806"......................==%%@@*$#$#",
     3807".....................-;>,'&+@#$##",
     3808"....................))!~%%@@*$#$#",
     3809"...................{]-!%%@@*$#$##",
     3810"..................^/)(>>_&*$#$###",
     3811".................:^<(=,'&*@#$#$##",
     3812".................[]}!~%&+@#$#$###",
     3813"................|{]-~%&@@#$######",
     3814"................^/(;1%@@#$#######",
     3815"................^)(=>@@*$########",
     3816"...............[{}!,'&*$#$#######",
     3817"...............^{-!%&+$#$########",
     3818"...............^)(>2@@#$#########",
     3819"...............{]!='&*$##########",
     3820"...............3(;%%@$###########",
     3821"...............{}=,_@*$##########",
     3822".............../-!%&+$###########",
     3823"...............])=,_@#$##########",
     3824".............../-!%&+$###########",
     3825"...............])=,_@#$##########",
     3826".............../-!%&+$###########",
     3827"...............])=,_@#$##########",
     3828".............../-!%&+$###########",
     3829"...............])=,_@#$##########",
     3830".............../-!%&+$###########",
     3831"...............])=,@@#$##########",
     3832".............../-~%&*$###########",
     3833"...............](=>@@#$##########",
     3834"...............]!~%&*$###########",
     3835"..............^)(>2@@#$##########",
     3836"..............34!,'&*$###########",
     3837"..............{-;%%@@#$##########",
     3838".............^](=>@@#$###########",
     3839"............[/}!,'&*$############",
     3840"............^](~%&@@#$###########",
     3841"..........^/};~%&@@#$############",
     3842".........^/4(~,%@@#$#############",
     3843".......[^/4(~,%@@*$##############",
     3844".....[^3]}(~,%&@*$#$#############",
     3845"|[[:^3]4(;~,%&@*$#$##############"};
     3846
     3847
     3848static char * tabend_xpm[] = {
     3849"33 42 3 1",
     3850"       c None",
     3851".      c #CECFEF",
     3852"+      c #FFFFFF",
     3853"..........................+++++++",
     3854"........................+++++++++",
     3855"......................+++++++++++",
     3856".....................++++++++++++",
     3857"....................+++++++++++++",
     3858"...................++++++++++++++",
     3859"..................+++++++++++++++",
     3860".................++++++++++++++++",
     3861".................++++++++++++++++",
     3862"................+++++++++++++++++",
     3863"................+++++++++++++++++",
     3864"................+++++++++++++++++",
     3865"...............++++++++++++++++++",
     3866"...............++++++++++++++++++",
     3867"...............++++++++++++++++++",
     3868"...............++++++++++++++++++",
     3869"...............++++++++++++++++++",
     3870"...............++++++++++++++++++",
     3871"...............++++++++++++++++++",
     3872"...............++++++++++++++++++",
     3873"...............++++++++++++++++++",
     3874"...............++++++++++++++++++",
     3875"...............++++++++++++++++++",
     3876"...............++++++++++++++++++",
     3877"...............++++++++++++++++++",
     3878"...............++++++++++++++++++",
     3879"...............++++++++++++++++++",
     3880"...............++++++++++++++++++",
     3881"...............++++++++++++++++++",
     3882"...............++++++++++++++++++",
     3883"...............++++++++++++++++++",
     3884"..............+++++++++++++++++++",
     3885"..............+++++++++++++++++++",
     3886"..............+++++++++++++++++++",
     3887".............++++++++++++++++++++",
     3888"............+++++++++++++++++++++",
     3889"............+++++++++++++++++++++",
     3890"..........+++++++++++++++++++++++",
     3891".........++++++++++++++++++++++++",
     3892".......++++++++++++++++++++++++++",
     3893".....++++++++++++++++++++++++++++",
     3894"+++++++++++++++++++++++++++++++++"};
     3895
     3896
     3897
     3898
     3899QColor fromHsl(QColor c)
     3900{
     3901    const qreal h = c.hueF();
     3902    const qreal s = c.saturationF();
     3903    const qreal l = c.valueF();
     3904
     3905    qreal ca[3] = {0, 0, 0};
     3906
     3907    if (s == 0 || h == 1) {
     3908        // achromatic case
     3909        ca[0] = ca[1] = ca[2] = l;
     3910    } else {
     3911        // chromatic case
     3912        qreal temp2;
     3913        if (l < qreal(0.5))
     3914            temp2 = l * (qreal(1.0) + s);
     3915        else
     3916            temp2 = l + s - (l * s);
     3917
     3918        const qreal temp1 = (qreal(2.0) * l) - temp2;
     3919        qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)),
     3920            h,
     3921            h - (qreal(1.0) / qreal(3.0)) };
     3922
     3923        for (int i = 0; i != 3; ++i) {
     3924            if (temp3[i] < qreal(0.0))
     3925                temp3[i] += qreal(1.0);
     3926            else if (temp3[i] > qreal(1.0))
     3927                temp3[i] -= qreal(1.0);
     3928
     3929            const qreal sixtemp3 = temp3[i] * qreal(6.0);
     3930
     3931            if (sixtemp3 < qreal(1.0))
     3932                ca[i] = ((temp1 + (temp2 - temp1) * sixtemp3));
     3933            else if ((temp3[i] * qreal(2.0)) < qreal(1.0))
     3934                ca[i] = (temp2);
     3935            else if ((temp3[i] * qreal(3.0)) < qreal(2.0))
     3936                ca[i] = temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0);
     3937            else ca[i] = temp1;
     3938        }
     3939    }
     3940   
     3941    return QColor::fromRgbF(ca[0], ca[1], ca[2]);
     3942}
     3943
     3944#define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) )
     3945#define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) )
     3946
     3947QColor toHsl(QColor c)
     3948{
     3949    QColor color;
     3950    qreal h;
     3951    qreal s;
     3952    qreal l;
     3953
     3954    const qreal r = c.redF();
     3955    const qreal g = c.greenF();
     3956    const qreal b = c.blueF();
     3957    const qreal max = Q_MAX_3(r, g, b);
     3958    const qreal min = Q_MIN_3(r, g, b);
     3959    const qreal delta = max - min; 
     3960    const qreal delta2 = max + min;
     3961    const qreal lightness = qreal(0.5) * delta2;
     3962    l = (lightness);
     3963    if (qFuzzyIsNull(delta)) {
     3964        // achromatic case, hue is undefined
     3965        h = 0;
     3966        s = 0;
     3967    } else {
     3968        // chromatic case
     3969        qreal hue = 0;
     3970        if (lightness < qreal(0.5))
     3971            s = ((delta / delta2));
     3972        else
     3973            s = ((delta / (qreal(2.0) - delta2)));
     3974        if (qFuzzyCompare(r, max)) {
     3975            hue = ((g - b) /delta);
     3976        } else if (qFuzzyCompare(g, max)) {
     3977            hue = (2.0 + (b - r) / delta);
     3978        } else if (qFuzzyCompare(b, max)) {
     3979            hue = (4.0 + (r - g) / delta);
     3980        } else {
     3981            Q_ASSERT_X(false, "QColor::toHsv", "internal error");
     3982        }
     3983        hue *= 60.0;
     3984        if (hue < 0.0)
     3985            hue += 360.0;
     3986        h = (hue * 100);
     3987    }
     3988
     3989    h = h / 36000;
     3990
     3991    return QColor::fromHsvF(h, s, l);
     3992}
     3993
     3994void tintColor(QColor &color, QColor tintColor, qreal _saturation)
     3995{
     3996    tintColor = toHsl(tintColor);
     3997    color = toHsl(color);
     3998    qreal hue = tintColor.hueF();
     3999
     4000    qreal saturation = color.saturationF();
     4001    if (_saturation)
     4002        saturation = _saturation;
     4003    qreal lightness = color.valueF();
     4004    color.setHsvF(hue, saturation, lightness);
     4005
     4006    color = fromHsl(color);
     4007    color.toRgb();
     4008}
     4009
     4010void tintImagePal(QImage *image, QColor color, qreal saturation)
     4011{
     4012    QVector<QRgb> colorTable = image->colorTable();
     4013    for (int i=2;i< colorTable.size();i++) {
     4014        QColor c(toHsl(colorTable.at(i)));
     4015        tintColor(c, color, saturation);
     4016        colorTable[i] = c.rgb();
     4017    }
     4018    image->setColorTable(colorTable);
     4019}
     4020
     4021
     4022void tintImage(QImage *image, QColor color, qreal saturation)
     4023{
     4024    *image = image->convertToFormat(QImage::Format_RGB32);
     4025
     4026    for (int x = 0; x < image->width(); x++)
     4027        for (int y = 0; y < image->height(); y++) {
     4028            QColor c(image->pixel(x,y));
     4029            tintColor(c, color, saturation);
     4030            image->setPixel(x, y, c.rgb());
     4031        }
     4032}
     4033
     4034#endif //Q_WS_WINCE_WM
    6724035
    6734036
    6744037enum QSliderDirection { SliderUp, SliderDown, SliderLeft, SliderRight };
     4038
     4039#ifdef Q_WS_WINCE_WM
     4040
     4041void QWindowsMobileStylePrivate::tintImagesButton(QColor color)
     4042{
     4043       if (currentTintButton == color)
     4044        return;
     4045
     4046       imageTabEnd = QImage(tabend_xpm);
     4047       imageTabSelectedEnd = QImage(tabselectedend_xpm);
     4048       imageTabSelectedBegin = QImage(tabselectedbeginn_xpm);
     4049       imageTabMiddle = QImage(tabmiddle_xpm);
     4050       tintImage(&imageTabEnd, color, 0.0);
     4051       tintImage(&imageTabSelectedEnd, color, 0.0);
     4052       tintImage(&imageTabSelectedBegin, color, 0.0);
     4053       tintImage(&imageTabMiddle, color, 0.0);
     4054
     4055       if (!doubleControls) {
     4056           int height = imageTabMiddle.height() / 2 + 1;
     4057           imageTabEnd = imageTabEnd.scaledToHeight(height);
     4058           imageTabMiddle = imageTabMiddle.scaledToHeight(height);
     4059           imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height);
     4060           imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height);
     4061       }
     4062}
     4063
     4064void QWindowsMobileStylePrivate::tintImagesHigh(QColor color)
     4065{
     4066    if (currentTintHigh == color)
     4067        return;
     4068    currentTintHigh = color;
     4069    tintListViewHighlight(color);
     4070    imageScrollbarHandleUpHigh = imageScrollbarHandleUp;
     4071    imageScrollbarHandleDownHigh = imageScrollbarHandleDown;
     4072    tintImagePal(&imageScrollbarHandleDownHigh, color, qreal(0.8));
     4073    tintImagePal(&imageScrollbarHandleUpHigh, color, qreal(0.8));
     4074}
     4075
     4076void QWindowsMobileStylePrivate::tintListViewHighlight(QColor color)
     4077{
     4078    imageListViewHighlightCornerRight = QImage(listviewhighcornerright_xpm);
     4079    tintImage(&imageListViewHighlightCornerRight, color, qreal(0.0));
     4080
     4081    imageListViewHighlightCornerLeft = QImage(listviewhighcornerleft_xpm);
     4082    tintImage(&imageListViewHighlightCornerLeft, color, qreal(0.0));
     4083
     4084    imageListViewHighlightMiddle = QImage(listviewhighmiddle_xpm);
     4085    tintImage(&imageListViewHighlightMiddle, color, qreal(0.0));
     4086     
     4087     int height = imageListViewHighlightMiddle.height();
     4088     if (!doubleControls) {
     4089         height = height / 2;
     4090         imageListViewHighlightCornerRight = imageListViewHighlightCornerRight.scaledToHeight(height);
     4091         imageListViewHighlightCornerLeft = imageListViewHighlightCornerLeft.scaledToHeight(height);
     4092         imageListViewHighlightMiddle = imageListViewHighlightMiddle.scaledToHeight(height);
     4093     }
     4094}
     4095
     4096#endif //Q_WS_WINCE_WM
     4097
     4098void QWindowsMobileStylePrivate::setupWindowsMobileStyle65()
     4099{
     4100#ifdef Q_WS_WINCE_WM
     4101    wm65 = qt_wince_is_windows_mobile_65();
     4102    if (wm65) {
     4103        imageScrollbarHandleUp =  QImage(sbhandleup_xpm);
     4104        imageScrollbarHandleDown = QImage(sbhandledown_xpm);
     4105        imageScrollbarGripUp = QImage(sbgripup_xpm);
     4106        imageScrollbarGripDown = QImage(sbgripdown_xpm);
     4107        imageScrollbarGripMiddle = QImage(sbgripmiddle_xpm);
     4108
     4109        if (!doubleControls) {
     4110            imageScrollbarHandleUp = imageScrollbarHandleUp.scaledToHeight(imageScrollbarHandleUp.height() / 2);
     4111            imageScrollbarHandleDown = imageScrollbarHandleDown.scaledToHeight(imageScrollbarHandleDown.height() / 2);
     4112            imageScrollbarGripMiddle = imageScrollbarGripMiddle.scaledToHeight(imageScrollbarGripMiddle.height() / 2);
     4113            imageScrollbarGripUp = imageScrollbarGripUp.scaledToHeight(imageScrollbarGripUp.height() / 2);
     4114            imageScrollbarGripDown = imageScrollbarGripDown.scaledToHeight(imageScrollbarGripDown.height() / 2);
     4115        } else {
     4116        }
     4117        tintImagesHigh(Qt::blue);
     4118    }
     4119#endif //Q_WS_WINCE_WM
     4120}
     4121
     4122void QWindowsMobileStylePrivate::drawTabBarTab(QPainter *painter, const QStyleOptionTab *tab)
     4123{
     4124#ifndef QT_NO_TABBAR
     4125#ifdef Q_WS_WINCE_WM
     4126    if (wm65) {
     4127        tintImagesButton(tab->palette.button().color());
     4128        QRect r;
     4129        r.setTopLeft(tab->rect.topRight() - QPoint(imageTabMiddle.width(), 0));
     4130        r.setBottomRight(tab->rect.bottomRight());
     4131        if (tab->state & QStyle::State_Selected) {
     4132            painter->fillRect(tab->rect, tab->palette.window());
     4133        } else {
     4134            painter->fillRect(tab->rect, QColor(imageTabMiddle.pixel(0,0)));
     4135        }
     4136        if  (tab->selectedPosition ==  QStyleOptionTab::NextIsSelected) {
     4137            painter->drawImage(r, imageTabSelectedBegin);
     4138        } else if (tab->position == QStyleOptionTab::End ||
     4139            tab->position == QStyleOptionTab::OnlyOneTab) {
     4140                if (!(tab->state & QStyle::State_Selected)) {
     4141                    painter->drawImage(r, imageTabEnd);
     4142                }
     4143        } else if (tab->state & QStyle::State_Selected) {
     4144            painter->drawImage(r, imageTabSelectedEnd);
     4145        } else {
     4146            painter->drawImage(r, imageTabMiddle);
     4147        }
     4148        if (tab->position == QStyleOptionTab::Beginning && ! (tab->state & QStyle::State_Selected)) {
     4149            painter->drawImage(tab->rect.topLeft() - QPoint(imageTabMiddle.width() * 0.60, 0), imageTabSelectedEnd);
     4150        }
     4151        //imageTabBarBig
     4152        return;
     4153    }
     4154#endif //Q_WS_WINCE_WM
     4155    painter->save();
     4156    painter->setPen(tab->palette.shadow().color());
     4157    if (doubleControls) {
     4158        QPen pen = painter->pen();
     4159        pen.setWidth(2);
     4160        pen.setCapStyle(Qt::FlatCap);
     4161        painter->setPen(pen);
     4162    }
     4163    if(tab->shape == QTabBar::RoundedNorth) {
     4164        if (tab->state & QStyle::State_Selected) {
     4165            painter->fillRect(tab->rect, tab->palette.light());
     4166            painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
     4167        }
     4168        else {
     4169            painter->fillRect(tab->rect, tab->palette.button());
     4170            painter->drawLine(tab->rect.bottomLeft() , tab->rect.bottomRight());
     4171            painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
     4172        }
     4173    }
     4174    else if(tab->shape == QTabBar::RoundedSouth) {
     4175        if (tab->state & QStyle::State_Selected) {
     4176            painter->fillRect(tab->rect.adjusted(0,-2,0,0), tab->palette.light());
     4177            painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
     4178        }
     4179        else {
     4180            painter->fillRect(tab->rect, tab->palette.button());
     4181            if (doubleControls)
     4182                painter->drawLine(tab->rect.topLeft() + QPoint(0,1), tab->rect.topRight() + QPoint(0,1));
     4183            else
     4184                painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
     4185            painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
     4186        }
     4187    }
     4188    else if(tab->shape == QTabBar::RoundedEast) {
     4189        if (tab->state & QStyle::State_Selected) {
     4190            painter->fillRect(tab->rect, tab->palette.light());
     4191            painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
     4192        }
     4193        else {
     4194            painter->fillRect(tab->rect, tab->palette.button());
     4195            painter->drawLine(tab->rect.topLeft(), tab->rect.bottomLeft());
     4196            painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
     4197        }
     4198    }
     4199    else if(tab->shape == QTabBar::RoundedWest) {
     4200        if (tab->state & QStyle::State_Selected) {
     4201            painter->fillRect(tab->rect, tab->palette.light());
     4202            painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
     4203        }
     4204        else {
     4205            painter->fillRect(tab->rect, tab->palette.button());
     4206            painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
     4207            painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
     4208        }
     4209    }
     4210    painter->restore();
     4211#endif //QT_NO_TABBAR
     4212}
     4213
     4214void QWindowsMobileStylePrivate::drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItemV4 *option, QRect rect)
     4215{
     4216#ifdef Q_WS_WINCE_WM
     4217    if (wm65) {
     4218        QRect r;
     4219        if (rect.isValid())
     4220            r = rect;
     4221        else
     4222            r = option->rect;
     4223        tintImagesHigh(option->palette.highlight().color());
     4224
     4225        painter->setPen(QColor(Qt::lightGray));
     4226
     4227        if (option->viewItemPosition ==  QStyleOptionViewItemV4::Middle) {
     4228            painter->drawImage(r, imageListViewHighlightMiddle);
     4229        } else if (option->viewItemPosition ==  QStyleOptionViewItemV4::Beginning) {
     4230            painter->drawImage(r.adjusted(10, 0, 0, 0), imageListViewHighlightMiddle);
     4231        } else if (option->viewItemPosition ==  QStyleOptionViewItemV4::End) {
     4232            painter->drawImage(r.adjusted(0, 0, -10, 0), imageListViewHighlightMiddle);
     4233        } else {
     4234            painter->drawImage(r.adjusted(10, 0, -10, 0), imageListViewHighlightMiddle);
     4235        }
     4236
     4237        QImage cornerLeft = imageListViewHighlightCornerLeft;
     4238        QImage cornerRight = imageListViewHighlightCornerRight;
     4239
     4240        int width = r.width() > cornerRight.width() ? r.width() : cornerRight.width();
     4241
     4242        if ((width * 2) > r.width()) {
     4243            width = (r.width() - 5) / 2;
     4244        }
     4245
     4246        cornerLeft = cornerLeft.scaled(width, r.height());
     4247        cornerRight = cornerRight.scaled(width, r.height());
     4248
     4249        if ((option->viewItemPosition ==  QStyleOptionViewItemV4::Beginning) || (option->viewItemPosition ==  QStyleOptionViewItemV4::OnlyOne) || !option->viewItemPosition) {
     4250            painter->drawImage(r.topLeft(), cornerLeft);
     4251        }
     4252        if ((option->viewItemPosition ==  QStyleOptionViewItemV4::End) || (option->viewItemPosition ==  QStyleOptionViewItemV4::OnlyOne) || !option->viewItemPosition) {
     4253            painter->drawImage(r.topRight() - QPoint(cornerRight.width(),0), cornerRight);
     4254        }
     4255        return;
     4256    }
     4257#endif //Q_WS_WINCE_WM
     4258    QPalette::ColorGroup cg = option->state & QStyle::State_Enabled
     4259                                      ? QPalette::Normal : QPalette::Disabled;
     4260
     4261    if (rect.isValid())
     4262        painter->fillRect(rect, option->palette.brush(cg, QPalette::Highlight));
     4263    else
     4264        painter->fillRect(option->rect, option->palette.brush(cg, QPalette::Highlight));
     4265}
     4266
     4267void QWindowsMobileStylePrivate::drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame)
     4268{
     4269#ifdef Q_WS_WINCE_WM
     4270    if (wm65) {
     4271        if (newScrollbar->orientation == Qt::Horizontal) {
     4272            QTransform transform;
     4273            transform.rotate(-90);
     4274            QRect r = newScrollbar->rect;
     4275            p->drawImage(r.adjusted(10, 0, -10, 0), imageScrollbarGripMiddle.transformed(transform));
     4276            p->drawImage(r.topLeft(), imageScrollbarGripUp.transformed(transform));
     4277            p->drawImage(r.topRight() - QPoint(imageScrollbarGripDown.height() - 1, 0), imageScrollbarGripDown.transformed(transform));
     4278        } else {
     4279            QRect r = newScrollbar->rect;
     4280            p->drawImage(r.adjusted(0, 10, 0, -10), imageScrollbarGripMiddle);
     4281            p->drawImage(r.topLeft(), imageScrollbarGripUp);
     4282            p->drawImage(r.bottomLeft() - QPoint(0, imageScrollbarGripDown.height() - 1), imageScrollbarGripDown);
     4283        }
     4284        return ;
     4285    }
     4286#endif
     4287        if (newScrollbar->orientation == Qt::Horizontal) {
     4288            p->fillRect(newScrollbar->rect,option->palette.button());
     4289            QRect r = newScrollbar->rect;
     4290            p->drawLine(r.topLeft(), r.bottomLeft());
     4291            p->drawLine(r.topRight(), r.bottomRight());
     4292            if (smartphone) {
     4293                p->drawLine(r.topLeft(), r.topRight());
     4294                p->drawLine(r.bottomLeft(), r.bottomRight());
     4295            }
     4296        }
     4297        else {
     4298            p->fillRect(newScrollbar->rect,option->palette.button());
     4299            QRect r = newScrollbar->rect;
     4300            p->drawLine(r.topLeft(), r.topRight());
     4301            p->drawLine(r.bottomLeft(), r.bottomRight());
     4302            if (smartphone) {
     4303                p->drawLine(r.topLeft(), r.bottomLeft());
     4304                p->drawLine(r.topRight(), r.bottomRight());
     4305            }
     4306        }
     4307        if (newScrollbar->state & QStyle::State_HasFocus) {
     4308            QStyleOptionFocusRect fropt;
     4309            fropt.QStyleOption::operator=(*newScrollbar);
     4310            fropt.rect.setRect(newScrollbar->rect.x() + 2, newScrollbar->rect.y() + 2,
     4311                newScrollbar->rect.width() - 5,
     4312                newScrollbar->rect.height() - 5);
     4313        }
     4314    int gripMargin = doubleControls ? 4 : 2;
     4315    int doubleLines = doubleControls ? 2 : 1;
     4316    //If there is a frame around the scrollbar (abstractScrollArea),
     4317    //then the margin is different, because of the missing frame
     4318    int gripMarginFrame = doubleControls ? 3 : 1;
     4319    if (drawCompleteFrame)
     4320        gripMarginFrame = 0;
     4321    //draw grips
     4322    if (!smartphone)
     4323        if (newScrollbar->orientation == Qt::Horizontal) {
     4324            for (int i = -3; i < 3; i += 2) {
     4325                p->drawLine(
     4326                    QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1,
     4327                    newScrollbar->rect.top() + gripMargin +gripMarginFrame),
     4328                    QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1,
     4329                    newScrollbar->rect.bottom() - gripMargin));
     4330            }
     4331        } else {
     4332            for (int i = -2; i < 4 ; i += 2) {
     4333                p->drawLine(
     4334                    QPoint(newScrollbar->rect.left() + gripMargin + gripMarginFrame ,
     4335                    newScrollbar->rect.center().y() + 1 + i * doubleLines - 1),
     4336                    QPoint(newScrollbar->rect.right() - gripMargin,
     4337                    newScrollbar->rect.center().y() + 1 + i * doubleLines - 1));
     4338            }
     4339        }
     4340        if (!smartphone) {
     4341            QRect r;
     4342            if (doubleControls)
     4343                r = option->rect.adjusted(1, 1, -1, 0);
     4344            else
     4345                r = option->rect.adjusted(0, 0, -1, 0);
     4346            if (drawCompleteFrame && doubleControls)
     4347                r.adjust(0, 0, 0, -1);
     4348            //Check if the scrollbar is part of an abstractItemView and draw the frame according
     4349            if (drawCompleteFrame)
     4350                p->drawRect(r);
     4351            else
     4352                if (newScrollbar->orientation == Qt::Horizontal)
     4353                    p->drawLine(r.topLeft(), r.topRight());
     4354                else
     4355                    p->drawLine(r.topLeft(), r.bottomLeft());
     4356        }
     4357}
     4358
     4359void QWindowsMobileStylePrivate::drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool )
     4360{
     4361#ifdef Q_WS_WINCE_WM
     4362    if (wm65) {
     4363        tintImagesHigh(opt->palette.highlight().color());
     4364        QRect r = opt->rect;
     4365         if (opt->orientation == Qt::Horizontal) {
     4366            QTransform transform;
     4367            transform.rotate(-90);
     4368            if (opt->state & QStyle::State_Sunken)
     4369                p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh.transformed(transform));
     4370            else
     4371                p->drawImage(r.topLeft(), imageScrollbarHandleUp.transformed(transform));
     4372         } else {
     4373             if (opt->state & QStyle::State_Sunken)
     4374                 p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh);
     4375             else
     4376                 p->drawImage(r.topLeft(), imageScrollbarHandleUp);
     4377         }
     4378        return ;
     4379    }
     4380#endif //Q_WS_WINCE_WM
     4381
     4382    QBrush fill = opt->palette.button();
     4383    if (opt->state & QStyle::State_Sunken)
     4384        fill = opt->palette.shadow();
     4385
     4386    QStyleOption arrowOpt = *opt;
     4387    if (doubleControls)
     4388        arrowOpt.rect = opt->rect.adjusted(4, 6, -5, -3);
     4389    else
     4390        arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3);
     4391
     4392    bool horizontal = (opt->orientation == Qt::Horizontal);
     4393
     4394    if (horizontal) {
     4395        p->fillRect(opt->rect,fill);
     4396        QRect r = opt->rect.adjusted(0,0,1,0);
     4397        p->drawLine(r.topRight(), r.bottomRight());
     4398        if (doubleControls)
     4399            arrowOpt.rect.adjust(0, -2 ,0, -2);
     4400        q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &arrowOpt, p, 0);
     4401    } else {
     4402        p->fillRect(opt->rect,fill);
     4403        QRect r = opt->rect.adjusted(0, 0, 0, 1);
     4404        p->drawLine(r.bottomLeft(), r.bottomRight());
     4405        if (completeFrame)
     4406            arrowOpt.rect.adjust(-2, 0, -2, 0);
     4407        if (doubleControls)
     4408            arrowOpt.rect.adjust(0, -4 , 0, -4);
     4409        if (completeFrame && doubleControls)
     4410            arrowOpt.rect.adjust(2, 0, 2, 0);
     4411        q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, p, 0);
     4412    }
     4413}
     4414
     4415void QWindowsMobileStylePrivate::drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool secondScrollBar)
     4416{
     4417#ifndef QT_NO_SCROLLBAR
     4418#ifdef Q_WS_WINCE_WM
     4419    if (wm65) {
     4420        tintImagesHigh(opt->palette.highlight().color());
     4421        QRect r = opt->rect;
     4422        if (opt->orientation == Qt::Horizontal) {
     4423            QTransform transform;
     4424            transform.rotate(-90);
     4425            if (opt->state & QStyle::State_Sunken)
     4426                p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh.transformed(transform));
     4427            else
     4428                p->drawImage(r.topLeft(), imageScrollbarHandleDown.transformed(transform));
     4429        } else {
     4430            if (opt->state & QStyle::State_Sunken)
     4431                p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh);
     4432            else
     4433                p->drawImage(r.topLeft(), imageScrollbarHandleDown);
     4434        }
     4435        return ;
     4436    }
     4437#endif //Q_WS_WINCE_WM
     4438
     4439    QBrush fill = opt->palette.button();
     4440    if (opt->state & QStyle::State_Sunken)
     4441        fill = opt->palette.shadow();
     4442
     4443    QStyleOption arrowOpt = *opt;
     4444    if (doubleControls)
     4445        arrowOpt.rect = opt->rect.adjusted(4, 0, -5, 3);
     4446    else
     4447        arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3);
     4448
     4449    bool horizontal = (opt->orientation == Qt::Horizontal);
     4450
     4451    if (horizontal) {
     4452        p->fillRect(opt->rect,fill);
     4453        QRect r = opt->rect.adjusted(0, 0, 0, 0);
     4454        p->drawLine(r.topLeft(), r.bottomLeft());
     4455        if (secondScrollBar)
     4456            p->drawLine(r.topRight(), r.bottomRight());
     4457        if (doubleControls)
     4458            arrowOpt.rect.adjust(0, 4, 0, 4 );
     4459        q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowRight, &arrowOpt, p, 0);
     4460    } else {
     4461        p->fillRect(opt->rect,fill);
     4462        QRect r = opt->rect.adjusted(0, -1, 0, -1);
     4463        p->drawLine(r.topLeft(), r.topRight());
     4464        if (secondScrollBar)
     4465            p->drawLine(r.bottomLeft() + QPoint(0,1), r.bottomRight() + QPoint(0, 1));
     4466        if (completeFrame)
     4467            arrowOpt.rect.adjust(-2, 0, -2, 0);
     4468        if (doubleControls)
     4469            arrowOpt.rect.adjust(1, 0, 1, 0 );
     4470        if (completeFrame && doubleControls)
     4471            arrowOpt.rect.adjust(1, 0, 1, 0);
     4472        q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &arrowOpt, p, 0);
     4473    }
     4474#endif //QT_NO_SCROLLBAR
     4475}
     4476
     4477void QWindowsMobileStylePrivate::drawScrollbarGroove(QPainter *p,const QStyleOptionSlider *opt)
     4478{
     4479#ifndef QT_NO_SCROLLBAR
     4480#ifdef Q_OS_WINCE_WM
     4481    if (wm65) {
     4482        p->fillRect(opt->rect, QColor(231, 231, 231));
     4483        return ;
     4484    }
     4485#endif
     4486            QBrush fill;
     4487            if (smartphone) {
     4488                fill = opt->palette.light();
     4489                p->fillRect(opt->rect, fill);
     4490                fill = opt->palette.button();
     4491                QImage image;
     4492#ifndef QT_NO_IMAGEFORMAT_XPM
     4493                if (opt->orientation == Qt::Horizontal)
     4494                  image = QImage(vertlines_xpm);
     4495                else
     4496                  image = QImage(horlines_xpm);
     4497#endif
     4498                image.setColor(1, opt->palette.button().color().rgb());
     4499                fill.setTextureImage(image);
     4500            }
     4501            else {
     4502              fill = opt->palette.light();
     4503            }
     4504            p->fillRect(opt->rect, fill);
     4505#endif //QT_NO_SCROLLBAR
     4506}
    6754507
    6764508QWindowsMobileStyle::QWindowsMobileStyle(QWindowsMobileStylePrivate &dd) : QWindowsStyle(dd) {
     
    6864518QWindowsMobileStylePrivate::QWindowsMobileStylePrivate() :QWindowsStylePrivate() {
    6874519
    688 #ifdef Q_OS_WINCE
     4520#ifdef Q_WS_WINCE
    6894521   doubleControls = qt_wince_is_high_dpi();
    6904522   smartphone = qt_wince_is_smartphone();
     
    6924524   doubleControls = false;
    6934525   smartphone = false;
    694 #endif //Q_OS_WINCE
     4526#endif //Q_WS_WINCE
    6954527
    6964528#ifndef QT_NO_IMAGEFORMAT_XPM
     
    7214553       imageNormalize = QImage(normal_small_xpm);
    7224554   }
     4555
     4556   setupWindowsMobileStyle65();
     4557
    7234558
    7244559   imageArrowDownBig = QImage(arrowdown_big_xpm);
     
    11574992   case PE_IndicatorSpinMinus: {
    11584993       QRect r = option->rect;
    1159        int fw = pixelMetric(PM_DefaultFrameWidth, option, widget)+2;
     4994       int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget)+2;
    11604995       QRect br = r.adjusted(fw, fw, -fw, -fw);
    11614996       int offset = (option->state & State_Sunken) ? 1 : 0;
     
    11945029            }
    11955030            if (option->state & State_Sunken)
    1196                 painter->translate(pixelMetric(PM_ButtonShiftHorizontal),
    1197                 pixelMetric(PM_ButtonShiftVertical));
     5031                painter->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal),
     5032                proxy()->pixelMetric(PM_ButtonShiftVertical));
    11985033            if (option->state & State_Enabled) {
    11995034                painter->translate(option->rect.x() + option->rect.width() / 2,
     
    13745209          switch (tab->shape) {
    13755210            case QTabBar::RoundedNorth:
     5211#ifdef Q_WS_WINCE_WM
     5212                if (!d->wm65)
     5213#endif
     5214                {
    13765215                if (d->doubleControls)
    1377                   painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1));
     5216                    painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1));
    13785217                else
    13795218                    painter->drawLine(rect.topLeft(), rect.topRight());
     5219                }
    13805220                break;
    13815221            case QTabBar::RoundedSouth:
     5222#ifdef Q_WS_WINCE_WM
     5223                if (!d->wm65)
     5224#endif
     5225                {
    13825226                if (d->doubleControls)
    13835227                  painter->drawLine(rect.bottomLeft(), rect.bottomRight());
    13845228                else
    13855229                  painter->drawLine(rect.bottomLeft(), rect.bottomRight());
     5230                }
    13865231                break;
    13875232            case QTabBar::RoundedEast:
     5233#ifdef Q_WS_WINCE_WM
     5234                if (!d->wm65)
     5235#endif
    13885236                painter->drawLine(rect.topRight(), rect.bottomRight());
    13895237                break;
    13905238            case QTabBar::RoundedWest:
     5239#ifdef Q_WS_WINCE_WM
     5240                if (!d->wm65)
     5241#endif
    13915242                painter->drawLine(rect.topLeft(), rect.bottomLeft());
    13925243                break;
     
    14075258        break;
    14085259#endif //QT_NO_TABBAR
     5260#ifndef QT_NO_ITEMVIEWS
     5261    case PE_PanelItemViewRow:
     5262        if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
     5263            QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
     5264                                      ? QPalette::Normal : QPalette::Disabled;
     5265            if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
     5266                cg = QPalette::Inactive;
     5267
     5268            if ((vopt->state & QStyle::State_Selected) &&  proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, option, widget))
     5269                 d->drawPanelItemViewSelected(painter, vopt);
     5270            else if (vopt->features & QStyleOptionViewItemV2::Alternate)
     5271                painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase));
     5272            else if (!(vopt->state & QStyle::State_Enabled))
     5273                painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base));
     5274        }
     5275        break;
     5276    case PE_PanelItemViewItem:
     5277        if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
     5278            QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
     5279                                      ? QPalette::Normal : QPalette::Disabled;
     5280            if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
     5281                cg = QPalette::Inactive;
     5282
     5283            if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) {
     5284                d->drawPanelItemViewSelected(painter, vopt);
     5285            } else {
     5286                if (vopt->backgroundBrush.style() != Qt::NoBrush) {
     5287                    QPointF oldBO = painter->brushOrigin();
     5288                    painter->setBrushOrigin(vopt->rect.topLeft());
     5289                    painter->fillRect(vopt->rect, vopt->backgroundBrush);
     5290                    painter->setBrushOrigin(oldBO);
     5291                }
     5292
     5293                if (vopt->state & QStyle::State_Selected) {
     5294                    QRect textRect = proxy()->subElementRect(QStyle::SE_ItemViewItemText,  option, widget);
     5295                    d->drawPanelItemViewSelected(painter, vopt, textRect);
     5296                }
     5297            }
     5298        }
     5299        break;
     5300#endif //QT_NO_ITEMVIEWS
    14095301
    14105302    case PE_FrameWindow: {
     
    14615353        break; }
    14625354    case PE_Frame:
    1463        if (d->doubleControls)
    1464             qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2,&option->palette.light());
    1465         else
    1466             qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1,&option->palette.light());
     5355        qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),
     5356                       d->doubleControls ? 2 : 1, &option->palette.background());
    14675357        break;
    14685358    case PE_FrameLineEdit:
     
    15025392        if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
    15035393            QRect br = button->rect;
    1504             int dbi = pixelMetric(PM_ButtonDefaultIndicator, button, widget);
     5394            int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget);
    15055395
    15065396            if (button->features & QStyleOptionButton::AutoDefaultButton)
     
    15085398            QStyleOptionButton tmpBtn = *button;
    15095399            tmpBtn.rect = br;
    1510             drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget);
     5400            proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget);
    15115401            if (button->features & QStyleOptionButton::HasMenu) {
    1512                 int mbi = pixelMetric(PM_MenuButtonIndicator, button, widget);
     5402                int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget);
    15135403                QRect ir = button->rect;
    15145404                QStyleOptionButton newButton = *button;
     
    15175407                else
    15185408                    newButton.rect = QRect(ir.right() - mbi, ir.height() - 20, mbi, ir.height() - 4);
    1519                 drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget);
     5409                proxy()->drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget);
    15205410            }
    15215411            if (button->features & QStyleOptionButton::DefaultButton)
    1522                 drawPrimitive(PE_FrameDefaultButton, option, painter, widget);
     5412                proxy()->drawPrimitive(PE_FrameDefaultButton, option, painter, widget);
    15235413        }
    15245414        break;
     
    15285418           bool isRadio = (element == CE_RadioButton);
    15295419           QStyleOptionButton subopt = *button;
    1530            subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
     5420           subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator
    15315421               : SE_CheckBoxIndicator, button, widget);
    1532            drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
     5422           proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
    15335423               &subopt, painter, widget);
    1534            subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
     5424           subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonContents
    15355425               : SE_CheckBoxContents, button, widget);
    1536            drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
     5426           proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
    15375427           if (button->state & State_HasFocus) {
    15385428               QStyleOptionFocusRect fropt;
    15395429               fropt.QStyleOption::operator=(*button);
    1540                fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
     5430               fropt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonFocusRect
    15415431                   : SE_CheckBoxFocusRect, button, widget);
    1542                drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
     5432               proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
    15435433           }
    15445434       }
     
    15545444           if (!button->icon.isNull()) {
    15555445               pix = button->icon.pixmap(button->iconSize, button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled);
    1556                drawItemPixmap(painter, button->rect, alignment, pix);
     5446               proxy()->drawItemPixmap(painter, button->rect, alignment, pix);
    15575447               if (button->direction == Qt::RightToLeft)
    15585448                   textRect.setRight(textRect.right() - button->iconSize.width() - 4);
     
    15625452           if (!button->text.isEmpty()){
    15635453               if (button->state & State_Enabled)
    1564                    drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
     5454                   proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
    15655455                   button->palette, false, button->text, QPalette::WindowText);
    15665456               else
    1567                    drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
     5457                   proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
    15685458                   button->palette, false, button->text, QPalette::Mid);
    15695459           }
     
    15815471    case CE_TabBarTab:
    15825472        if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
    1583             drawControl(CE_TabBarTabShape, tab, painter, widget);
    1584             drawControl(CE_TabBarTabLabel, tab, painter, widget);
     5473            proxy()->drawControl(CE_TabBarTabShape, tab, painter, widget);
     5474            proxy()->drawControl(CE_TabBarTabLabel, tab, painter, widget);
    15855475        }
    15865476        break;
    15875477    case CE_TabBarTabShape:
    15885478        if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
     5479           
    15895480            if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast ||
    15905481                tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) {
    1591 
    1592                     painter->save();
    1593                     painter->setPen(tab->palette.shadow().color());
    1594                     if (d->doubleControls) {
    1595                         QPen pen = painter->pen();
    1596                         pen.setWidth(2);
    1597                         pen.setCapStyle(Qt::FlatCap);
    1598                         painter->setPen(pen);
    1599                     }
    1600                     if(tab->shape == QTabBar::RoundedNorth) {
    1601                           if (tab->state & State_Selected) {
    1602                             painter->fillRect(tab->rect, tab->palette.light());
    1603                             painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
    1604                         }
    1605                         else {
    1606                             painter->fillRect(tab->rect, tab->palette.button());
    1607                             painter->drawLine(tab->rect.bottomLeft() , tab->rect.bottomRight());
    1608                             painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
    1609                         }
    1610                     }
    1611                     else if(tab->shape == QTabBar::RoundedSouth) {
    1612 
    1613                         if (tab->state & State_Selected) {
    1614                             painter->fillRect(tab->rect.adjusted(0,-2,0,0), tab->palette.light());
    1615                             painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
    1616                         }
    1617                         else {
    1618                             painter->fillRect(tab->rect, tab->palette.button());
    1619                             if (d->doubleControls)
    1620                                 painter->drawLine(tab->rect.topLeft() + QPoint(0,1), tab->rect.topRight() + QPoint(0,1));
    1621                             else
    1622                                 painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
    1623                             painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
    1624                         }
    1625                     }
    1626                     else if(tab->shape == QTabBar::RoundedEast) {
    1627                         if (tab->state & State_Selected) {
    1628                             painter->fillRect(tab->rect, tab->palette.light());
    1629                             painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
    1630                         }
    1631                         else {
    1632                             painter->fillRect(tab->rect, tab->palette.button());
    1633                             painter->drawLine(tab->rect.topLeft(), tab->rect.bottomLeft());
    1634                             painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
    1635                         }
    1636                     }
    1637                     else if(tab->shape == QTabBar::RoundedWest) {
    1638                         if (tab->state & State_Selected) {
    1639                             painter->fillRect(tab->rect, tab->palette.light());
    1640                             painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
    1641                         }
    1642                         else {
    1643                             painter->fillRect(tab->rect, tab->palette.button());
    1644                             painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
    1645                             painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
    1646                         }
    1647                     }
    1648 
    1649                     painter->restore();
     5482                    d->drawTabBarTab(painter, tab);
    16505483            } else {
    16515484                QCommonStyle::drawControl(element, option, painter, widget);
     
    16785511            QRegion clipRegion = painter->clipRegion();
    16795512            painter->setClipRect(option->rect);
    1680             drawControl(CE_HeaderSection, header, painter, widget);
     5513            proxy()->drawControl(CE_HeaderSection, header, painter, widget);
    16815514            QStyleOptionHeader subopt = *header;
    1682             subopt.rect = subElementRect(SE_HeaderLabel, header, widget);
     5515            subopt.rect = proxy()->subElementRect(SE_HeaderLabel, header, widget);
    16835516            if (header->state & State_Sunken)
    16845517                subopt.palette.setColor(QPalette::ButtonText, header->palette.brightText().color());
    16855518            subopt.state |= QStyle::State_On;
    16865519            if (subopt.rect.isValid())
    1687                 drawControl(CE_HeaderLabel, &subopt, painter, widget);
     5520                proxy()->drawControl(CE_HeaderLabel, &subopt, painter, widget);
    16885521            if (header->sortIndicator != QStyleOptionHeader::None) {
    1689                 subopt.rect = subElementRect(SE_HeaderArrow, option, widget);
    1690                 drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget);
     5522                subopt.rect = proxy()->subElementRect(SE_HeaderArrow, option, widget);
     5523                proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget);
    16915524            }
    16925525            painter->setClipRegion(clipRegion);
     
    17635596             }
    17645597#endif // QT_NO_SCROLLAREA
    1765             break; }
    1766 
     5598            break;
     5599        }
     5600#ifndef QT_NO_COMBOBOX
     5601    case CE_ComboBoxLabel:
     5602        // This is copied from qcommonstyle.cpp with the difference, that
     5603        // the editRect isn't adjusted when calling drawItemText.
     5604        if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
     5605            QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
     5606            painter->save();
     5607            painter->setClipRect(editRect);
     5608            if (!cb->currentIcon.isNull()) {
     5609                QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
     5610                                                             : QIcon::Disabled;
     5611                QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
     5612                QRect iconRect(editRect);
     5613                iconRect.setWidth(cb->iconSize.width() + 4);
     5614                iconRect = alignedRect(cb->direction,
     5615                                       Qt::AlignLeft | Qt::AlignVCenter,
     5616                                       iconRect.size(), editRect);
     5617                if (cb->editable)
     5618                    painter->fillRect(iconRect, option->palette.brush(QPalette::Base));
     5619                proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
     5620
     5621                if (cb->direction == Qt::RightToLeft)
     5622                    editRect.translate(-4 - cb->iconSize.width(), 0);
     5623                else
     5624                    editRect.translate(cb->iconSize.width() + 4, 0);
     5625            }
     5626            if (!cb->currentText.isEmpty() && !cb->editable) {
     5627                proxy()->drawItemText(painter, editRect,
     5628                             visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter),
     5629                             cb->palette, cb->state & State_Enabled, cb->currentText);
     5630            }
     5631            painter->restore();
     5632        }
     5633        break;
     5634#endif // QT_NO_COMBOBOX
    17675635#ifndef QT_NO_DOCKWIDGET
    17685636    case CE_DockWidgetTitle:
     
    18335701                QPalette palette = dwOpt->palette;
    18345702                palette.setColor(QPalette::Window, inactiveCaptionTextColor);
    1835                 QRect titleRect = subElementRect(SE_DockWidgetTitleBarText, option, widget);
     5703                QRect titleRect = proxy()->subElementRect(SE_DockWidgetTitleBarText, option, widget);
    18365704                if (verticalTitleBar) {
    18375705                    titleRect = QRect(r.left() + rect.bottom()
     
    18405708                                    titleRect.height(), titleRect.width());
    18415709                }
    1842                 drawItemText(painter, titleRect,
     5710                proxy()->drawItemText(painter, titleRect,
    18435711                            Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette,
    18445712                            dwOpt->state & State_Enabled, dwOpt->title,
     
    18905758
    18915759                if ((button->state & (State_On | State_Sunken)) && button->direction == Qt::RightToLeft)
    1892                     point.rx() -= pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2;
     5760                    point.rx() -= proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2;
    18935761
    18945762                painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap);
     
    19065774            }
    19075775            if (button->state & State_Enabled)
    1908                 drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole);
     5776                proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole);
    19095777            else
    1910             drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid);
     5778            proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid);
    19115779            painter->restore();
    19125780        }
     
    19285796    case CC_Slider:
    19295797        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    1930             int thickness  = pixelMetric(PM_SliderControlThickness, slider, widget);
    1931             int len        = pixelMetric(PM_SliderLength, slider, widget);
     5798            int thickness  = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
     5799            int len        = proxy()->pixelMetric(PM_SliderLength, slider, widget);
    19325800            int ticks = slider->tickPosition;
    1933             QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
    1934             QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
     5801            QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
     5802            QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
    19355803
    19365804            if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
     
    19835851                    QStyleOptionFocusRect fropt;
    19845852                    fropt.QStyleOption::operator=(*slider);
    1985                     fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
    1986                     drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
     5853                    fropt.rect = proxy()->subElementRect(SE_SliderFocusRect, slider, widget);
     5854                    proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
    19875855                }
    19885856                if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
     
    21195987        }
    21205988        if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
     5989            d->drawScrollbarGroove(painter, scrollbar);
    21215990            // Make a copy here and reset it for each primitive.
    2122             QBrush fill;
    2123             if (d->smartphone) {
    2124                 fill = option->palette.light();
    2125                 painter->fillRect(option->rect,fill);
    2126                 fill = option->palette.button();
    2127                 QImage image;
    2128 #ifndef QT_NO_IMAGEFORMAT_XPM
    2129                 if (scrollbar->orientation == Qt::Horizontal)
    2130                   image = QImage(vertlines_xpm);
    2131                 else
    2132                   image = QImage(horlines_xpm);
    2133 #endif
    2134                 image.setColor(1, option->palette.button().color().rgb());
    2135                 fill.setTextureImage(image);
    2136             }
    2137             else {
    2138               fill = option->palette.light();
    2139             }
    2140             painter->fillRect(option->rect,fill);
    21415991            QStyleOptionSlider newScrollbar = *scrollbar;
    21425992            State saveFlags = scrollbar->state;
     
    21606010                if (scrollbar->subControls & SC_ScrollBarSubLine) {
    21616011                    newScrollbar.state = saveFlags;
    2162                     newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget);
     6012                    newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget);
    21636013                    if (newScrollbar.rect.isValid()) {
    21646014                        if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine))
    21656015                            newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    2166                         QStyleOption arrowOpt = newScrollbar;
    2167                         if (d->doubleControls)
    2168                             arrowOpt.rect = newScrollbar.rect.adjusted(4, 6, -5, -3);
    2169                         else
    2170                             arrowOpt.rect = newScrollbar.rect.adjusted(5, 6, -4, -3);
    2171                         QBrush fill = option->palette.button();
    2172                         if (newScrollbar.state & State_Sunken)
    2173                             fill = option->palette.shadow();
    2174                         if (scrollbar->orientation == Qt::Horizontal) {
    2175                             painter->fillRect(newScrollbar.rect,fill);
    2176                             QRect r = newScrollbar.rect.adjusted(0,0,1,0);
    2177                             painter->drawLine(r.topRight(), r.bottomRight());
    2178                             if (d->doubleControls)
    2179                                arrowOpt.rect.adjust(0, -2 ,0, -2);
    2180                             drawPrimitive(PE_IndicatorArrowLeft, &arrowOpt, painter, widget);
    2181                         }
    2182                         else {
    2183                             painter->fillRect(newScrollbar.rect,fill);
    2184                             QRect r = newScrollbar.rect.adjusted(0, 0, 0, 1);
    2185                             painter->drawLine(r.bottomLeft(), r.bottomRight());
    2186                             if (drawCompleteFrame)
    2187                                 arrowOpt.rect.adjust(-2, 0, -2, 0);
    2188                             if (d->doubleControls)
    2189                                arrowOpt.rect.adjust(0, -4 , 0, -4);
    2190                             if (drawCompleteFrame && d->doubleControls)
    2191                                 arrowOpt.rect.adjust(2, 0, 2, 0);
    2192                             drawPrimitive(PE_IndicatorArrowUp, &arrowOpt, painter, widget);
    2193                         }
     6016                        d->drawScrollbarHandleUp(painter, &newScrollbar, drawCompleteFrame, secondScrollBar);
    21946017                    }
    21956018                }
     
    21976020                    newScrollbar.rect = scrollbar->rect;
    21986021                    newScrollbar.state = saveFlags;
    2199                     newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget);
     6022                    newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget);
    22006023                    if (newScrollbar.rect.isValid()) {
    22016024                        if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine))
    22026025                            newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    2203                         QStyleOption arrowOpt = newScrollbar;
    2204                         if (d->doubleControls)
    2205                             arrowOpt.rect = newScrollbar.rect.adjusted(4, 0, -5, 3);
    2206                         else
    2207                             arrowOpt.rect = newScrollbar.rect.adjusted(5, 6, -4, -3);
    2208                         QBrush fill = option->palette.button();
    2209                         if (newScrollbar.state & State_Sunken)
    2210                             fill = option->palette.shadow();
    2211                         if (scrollbar->orientation == Qt::Horizontal) {
    2212                             painter->fillRect(newScrollbar.rect,fill);
    2213                             QRect r = newScrollbar.rect.adjusted(0, 0, 0, 0);
    2214                             painter->drawLine(r.topLeft(), r.bottomLeft());
    2215                             if (secondScrollBar)
    2216                                 painter->drawLine(r.topRight(), r.bottomRight());
    2217                              if (d->doubleControls)
    2218                                arrowOpt.rect.adjust(0, 4, 0, 4 );
    2219                             drawPrimitive(PE_IndicatorArrowRight, &arrowOpt, painter, widget);
    2220                         }
    2221                         else {
    2222                             painter->fillRect(newScrollbar.rect,fill);
    2223                             QRect r = newScrollbar.rect.adjusted(0, -1, 0, -1);
    2224                             painter->drawLine(r.topLeft(), r.topRight());
    2225                             if (secondScrollBar)
    2226                                 painter->drawLine(r.bottomLeft() + QPoint(0,1), r.bottomRight() + QPoint(0, 1));
    2227                             if (drawCompleteFrame)
    2228                                 arrowOpt.rect.adjust(-2, 0, -2, 0);
    2229                             if (d->doubleControls)
    2230                               arrowOpt.rect.adjust(1, 0, 1, 0 );
    2231                             if (drawCompleteFrame && d->doubleControls)
    2232                                 arrowOpt.rect.adjust(1, 0, 1, 0);
    2233                             drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
    2234                         }
    2235                     }
    2236                 }
    2237                 if (scrollbar->subControls & SC_ScrollBarSubPage) {
    2238                     newScrollbar.rect = scrollbar->rect;
    2239                     newScrollbar.state = saveFlags;
    2240                     newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarSubPage, widget);
    2241                     if (newScrollbar.rect.isValid()) {
    2242                         if (!(scrollbar->activeSubControls & SC_ScrollBarSubPage))
    2243                             newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    2244                         if (scrollbar->orientation == Qt::Horizontal) {
    2245                             QRect r = newScrollbar.rect.adjusted(0, 0, 0, 0);
    2246                         }
    2247                         else{
    2248                             QRect r = newScrollbar.rect.adjusted(0, 0, 0, 0);
    2249                         }
    2250                     }
    2251                 }
    2252                 if (scrollbar->subControls & SC_ScrollBarAddPage) {
    2253                     newScrollbar.rect = scrollbar->rect;
    2254                     newScrollbar.state = saveFlags;
    2255                     newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarAddPage, widget);
    2256                     if (newScrollbar.rect.isValid()) {
    2257                         if (!(scrollbar->activeSubControls & SC_ScrollBarAddPage))
    2258                             newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    2259                         if (scrollbar->orientation == Qt::Horizontal) {
    2260                             QRect r = newScrollbar.rect.adjusted(0, 0, 0, -1);
    2261                         }
    2262                         else {
    2263                             QRect r = newScrollbar.rect.adjusted(0, 0,- 1, 0);
    2264                         }
    2265                     }
    2266                 }
    2267                 if (scrollbar->subControls & SC_ScrollBarFirst) {
    2268                     newScrollbar.rect = scrollbar->rect;
    2269                     newScrollbar.state = saveFlags;
    2270                     newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarFirst, widget);
    2271                     if (newScrollbar.rect.isValid()) {
    2272                         if (!(scrollbar->activeSubControls & SC_ScrollBarFirst))
    2273                             newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    2274                         QRect r = newScrollbar.rect;
    2275                     }
    2276                 }
    2277                 if (scrollbar->subControls & SC_ScrollBarLast) {
    2278                     newScrollbar.rect = scrollbar->rect;
    2279                     newScrollbar.state = saveFlags;
    2280                     newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarLast, widget);
    2281                     if (newScrollbar.rect.isValid()) {
    2282                         if (!(scrollbar->activeSubControls & SC_ScrollBarLast))
    2283                             newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    2284                         QRect r = newScrollbar.rect;
     6026                        d->drawScrollbarHandleDown(painter, &newScrollbar, drawCompleteFrame, secondScrollBar);
    22856027                    }
    22866028                }
    22876029                if (scrollbar->subControls & SC_ScrollBarSlider) {
    2288                     newScrollbar.rect = scrollbar->rect;
    2289                     newScrollbar.state = saveFlags;
    2290                     newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget);
    2291                     if (newScrollbar.rect.isValid()) {
    2292                         if (!(scrollbar->activeSubControls & SC_ScrollBarSlider))
    2293                             newScrollbar.state &= ~(State_Sunken | State_MouseOver);
    2294                         if (scrollbar->orientation == Qt::Horizontal) {
    2295                             painter->fillRect(newScrollbar.rect,option->palette.button());
    2296                             QRect r = newScrollbar.rect;
    2297                             painter->drawLine(r.topLeft(), r.bottomLeft());
    2298                             painter->drawLine(r.topRight(), r.bottomRight());
    2299                             if (d->smartphone) {
    2300                                 painter->drawLine(r.topLeft(), r.topRight());
    2301                                 painter->drawLine(r.bottomLeft(), r.bottomRight());
    2302                             }
    2303                         }
    2304                         else {
    2305                             painter->fillRect(newScrollbar.rect,option->palette.button());
    2306                             QRect r = newScrollbar.rect;
    2307                             painter->drawLine(r.topLeft(), r.topRight());
    2308                             painter->drawLine(r.bottomLeft(), r.bottomRight());
    2309                             if (d->smartphone) {
    2310                                 painter->drawLine(r.topLeft(), r.bottomLeft());
    2311                                 painter->drawLine(r.topRight(), r.bottomRight());
    2312                             }
    2313                         }
    2314                         if (scrollbar->state & State_HasFocus) {
    2315                             QStyleOptionFocusRect fropt;
    2316                             fropt.QStyleOption::operator=(newScrollbar);
    2317                             fropt.rect.setRect(newScrollbar.rect.x() + 2, newScrollbar.rect.y() + 2,
    2318                                 newScrollbar.rect.width() - 5,
    2319                                 newScrollbar.rect.height() - 5);
    2320                         }
    2321                     }
     6030
     6031                      newScrollbar.rect = scrollbar->rect;
     6032                      newScrollbar.state = saveFlags;
     6033                      newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget);
     6034
     6035                      if (newScrollbar.rect.isValid()) {
     6036                          if (!(scrollbar->activeSubControls & SC_ScrollBarSlider))
     6037                              newScrollbar.state &= ~(State_Sunken | State_MouseOver);
     6038                          d->drawScrollbarGrip(painter, &newScrollbar, option, drawCompleteFrame);
     6039                      }
    23226040                }
    2323                 int gripMargin = d->doubleControls ? 4 : 2;
    2324                 int doubleLines = d->doubleControls ? 2 : 1;
    2325                 //If there is a frame around the scrollbar (abstractScrollArea),
    2326                 //then the margin is different, because of the missing frame
    2327                 int gripMarginFrame = d->doubleControls ? 3 : 1;
    2328                 if (drawCompleteFrame)
    2329                     gripMarginFrame = 0;
    2330                 //draw grips
    2331                 if (!d->smartphone)
    2332                     if (scrollbar->orientation == Qt::Horizontal) {
    2333                         for (int i = -3; i < 3; i += 2) {
    2334                             painter->drawLine(
    2335                                 QPoint(newScrollbar.rect.center().x() + i * doubleLines + 1,
    2336                                 newScrollbar.rect.top() + gripMargin +gripMarginFrame),
    2337                                 QPoint(newScrollbar.rect.center().x() + i * doubleLines + 1,
    2338                                 newScrollbar.rect.bottom() - gripMargin));
    2339                         }
    2340                     } else {
    2341                         for (int i = -2; i < 4 ; i += 2) {
    2342                             painter->drawLine(
    2343                                 QPoint(newScrollbar.rect.left() + gripMargin + gripMarginFrame ,
    2344                                 newScrollbar.rect.center().y() + 1 + i * doubleLines - 1),
    2345                                 QPoint(newScrollbar.rect.right() - gripMargin,
    2346                                 newScrollbar.rect.center().y() + 1 + i * doubleLines - 1));
    2347                         }
    2348                 }
    2349                 if (!d->smartphone) {
    2350                     QRect r;
    2351                     if (d->doubleControls)
    2352                         r = option->rect.adjusted(1, 1, -1, 0);
    2353                     else
    2354                         r = option->rect.adjusted(0, 0, -1, 0);
    2355                     if (drawCompleteFrame && d->doubleControls)
    2356                         r.adjust(0, 0, 0, -1);
    2357                     //Check if the scrollbar is part of an abstractItemView and draw the frame according
    2358                     if (drawCompleteFrame)
    2359                         painter->drawRect(r);
    2360                     else
    2361                         if (scrollbar->orientation == Qt::Horizontal)
    2362                             painter->drawLine(r.topLeft(), r.topRight());
    2363                         else
    2364                             painter->drawLine(r.topLeft(), r.bottomLeft());
    2365                 }
    23666041        }
    23676042        painter->restore();
    23686043        break;
    2369 #endif // QT_NO_SLIDER
     6044#endif // QT_NO_SCROLLBAR
    23706045    case CC_ToolButton:
    23716046        if (const QStyleOptionToolButton *toolbutton
     
    23796054#endif //QT_NO_TABWIDGET
    23806055
    2381             button = subControlRect(control, toolbutton, SC_ToolButton, widget);
    2382             menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
     6056            button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget);
     6057            menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
    23836058            State buttonFlags = toolbutton->state;
    23846059            if (buttonFlags & State_AutoRaise) {
     
    23976072                    tool.rect = button;
    23986073                    tool.state = buttonFlags;
    2399                     drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
     6074                    proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
    24006075            }
    24016076            if (toolbutton->subControls & SC_ToolButtonMenu) {
     
    24066081                toolMenu.state = menuFlags;
    24076082                if (buttonFlags & State_Sunken)
    2408                   drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget);
     6083                  proxy()->drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget);
    24096084                QStyleOption arrowOpt(0);
    24106085                arrowOpt.rect = tool.rect;
     
    24186093                }
    24196094                arrowOpt.state = flags;
    2420                 drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
     6095                proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
    24216096            }
    24226097            if (toolbutton->state & State_HasFocus) {
     
    24256100                focusRect.rect.adjust(3, 3, -3, -3);
    24266101                if (toolbutton->features & QStyleOptionToolButton::Menu)
    2427                     focusRect.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator,
     6102                    focusRect.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
    24286103                                                         toolbutton, widget), 0);
    2429                 drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget);
     6104                proxy()->drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget);
    24306105            }
    24316106            QStyleOptionToolButton label = *toolbutton;
     
    24346109            else
    24356110              label.state = toolbutton->state & State_Enabled;
    2436             int fw = pixelMetric(PM_DefaultFrameWidth, option, widget);
     6111            int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
    24376112            label.rect = button.adjusted(fw, fw, -fw, -fw);
    2438             drawControl(CE_ToolButtonLabel, &label, painter, widget);
     6113            proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget);
    24396114        }
    24406115        break;
     
    24506125            QStyleOptionGroupBox groupBoxFont = *groupBox;
    24516126            groupBoxFont.fontMetrics = QFontMetrics(font);
    2452             QRect textRect = subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget);
    2453             QRect checkBoxRect = subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0);
     6127            QRect textRect = proxy()->subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget);
     6128            QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0);
    24546129            if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
    24556130                QStyleOptionFrameV2 frame;
     
    24586133                frame.lineWidth = groupBox->lineWidth;
    24596134                frame.midLineWidth = groupBox->midLineWidth;
    2460                 frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
     6135                frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
    24616136                painter->save();
    24626137                QRegion region(groupBox->rect);
     
    24686143                    region -= finalRect;
    24696144                }
    2470                 drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
     6145                proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
    24716146                painter->restore();
    24726147            }
     
    24766151                box.QStyleOption::operator=(*groupBox);
    24776152                box.rect = checkBoxRect;
    2478                 drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
     6153                proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
    24796154            }
    24806155            // Draw title
     
    24926167
    24936168                if (groupBox->state & State_Enabled)
    2494                     drawItemText(painter, textRect,  Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
     6169                    proxy()->drawItemText(painter, textRect,  Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
    24956170                    groupBox->palette, true, groupBox->text,
    24966171                    textColor.isValid() ? QPalette::NoRole : QPalette::Link);
    24976172                else
    2498                     drawItemText(painter, textRect,  Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
     6173                    proxy()->drawItemText(painter, textRect,  Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
    24996174                    groupBox->palette, true, groupBox->text, QPalette::Mid);
    25006175                if (groupBox->state & State_HasFocus) {
     
    25026177                    fropt.QStyleOption::operator=(*groupBox);
    25036178                    fropt.rect = textRect;
    2504                     drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
     6179                    proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
    25056180                }
    25066181            }
     
    25156190            QBrush editBrush = cmb->palette.brush(QPalette::Base);
    25166191            if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame)
    2517                 qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush);
     6192                qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush);
    25186193            else
    25196194                painter->fillRect(option->rect, editBrush);
    2520                 State flags = State_None;
    2521                 QRect ar = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
    2522                 if ((option->state & State_On)) {
    2523                   painter->fillRect(ar.adjusted(0, 0, 1, 1),cmb->palette.brush(QPalette::Shadow));
    2524                 }
    2525                 if (d->doubleControls)
    2526                   ar.adjust(5, 0, 5, 0);
    2527                 else
    2528                   ar.adjust(2, 0, -2, 0);
    2529                 if (option->state & State_Enabled)
    2530                     flags |= State_Enabled;
    2531                 if (option->state & State_On)
    2532                     flags |= State_Sunken;
    2533                 QStyleOption arrowOpt(0);
    2534                 arrowOpt.rect = ar;
    2535                 arrowOpt.palette = cmb->palette;
    2536                 arrowOpt.state = flags;
    2537                 drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget);
     6195            State flags = State_None;
     6196            QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
     6197            if ((option->state & State_On)) {
     6198                painter->fillRect(ar.adjusted(0, 0, 1, 1),cmb->palette.brush(QPalette::Shadow));
     6199            }
     6200            if (d->doubleControls)
     6201                ar.adjust(5, 0, 5, 0);
     6202            else
     6203                ar.adjust(2, 0, -2, 0);
     6204            if (option->state & State_Enabled)
     6205                flags |= State_Enabled;
     6206            if (option->state & State_On)
     6207                flags |= State_Sunken;
     6208            QStyleOption arrowOpt(0);
     6209            arrowOpt.rect = ar;
     6210            arrowOpt.palette = cmb->palette;
     6211            arrowOpt.state = flags;
     6212            proxy()->drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget);
    25386213            if (cmb->subControls & SC_ComboBoxEditField) {
    2539                 QRect re = subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
     6214                QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
    25406215                if (cmb->state & State_HasFocus && !cmb->editable)
    25416216                    painter->fillRect(re.x(), re.y(), re.width(), re.height(),
     
    25516226                    QStyleOptionFocusRect focus;
    25526227                    focus.QStyleOption::operator=(*cmb);
    2553                     focus.rect = subElementRect(SE_ComboBoxFocusRect, cmb, widget);
     6228                    focus.rect = proxy()->subElementRect(SE_ComboBoxFocusRect, cmb, widget);
    25546229                    focus.state |= State_FocusAtBorder;
    25556230                    focus.backgroundColor = cmb->palette.highlight().color();
    25566231                    if ((option->state & State_On))
    2557                       drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
     6232                      proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
    25586233               }
    25596234            }
     
    25716246
    25726247            if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) {
    2573                 QRect r = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget);
    2574                 qDrawPlainRect(painter, r, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget),0);
     6248                QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget);
     6249                qDrawPlainRect(painter, r, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget),0);
    25756250            }
    25766251            QPalette shadePal(option->palette);
     
    25946269                primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowUpBig
    25956270                    : PE_IndicatorArrowUpBig);
    2596                 copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
     6271                copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
    25976272                if (copy.state & (State_Sunken | State_On))
    2598                     qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
     6273                    qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
    25996274                else
    2600                   qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
    2601                 copy.rect.adjust(pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0, -pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0);
    2602                 drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
     6275                  qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
     6276                copy.rect.adjust(proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0, -pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0);
     6277                proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
    26036278            }
    26046279            if (spinBox->subControls & SC_SpinBoxDown) {
     
    26206295                primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowDownBig
    26216296                                                                       : PE_IndicatorArrowDownBig);
    2622                 copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
    2623                 qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
     6297                copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
     6298                qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
    26246299                if (copy.state & (State_Sunken | State_On))
    2625                     qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
     6300                    qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
    26266301                else
    2627                     qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
     6302                    qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
    26286303                copy.rect.adjust(3, 0, -4, 0);
    26296304                if (primitiveElement == PE_IndicatorArrowUp || primitiveElement == PE_IndicatorArrowDown) {
    2630                     int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, option, widget);
     6305                    int frameWidth = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
    26316306                    copy.rect = copy.rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth);
    2632                     drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
     6307                    proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
    26336308                }
    26346309                else {
    2635                     drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
     6310                    proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
    26366311                }
    26376312                if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) {
    2638                     QRect r = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget);
     6313                    QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget);
    26396314                }
    26406315            }
     
    26566331    case CT_PushButton:
    26576332       if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
    2658             newSize = QWindowsStyle::sizeFromContents(type, option, size, widget);
     6333            newSize = QCommonStyle::sizeFromContents(type, option, size, widget);
    26596334            int w = newSize.width(),
    26606335                h = newSize.height();
    26616336            int defwidth = 0;
    26626337            if (button->features & QStyleOptionButton::AutoDefaultButton)
    2663                 defwidth = 2 * pixelMetric(PM_ButtonDefaultIndicator, button, widget);
    2664             if (w < 75 + defwidth && button->icon.isNull())
    2665                 w = 75 + defwidth;
    2666             if (h < 23 + defwidth)
    2667                 h = 23 + defwidth;
     6338                defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget);
     6339
     6340            int minwidth = int(QStyleHelper::dpiScaled(55.0f));
     6341            int minheight = int(QStyleHelper::dpiScaled(19.0f));
     6342
     6343            if (w < minwidth + defwidth && button->icon.isNull())
     6344                w = minwidth + defwidth;
     6345            if (h < minheight + defwidth)
     6346                h = minheight + defwidth;
    26686347            newSize = QSize(w + 4, h + 4);
    26696348        }
     
    26846363            bool isRadio = (type == CT_RadioButton);
    26856364            QRect irect = visualRect(button->direction, button->rect,
    2686                                      subElementRect(isRadio ? SE_RadioButtonIndicator
     6365                                     proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator
    26876366                                                            : SE_CheckBoxIndicator, button, widget));
    2688             int h = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
     6367            int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
    26896368                                        : PM_IndicatorHeight, button, widget);
    26906369            int margins = (!button->icon.isNull() && button->text.isEmpty()) ? 0 : 10;
     
    26986377    case CT_ComboBox:
    26996378        if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
    2700             int fw = comboBox->frame ? pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0;
    2701             newSize = QSize(newSize.width() + fw + 9, newSize.height() + fw-4); //Nine is a magic Number - See CommonStyle for real magic (23)
     6379            int fw = comboBox->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0;
     6380            newSize = QSize(newSize.width() + fw + 9, newSize.height() + fw); //Nine is a magic Number - See CommonStyle for real magic (23)
    27026381        }
    27036382        break;
     
    27066385    case CT_SpinBox:
    27076386        if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
    2708             int fw = spinBox->frame ? pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0;
     6387            int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0;
    27096388            newSize = QSize(newSize.width() + fw-5, newSize.height() + fw-6);
    27106389        }
     
    27206399        break;
    27216400    case CT_TabBarTab:
    2722         newSize += QSize(0,0);
     6401        if (d_func()->doubleControls)
     6402            newSize = QSize(newSize.width(), 42);
     6403        else
     6404            newSize = QSize(newSize.width(), 21);
    27236405        break;
    27246406    case CT_HeaderSection:
    27256407        newSize += QSize(4, 2);
    27266408        break;
     6409#ifndef QT_NO_ITEMVIEWS
     6410#ifdef Q_WS_WINCE_WM
     6411    case CT_ItemViewItem:
     6412        if (d_func()->wm65)
     6413            if (d_func()->doubleControls)
     6414                newSize.setHeight(46);
     6415            else
     6416                newSize.setHeight(23);
     6417        break;
     6418#endif //Q_WS_WINCE_WM
     6419#endif //QT_NO_ITEMVIEWS
    27276420    default:
    27286421        break;
     
    27526445    default:
    27536446        break;
    2754         #ifndef QT_NO_SLIDER
     6447#ifndef QT_NO_SLIDER
    27556448    case SE_SliderFocusRect:
    27566449        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
     
    27636456        break;
    27646457#endif // QT_NO_SLIDER
     6458#ifndef QT_NO_ITEMVIEWS
     6459        case SE_ItemViewItemFocusRect:
     6460#ifdef Q_WS_WINCE_WM
     6461            if (d->wm65)
     6462                rect = QRect();
     6463#endif
     6464        break;
     6465#endif //QT_NO_ITEMVIEWS
    27656466    }
    27666467    return rect;
     
    27786479    case CC_ScrollBar:
    27796480        if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    2780             int sliderButtonExtent = pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
    2781             int sliderlen;
     6481            int sliderButtonExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
    27826482            float stretchFactor = 1.4f;
    27836483            int sliderButtonExtentDir = int (sliderButtonExtent * stretchFactor);
     6484
     6485#ifdef Q_WS_WINCE_WM
     6486            if (d->wm65)
     6487            {
     6488                sliderButtonExtent = d->imageScrollbarHandleUp.width();
     6489                sliderButtonExtentDir = d->imageScrollbarHandleUp.height();
     6490            }
     6491#endif //Q_WS_WINCE_WM
     6492
     6493            int sliderlen;
    27846494            int maxlen = ((scrollbar->orientation == Qt::Horizontal) ?
    27856495                scrollbar->rect.width() : scrollbar->rect.height()) - (sliderButtonExtentDir * 2);
     
    27896499                sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep);
    27906500
    2791                 int slidermin = pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
     6501                int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
    27926502                if (sliderlen < slidermin || range > INT_MAX / 2)
    27936503                    sliderlen = slidermin;
     
    28846594    case CC_ToolButton:
    28856595        if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
    2886             int mbi = pixelMetric(PM_MenuButtonIndicator, toolButton, widget);
     6596            int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolButton, widget);
    28876597            rect = toolButton->rect;
    28886598            switch (subControl) {
     
    29106620        case CC_Slider:
    29116621        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    2912             int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
    2913             int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
     6622            int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
     6623            int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
    29146624            switch (subControl) {
    29156625            case SC_SliderHandle: {
    29166626                int sliderPos = 0;
    2917                 int len = pixelMetric(PM_SliderLength, slider, widget);
     6627                int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
    29186628                bool horizontal = slider->orientation == Qt::Horizontal;
    29196629                sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum,
     
    29516661        case SC_ComboBoxArrow:
    29526662            rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg);
    2953             rect.setRect(xpos, y + bmarg, int((he - 2*bmarg)), he - 2*bmarg);
    29546663            break;
    2955          case SC_ComboBoxEditField:
    2956              rect.setRect(x + margin+4, y + margin+2, wi - 4 * margin - int((he - 2*bmarg) * 0.84f) -2, he - 2 * margin-4);
    2957              break;
    2958           case SC_ComboBoxFrame:
    2959               rect = comboBox->rect;
    2960               break;
     6664        case SC_ComboBoxEditField:
     6665            rect.setRect(x + margin, y + margin, wi - 2 * margin - int((he - 2*bmarg) * 0.84f), he - 2 * margin);
     6666            if (d->doubleControls) {
     6667                if (comboBox->editable)
     6668                    rect.adjust(2, 0, 0, 0);
     6669                else
     6670                    rect.adjust(4, 2, 0, -2);
     6671            } else if (!comboBox->editable) {
     6672                rect.adjust(2, 1, 0, -1);
     6673            }
     6674            break;
     6675        case SC_ComboBoxFrame:
     6676            rect = comboBox->rect;
     6677            break;
    29616678        default:
    29626679        break;
     
    29686685        if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
    29696686            QSize bs;
    2970             int fw = spinBox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0;
     6687            int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0;
    29716688            bs.setHeight(qMax(d->doubleControls ? 28 : 14, (spinBox->rect.height())));
    29726689            // 1.6 -approximate golden mean
     
    29796696            switch (subControl) {
    29806697            case SC_SpinBoxUp:
    2981                 rect = QRect(x+pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height());
     6698                rect = QRect(x + proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height());
    29826699                break;
    29836700            case SC_SpinBoxDown:
     
    29856702                break;
    29866703            case SC_SpinBoxEditField:
     6704                if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons) {
     6705                    rect = QRect(lx, fw, spinBox->rect.width() - 2*fw - 2, spinBox->rect.height() - 2*fw);
     6706                } else {
    29876707                    rect = QRect(lx, fw, rx-2, spinBox->rect.height() - 2*fw);
     6708                }
    29886709                break;
    29896710            case SC_SpinBoxFrame:
     
    30256746                int frameWidth = 0;
    30266747                if (groupBox->text.size()) {
    3027                     frameWidth = pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
     6748                    frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
    30286749                    rect = frameRect.adjusted(frameWidth, frameWidth + topHeight + labelMargin, -frameWidth, -frameWidth);
    30296750                }
     
    30466767                else
    30476768                  rect.setHeight(0);
    3048                 int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget);
    3049                 int indicatorSpace = pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1;
     6769                int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
     6770                int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1;
    30506771                bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
    30516772                int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
     
    30616782                    // Adjust for check box
    30626783                    if (subControl == SC_GroupBoxCheckBox) {
    3063                         int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget);
     6784                        int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
    30646785                        left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
    30656786                        int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2;
     
    31276848#endif //QT_NO_TOOLBAR
    31286849
    3129 #ifndef QT_NO_PROPERTIES
    3130         if (QAbstractButton *pushButton = qobject_cast<QAbstractButton*>(widget)) {
    3131             QVariant oldFont = widget->property("_q_styleWindowsMobileFont");
    3132             if (!oldFont.isValid()) {
    3133                 QFont f = pushButton->font();
    3134                 widget->setProperty("_q_styleWindowsMobileFont", f);
    3135                 f.setBold(true);
    3136                 int p = f.pointSize();
    3137                 if (p > 2)
    3138                     f.setPointSize(p-1);
    3139                 pushButton->setFont(f);
    3140             }
    3141         }
    3142 #endif
    3143         QWindowsStyle::polish(widget);
     6850    QWindowsStyle::polish(widget);
    31446851}
    31456852
    31466853void QWindowsMobileStyle::unpolish(QWidget *widget)
    31476854{
    3148 #ifndef QT_NO_PROPERTIES
    3149     if (QAbstractButton *pushButton = qobject_cast<QAbstractButton*>(widget)) {
    3150         QVariant oldFont = widget->property("_q_styleWindowsMobileFont");
    3151         if (oldFont.isValid()) {
    3152             widget->setFont(qVariantValue<QFont>(oldFont));
    3153         widget->setProperty("_q_styleWindowsMobileFont", QVariant());
    3154         }
    3155     }
    3156 #endif
    31576855    QWindowsStyle::unpolish(widget);
    31586856}
     
    32566954      case PM_RadioButtonLabelSpacing:
    32576955        ret = d->doubleControls ? 6 * 2 : 6;
    3258         break;
    32596956        break;
    32606957        // Returns the number of pixels to use for the business part of the
     
    32766973            int thick = 8;
    32776974            if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
    3278                 thick += pixelMetric(PM_SliderLength, sl, widget) / 4;
     6975                thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4;
    32796976
    32806977            space -= thick;
     
    32986995        break;
    32996996    case PM_IconViewIconSize:
    3300         ret = pixelMetric(PM_LargeIconSize, opt, widget);
     6997        ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
    33016998        break;
    33026999    case PM_ToolBarIconSize:
     
    33197016        break;
    33207017   case PM_ScrollBarSliderMin:
    3321         d->doubleControls ? ret = 36 : ret = 18;
    3322         break;       
     7018#ifdef Q_WS_WINCE_WM
     7019       if (d->wm65)
     7020#else
     7021       if (false)
     7022#endif
     7023       {
     7024           d->doubleControls ? ret = 68 : ret = 34;
     7025       } else {
     7026           d->doubleControls ? ret = 36 : ret = 18;
     7027       }
     7028        break;
    33237029   case PM_ScrollBarExtent: {
    3324        //Check if the scrollbar is part of an abstractItemView and set size according
     7030       
    33257031       if (d->smartphone)
    33267032           ret = 9;
    33277033       else
    33287034         d->doubleControls ? ret = 25 : ret = 13;
     7035
     7036#ifdef Q_WS_WINCE_WM
     7037       if (d->wm65)
     7038#else
     7039       if (false)
     7040#endif
     7041       {
     7042           d->doubleControls ? ret = 26 : ret = 13;
     7043           break;
     7044       }
     7045
    33297046#ifndef QT_NO_SCROLLAREA
     7047       //Check if the scrollbar is part of an abstractItemView and set size according
    33307048       if (widget)
    33317049       if (QWidget *parent = widget->parentWidget())
     
    33647082    case PM_TextCursorWidth:
    33657083        ret = 2;
    3366         break;       
     7084        break;
    33677085    case PM_TabBar_ScrollButtonOverlap:
    33687086        ret = 0;
     
    33987116    case SH_ToolBar_Movable:
    33997117        ret = false;
    3400         break;   
     7118        break;
    34017119    case SH_ScrollBar_ContextMenu:
    34027120        ret = false;
     7121        break;
     7122    case SH_MenuBar_AltKeyNavigation:
     7123        ret = false;
     7124        break;
     7125    case SH_RequestSoftwareInputPanel:
     7126        ret = RSIP_OnMouseClick;
    34037127        break;
    34047128    default:
     
    34647188    switch (iconMode) {
    34657189    case QIcon::Selected: {
     7190#ifdef Q_WS_WINCE_WM
     7191        if (d_func()->wm65)
     7192            return pixmap;
     7193#endif //Q_WS_WINCE_WM
    34667194        QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32);
    34677195        int imgh = img.height();
  • trunk/src/gui/styles/qwindowsmobilestyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qwindowsmobilestyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6161#ifndef QT_NO_STYLE_WINDOWSMOBILE
    6262
     63class QStyleOptionTab;
     64class QStyleOptionSlider;
     65class QStyleOptionViewItemV4;
     66
    6367class QWindowsMobileStylePrivate : public QWindowsStylePrivate
    6468{
     
    6872    bool doubleControls;
    6973    bool smartphone;
     74#ifdef Q_WS_WINCE_WM
     75    bool wm65;
     76#endif
    7077
    7178    QImage imageRadioButton;
     
    8693    QImage imageNormalize;
    8794    QImage imageMinimize;
     95
     96    void setupWindowsMobileStyle65();
     97
     98#ifdef Q_WS_WINCE_WM
     99    //Windows Mobile 6.5 images
     100    QImage imageScrollbarHandleUp;
     101    QImage imageScrollbarHandleDown;
     102    QImage imageScrollbarHandleUpHigh;
     103    QImage imageScrollbarHandleDownHigh;
     104    QImage imageScrollbarGripUp;
     105    QImage imageScrollbarGripDown;
     106    QImage imageScrollbarGripMiddle;
     107    QImage imageListViewHighlightCornerLeft;
     108    QImage imageListViewHighlightCornerRight;
     109    QImage imageListViewHighlightMiddle;
     110    QImage imageTabEnd;
     111    QImage imageTabSelectedEnd;
     112    QImage imageTabSelectedBegin;
     113    QImage imageTabMiddle;
     114
     115    QColor currentTintHigh;
     116    QColor currentTintButton;
     117
     118    void tintImagesHigh(QColor color);
     119    void tintImagesButton(QColor color);
     120    void tintListViewHighlight(QColor color);
     121
     122#endif //Q_WS_WINCE_WM
     123
     124    void drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false);
     125    void drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false);
     126    void drawScrollbarGroove(QPainter *p, const QStyleOptionSlider *opt);
     127    void drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame);
     128    void drawTabBarTab(QPainter *p, const QStyleOptionTab *tab);
     129    void drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItemV4 *option, QRect rect = QRect());
     130
    88131};
    89132
  • trunk/src/gui/styles/qwindowsstyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242#include "qwindowsstyle.h"
    4343#include "qwindowsstyle_p.h"
    44 #include <private/qpixmapdata_p.h>
     44#include <private/qstylehelper_p.h>
    4545
    4646#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
     
    6868#include "qwizard.h"
    6969#include "qlistview.h"
     70#include <private/qmath_p.h>
     71#include <qmath.h>
     72
    7073
    7174#ifdef Q_WS_X11
     
    112115#include <limits.h>
    113116QT_END_INCLUDE_NAMESPACE
    114 
    115 static const int windowsItemFrame        =  2; // menu item frame width
    116 static const int windowsSepHeight        =  9; // separator item height
    117 static const int windowsItemHMargin      =  3; // menu item hor text margin
    118 static const int windowsItemVMargin      =  2; // menu item ver text margin
    119 static const int windowsArrowHMargin     =  6; // arrow horizontal margin
    120 static const int windowsTabSpacing       = 12; // space between text and tab
    121 static const int windowsCheckMarkHMargin =  2; // horiz. margins of check mark
    122 static const int windowsRightBorder      = 15; // right border on windows
    123 static const int windowsCheckMarkWidth   = 12; // checkmarks width on windows
    124 
    125 static bool use2000style = true;
    126117
    127118enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
     
    223214    case QEvent::Show:
    224215        if (QProgressBar *bar = qobject_cast<QProgressBar *>(o)) {
    225             d->bars << bar;
    226             if (d->bars.size() == 1) {
    227                 Q_ASSERT(d->animationFps> 0);
    228                 d->animateTimer = startTimer(1000 / d->animationFps);
     216            if (!d->bars.contains(bar)) {
     217                d->bars << bar;
     218                if (d->bars.size() == 1) {
     219                    Q_ASSERT(d->animationFps> 0);
     220                    d->animateTimer = startTimer(1000 / d->animationFps);
     221                }
    229222            }
    230223        }
     
    266259QWindowsStyle::QWindowsStyle() : QCommonStyle(*new QWindowsStylePrivate)
    267260{
    268 #if defined(Q_OS_WIN32)
    269     use2000style = QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95;
    270 #endif
    271261}
    272262
     
    278268QWindowsStyle::QWindowsStyle(QWindowsStylePrivate &dd) : QCommonStyle(dd)
    279269{
    280 #if defined(Q_OS_WIN32)
    281     use2000style = QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95;
    282 #endif
    283270}
    284271
     
    302289    QWindowsStylePrivate *d = const_cast<QWindowsStylePrivate*>(d_func());
    303290    // We only need the overhead when shortcuts are sometimes hidden
    304     if (!styleHint(SH_UnderlineShortcut, 0) && app)
     291    if (!proxy()->styleHint(SH_UnderlineShortcut, 0) && app)
    305292        app->installEventFilter(this);
    306293
     
    403390#ifndef QT_NO_SLIDER
    404391    case PM_SliderLength:
    405         ret = 11;
     392        ret = int(QStyleHelper::dpiScaled(11.));
    406393        break;
    407394
     
    425412            int thick = 6;        // Magic constant to get 5 + 16 + 5
    426413            if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
    427                 thick += pixelMetric(PM_SliderLength, sl, widget) / 4;
     414                thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4;
    428415
    429416            space -= thick;
     
    451438
    452439    case PM_SmallIconSize:
    453         ret = 16;
     440        ret = int(QStyleHelper::dpiScaled(16.));
    454441        break;
    455442
    456443    case PM_LargeIconSize:
    457         ret = 32;
     444        ret = int(QStyleHelper::dpiScaled(32.));
    458445        break;
    459446
    460447    case PM_IconViewIconSize:
    461         ret = pixelMetric(PM_LargeIconSize, opt, widget);
    462         break;
    463 
    464     case PM_ToolBarIconSize:
    465         ret = 24;
    466         break;
     448        ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
     449        break;
     450
    467451    case PM_DockWidgetTitleMargin:
    468         ret = 2;
     452        ret = int(QStyleHelper::dpiScaled(2.));
    469453        break;
    470454    case PM_DockWidgetTitleBarButtonMargin:
    471         ret = 4;
     455        ret = int(QStyleHelper::dpiScaled(4.));
    472456        break;
    473457#if defined(Q_WS_WIN)
     
    551535        break;
    552536    case PM_ToolBarHandleExtent:
    553         ret = 10;
     537        ret = int(QStyleHelper::dpiScaled(10.));
    554538        break;
    555539    default:
     
    934918#endif //QT_NO_IMAGEFORMAT_XPM
    935919
     920#ifdef Q_OS_WIN
     921static QPixmap loadIconFromShell32( int resourceId, int size )
     922{
     923#ifdef Q_OS_WINCE
     924    HMODULE hmod = LoadLibrary(L"ceshell.dll");
     925#else
     926    HMODULE hmod = LoadLibrary(L"shell32.dll");
     927#endif
     928    if( hmod ) {
     929        HICON iconHandle = (HICON)LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, size, size, 0);
     930        if( iconHandle ) {
     931            QPixmap iconpixmap = QPixmap::fromWinHICON( iconHandle );
     932            DestroyIcon(iconHandle);
     933            return iconpixmap;
     934        }
     935    }
     936    return QPixmap();
     937}
     938#endif
     939
    936940/*!
    937941 \reimp
     
    10231027        {
    10241028            HICON iconHandle = LoadIcon(NULL, IDI_INFORMATION);
    1025             desktopIcon = convertHIconToPixmap( iconHandle );
     1029            desktopIcon = QPixmap::fromWinHICON( iconHandle );
    10261030            DestroyIcon(iconHandle);
    10271031            break;
     
    10301034        {
    10311035            HICON iconHandle = LoadIcon(NULL, IDI_WARNING);
    1032             desktopIcon = convertHIconToPixmap( iconHandle );
     1036            desktopIcon = QPixmap::fromWinHICON( iconHandle );
    10331037            DestroyIcon(iconHandle);
    10341038            break;
     
    10371041        {
    10381042            HICON iconHandle = LoadIcon(NULL, IDI_ERROR);
    1039             desktopIcon = convertHIconToPixmap( iconHandle );
     1043            desktopIcon = QPixmap::fromWinHICON( iconHandle );
    10401044            DestroyIcon(iconHandle);
    10411045            break;
     
    10441048        {
    10451049            HICON iconHandle = LoadIcon(NULL, IDI_QUESTION);
    1046             desktopIcon = convertHIconToPixmap( iconHandle );
     1050            desktopIcon = QPixmap::fromWinHICON( iconHandle );
    10471051            DestroyIcon(iconHandle);
    10481052            break;
     
    10591063                iconInfo.cbSize = sizeof(iconInfo);
    10601064                if (pSHGetStockIconInfo(_SIID_SHIELD, _SHGFI_ICON | _SHGFI_SMALLICON, &iconInfo) == S_OK) {
    1061                     pixmap = convertHIconToPixmap(iconInfo.hIcon);
     1065                    pixmap = QPixmap::fromWinHICON(iconInfo.hIcon);
    10621066                    DestroyIcon(iconInfo.hIcon);
    10631067                    return pixmap;
     
    10651069            }
    10661070        }
     1071        break;
     1072    default:
    10671073        break;
    10681074    }
     
    11341140        break;
    11351141    case SH_ItemView_ChangeHighlightOnFocus:
    1136 #if defined(Q_WS_WIN)
    1137         if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT)
    1138             ret = 1;
    1139         else
    1140 #endif
    1141             ret = 0;
     1142        ret = 1;
    11421143        break;
    11431144    case SH_ToolBox_SelectedPageTitleBold:
     
    11471148#if defined(Q_WS_WIN)
    11481149    case SH_UnderlineShortcut:
     1150    {
    11491151        ret = 1;
    1150         if (QSysInfo::WindowsVersion != QSysInfo::WV_95
    1151             && QSysInfo::WindowsVersion != QSysInfo::WV_98
    1152             && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
    1153             BOOL cues;
    1154             SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0);
    1155             ret = int(cues);
    1156             // Do nothing if we always paint underlines
    1157             Q_D(const QWindowsStyle);
    1158             if (!ret && widget && d) {
     1152        BOOL cues = false;
     1153        SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0);
     1154        ret = int(cues);
     1155        // Do nothing if we always paint underlines
     1156        Q_D(const QWindowsStyle);
     1157        if (!ret && widget && d) {
    11591158#ifndef QT_NO_MENUBAR
    1160                 const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
    1161                 if (!menuBar && qobject_cast<const QMenu *>(widget)) {
    1162                     QWidget *w = QApplication::activeWindow();
    1163                     if (w && w != widget)
    1164                         menuBar = qFindChild<QMenuBar *>(w);
    1165                 }
    1166                 // If we paint a menu bar draw underlines if is in the keyboardState
    1167                 if (menuBar) {
    1168                     if (menuBar->d_func()->keyboardState || d->altDown())
    1169                         ret = 1;
    1170                     // Otherwise draw underlines if the toplevel widget has seen an alt-press
    1171                 } else
     1159            const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
     1160            if (!menuBar && qobject_cast<const QMenu *>(widget)) {
     1161                QWidget *w = QApplication::activeWindow();
     1162                if (w && w != widget)
     1163                    menuBar = qFindChild<QMenuBar *>(w);
     1164            }
     1165            // If we paint a menu bar draw underlines if is in the keyboardState
     1166            if (menuBar) {
     1167                if (menuBar->d_func()->keyboardState || d->altDown())
     1168                    ret = 1;
     1169                // Otherwise draw underlines if the toplevel widget has seen an alt-press
     1170            } else
    11721171#endif // QT_NO_MENUBAR
    1173                 if (d->hasSeenAlt(widget)) {
    1174                     ret = 1;
    1175                 }
    1176             }
    1177         }
    1178         break;
     1172            if (d->hasSeenAlt(widget)) {
     1173                ret = 1;
     1174            }
     1175        }
     1176        break;
     1177    }
    11791178#endif
    11801179#ifndef QT_NO_RUBBERBAND
     
    12171216    case SH_ItemView_ArrowKeysNavigateIntoChildren:
    12181217        ret = true;
     1218        break;
     1219    case SH_DialogButtonBox_ButtonsHaveIcons:
     1220        ret = 0;
    12191221        break;
    12201222    default:
     
    12731275        if (opt->state & State_Horizontal) {
    12741276            int x = opt->rect.width() / 2 - 4;
    1275             if (QApplication::layoutDirection() == Qt::RightToLeft)
     1277            if (opt->direction == Qt::RightToLeft)
    12761278                x -= 2;
    12771279            if (opt->rect.height() > 4) {
     
    13141316            && (!(opt->state & State_Enabled)
    13151317                || !(opt->state & State_MouseOver && opt->state & State_AutoRaise))
    1316             && (opt->state & State_On) && use2000style) {
     1318            && (opt->state & State_On)) {
    13171319            fill = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
    13181320            stippled = true;
     
    13871389            int size = qMin(r.height(), r.width());
    13881390            QPixmap pixmap;
    1389             QString pixmapName;
    1390             pixmapName.sprintf("%s-%s-%d-%d-%d-%lld",
    1391                                "$qt_ia", metaObject()->className(),
    1392                                uint(opt->state), pe,
    1393                                size, opt->palette.cacheKey());
     1391            QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-") + QLatin1String(metaObject()->className()), opt, QSize(size, size))
     1392                  + QLatin1Char('-') + QString::number(pe);                               
    13941393            if (!QPixmapCache::find(pixmapName, pixmap)) {
    13951394                int border = size/5;
     
    14211420
    14221421                if (opt->state & State_Sunken) {
    1423                     bsx = pixelMetric(PM_ButtonShiftHorizontal, opt, w);
    1424                     bsy = pixelMetric(PM_ButtonShiftVertical, opt, w);
     1422                    bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, w);
     1423                    bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, w);
    14251424                }
    14261425
     
    15111510        if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
    15121511            //### check for d->alt_down
    1513             if (!(fropt->state & State_KeyboardFocusChange) && !styleHint(SH_UnderlineShortcut, opt))
     1512            if (!(fropt->state & State_KeyboardFocusChange) && !proxy()->styleHint(SH_UnderlineShortcut, opt))
    15141513                return;
    15151514            QRect r = opt->rect;
     
    15781577            int xOffset = 0;
    15791578            int yOffset = 0;
    1580             int indicatorWidth = pixelMetric(PM_ExclusiveIndicatorWidth);
    1581             int indicatorHeight = pixelMetric(PM_ExclusiveIndicatorWidth);
     1579            int indicatorWidth = proxy()->pixelMetric(PM_ExclusiveIndicatorWidth);
     1580            int indicatorHeight = proxy()->pixelMetric(PM_ExclusiveIndicatorWidth);
    15821581            if (ir.width() > indicatorWidth)
    15831582                xOffset += (ir.width() - indicatorWidth)/2;
     
    16281627                    popupPal.setColor(QPalette::Midlight, frame->palette.light().color());
    16291628                }
    1630                 if (use2000style && pe == PE_Frame && (frame->state & State_Raised))
     1629                if (pe == PE_Frame && (frame->state & State_Raised))
    16311630                    qDrawWinButton(p, frame->rect, popupPal, frame->state & State_Sunken);
    1632                 else if (use2000style && pe == PE_Frame && (frame->state & State_Sunken))
     1631                else if (pe == PE_Frame && (frame->state & State_Sunken))
    16331632                {
    16341633                    popupPal.setColor(QPalette::Midlight, frame->palette.background().color());
     
    17361735case PE_FrameDockWidget:
    17371736        if (qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
    1738             drawPrimitive(QStyle::PE_FrameWindow, opt, p, w);
     1737            proxy()->drawPrimitive(QStyle::PE_FrameWindow, opt, p, w);
    17391738        }
    17401739    break;
     
    17551754
    17561755            int space = 2;
    1757             int chunksize = pixelMetric(PM_ProgressBarChunkWidth, opt, w) - space;
     1756            int chunksize = proxy()->pixelMetric(PM_ProgressBarChunkWidth, opt, w) - space;
    17581757            if (!vertical) {
    17591758                if (opt->rect.width() <= chunksize)
     
    17811780#endif // QT_NO_PROGRESSBAR
    17821781
    1783     case PE_FrameTabWidget:
    1784         if (use2000style) {
    1785             QRect rect = opt->rect;
    1786             QPalette pal = opt->palette;
    1787             qDrawWinButton(p, opt->rect, opt->palette, false, 0);
    1788             break;
    1789        }
     1782    case PE_FrameTabWidget: {
     1783        qDrawWinButton(p, opt->rect, opt->palette, false, 0);
     1784        break;
     1785    }
    17901786    default:
    17911787        QCommonStyle::drawPrimitive(pe, opt, p, w);
     
    18141810            QRect r = opt->rect;
    18151811            QStyleHintReturnMask mask;
    1816             if (styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
     1812            if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
    18171813                p->setClipRegion(mask.region);
    18181814            p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap);
     
    18461842
    18471843            // windows always has a check column, regardless whether we have an icon or not
    1848             int checkcol = qMax(menuitem->maxIconWidth, windowsCheckMarkWidth);
     1844            int checkcol = qMax<int>(menuitem->maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth);
    18491845
    18501846            QBrush fill = menuitem->palette.brush(act ? QPalette::Highlight : QPalette::Button);
     
    18831879                QPixmap pixmap;
    18841880                if (checked)
    1885                     pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On);
     1881                    pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On);
    18861882                else
    1887                     pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, opt, widget), mode);
     1883                    pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode);
    18881884                int pixw = pixmap.width();
    18891885                int pixh = pixmap.height();
     
    19021898                if (act)
    19031899                    newMi.state |= State_On;
    1904                 newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + windowsItemFrame, menuitem->rect.y() + windowsItemFrame,
    1905                                                                               checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame));
    1906                 drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget);
     1900                newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + QWindowsStylePrivate::windowsItemFrame,
     1901                                                                              menuitem->rect.y() + QWindowsStylePrivate::windowsItemFrame,
     1902                                                                              checkcol - 2 * QWindowsStylePrivate::windowsItemFrame,
     1903                                                                              menuitem->rect.height() - 2 * QWindowsStylePrivate::windowsItemFrame));
     1904                proxy()->drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget);
    19071905            }
    19081906            p->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color());
     
    19141912            }
    19151913
    1916             int xm = windowsItemFrame + checkcol + windowsItemHMargin;
     1914            int xm = QWindowsStylePrivate::windowsItemFrame + checkcol + QWindowsStylePrivate::windowsItemHMargin;
    19171915            int xpos = menuitem->rect.x() + xm;
    1918             QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
     1916            QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin,
     1917                           w - xm - QWindowsStylePrivate::windowsRightBorder - tab + 1, h - 2 * QWindowsStylePrivate::windowsItemVMargin);
    19191918            QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
    19201919            QString s = menuitem->text;
     
    19231922                int t = s.indexOf(QLatin1Char('\t'));
    19241923                int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
    1925                 if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
     1924                if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
    19261925                    text_flags |= Qt::TextHideMnemonic;
    19271926                text_flags |= Qt::AlignLeft;
     
    19291928                    QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
    19301929                        QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
    1931                     if (dis && !act && styleHint(SH_EtchDisabledText, opt, widget)) {
     1930                    if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
    19321931                        p->setPen(menuitem->palette.light().color());
    19331932                        p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1));
     
    19411940                    font.setBold(true);
    19421941                p->setFont(font);
    1943                 if (dis && !act && styleHint(SH_EtchDisabledText, opt, widget)) {
     1942                if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
    19441943                    p->setPen(menuitem->palette.light().color());
    19451944                    p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t));
     
    19501949            }
    19511950            if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
    1952                 int dim = (h - 2 * windowsItemFrame) / 2;
     1951                int dim = (h - 2 * QWindowsStylePrivate::windowsItemFrame) / 2;
    19531952                PrimitiveElement arrow;
    19541953                arrow = (opt->direction == Qt::RightToLeft) ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
    1955                 xpos = x + w - windowsArrowHMargin - windowsItemFrame - dim;
     1954                xpos = x + w - QWindowsStylePrivate::windowsArrowHMargin - QWindowsStylePrivate::windowsItemFrame - dim;
    19561955                QRect  vSubMenuRect = visualRect(opt->direction, menuitem->rect, QRect(xpos, y + h / 2 - dim / 2, dim, dim));
    19571956                QStyleOptionMenuItem newMI = *menuitem;
     
    19611960                    newMI.palette.setColor(QPalette::ButtonText,
    19621961                                           newMI.palette.highlightedText().color());
    1963                 drawPrimitive(arrow, &newMI, p, widget);
     1962                proxy()->drawPrimitive(arrow, &newMI, p, widget);
    19641963            }
    19651964
     
    19831982                                   mbi->rect.height(), mbi->palette, active && down, 1, 0, &b);
    19841983                if (active && down) {
    1985                     newMbi.rect.translate(pixelMetric(PM_ButtonShiftHorizontal, mbi, widget),
    1986                                        pixelMetric(PM_ButtonShiftVertical, mbi, widget));
     1984                    newMbi.rect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, mbi, widget),
     1985                                       proxy()->pixelMetric(PM_ButtonShiftVertical, mbi, widget));
    19871986                    p->setBrushOrigin(p->brushOrigin() - QPoint(1, 1));
    19881987                }
     
    20182017                     && tab->selectedPosition
    20192018                            == QStyleOptionTab::PreviousIsSelected));
    2020             int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget);
     2019            int tabBarAlignment = proxy()->styleHint(SH_TabBar_Alignment, tab, widget);
    20212020            bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft)
    20222021                                || (rtlHorTabs
     
    20322031            QColor shadow = tab->palette.shadow().color();
    20332032            QColor background = tab->palette.background().color();
    2034             int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget);
     2033            int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
    20352034            if (selected)
    20362035                borderThinkness /= 2;
     
    20632062                    p->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
    20642063                    p->drawPoint(x1 + 1, y1 + 1);
    2065                     if (!use2000style) {
    2066                         p->setPen(midlight);
    2067                         p->drawLine(x1 + 1, y1 + 2, x1 + 1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
    2068                     }
    20692064                }
    20702065                // Top
     
    20742069                    p->setPen(light);
    20752070                    p->drawLine(beg, y1, end, y1);
    2076                     if (!use2000style) {
    2077                         p->setPen(midlight);
    2078                         p->drawLine(beg, y1 + 1, end, y1 + 1);
    2079                     }
    20802071                }
    20812072                // Right
     
    21072098                    p->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
    21082099                    p->drawPoint(x1 + 1, y2 - 1);
    2109                     if (!use2000style) {
    2110                         p->setPen(midlight);
    2111                         p->drawLine(x1 + 1, y2 - 2, x1 + 1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
    2112                     }
    21132100                }
    21142101                // Bottom
     
    21492136                    p->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);
    21502137                    p->drawPoint(x1 + 1, y1 + 1);
    2151                     if (!use2000style) {
    2152                         p->setPen(midlight);
    2153                         p->drawLine(x1 + 2, y1 + 1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1 + 1);
    2154                     }
    21552138                }
    21562139                // Left
     
    21602143                    p->setPen(light);
    21612144                    p->drawLine(x1, beg, x1, end);
    2162                     if (!use2000style) {
    2163                         p->setPen(midlight);
    2164                         p->drawLine(x1 + 1, beg, x1 + 1, end);
    2165                     }
    21662145                }
    21672146                // Bottom
     
    21952174                    p->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);
    21962175                    p->drawPoint(x2 - 1, y1 + 1);
    2197                     if (!use2000style) {
    2198                         p->setPen(midlight);
    2199                         p->drawLine(x2 - 3, y1 + 1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1 + 1);
    2200                         p->drawPoint(x2 - 1, y1);
    2201                     }
    22022176                }
    22032177                // Right
     
    22362210    case CE_ScrollBarSubLine:
    22372211    case CE_ScrollBarAddLine: {
    2238         if (use2000style && (opt->state & State_Sunken)) {
     2212        if ((opt->state & State_Sunken)) {
    22392213            p->setPen(opt->palette.dark().color());
    22402214            p->setBrush(opt->palette.brush(QPalette::Button));
     
    22642238        QStyleOption arrowOpt = *opt;
    22652239        arrowOpt.rect = opt->rect.adjusted(4, 4, -4, -4);
    2266         drawPrimitive(arrow, &arrowOpt, p, widget);
     2240        proxy()->drawPrimitive(arrow, &arrowOpt, p, widget);
    22672241        break; }
    22682242    case CE_ScrollBarAddPage:
     
    23532327                    break;
    23542328                }
    2355                 if(QApplication::layoutDirection() == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end
     2329                if(opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end
    23562330                    bool tmp = paintLeftBorder;
    23572331                    paintRightBorder=paintLeftBorder;
     
    24502424            if (pb->minimum == 0 && pb->maximum == 0) {
    24512425                Q_D(const QWindowsStyle);
    2452                 const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, pb, widget);
     2426                const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb, widget);
    24532427                QStyleOptionProgressBarV2 pbBits = *pb;
    24542428                Q_ASSERT(unit_width >0);
     
    24742448                    pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);
    24752449                    pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
    2476                     drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
     2450                    proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
    24772451                    x += reverse ? -unit_width : unit_width;
    24782452                }
     
    24852459                        pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);
    24862460                        pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
    2487                         drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
     2461                        proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
    24882462                        x += reverse ? -unit_width : unit_width;
    24892463                    }
     
    25242498            bool floating = false;
    25252499            bool active = dwOpt->state & State_Active;
    2526             int menuOffset = 0; //used to center text when floated
    25272500            QColor inactiveCaptionTextColor = d->inactiveCaptionText;
    25282501            if (dwOpt->movable) {
     
    25392512                        right = d->inactiveGradientCaptionColor;
    25402513                    }
    2541                     menuOffset = 2;
    25422514                    QBrush fillBrush(left);
    25432515                    if (left != right) {
     
    25732545                                    titleRect.height(), titleRect.width());
    25742546                }
    2575                 drawItemText(p, titleRect,
     2547                proxy()->drawItemText(p, titleRect,
    25762548                            Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette,
    25772549                            dwOpt->state & State_Enabled, dwOpt->title,
     
    26032575            = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(opt);
    26042576        bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
    2605         int m = pixelMetric(PM_DockWidgetTitleMargin, opt, w);
     2577        int m = proxy()->pixelMetric(PM_DockWidgetTitleMargin, opt, w);
    26062578        if (verticalTitleBar) {
    26072579            r.adjust(0, 0, 0, -m);
    26082580        } else {
    2609             if (QApplication::layoutDirection() == Qt::LeftToRight)
     2581            if (opt->direction == Qt::LeftToRight)
    26102582                r.adjust(m, 0, 0, 0);
    26112583            else
     
    26372609    case CC_Slider:
    26382610        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
    2639             int thickness  = pixelMetric(PM_SliderControlThickness, slider, widget);
    2640             int len        = pixelMetric(PM_SliderLength, slider, widget);
     2611            int thickness  = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
     2612            int len        = proxy()->pixelMetric(PM_SliderLength, slider, widget);
    26412613            int ticks = slider->tickPosition;
    2642             QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
    2643             QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
     2614            QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
     2615            QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
    26442616
    26452617            if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
     
    27122684                    fropt.QStyleOption::operator=(*slider);
    27132685                    fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
    2714                     drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
     2686                    proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
    27152687                }
    27162688
     
    30242996                if (cmb->frame) {
    30252997                    QPalette shadePal = opt->palette;
    3026                     if (use2000style)
    3027                         shadePal.setColor(QPalette::Midlight, shadePal.button().color());
     2998                    shadePal.setColor(QPalette::Midlight, shadePal.button().color());
    30282999                    qDrawWinPanel(p, opt->rect, shadePal, true, &editBrush);
    30293000                }
     
    30353006                State flags = State_None;
    30363007
    3037                 QRect ar = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
     3008                QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
    30383009                bool sunkenArrow = cmb->activeSubControls == SC_ComboBoxArrow
    30393010                                   && cmb->state & State_Sunken;
     
    30543025                if (opt->state & State_Enabled)
    30553026                    flags |= State_Enabled;
     3027                if (opt->state & State_HasFocus)
     3028                    flags |= State_HasFocus;
    30563029
    30573030                if (sunkenArrow)
     
    30613034                arrowOpt.palette = cmb->palette;
    30623035                arrowOpt.state = flags;
    3063                 drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
     3036                proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
    30643037            }
    30653038
    30663039            if (cmb->subControls & SC_ComboBoxEditField) {
    3067                 QRect re = subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
     3040                QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
    30683041                if (cmb->state & State_HasFocus && !cmb->editable)
    30693042                    p->fillRect(re.x(), re.y(), re.width(), re.height(),
     
    30853058                    focus.state |= State_FocusAtBorder;
    30863059                    focus.backgroundColor = cmb->palette.highlight().color();
    3087                     drawPrimitive(PE_FrameFocusRect, &focus, p, widget);
     3060                    proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget);
    30883061                }
    30893062            }
     
    30993072            if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
    31003073                QBrush editBrush = sb->palette.brush(QPalette::Base);
    3101                 QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
     3074                QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
    31023075                QPalette shadePal = sb->palette;
    3103                 if (use2000style)
    3104                     shadePal.setColor(QPalette::Midlight, shadePal.button().color());
     3076                shadePal.setColor(QPalette::Midlight, shadePal.button().color());
    31053077                qDrawWinPanel(p, r, shadePal, true, &editBrush);
    31063078            }
     
    31303102                                                                       : PE_IndicatorSpinUp);
    31313103
    3132                 copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
     3104                copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
    31333105                qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
    31343106                                &copy.palette.brush(QPalette::Button));
     
    31383110                    lightCopy.rect.adjust(1, 1, 1, 1);
    31393111                    lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());
    3140                     drawPrimitive(pe, &lightCopy, p, widget);
    3141                 }
    3142                 drawPrimitive(pe, &copy, p, widget);
     3112                    proxy()->drawPrimitive(pe, &lightCopy, p, widget);
     3113                }
     3114                proxy()->drawPrimitive(pe, &copy, p, widget);
    31433115            }
    31443116
     
    31633135                                                                       : PE_IndicatorSpinDown);
    31643136
    3165                 copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
     3137                copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
    31663138                qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
    31673139                                &copy.palette.brush(QPalette::Button));
     
    31713143                    lightCopy.rect.adjust(1, 1, 1, 1);
    31723144                    lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());
    3173                     drawPrimitive(pe, &lightCopy, p, widget);
    3174                 }
    3175                 drawPrimitive(pe, &copy, p, widget);
     3145                    proxy()->drawPrimitive(pe, &lightCopy, p, widget);
     3146                }
     3147                proxy()->drawPrimitive(pe, &copy, p, widget);
    31763148            }
    31773149        }
    31783150        break;
    31793151#endif // QT_NO_SPINBOX
     3152
    31803153    default:
    31813154        QCommonStyle::drawComplexControl(cc, opt, p, widget);
     
    31963169            int defwidth = 0;
    31973170            if (btn->features & QStyleOptionButton::AutoDefaultButton)
    3198                 defwidth = 2 * pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
     3171                defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
     3172            int minwidth = int(QStyleHelper::dpiScaled(75.));
     3173            int minheight = int(QStyleHelper::dpiScaled(23.));
     3174
    31993175#ifndef QT_QWS_SMALL_PUSHBUTTON
    3200             if (w < 75 + defwidth && !btn->text.isEmpty())
    3201                 w = 75 + defwidth;
    3202             if (h < 23 + defwidth)
    3203                 h = 23 + defwidth;
     3176            if (w < minwidth + defwidth && !btn->text.isEmpty())
     3177                w = minwidth + defwidth;
     3178            if (h < minheight + defwidth)
     3179                h = minheight + defwidth;
    32043180#endif
    32053181            sz = QSize(w, h);
     
    32133189
    32143190            if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
    3215                 sz = QSize(10, windowsSepHeight);
     3191                sz = QSize(10, QWindowsStylePrivate::windowsSepHeight);
    32163192            }
    32173193            else if (mi->icon.isNull()) {
     
    32213197
    32223198            if (mi->menuItemType != QStyleOptionMenuItem::Separator && !mi->icon.isNull()) {
    3223                 int iconExtent = pixelMetric(PM_SmallIconSize, opt, widget);
     3199                int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
    32243200                sz.setHeight(qMax(sz.height(),
    32253201                                  mi->icon.actualSize(QSize(iconExtent, iconExtent)).height()
    3226                                   + 2 * windowsItemFrame));
     3202                                  + 2 * QWindowsStylePrivate::windowsItemFrame));
    32273203            }
    32283204            int maxpmw = mi->maxIconWidth;
    3229             int tabSpacing = use2000style ? 20 :windowsTabSpacing;
     3205            int tabSpacing = 20;
    32303206            if (mi->text.contains(QLatin1Char('\t')))
    32313207                w += tabSpacing;
    32323208            else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu)
    3233                 w += 2 * windowsArrowHMargin;
     3209                w += 2 * QWindowsStylePrivate::windowsArrowHMargin;
    32343210            else if (mi->menuItemType == QStyleOptionMenuItem::DefaultItem) {
    32353211                // adjust the font and add the difference in size.
     
    32423218            }
    32433219
    3244             int checkcol = qMax(maxpmw, windowsCheckMarkWidth); // Windows always shows a check column
     3220            int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column
    32453221            w += checkcol;
    3246             w += windowsRightBorder + 10;
     3222            w += QWindowsStylePrivate::windowsRightBorder + 10;
    32473223            sz.setWidth(w);
    32483224        }
     
    32523228    case CT_MenuBarItem:
    32533229        if (!sz.isEmpty())
    3254             sz += QSize(windowsItemHMargin * 4, windowsItemVMargin * 2);
     3230            sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2);
    32553231        break;
    32563232#endif
     
    33813357                && pSHGetStockIconInfo)
    33823358            {
    3383                 icon.addPixmap(standardPixmap(SP_VistaShield, option, widget)); //fetches small icon
     3359                icon.addPixmap(proxy()->standardPixmap(SP_VistaShield, option, widget)); //fetches small icon
    33843360                QSHSTOCKICONINFO iconInfo; //append large icon
    33853361                memset(&iconInfo, 0, sizeof(iconInfo));
    33863362                iconInfo.cbSize = sizeof(iconInfo);
    33873363                if (pSHGetStockIconInfo(_SIID_SHIELD, _SHGFI_ICON | _SHGFI_LARGEICON, &iconInfo) == S_OK) {
    3388                     icon.addPixmap(convertHIconToPixmap(iconInfo.hIcon));
     3364                    icon.addPixmap(QPixmap::fromWinHICON(iconInfo.hIcon));
    33893365                    DestroyIcon(iconInfo.hIcon);
    33903366                }
  • trunk/src/gui/styles/qwindowsstyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qwindowsstyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8888    QColor inactiveCaptionColor;
    8989    QColor inactiveGradientCaptionColor;
     90
     91    enum {
     92        windowsItemFrame        =  2, // menu item frame width
     93        windowsSepHeight        =  9, // separator item height
     94        windowsItemHMargin      =  3, // menu item hor text margin
     95        windowsItemVMargin      =  2, // menu item ver text margin
     96        windowsArrowHMargin     =  6, // arrow horizontal margin
     97        windowsRightBorder      = 15, // right border on windows
     98        windowsCheckMarkWidth   = 12  // checkmarks width on windows
    9099    };
     100};
    91101
    92102QT_END_NAMESPACE
  • trunk/src/gui/styles/qwindowsvistastyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242#include "qwindowsvistastyle.h"
    4343#include "qwindowsvistastyle_p.h"
     44#include <private/qstylehelper_p.h>
    4445
    4546#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN)
     
    159160
    160161//convert Qt state flags to uxtheme button states
    161 int buttonStateId(int flags, int partId)
     162static int buttonStateId(int flags, int partId)
    162163{
    163164    int stateId = 0;
     
    190191}
    191192
    192 void Animation::paint(QPainter *painter, const QStyleOption *option)
     193void QWindowsVistaAnimation::paint(QPainter *painter, const QStyleOption *option)
    193194{
    194195    Q_UNUSED(option);
     
    196197}
    197198
    198 /*
    199 * ! \internal
    200 *
    201 * Helperfunction to paint the current transition state
    202 * between two animation frames.
    203 *
    204 * The result is a blended image consisting of
    205 * ((alpha)*_primaryImage) + ((1-alpha)*_secondaryImage)
    206 *
     199/*! \internal
     200
     201  Helperfunction to paint the current transition state between two
     202  animation frames.
     203
     204  The result is a blended image consisting of ((alpha)*_primaryImage)
     205  + ((1-alpha)*_secondaryImage)
     206
    207207*/
    208 
    209 void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
     208void QWindowsVistaAnimation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
    210209    if (_secondaryImage.isNull() || _primaryImage.isNull())
    211210        return;
     
    248247}
    249248
    250 /*
    251 * ! \internal
    252 *
    253 * Paints a transition state. The result will be a mix between the
    254 * initial and final state of the transition, depending on the
    255 * time difference between _startTime and current time.
     249/*! \internal
     250  Paints a transition state. The result will be a mix between the
     251  initial and final state of the transition, depending on the time
     252  difference between _startTime and current time.
    256253*/
    257 
    258 void Transition::paint(QPainter *painter, const QStyleOption *option)
     254void QWindowsVistaTransition::paint(QPainter *painter, const QStyleOption *option)
    259255{
    260256    float alpha = 1.0;
     
    278274}
    279275
    280 /*
    281 * ! \internal
    282 *
    283 * Paints a pulse. The result will be a mix between the
    284 * primary and secondary pulse images depending on the
    285 * time difference between _startTime and current time.
     276/*! \internal
     277  Paints a pulse. The result will be a mix between the primary and
     278  secondary pulse images depending on the time difference between
     279  _startTime and current time.
    286280*/
    287 
    288 
    289 void Pulse::paint(QPainter *painter, const QStyleOption *option)
     281void QWindowsVistaPulse::paint(QPainter *painter, const QStyleOption *option)
    290282{
    291283    float alpha = 1.0;
     
    308300
    309301/*!
    310  \reimp
    311  *
    312  * Animations are used for some state transitions on specific widgets.
    313  *
    314  * Only one running animation can exist for a widget at any specific time.
    315  * Animations can be added through QWindowsVistaStylePrivate::startAnimation(Animation *)
    316  * and any existing animation on a widget can be retrieved with
    317  * QWindowsVistaStylePrivate::widgetAnimation(Widget *).
    318  *
    319  * Once an animation has been started, QWindowsVistaStylePrivate::timerEvent(QTimerEvent *)
    320  * will continuously call update() on the widget until it is stopped, meaning that drawPrimitive
    321  * will be called many times until the transition has completed. During this time, the result
    322  * will be retrieved by the Animation::paint(...) function and not by the style itself.
    323  *
    324  * To determine if a transition should occur, the style needs to know the previous state of the
    325  * widget as well as the current one. This is solved by updating dynamic properties on the widget
    326  * every time the function is called.
    327  *
    328  * Transitions interrupting existing transitions should always be smooth, so whenever a hover-transition
    329  * is started on a pulsating button, it uses the current frame of the pulse-animation as the
    330  * starting image for the hover transition.
    331  *
     302 \internal
     303 
     304  Animations are used for some state transitions on specific widgets.
     305 
     306  Only one running animation can exist for a widget at any specific
     307  time.  Animations can be added through
     308  QWindowsVistaStylePrivate::startAnimation(Animation *) and any
     309  existing animation on a widget can be retrieved with
     310  QWindowsVistaStylePrivate::widgetAnimation(Widget *).
     311 
     312  Once an animation has been started,
     313  QWindowsVistaStylePrivate::timerEvent(QTimerEvent *) will
     314  continuously call update() on the widget until it is stopped,
     315  meaning that drawPrimitive will be called many times until the
     316  transition has completed. During this time, the result will be
     317  retrieved by the Animation::paint(...) function and not by the style
     318  itself.
     319 
     320  To determine if a transition should occur, the style needs to know
     321  the previous state of the widget as well as the current one. This is
     322  solved by updating dynamic properties on the widget every time the
     323  function is called.
     324 
     325  Transitions interrupting existing transitions should always be
     326  smooth, so whenever a hover-transition is started on a pulsating
     327  button, it uses the current frame of the pulse-animation as the
     328  starting image for the hover transition.
     329 
    332330 */
    333331void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
    334                                     QPainter *painter, const QWidget *widget) const
     332                                       QPainter *painter, const QWidget *widget) const
    335333{
    336334    QWindowsVistaStylePrivate *d = const_cast<QWindowsVistaStylePrivate*>(d_func());
     
    367365            w->setProperty("_q_stylerect", w->rect());
    368366
    369             bool doTransition = ((state & State_Sunken)     != (oldState & State_Sunken) ||
     367            bool doTransition = oldState &&
     368                                ((state & State_Sunken)     != (oldState & State_Sunken) ||
    370369                                 (state & State_On)         != (oldState & State_On)     ||
    371370                                 (state & State_MouseOver)  != (oldState & State_MouseOver));
     
    395394                QPainter startPainter(&startImage);
    396395
    397                 Animation *anim = d->widgetAnimation(widget);
    398                 Transition *t = new Transition;
     396                QWindowsVistaAnimation *anim = d->widgetAnimation(widget);
     397                QWindowsVistaTransition *t = new QWindowsVistaTransition;
    399398                t->setWidget(w);
    400399
     
    404403
    405404                if (!anim)
    406                     drawPrimitive(element, &opt, &startPainter, 0); // Note that the widget pointer is intentionally 0
     405                    proxy()->drawPrimitive(element, &opt, &startPainter, 0); // Note that the widget pointer is intentionally 0
    407406                else                                               // this ensures that we do not recurse in the animation logic above
    408407                    anim->paint(&startPainter, &opt);
     
    418417                QStyleOption opt2 = opt;
    419418                opt2.state = option->state;
    420                 drawPrimitive(element, &opt2, &endPainter, 0); // Note that the widget pointer is intentionally 0
     419                proxy()->drawPrimitive(element, &opt2, &endPainter, 0); // Note that the widget pointer is intentionally 0
    421420                                                              // this ensures that we do not recurse in the animation logic above
    422421                t->setEndImage(endImage);
     
    488487        {
    489488            XPThemeData theme(d->treeViewHelper(), painter, QLatin1String("TREEVIEW"));
    490             static const int decoration_size = 16;
     489            static int decoration_size = 0;
     490            if (theme.isValid() && !decoration_size) {
     491                SIZE size;
     492                pGetThemePartSize(theme.handle(), 0, TVP_HOTGLYPH, GLPS_OPENED, 0, TS_TRUE, &size);
     493                decoration_size = qMax(size.cx, size.cy);
     494            }
    491495            int mid_h = option->rect.x() + option->rect.width() / 2;
    492496            int mid_v = option->rect.y() + option->rect.height() / 2;
     
    528532    case PE_IndicatorRadioButton:
    529533        {
    530             if (Animation *a = d->widgetAnimation(widget)) {
     534            if (QWindowsVistaAnimation *a = d->widgetAnimation(widget)) {
    531535                a->paint(painter, option);
    532536            } else {
    533537                QWindowsXPStyle::drawPrimitive(element, option, painter, widget);
    534538            }
    535         }
    536         break;
    537 
    538     case PE_IndicatorToolBarHandle:
    539         {
    540             XPThemeData theme;
    541             if (option->state & State_Horizontal)
    542                 theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPER, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
    543             else
    544                 theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPERVERT, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
    545             d->drawBackground(theme);
    546539        }
    547540        break;
     
    646639            }
    647640            if (panel->lineWidth > 0)
    648                 drawPrimitive(PE_FrameLineEdit, panel, painter, widget);
     641                proxy()->drawPrimitive(PE_FrameLineEdit, panel, painter, widget);
    649642            return;
    650643        }
     
    652645
    653646    case PE_FrameLineEdit:
    654         if (Animation *anim = d->widgetAnimation(widget)) {
     647        if (QWindowsVistaAnimation *anim = d->widgetAnimation(widget)) {
    655648            anim->paint(painter, option);
    656649        } else {
     
    695688        break;
    696689
     690    case PE_IndicatorToolBarHandle:
     691        {
     692            XPThemeData theme;
     693            QRect rect;
     694            if (option->state & State_Horizontal) {
     695                theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPER, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
     696                rect = option->rect.adjusted(0, 1, 0, -2);
     697                rect.setWidth(4);
     698            } else {
     699                theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPERVERT, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
     700                rect = option->rect.adjusted(1, 0, -1, 0);
     701                rect.setHeight(4);
     702            }
     703            theme.rect = rect;
     704            d->drawBackground(theme);
     705        }
     706        break;
     707
    697708    case PE_IndicatorToolBarSeparator:
    698709        {
     
    721732            const QStyleOptionViewItemV4 *vopt;
    722733            const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
    723             bool newStyle = false;
    724 
    725             if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
    726                 if (listview->viewMode() == QListView::IconMode)
    727                     newStyle = true;
    728             } else if (const QTreeView* treeview = qobject_cast<const QTreeView *>(widget)) {
    729                 newStyle = true;
    730             }
     734            bool newStyle = true;
     735
     736            if (qobject_cast<const QTableView*>(widget))
     737                newStyle = false;
     738
    731739            if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
    732740                bool selected = vopt->state & QStyle::State_Selected;
     
    865873
    866874/*!
    867 
    868  \reimp
     875 \internal
    869876
    870877 see drawPrimitive for comments on the animation support
    871 
    872878 */
    873879void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption *option,
     
    924930                    QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
    925931                    QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
    926                     Animation *anim = d->widgetAnimation(widget);
     932                    QWindowsVistaAnimation *anim = d->widgetAnimation(widget);
    927933
    928934                    QStyleOptionButton opt = *button;
     
    930936
    931937                    startImage.fill(0);
    932                     Transition *t = new Transition;
     938                    QWindowsVistaTransition *t = new QWindowsVistaTransition;
    933939                    t->setWidget(w);
    934940                    QPainter startPainter(&startImage);
    935941
    936942                    if (!anim) {
    937                         drawControl(element, &opt, &startPainter, 0 /* Intentional */);
     943                        proxy()->drawControl(element, &opt, &startPainter, 0 /* Intentional */);
    938944                    } else {
    939945                        anim->paint(&startPainter, &opt);
     
    946952                    endImage.fill(0);
    947953                    QPainter endPainter(&endImage);
    948                     drawControl(element, option, &endPainter, 0 /* Intentional */);
     954                    proxy()->drawControl(element, option, &endPainter, 0 /* Intentional */);
    949955                    t->setEndImage(endImage);
    950956                    int duration = 0;
     
    967973        {
    968974
    969             if (Animation *anim = d->widgetAnimation(widget)) {
     975            if (QWindowsVistaAnimation *anim = d->widgetAnimation(widget)) {
    970976                anim->paint(painter, option);
    971977            } else {
     
    9941000                         (state & State_Enabled) && (state & State_Active))
    9951001                        {
    996                         Animation *anim = d->widgetAnimation(widget);
     1002                        QWindowsVistaAnimation *anim = d->widgetAnimation(widget);
    9971003                        if (!anim && widget) {
    9981004                            QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
     
    10011007                            alternateImage.fill(0);
    10021008
    1003                             Pulse *pulse = new Pulse;
     1009                            QWindowsVistaPulse *pulse = new QWindowsVistaPulse;
    10041010                            pulse->setWidget(const_cast<QWidget*>(widget));
    10051011
     
    10481054                QStyleOptionButton newBtn = *btn;
    10491055                newBtn.rect = QStyle::visualRect(option->direction, option->rect,
    1050                                                 QRect(ir.right() - mbiw - 2, (option->rect.height()/2) - (mbih/2),
     1056                                                QRect(ir.right() - mbiw - 2,
     1057                                                      option->rect.top() + (option->rect.height()/2) - (mbih/2),
    10511058                                                      mbiw + 1, mbih + 1));
    1052                 drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
     1059                proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
    10531060            }
    10541061            return;
     
    10731080                if (((progressbar->value() > 0  && d->transitionsEnabled()) || isIndeterminate)) {
    10741081                    if (!d->widgetAnimation(progressbar) && progressbar->value() < progressbar->maximum()) {
    1075                         Animation *a = new Animation;
     1082                        QWindowsVistaAnimation *a = new QWindowsVistaAnimation;
    10761083                        a->setWidget(const_cast<QWidget*>(widget));
    10771084                        a->setStartTime(QTime::currentTime());
     
    10851092            XPThemeData theme(widget, painter, QLatin1String("PROGRESS"), vertical ? PP_FILLVERT : PP_FILL);
    10861093            theme.rect = option->rect;
    1087             bool reverse = bar->direction == Qt::LeftToRight && inverted || bar->direction == Qt::RightToLeft && !inverted;
     1094            bool reverse = (bar->direction == Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted);
    10881095            QTime current = QTime::currentTime();
    10891096
    10901097            if (isIndeterminate) {
    1091                 if (Animation *a = d->widgetAnimation(widget)) {
     1098                if (QWindowsVistaAnimation *a = d->widgetAnimation(widget)) {
    10921099                    int glowSize = 120;
    10931100                    int animationWidth = glowSize * 2 + (vertical ? theme.rect.height() : theme.rect.width());
     
    11591166                d->drawBackground(theme);
    11601167
    1161                 if (Animation *a = d->widgetAnimation(widget)) {
     1168                if (QWindowsVistaAnimation *a = d->widgetAnimation(widget)) {
    11621169                    int glowSize = 140;
    11631170                    int animationWidth = glowSize * 2 + (vertical ? theme.rect.height() : theme.rect.width());
     
    11981205
    11991206            QPalette::ColorRole textRole = disabled ? QPalette::Text : QPalette::ButtonText;
    1200             QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal);
     1207            QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal);
    12011208
    12021209            uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
    1203             if (!styleHint(SH_UnderlineShortcut, mbi, widget))
     1210            if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
    12041211                alignment |= Qt::TextHideMnemonic;
    12051212
    12061213            //The rect adjustment is a workaround for the menu not really filling its background.
    1207             XPThemeData theme(widget, painter, QLatin1String("MENU"), MENU_BARBACKGROUND, 0, option->rect.adjusted(-1, 1 , 2, 1));
     1214            XPThemeData theme(widget, painter, QLatin1String("MENU"), MENU_BARBACKGROUND, 0, option->rect.adjusted(-1, 0, 2, 1));
    12081215            d->drawBackground(theme);
    12091216
     
    12301237        if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
    12311238            // windows always has a check column, regardless whether we have an icon or not
    1232             int checkcol = qMax(menuitem->maxIconWidth, 28);
     1239            int checkcol = 28;
     1240            {
     1241                SIZE    size;
     1242                MARGINS margins;
     1243                XPThemeData theme(widget, 0, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND, MBI_HOT);
     1244                pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
     1245                pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins);
     1246                checkcol = qMax(menuitem->maxIconWidth, int(6 + size.cx + margins.cxLeftWidth + margins.cxRightWidth));
     1247            }
    12331248            QColor darkLine = option->palette.background().color().darker(108);
    12341249            QColor lightLine = option->palette.background().color().lighter(107);
     
    12551270                QPoint p1 = QPoint(x + checkcol, yoff);
    12561271                QPoint p2 = QPoint(x + w + 6 , yoff);
    1257                 int stateId = stateId = MBI_HOT;
     1272                stateId = MBI_HOT;
    12581273                QRect subRect(p1.x(), p1.y(), p2.x() - p1.x(), 6);
    12591274                subRect  = QStyle::visualRect(option->direction, option->rect, subRect );
     
    12671282
    12681283            if (act) {
    1269                 int stateId = stateId = MBI_HOT;
     1284                stateId = MBI_HOT;
    12701285                XPThemeData theme2(widget, painter, QLatin1String("MENU"), MENU_POPUPITEM, stateId, option->rect);
    12711286                d->drawBackground(theme2);
     
    12751290                XPThemeData theme(widget, painter, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND,
    12761291                                  menuitem->icon.isNull() ? MBI_HOT : MBI_PUSHED, vCheckRect);
     1292                SIZE    size;
     1293                MARGINS margins;
     1294                pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
     1295                pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0,
     1296                                TMT_CONTENTMARGINS, NULL, &margins);
     1297                QRect checkRect(0, 0, size.cx + margins.cxLeftWidth + margins.cxRightWidth ,
     1298                                size.cy + margins.cyBottomHeight + margins.cyTopHeight);
     1299                checkRect.moveCenter(vCheckRect.center());
     1300                theme.rect = checkRect;
     1301
    12771302                d->drawBackground(theme);
     1303
    12781304                if (menuitem->icon.isNull()) {
     1305                    checkRect = QRect(0, 0, size.cx, size.cy);
     1306                    checkRect.moveCenter(theme.rect.center());
     1307                    theme.rect = checkRect;
     1308
    12791309                    theme.partId = MENU_POPUPCHECK;
    12801310                    bool bullet = menuitem->checkType & QStyleOptionMenuItem::Exclusive;
     
    12931323                QPixmap pixmap;
    12941324                if (checked)
    1295                     pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On);
     1325                    pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On);
    12961326                else
    1297                     pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode);
     1327                    pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode);
    12981328                int pixw = pixmap.width();
    12991329                int pixh = pixmap.height();
     
    13211351                int t = s.indexOf(QLatin1Char('\t'));
    13221352                int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
    1323                 if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
     1353                if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
    13241354                    text_flags |= Qt::TextHideMnemonic;
    13251355                text_flags |= Qt::AlignLeft;
     
    13471377                newMI.rect = vSubMenuRect;
    13481378                newMI.state = dis ? State_None : State_Enabled;
    1349                 drawPrimitive(arrow, &newMI, painter, widget);
     1379                proxy()->drawPrimitive(arrow, &newMI, painter, widget);
    13501380            }
    13511381        }
     
    13721402    case CE_MenuBarEmptyArea:
    13731403        {
    1374             int stateId = MBI_NORMAL;
     1404            stateId = MBI_NORMAL;
    13751405            if (!(state & State_Enabled))
    13761406                stateId = MBI_DISABLED;
     
    14171447
    14181448            int buttonMargin = 4;
    1419             int mw = pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget);
    1420             int fw = pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget);
     1449            int mw = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget);
     1450            int fw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget);
    14211451            const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget);
    14221452            bool isFloating = dw != 0 && dw->isFloating();
     
    14371467            if (isFloating) {
    14381468                titleRect.adjust(0, -fw, 0, 0);
    1439                 if (widget != 0 && widget->windowIcon().cacheKey() != qApp->windowIcon().cacheKey())
     1469                if (widget != 0 && widget->windowIcon().cacheKey() != QApplication::windowIcon().cacheKey())
    14401470                    titleRect.adjust(titleRect.height() + mw, 0, 0, 0);
    14411471            } else {
     
    14641494            const QStyleOptionViewItemV4 *vopt;
    14651495            const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
    1466             bool newStyle = false;
    1467 
    1468             if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
    1469                 if (listview->viewMode() == QListView::IconMode)
    1470                     newStyle = true;
    1471             } else if (const QTreeView* treeview = qobject_cast<const QTreeView *>(widget)) {
    1472                 newStyle = true;
    1473             }
     1496            bool newStyle = true;
     1497
     1498            if (qobject_cast<const QTableView*>(widget))
     1499                newStyle = false;
     1500
    14741501            if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
    14751502                /*
     
    15051532
    15061533/*!
    1507   \reimp
     1534  \internal
    15081535
    15091536  see drawPrimitive for comments on the animation support
     
    15571584            if (qstyleoption_cast<const QStyleOptionSlider *>(option)) {
    15581585                QRect oldSliderPos = w->property("_q_stylesliderpos").toRect();
    1559                 QRect currentPos = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
     1586                QRect currentPos = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
    15601587                w->setProperty("_q_stylesliderpos", currentPos);
    15611588                if (oldSliderPos != currentPos) {
     
    15771604                QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
    15781605                QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
    1579                 Animation *anim = d->widgetAnimation(widget);
    1580                 Transition *t = new Transition;
     1606                QWindowsVistaAnimation *anim = d->widgetAnimation(widget);
     1607                QWindowsVistaTransition *t = new QWindowsVistaTransition;
    15811608                t->setWidget(w);
    15821609                if (!anim) {
     
    15881615                        startCombo.state = (QStyle::State)oldState;
    15891616                        startCombo.activeSubControls = (QStyle::SubControl)oldActiveControls;
    1590                         drawComplexControl(control, &startCombo, &startPainter, 0 /* Intentional */);
     1617                        proxy()->drawComplexControl(control, &startCombo, &startPainter, 0 /* Intentional */);
    15911618                        t->setStartImage(startImage);
    15921619                    } else if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option)) {
     
    15971624                        startSlider.state = (QStyle::State)oldState;
    15981625                        startSlider.activeSubControls = (QStyle::SubControl)oldActiveControls;
    1599                         drawComplexControl(control, &startSlider, &startPainter, 0 /* Intentional */);
     1626                        proxy()->drawComplexControl(control, &startSlider, &startPainter, 0 /* Intentional */);
    16001627                        t->setStartImage(startImage);
    16011628                    } else {
     
    16151642                endImage.fill(0);
    16161643                QPainter endPainter(&endImage);
    1617                 drawComplexControl(control, option, &endPainter, 0 /* Intentional */);
     1644                proxy()->drawComplexControl(control, option, &endPainter, 0 /* Intentional */);
    16181645                t->setEndImage(endImage);
    16191646                t->setStartTime(QTime::currentTime());
     
    16251652            }
    16261653
    1627             if (Animation *anim = d->widgetAnimation(widget)) {
     1654            if (QWindowsVistaAnimation *anim = d->widgetAnimation(widget)) {
    16281655                anim->paint(painter, option);
    16291656                return;
     
    16541681                }
    16551682                if (sub & SC_ComboBoxArrow) {
    1656                     QRect subRect = subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
     1683                    QRect subRect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
    16571684                    XPThemeData theme(widget, painter, QLatin1String("COMBOBOX"));
    1658                     theme.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
     1685                    theme.rect = subRect;
    16591686                    partId = option->direction == Qt::RightToLeft ? CP_DROPDOWNBUTTONLEFT : CP_DROPDOWNBUTTONRIGHT;
    16601687
     
    16801707                    if (sub & SC_ComboBoxArrow)
    16811708                        btn.features = QStyleOptionButton::HasMenu;
    1682                     drawControl(QStyle::CE_PushButton, &btn, painter, widget);
     1709                    proxy()->drawControl(QStyle::CE_PushButton, &btn, painter, widget);
    16831710                }
    16841711            }
     
    16971724            bool isRTL  = option->direction == Qt::RightToLeft;
    16981725            if (sub & SC_ScrollBarAddLine) {
    1699                 theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
     1726                theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
    17001727                partId = SBP_ARROWBTN;
    17011728                if (!(flags & State_Enabled))
     
    17141741            }
    17151742            if (sub & SC_ScrollBarSubLine) {
    1716                 theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
     1743                theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
    17171744                partId = SBP_ARROWBTN;
    17181745                if (!(flags & State_Enabled))
     
    17311758            }
    17321759            if (maxedOut) {
    1733                 theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
    1734                 theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
    1735                 theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
     1760                theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
     1761                theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
     1762                theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
    17361763                partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
    17371764                stateId = SCRBS_DISABLED;
     
    17411768            } else {
    17421769                if (sub & SC_ScrollBarSubPage) {
    1743                     theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
     1770                    theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
    17441771                    partId = flags & State_Horizontal ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT;
    17451772                    if (!(flags & State_Enabled))
     
    17561783                }
    17571784                if (sub & SC_ScrollBarAddPage) {
    1758                     theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
     1785                    theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
    17591786                    partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
    17601787                    if (!(flags & State_Enabled))
     
    17711798                }
    17721799                if (sub & SC_ScrollBarSlider) {
    1773                     theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
     1800                    theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
    17741801                    if (!(flags & State_Enabled))
    17751802                        stateId = SCRBS_DISABLED;
     
    17841811
    17851812                    // Draw handle
    1786                     theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
     1813                    theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
    17871814                    theme.partId = flags & State_Horizontal ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT;
    17881815                    theme.stateId = stateId;
     
    18521879            }
    18531880            if (sub & SC_SpinBoxUp) {
    1854                 theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget).adjusted(0, 0, 0, 1);
     1881                theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget).adjusted(0, 0, 0, 1);
    18551882                partId = SPNP_UP;
    18561883                if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled))
     
    18671894            }
    18681895            if (sub & SC_SpinBoxDown) {
    1869                 theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
     1896                theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
    18701897                partId = SPNP_DOWN;
    18711898                if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) || !(flags & State_Enabled))
     
    18911918
    18921919/*!
    1893  \reimp
     1920 \internal
    18941921 */
    18951922QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
     
    19261953    case CT_MenuItem:
    19271954        sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget);
    1928         sz.rwidth() += 28;
     1955        int minimumHeight;
     1956        {
     1957            SIZE    size;
     1958            MARGINS margins;
     1959            XPThemeData theme(widget, 0, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND, MBI_HOT);
     1960            pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
     1961            pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins);
     1962            minimumHeight = qMax<qint32>(size.cy + margins.cyBottomHeight+ margins.cyTopHeight, sz.height());
     1963            sz.rwidth() += size.cx + margins.cxLeftWidth + margins.cxRightWidth;
     1964        }
     1965       
    19291966        if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
    1930             int minimumHeight = qMax<qint32>(22, sz.height());
    19311967            if (menuitem->menuItemType != QStyleOptionMenuItem::Separator)
    19321968                sz.setHeight(minimumHeight);
     
    19481984            //Spinbox adds frame twice
    19491985            sz = QWindowsStyle::sizeFromContents(type, option, size, widget);
    1950             int border = pixelMetric(PM_SpinBoxFrameWidth, option, widget);
     1986            int border = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
    19511987            sz -= QSize(2*border, 2*border);
    19521988        }
     
    19591995
    19601996/*!
    1961  \reimp
     1997 \internal
    19621998 */
    19631999QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
     
    19742010            HTHEME theme = pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"Button");
    19752011            if (theme) {
    1976                 int stateId;
     2012                int stateId = PBS_NORMAL;
    19772013                if (!(option->state & State_Enabled))
    19782014                    stateId = PBS_DISABLED;
     
    19832019                else if (btn->features & QStyleOptionButton::DefaultButton)
    19842020                    stateId = PBS_DEFAULTED;
    1985                 else
    1986                     stateId = PBS_NORMAL;
    1987 
    1988                 int border = pixelMetric(PM_DefaultFrameWidth, btn, widget);
     2021
     2022                int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
    19892023                rect = option->rect.adjusted(border, border, -border, -border);
    19902024
     
    20132047            int x = option->rect.x();
    20142048            int y = option->rect.y();
    2015             int margin = pixelMetric(QStyle::PM_HeaderMargin, option, widget);
     2049            int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, option, widget);
    20162050
    20172051            XPThemeData theme(widget, 0, QLatin1String("HEADER"), HP_HEADERSORTARROW, HSAS_SORTEDDOWN, option->rect);
     
    20392073    case SE_HeaderLabel:
    20402074        {
    2041             int margin = pixelMetric(QStyle::PM_HeaderMargin, option, widget);
     2075            int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, option, widget);
    20422076            QRect r = option->rect;
    20432077            r.setRect(option->rect.x() + margin, option->rect.y() + margin,
     
    20572091        break;
    20582092    case SE_ItemViewItemDecoration:
    2059         if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))
     2093        if (qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))
    20602094            rect.adjust(-2, 0, 2, 0);
    20612095        break;
     
    21302164
    21312165
    2132 /*! \reimp */
     2166/*! \internal */
    21332167int QWindowsVistaStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget,
    21342168                             QStyleHintReturn *returnData) const
     
    21642198
    21652199/*!
    2166  \reimp
     2200 \internal
    21672201 */
    21682202QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option,
     
    21842218            int margin = cb->frame ? 3 : 0;
    21852219            int bmarg = cb->frame ? 2 : 0;
    2186             xpos += wi - bmarg - 16;
     2220            int arrowButtonWidth = bmarg + 16;
     2221            xpos += wi - arrowButtonWidth;
    21872222
    21882223            switch (subControl) {
     
    21912226                break;
    21922227            case SC_ComboBoxArrow:
    2193                 rect.setRect(cb->editable ? xpos : 0, y , wi - xpos, he);
     2228                rect.setRect(xpos, y , arrowButtonWidth, he);
    21942229                break;
    21952230            case SC_ComboBoxEditField:
     
    22152250            int buttonWidth = GetSystemMetrics(SM_CXSIZE) - 4;
    22162251
    2217             const int frameWidth = pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
     2252            const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
    22182253            const bool sysmenuHint  = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0;
    22192254            const bool minimizeHint = (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) != 0;
     
    22522287                    const int controlTop = 6;
    22532288                    const int controlHeight = height - controlTop - 3;
    2254                     int iconExtent = pixelMetric(PM_SmallIconSize);
     2289                    int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
    22552290                    QSize iconSize = tb->icon.actualSize(QSize(iconExtent, iconExtent));
    22562291                    if (tb->icon.isNull())
     
    22632298                }
    22642299                break;
     2300            default:
     2301                break;
    22652302            }
    22662303        }
     
    22732310
    22742311/*!
    2275  \reimp
     2312 \internal
    22762313 */
    22772314bool QWindowsVistaStyle::event(QEvent *e)
     
    22962333
    22972334/*!
    2298  \reimp
     2335 \internal
    22992336 */
    23002337QStyle::SubControl QWindowsVistaStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option,
     
    23082345
    23092346/*!
    2310  \reimp
     2347 \internal
    23112348 */
    23122349int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
     
    23182355
    23192356    case PM_DockWidgetTitleBarButtonMargin:
    2320         return 5;
     2357        return int(QStyleHelper::dpiScaled(5.));
    23212358    case PM_ScrollBarSliderMin:
    2322         return 18;
     2359        return int(QStyleHelper::dpiScaled(18.));
    23232360    case PM_MenuHMargin:
    23242361    case PM_MenuVMargin:
     
    23332370
    23342371/*!
    2335  \reimp
     2372 \internal
    23362373 */
    23372374QPalette QWindowsVistaStyle::standardPalette() const
     
    23412378
    23422379/*!
    2343  \reimp
     2380 \internal
    23442381 */
    23452382void QWindowsVistaStyle::polish(QApplication *app)
     
    23492386
    23502387/*!
    2351  \reimp
     2388 \internal
    23522389 */
    23532390void QWindowsVistaStyle::polish(QWidget *widget)
     
    23972434        tree->viewport()->setAttribute(Qt::WA_Hover);
    23982435    }
     2436    else if (QListView *list = qobject_cast<QListView *> (widget)) {
     2437        list->viewport()->setAttribute(Qt::WA_Hover);
     2438    }
    23992439}
    24002440
    24012441/*!
    2402  \reimp
     2442 \internal
    24032443 */
    24042444void QWindowsVistaStyle::unpolish(QWidget *widget)
     
    24332473        tree->viewport()->setAttribute(Qt::WA_Hover, false);
    24342474    } else if (qobject_cast<QCommandLinkButton*>(widget)) {
    2435         QFont font = qApp->font("QCommandLinkButton");
     2475        QFont font = QApplication::font("QCommandLinkButton");
    24362476        QFont widgetFont = widget->font();
    24372477        widgetFont.setFamily(font.family()); //Only family set by polish
     
    24422482
    24432483/*!
    2444  \reimp
     2484 \internal
    24452485 */
    24462486void QWindowsVistaStyle::unpolish(QApplication *app)
     
    24502490
    24512491/*!
    2452  \reimp
     2492 \internal
    24532493 */
    24542494void QWindowsVistaStyle::polish(QPalette &pal)
     
    24592499
    24602500/*!
    2461  \reimp
     2501 \internal
    24622502 */
    24632503QPixmap QWindowsVistaStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option,
     
    24952535            !QWindowsVistaStylePrivate::useVista())
    24962536        {
    2497             Animation *a = animations.takeAt(i);
     2537            QWindowsVistaAnimation *a = animations.takeAt(i);
    24982538            delete a;
    24992539        }
     
    25082548    for (int i = animations.size() - 1 ; i >= 0 ; --i) {
    25092549        if (animations[i]->widget() == w) {
    2510             Animation *a = animations.takeAt(i);
     2550            QWindowsVistaAnimation *a = animations.takeAt(i);
    25112551            delete a;
    25122552            break;
     
    25152555}
    25162556
    2517 void QWindowsVistaStylePrivate::startAnimation(Animation *t)
     2557void QWindowsVistaStylePrivate::startAnimation(QWindowsVistaAnimation *t)
    25182558{
    25192559    Q_Q(QWindowsVistaStyle);
     
    25282568{
    25292569    BOOL animEnabled = false;
    2530     if (QT_WA_INLINE(SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0),
    2531                      SystemParametersInfoA(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0)
    2532     ))
     2570    if (SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0))
    25332571    {
    25342572        if (animEnabled)
     
    25392577
    25402578
    2541 Animation * QWindowsVistaStylePrivate::widgetAnimation(const QWidget *widget) const
     2579QWindowsVistaAnimation * QWindowsVistaStylePrivate::widgetAnimation(const QWidget *widget) const
    25422580{
    25432581    if (!widget)
    25442582        return 0;
    2545     foreach (Animation *a, animations) {
     2583    foreach (QWindowsVistaAnimation *a, animations) {
    25462584        if (a->widget() == widget)
    25472585            return a;
  • trunk/src/gui/styles/qwindowsvistastyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qwindowsvistastyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7777#include <qprogressbar.h>
    7878#include <qdockwidget.h>
     79#include <qlistview.h>
    7980#include <qtreeview.h>
    8081#include <qtextedit.h>
     
    8485#include <qtreeview.h>
    8586#include <qlistview.h>
     87#include <qtableview.h>
    8688#include <qbasictimer.h>
    8789#include <qcommandlinkbutton.h>
     
    135137#endif
    136138
    137 class Animation
     139class QWindowsVistaAnimation
    138140{
    139141public :
    140     Animation() : _running(true) { }
    141     virtual ~Animation() { }
     142    QWindowsVistaAnimation() : _running(true) { }
     143    virtual ~QWindowsVistaAnimation() { }
    142144    QWidget * widget() const { return _widget; }
    143145    bool running() const { return _running; }
     
    160162
    161163// Handles state transition animations
    162 class Transition : public Animation
     164class QWindowsVistaTransition : public QWindowsVistaAnimation
    163165{
    164166public :
    165     Transition() : Animation() {}
    166     virtual ~Transition() { }
     167    QWindowsVistaTransition() : QWindowsVistaAnimation() {}
     168    virtual ~QWindowsVistaTransition() { }
    167169    void setDuration(int duration) { _duration = duration; }
    168170    void setStartImage(const QImage &image) { _primaryImage = image; }
     
    175177
    176178// Handles pulse animations (default buttons)
    177 class Pulse: public Animation
     179class QWindowsVistaPulse: public QWindowsVistaAnimation
    178180{
    179181public :
    180     Pulse() : Animation() {}
    181     virtual ~Pulse() { }
     182    QWindowsVistaPulse() : QWindowsVistaAnimation() {}
     183    virtual ~QWindowsVistaPulse() { }
    182184    void setDuration(int duration) { _duration = duration; }
    183185    void setPrimaryImage(const QImage &image) { _primaryImage = image; }
     
    198200    static bool resolveSymbols();
    199201    static inline bool useVista();
    200     void startAnimation(Animation *);
     202    void startAnimation(QWindowsVistaAnimation *);
    201203    void stopAnimation(const QWidget *);
    202     Animation* widgetAnimation(const QWidget *) const;
     204    QWindowsVistaAnimation* widgetAnimation(const QWidget *) const;
    203205    void timerEvent();
    204206    bool transitionsEnabled() const;
     
    206208
    207209private:
    208     QList <Animation*> animations;
     210    QList <QWindowsVistaAnimation*> animations;
    209211    QBasicTimer animationTimer;
    210212    QWidget *m_treeViewHelper;
  • trunk/src/gui/styles/qwindowsxpstyle.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4747#include <private/qpaintengine_raster_p.h>
    4848#include <private/qapplication_p.h>
     49#include <private/qstylehelper_p.h>
     50#include <private/qwidget_p.h>
    4951#include <qlibrary.h>
    5052#include <qpainter.h>
     
    125127// General const values
    126128static const int windowsItemFrame        =  2; // menu item frame width
    127 static const int windowsSepHeight        =  9; // separator item height
    128129static const int windowsItemHMargin      =  3; // menu item hor text margin
    129130static const int windowsItemVMargin      =  0; // menu item ver text margin
    130131static const int windowsArrowHMargin     =  6; // arrow horizontal margin
    131 static const int windowsCheckMarkHMargin =  0; // horiz. margins of check mark
    132132static const int windowsRightBorder      = 12; // right border on windows
    133133
    134134// External function calls
    135135extern Q_GUI_EXPORT HDC qt_win_display_dc();
     136extern QRegion qt_region_from_HRGN(HRGN rgn);
    136137
    137138
     
    161162
    162163    if (!htheme) {
    163         htheme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget),
    164                                 (TCHAR*)name.utf16());
     164        htheme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), (wchar_t*)name.utf16());
    165165        if (htheme) {
    166166            if (!QWindowsXPStylePrivate::handleMap)
     
    261261    cleanupHandleMap();
    262262    if (limboWidget) {
    263         if (qApp->closingDown())
     263        if (QApplication::closingDown())
    264264            delete limboWidget;
    265265        else
     
    301301    if (!limboWidget) {
    302302        limboWidget = new QWidget(0);
     303        limboWidget->createWinId();
    303304        limboWidget->setObjectName(QLatin1String("xp_limbo_widget"));
     305        // We dont need this internal widget to appear in QApplication::topLevelWidgets()
     306        if (QWidgetPrivate::allWidgets)
     307            QWidgetPrivate::allWidgets->remove(limboWidget);
    304308    }
    305309
     
    446450}
    447451
     452
    448453/*! \internal
    449454    Returns a QRegion of the region of the part
     
    457462        return QRegion();
    458463
    459     QRegion rgn = QRegion(0,0,1,1);
    460     const bool success = CombineRgn(rgn.handle(), hRgn, 0, RGN_COPY) != ERROR;
     464    HRGN dest = CreateRectRgn(0, 0, 0, 0);
     465    const bool success = CombineRgn(dest, hRgn, 0, RGN_COPY) != ERROR;
     466
     467    QRegion region;
     468
     469    if (success)
     470        region = qt_region_from_HRGN(dest);
     471
    461472    DeleteObject(hRgn);
    462     if (success)
    463         return rgn;
    464     return QRegion();
     473    DeleteObject(dest);
     474
     475    return region;
    465476}
    466477
     
    581592            register unsigned int alphaValue = (*buffer) & 0xFF000000;
    582593            if (alphaValue == 0xFF000000) {
    583                 *buffer &= 0x00FFFFFF;
     594                *buffer = 0;
    584595                valueChange = true;
    585596            } else if (alphaValue == 0) {
     
    608619    QPainter *painter = themeData.painter;
    609620    Q_ASSERT_X(painter != 0, "QWindowsXPStylePrivate::drawBackground()", "Trying to draw a theme part without a painter");
    610     if (!painter)
     621    if (!painter || !painter->isActive())
    611622        return;
    612623
    613624    painter->save();
    614625
    615     QMatrix m = painter->matrix();
    616     bool complexXForm = m.m11() != 1.0 || m.m22() != 1.0 || m.m12() != 0.0 || m.m21() != 0.0;
     626    bool complexXForm = painter->deviceTransform().type() > QTransform::TxTranslate;
     627
     628    bool translucentToplevel = false;
     629    QPaintDevice *pdev = painter->device();
     630    if (pdev->devType() == QInternal::Widget) {
     631        QWidget *win = ((QWidget *) pdev)->window();
     632        translucentToplevel = win->testAttribute(Qt::WA_TranslucentBackground);
     633    }
    617634
    618635    bool useFallback = painter->paintEngine()->getDC() == 0
     
    621638                       || complexXForm
    622639                       || themeData.mirrorVertically
    623                        || (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0);
     640                       || (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0)
     641                       || translucentToplevel;
     642
    624643    if (!useFallback)
    625644        drawBackgroundDirectly(themeData);
     
    10261045    QWindowsStyle, QCommonStyle, and QStyle, but the
    10271046    QWindowsXPStyle overloads of drawComplexControl(), drawControl(),
    1028     drawControlMask(), drawPrimitive(), subControlRect(), and
     1047    drawControlMask(), drawPrimitive(), proxy()->subControlRect(), and
    10291048    sizeFromContents(), are documented here.
    10301049
     
    11931212            otherOption.shape = (twfOption->shape == QTabBar::RoundedNorth
    11941213                                ? QTabBar::RoundedEast : QTabBar::RoundedSouth);
    1195             int overlap = pixelMetric(PM_TabBarBaseOverlap, &otherOption, widget);
    1196             int borderThickness = pixelMetric(PM_DefaultFrameWidth, option, widget);
     1214            int overlap = proxy()->pixelMetric(PM_TabBarBaseOverlap, &otherOption, widget);
     1215            int borderThickness = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
    11971216            rect.adjust(-overlap + borderThickness, 0, -overlap + borderThickness, 0);
    11981217        }
     
    12031222            MARGINS borderSize;
    12041223            if (widget) {
    1205                 HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button");
     1224                XPThemeData buttontheme(widget, 0, QLatin1String("Button"));
     1225                HTHEME theme = buttontheme.handle();
    12061226                if (theme) {
    12071227                    int stateId;
     
    12171237                        stateId = PBS_NORMAL;
    12181238
    1219                     int border = pixelMetric(PM_DefaultFrameWidth, btn, widget);
     1239                    int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
    12201240                    rect = option->rect.adjusted(border, border, -border, -border);
    12211241
     
    15331553
    15341554            if (panel->lineWidth > 0)
    1535                 drawPrimitive(PE_FrameLineEdit, panel, p, widget);
     1555                proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget);
    15361556            return;
    15371557        }
     
    15471567                bool useGradient = true;
    15481568                const int maxlength = 256;
    1549                 WCHAR themeFileName[maxlength];
    1550                 WCHAR themeColor[maxlength];
     1569                wchar_t themeFileName[maxlength];
     1570                wchar_t themeColor[maxlength];
    15511571                // Due to a a scaling issue with the XP Silver theme, tab gradients are not used with it
    15521572                if (pGetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) {
    1553                     WCHAR* offset;
     1573                    wchar_t *offset = 0;
    15541574                    if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) {
    15551575                        offset++;
     
    15621582                // code, when using the HDC directly..
    15631583                if (useGradient) {
    1564                     QStyleOptionTabWidgetFrame frameOpt = *tab;
     1584                    QStyleOptionTabWidgetFrameV2 frameOpt = *tab;
    15651585                    frameOpt.rect = widget->rect();
    15661586                    QRect contentsRect = subElementRect(SE_TabWidgetTabContents, &frameOpt, widget);
     
    16181638                stateId = FS_INACTIVE;
    16191639
    1620             int fwidth = pixelMetric(PM_DockWidgetFrameWidth, frm, widget);
     1640            int fwidth = proxy()->pixelMetric(PM_DockWidgetFrameWidth, frm, widget);
    16211641
    16221642            XPThemeData theme(widget, p, name, 0, stateId);
     
    17921812
    17931813    case PE_IndicatorToolBarSeparator:
    1794 
     1814        if (option->rect.height() < 3) {
     1815            // XP style requires a few pixels for the separator
     1816            // to be visible.
     1817            QWindowsStyle::drawPrimitive(pe, option, p, widget);
     1818            return;
     1819        }
    17951820        name = QLatin1String("TOOLBAR");
    17961821        partId = TP_SEPARATOR;
     
    18211846        button.QStyleOption::operator=(*option);
    18221847        button.state &= ~State_MouseOver;
    1823         drawPrimitive(PE_IndicatorCheckBox, &button, p, widget);
     1848        proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, p, widget);
    18241849        return;
    18251850    }
     
    19141939            name = QLatin1String("BUTTON");
    19151940            partId = BP_PUSHBUTTON;
    1916             bool justFlat = (btn->features & QStyleOptionButton::Flat) && !(flags & (State_On|State_Sunken))
    1917                 || (btn->features & QStyleOptionButton::CommandLinkButton
     1941            bool justFlat = ((btn->features & QStyleOptionButton::Flat) && !(flags & (State_On|State_Sunken)))
     1942                || ((btn->features & QStyleOptionButton::CommandLinkButton)
    19181943                    && !(flags & State_MouseOver)
    19191944                    && !(btn->features & QStyleOptionButton::DefaultButton));
     
    19491974                QStyleOptionButton newBtn = *btn;
    19501975                newBtn.rect = QRect(ir.right() - mbiw - 1, 1 + (ir.height()/2) - (mbih/2), mbiw, mbih);
    1951                 drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
     1976                proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
    19521977            }
    19531978            return;
     
    19721997            bool firstTab = tab->position == QStyleOptionTab::Beginning;
    19731998            bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
    1974             bool leftAligned = styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignLeft;
    1975             bool centerAligned = styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignCenter;
    1976             int borderThickness = pixelMetric(PM_DefaultFrameWidth, option, widget);
    1977             int tabOverlap = pixelMetric(PM_TabBarTabOverlap, option, widget);
     1999            bool leftAligned = proxy()->styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignLeft;
     2000            bool centerAligned = proxy()->styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignCenter;
     2001            int borderThickness = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
     2002            int tabOverlap = proxy()->pixelMetric(PM_TabBarTabOverlap, option, widget);
    19782003
    19792004            if (isDisabled)
     
    21202145                    mode = QIcon::Active;
    21212146                QPixmap pixmap = checked ?
    2122                                  menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On) :
    2123                                  menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode);
     2147                                 menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On) :
     2148                                 menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode);
    21242149                int pixw = pixmap.width();
    21252150                int pixh = pixmap.height();
     
    21472172                                            menuitem->rect.height() - 2*windowsItemFrame);
    21482173                newMi.rect = visualRect(option->direction, option->rect, checkMarkRect);
    2149                 drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget);
     2174                proxy()->drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget);
    21502175            }
    21512176
     
    21642189                int t = s.indexOf(QLatin1Char('\t'));
    21652190                int text_flags = Qt::AlignVCenter|Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine | Qt::AlignLeft;
    2166                 if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
     2191                if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
    21672192                    text_flags |= Qt::TextHideMnemonic;
    21682193                // draw tab text ----------------
    21692194                if (t >= 0) {
    21702195                    QRect vShortcutRect = visualRect(option->direction, option->rect, QRect(textRect.topRight(), menuitem->rect.bottomRight()));
    2171                     if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) {
     2196                    if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
    21722197                        p->setPen(menuitem->palette.light().color());
    21732198                        p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1));
     
    21812206                    font.setBold(true);
    21822207                p->setFont(font);
    2183                 if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) {
     2208                if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
    21842209                    p->setPen(menuitem->palette.light().color());
    21852210                    p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t));
     
    22022227                if (act)
    22032228                    newMI.palette.setColor(QPalette::ButtonText, newMI.palette.highlightedText().color());
    2204                 drawPrimitive(arrow, &newMI, p, widget);
     2229                proxy()->drawPrimitive(arrow, &newMI, p, widget);
    22052230            }
    22062231        }
     
    22192244            QPalette::ColorRole textRole = dis ? QPalette::Text:
    22202245                                           act ? QPalette::HighlightedText : QPalette::ButtonText;
    2221             QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal);
     2246            QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal);
    22222247
    22232248            uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
    2224             if (!styleHint(SH_UnderlineShortcut, mbi, widget))
     2249            if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
    22252250                alignment |= Qt::TextHideMnemonic;
    22262251
     
    22372262        {
    22382263            int buttonMargin = 4;
    2239             int mw = pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget);
    2240             int fw = pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget);
     2264            int mw = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget);
     2265            int fw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget);
    22412266            bool isFloating = widget && widget->isWindow();
    22422267            bool isActive = dwOpt->state & State_Active;
     
    22592284
    22602285            if (dwOpt->closable) {
    2261                 QSize sz = standardIcon(QStyle::SP_TitleBarCloseButton, dwOpt, widget).actualSize(QSize(10, 10));
     2286                QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarCloseButton, dwOpt, widget).actualSize(QSize(10, 10));
    22622287                titleRect.adjust(0, 0, -sz.width() - mw - buttonMargin, 0);
    22632288            }
    22642289
    22652290            if (dwOpt->floatable) {
    2266                 QSize sz = standardIcon(QStyle::SP_TitleBarMaxButton, dwOpt, widget).actualSize(QSize(10, 10));
     2291                QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarMaxButton, dwOpt, widget).actualSize(QSize(10, 10));
    22672292                titleRect.adjust(0, 0, -sz.width() - mw - buttonMargin, 0);
    22682293            }
     
    22702295            if (isFloating) {
    22712296                titleRect.adjust(0, -fw, 0, 0);
    2272                 if (widget != 0 && widget->windowIcon().cacheKey() != qApp->windowIcon().cacheKey())
     2297                if (widget != 0 && widget->windowIcon().cacheKey() != QApplication::windowIcon().cacheKey())
    22732298                    titleRect.adjust(titleRect.height() + mw, 0, 0, 0);
    22742299            } else {
     
    23172342
    23182343                QIcon ico = widget->windowIcon();
    2319                 bool hasIcon = (ico.cacheKey() != qApp->windowIcon().cacheKey());
     2344                bool hasIcon = (ico.cacheKey() != QApplication::windowIcon().cacheKey());
    23202345                if (hasIcon) {
    23212346                    QPixmap pxIco = ico.pixmap(titleHeight);
    2322                     if (!verticalTitleBar && QApplication::layoutDirection() == Qt::RightToLeft)
     2347                    if (!verticalTitleBar && dwOpt->direction == Qt::RightToLeft)
    23232348                        p->drawPixmap(rect.width() - titleHeight - pxIco.width(), rect.bottom() - titleHeight - 2, pxIco);
    23242349                    else
     
    24502475            }
    24512476            if (sub & SC_SpinBoxUp) {
    2452                 theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
     2477                theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
    24532478                partId = SPNP_UP;
    24542479                if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled))
     
    24652490            }
    24662491            if (sub & SC_SpinBoxDown) {
    2467                 theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
     2492                theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
    24682493                partId = SPNP_DOWN;
    24692494                if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) || !(flags & State_Enabled))
     
    25022527                }
    25032528                if (!cmb->editable) {
    2504                     QRect re = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget);
     2529                    QRect re = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget);
    25052530                    if (option->state & State_HasFocus) {
    25062531                        p->fillRect(re, option->palette.highlight());
     
    25172542            if (sub & SC_ComboBoxArrow) {
    25182543                XPThemeData theme(widget, p, QLatin1String("COMBOBOX"));
    2519                 theme.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
     2544                theme.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
    25202545                partId = CP_DROPDOWNBUTTON;
    25212546                if (!(flags & State_Enabled))
     
    25452570            bool isRTL  = option->direction == Qt::RightToLeft;
    25462571            if (sub & SC_ScrollBarAddLine) {
    2547                 theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
     2572                theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
    25482573                partId = SBP_ARROWBTN;
    25492574                if (!(flags & State_Enabled))
     
    25602585            }
    25612586            if (sub & SC_ScrollBarSubLine) {
    2562                 theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
     2587                theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
    25632588                partId = SBP_ARROWBTN;
    25642589                if (!(flags & State_Enabled))
     
    25752600            }
    25762601            if (maxedOut) {
    2577                 theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
    2578                 theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
    2579                 theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
     2602                theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
     2603                theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
     2604                theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
    25802605                partId = scrollbar->orientation == Qt::Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
    25812606                stateId = SCRBS_DISABLED;
     
    25852610            } else {
    25862611                if (sub & SC_ScrollBarSubPage) {
    2587                     theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
     2612                    theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
    25882613                    partId = flags & State_Horizontal ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT;
    25892614                    if (!(flags & State_Enabled))
     
    26002625                }
    26012626                if (sub & SC_ScrollBarAddPage) {
    2602                     theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
     2627                    theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
    26032628                    partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
    26042629                    if (!(flags & State_Enabled))
     
    26152640                }
    26162641                if (sub & SC_ScrollBarSlider) {
    2617                     theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
     2642                    theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
    26182643                    if (!(flags & State_Enabled))
    26192644                        stateId = SCRBS_DISABLED;
     
    26262651
    26272652                    // Draw handle
    2628                     theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
     2653                    theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
    26292654                    theme.partId = flags & State_Horizontal ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT;
    26302655                    theme.stateId = stateId;
     
    26612686                    if (!gripperBounds.isEmpty()) {
    26622687                        p->save();
    2663                         XPThemeData grippBackground = theme;
    2664                         grippBackground.partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
    26652688                        theme.rect = gripperBounds;
    26662689                        p->setClipRegion(d->region(theme));// Only change inside the region of the gripper
    2667                         d->drawBackground(grippBackground);// The gutter is the grippers background
    26682690                        d->drawBackground(theme);          // Transparent gripper ontop of background
    26692691                        p->restore();
     
    26822704            QRegion tickreg = slrect;
    26832705            if (sub & SC_SliderGroove) {
    2684                 theme.rect = subControlRect(CC_Slider, option, SC_SliderGroove, widget);
     2706                theme.rect = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
    26852707                if (slider->orientation == Qt::Horizontal) {
    26862708                    partId = TKP_TRACK;
     
    26982720            }
    26992721            if (sub & SC_SliderTickmarks) {
    2700                 int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
     2722                int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
    27012723                int ticks = slider->tickPosition;
    2702                 int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
    2703                 int len = pixelMetric(PM_SliderLength, slider, widget);
    2704                 int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
     2724                int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
     2725                int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
     2726                int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
    27052727                int interval = slider->tickInterval;
    27062728                if (interval <= 0) {
     
    27582780            }
    27592781            if (sub & SC_SliderHandle) {
    2760                 theme.rect = subControlRect(CC_Slider, option, SC_SliderHandle, widget);
     2782                theme.rect = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
    27612783                if (slider->orientation == Qt::Horizontal) {
    27622784                    if (slider->tickPosition == QSlider::TicksAbove)
     
    28042826                fropt.QStyleOption::operator=(*slider);
    28052827                fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
    2806                 drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
     2828                proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
    28072829            }
    28082830        }
     
    28142836            = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
    28152837            QRect button, menuarea;
    2816             button = subControlRect(cc, toolbutton, SC_ToolButton, widget);
    2817             menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
     2838            button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget);
     2839            menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
    28182840
    28192841            State bflags = toolbutton->state & ~State_Sunken;
    28202842            State mflags = bflags;
    2821 
    2822             if (bflags & State_AutoRaise) {
     2843            bool autoRaise = flags & State_AutoRaise;
     2844            if (autoRaise) {
    28232845                if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) {
    28242846                    bflags &= ~State_Raised;
     
    28352857                }
    28362858            }
    2837            
     2859
    28382860            QStyleOption tool(0);
    28392861            tool.palette = toolbutton->palette;
    28402862            if (toolbutton->subControls & SC_ToolButton) {
    2841                 if (flags & (State_Sunken | State_On | State_Raised) || !(flags & State_AutoRaise)) {
    2842                     if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup) {
     2863                if (flags & (State_Sunken | State_On | State_Raised) || !autoRaise) {
     2864                    if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup && autoRaise) {
    28432865                        XPThemeData theme(widget, p, QLatin1String("TOOLBAR"));
    28442866                        theme.partId = TP_SPLITBUTTON;
     
    28592881                        d->drawBackground(theme);
    28602882                    } else {
    2861                         tool.rect = button;
     2883                        tool.rect = option->rect;
    28622884                        tool.state = bflags;
    2863                         if (widget && !qobject_cast<QToolBar*>(widget->parentWidget())
    2864                                    && !(bflags & State_AutoRaise))
    2865                             drawPrimitive(PE_PanelButtonBevel, &tool, p, widget);
     2885                        if (autoRaise) // for tool bars
     2886                            proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
    28662887                        else
    2867                             drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
     2888                            proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, widget);
    28682889                    }
    28692890                }
     
    28752896                fr.rect.adjust(3, 3, -3, -3);
    28762897                if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
    2877                     fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator,
     2898                    fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
    28782899                                                      toolbutton, widget), 0);
    2879                 drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
     2900                proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
    28802901            }
    28812902            QStyleOptionToolButton label = *toolbutton;
    28822903            label.state = bflags;
    28832904            int fw = 2;
     2905            if (!autoRaise)
     2906                label.state &= ~State_Sunken;
    28842907            label.rect = button.adjusted(fw, fw, -fw, -fw);
    2885             drawControl(CE_ToolButtonLabel, &label, p, widget);
     2908            proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
    28862909
    28872910            if (toolbutton->subControls & SC_ToolButtonMenu) {
    28882911                tool.rect = menuarea;
    28892912                tool.state = mflags;
    2890                 drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
     2913                if (autoRaise) {
     2914                    proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
     2915                } else {
     2916                    tool.state = mflags;
     2917                    menuarea.adjust(-2, 0, 0, 0);
     2918                    // Draw menu button
     2919                    if ((bflags & State_Sunken) != (mflags & State_Sunken)){
     2920                        p->save();
     2921                        p->setClipRect(menuarea);
     2922                        tool.rect = option->rect;
     2923                        proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, 0);
     2924                        p->restore();
     2925                    }
     2926                    // Draw arrow
     2927                    p->save();
     2928                    p->setPen(option->palette.dark().color());
     2929                    p->drawLine(menuarea.left(), menuarea.top() + 3,
     2930                                menuarea.left(), menuarea.bottom() - 3);
     2931                    p->setPen(option->palette.light().color());
     2932                    p->drawLine(menuarea.left() - 1, menuarea.top() + 3,
     2933                                menuarea.left() - 1, menuarea.bottom() - 3);
     2934
     2935                    tool.rect = menuarea.adjusted(2, 3, -2, -1);
     2936                    proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
     2937                    p->restore();
     2938                }
    28912939            } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
    2892                 int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
     2940                int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
    28932941                QRect ir = toolbutton->rect;
    28942942                QStyleOptionToolButton newBtn = *toolbutton;
    28952943                newBtn.rect = QRect(ir.right() + 4 - mbi, ir.height() - mbi + 4, mbi - 5, mbi - 5);
    2896                 drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
     2944                proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
    28972945            }
    28982946        }
     
    29262974                    d->drawBackground(theme);
    29272975
    2928                     QRect ir = subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
     2976                    QRect ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
    29292977
    29302978                    int result = TST_NONE;
     
    29452993                }
    29462994                if (sub & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
    2947                     theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarSysMenu, widget);
     2995                    theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarSysMenu, widget);
    29482996                    partId = WP_SYSBUTTON;
    29492997                    if ((widget && !widget->isEnabled()) || !isActive)
     
    29633011                        pGetThemePartSize(theme.handle(), qt_win_display_dc(), theme.partId, theme.stateId, 0, TS_TRUE, &sz);
    29643012                        if (sz.cx == 0 || sz.cy == 0) {
    2965                             int iconSize = pixelMetric(PM_SmallIconSize, tb, widget);
    2966                             QPixmap pm = standardIcon(SP_TitleBarMenuButton, tb, widget).pixmap(iconSize, iconSize);
     3013                            int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget);
     3014                            QPixmap pm = proxy()->standardIcon(SP_TitleBarMenuButton, tb, widget).pixmap(iconSize, iconSize);
    29673015                            p->save();
    29683016                            drawItemPixmap(p, theme.rect, Qt::AlignCenter, pm);
     
    29763024                if (sub & SC_TitleBarMinButton && tb->titleBarFlags & Qt::WindowMinimizeButtonHint
    29773025                        && !(tb->titleBarState & Qt::WindowMinimized)) {
    2978                     theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarMinButton, widget);
     3026                    theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarMinButton, widget);
    29793027                    partId = WP_MINBUTTON;
    29803028                    if (widget && !widget->isEnabled())
     
    29943042                if (sub & SC_TitleBarMaxButton && tb->titleBarFlags & Qt::WindowMaximizeButtonHint
    29953043                        && !(tb->titleBarState & Qt::WindowMaximized)) {
    2996                     theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarMaxButton, widget);
     3044                    theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarMaxButton, widget);
    29973045                    partId = WP_MAXBUTTON;
    29983046                    if (widget && !widget->isEnabled())
     
    30123060                if (sub & SC_TitleBarContextHelpButton
    30133061                    && tb->titleBarFlags & Qt::WindowContextHelpButtonHint) {
    3014                     theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarContextHelpButton, widget);
     3062                    theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarContextHelpButton, widget);
    30153063                    partId = WP_HELPBUTTON;
    30163064                    if (widget && !widget->isEnabled())
     
    30343082                                        && (tb->titleBarState & Qt::WindowMaximized)));
    30353083                if (drawNormalButton) {
    3036                     theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarNormalButton, widget);
     3084                    theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarNormalButton, widget);
    30373085                    partId = WP_RESTOREBUTTON;
    30383086                    if (widget && !widget->isEnabled())
     
    30523100                if (sub & SC_TitleBarShadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint
    30533101                        && !(tb->titleBarState & Qt::WindowMinimized)) {
    3054                     theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarShadeButton, widget);
     3102                    theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarShadeButton, widget);
    30553103                    partId = WP_MINBUTTON;
    30563104                    if (widget && !widget->isEnabled())
     
    30703118                if (sub & SC_TitleBarUnshadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint
    30713119                        && tb->titleBarState & Qt::WindowMinimized) {
    3072                     theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarUnshadeButton, widget);
     3120                    theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarUnshadeButton, widget);
    30733121                    partId = WP_RESTOREBUTTON;
    30743122                    if (widget && !widget->isEnabled())
     
    30873135                }
    30883136                if (sub & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
    3089                     theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarCloseButton, widget);
     3137                    theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarCloseButton, widget);
    30903138                    //partId = titlebar->testWFlags(Qt::WA_WState_Tool) ? WP_SMALLCLOSEBUTTON : WP_CLOSEBUTTON;
    30913139                    partId = WP_CLOSEBUTTON;
     
    31153163
    31163164            if (option->subControls & SC_MdiCloseButton) {
    3117                 buttonRect = subControlRect(CC_MdiControls, option, SC_MdiCloseButton, widget);
     3165                buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiCloseButton, widget);
    31183166                if (theme.isValid()) {
    31193167                    theme.partId = WP_MDICLOSEBUTTON;
     
    31313179            }
    31323180            if (option->subControls & SC_MdiNormalButton) {
    3133                 buttonRect = subControlRect(CC_MdiControls, option, SC_MdiNormalButton, widget);
     3181                buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiNormalButton, widget);
    31343182                if (theme.isValid()) {
    31353183                    theme.partId = WP_MDIRESTOREBUTTON;
     
    31473195            }
    31483196            if (option->subControls & QStyle::SC_MdiMinButton) {
    3149                 buttonRect = subControlRect(CC_MdiControls, option, SC_MdiMinButton, widget);
     3197                buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiMinButton, widget);
    31503198                if (theme.isValid()) {
    31513199                    theme.partId = WP_MDIMINBUTTON;
     
    31653213        break;
    31663214#endif //QT_NO_WORKSPACE
     3215#ifndef QT_NO_DIAL
     3216    case CC_Dial:
     3217        if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
     3218            QStyleHelper::drawDial(dial, p);
     3219        break;
     3220#endif // QT_NO_DIAL
    31673221    default:
    31683222        QWindowsStyle::drawComplexControl(cc, option, p, widget);
     
    32243278
    32253279    case PM_SplitterWidth:
    3226         res = qMax(5, QApplication::globalStrut().width());
     3280        res = qMax(int(QStyleHelper::dpiScaled(5.)), QApplication::globalStrut().width());
    32273281        break;
    32283282
     
    32343288                SIZE size;
    32353289                pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
    3236                 res = (pm == PM_IndicatorWidth ? size.cx+2 : res = size.cy+2);
     3290                res = (pm == PM_IndicatorWidth) ? size.cx : size.cy;
    32373291            }
    32383292        }
     
    32463300                SIZE size;
    32473301                pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
    3248                 res = (pm == PM_ExclusiveIndicatorWidth ? size.cx+2 : res = size.cy+2);
     3302                res = (pm == PM_ExclusiveIndicatorWidth) ? size.cx : size.cy;
    32493303            }
    32503304        }
     
    32723326                pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
    32733327                res = size.cy;
    3274             }
    3275         }
    3276         break;
    3277 
    3278     case PM_MenuButtonIndicator:
    3279         {
    3280             XPThemeData theme(widget, 0, QLatin1String("TOOLBAR"), TP_SPLITBUTTONDROPDOWN);
    3281             if (theme.isValid()) {
    3282                 SIZE size;
    3283                 pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
    3284                 res = size.cx;
    32853328            }
    32863329        }
     
    33183361#ifndef QT_NO_TOOLBAR
    33193362    case PM_ToolBarHandleExtent:
    3320         res = 8;
     3363        res = int(QStyleHelper::dpiScaled(8.));
    33213364        break;
    33223365
     
    33333376    break;
    33343377    case PM_DockWidgetSeparatorExtent:
    3335         res = 4;
     3378        res = int(QStyleHelper::dpiScaled(4.));
    33363379        break;
    33373380    case PM_DockWidgetTitleMargin:
    3338         res = 4;
     3381        res = int(QStyleHelper::dpiScaled(4.));
    33393382        break;
    33403383
     
    33453388        else
    33463389            res = 0;
     3390        break;
     3391
     3392    case PM_ButtonDefaultIndicator:
     3393        res = 0;
    33473394        break;
    33483395
     
    34283475            const int delta = buttonWidth + 2;
    34293476            int controlTop = option->rect.bottom() - buttonHeight - 2;
    3430             const int frameWidth = pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
     3477            const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
    34313478            const bool sysmenuHint  = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0;
    34323479            const bool minimizeHint = (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) != 0;
     
    35133560                    const int controlTop = 6;
    35143561                    const int controlHeight = height - controlTop - 3;
    3515                     const int iconExtent = pixelMetric(PM_SmallIconSize);
     3562                    const int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
    35163563                    QSize iconSize = tb->icon.actualSize(QSize(iconExtent, iconExtent));
    35173564                    if (tb->icon.isNull())
     
    35223569                }
    35233570                break;
     3571            default:
     3572                break;
    35243573            }
    35253574        }
     
    35473596            case SC_ComboBoxListBoxPopup:
    35483597                rect = cmb->rect;
     3598                break;
     3599
     3600            default:
    35493601                break;
    35503602            }
     
    36123664    case CT_ComboBox:
    36133665        {
    3614             HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button");
     3666            XPThemeData buttontheme(widget, 0, QLatin1String("Button"));
     3667            HTHEME theme = buttontheme.handle();
    36153668            MARGINS borderSize;
    36163669            if (theme) {
     
    36343687            //Spinbox adds frame twice
    36353688            sz = QWindowsStyle::sizeFromContents(ct, option, contentsSize, widget);
    3636             int border = pixelMetric(PM_SpinBoxFrameWidth, option, widget);
     3689            int border = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
    36373690            sz -= QSize(2*border, 2*border);
    36383691        }
     
    37273780            const QStyleOptionTitleBar *titlebar = qstyleoption_cast<const QStyleOptionTitleBar *>(option);
    37283781            if (mask && titlebar) {
     3782                // Note certain themes will not return the whole window frame but only the titlebar part when
     3783                // queried This function needs to return the entire window mask, hence we will only fetch the mask for the
     3784                // titlebar itself and add the remaining part of the window rect at the bottom.
     3785                int tbHeight = proxy()->pixelMetric(PM_TitleBarHeight, option, widget);
     3786                QRect titleBarRect = option->rect;
     3787                titleBarRect.setHeight(tbHeight);
    37293788                XPThemeData themeData;
    37303789                if (titlebar->titleBarState & Qt::WindowMinimized) {
    3731                     themeData = XPThemeData(widget, 0, QLatin1String("WINDOW"), WP_MINCAPTION, CS_ACTIVE, option->rect);
     3790                    themeData = XPThemeData(widget, 0, QLatin1String("WINDOW"), WP_MINCAPTION, CS_ACTIVE, titleBarRect);
    37323791                } else
    3733                     themeData = XPThemeData(widget, 0, QLatin1String("WINDOW"), WP_CAPTION, CS_ACTIVE, option->rect);
    3734                 mask->region = d->region(themeData);
     3792                    themeData = XPThemeData(widget, 0, QLatin1String("WINDOW"), WP_CAPTION, CS_ACTIVE, titleBarRect);
     3793                mask->region = d->region(themeData) +
     3794                               QRect(0, tbHeight, option->rect.width(), option->rect.height() - tbHeight);
    37353795            }
    37363796        }
     
    37873847            }
    37883848        }
     3849        break;
     3850    default:
    37893851        break;
    37903852    }
     
    39093971        }
    39103972        break;
     3973    default:
     3974        break;
    39113975    }
    39123976
  • trunk/src/gui/styles/qwindowsxpstyle.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/qwindowsxpstyle_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/gui/styles/styles.pri

    r2 r561  
    88        styles/qcommonstylepixmaps_p.h \
    99        styles/qcommonstyle.h \
     10        styles/qstylehelper_p.h \
     11        styles/qproxystyle.h \
     12        styles/qproxystyle_p.h \
    1013        styles/qstylesheetstyle_p.h
     14
    1115SOURCES += \
    1216        styles/qstyle.cpp \
     
    1418        styles/qstyleoption.cpp \
    1519        styles/qstyleplugin.cpp \
     20        styles/qstylehelper.cpp \
    1621        styles/qcommonstyle.cpp \
     22        styles/qproxystyle.cpp \
    1723        styles/qstylesheetstyle.cpp \
    1824        styles/qstylesheetstyle_default.cpp
     
    3238x11{
    3339    QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE
    34     LIBS += $$QT_LIBS_QGTKSTYLE
     40    LIBS_PRIVATE += $$QT_LIBS_QGTKSTYLE
    3541    styles += gtk
    3642}
     
    104110        HEADERS += styles/qgtkstyle.h
    105111        HEADERS += styles/qgtkpainter_p.h
    106         HEADERS += styles/gtksymbols_p.h
     112        HEADERS += styles/qgtkstyle_p.h
    107113        SOURCES += styles/qgtkstyle.cpp
    108114        SOURCES += styles/qgtkpainter.cpp
    109         SOURCES += styles/gtksymbols.cpp
     115        SOURCES += styles/qgtkstyle_p.cpp
    110116        !contains( styles, cleanlooks ) {
    111117                styles += cleanlooks
     
    156162}
    157163
     164contains( styles, s60 ):contains(QT_CONFIG, s60) {
     165        HEADERS += \
     166                styles/qs60style.h \
     167                styles/qs60style_p.h
     168        SOURCES += styles/qs60style.cpp
     169        symbian {
     170                SOURCES += styles/qs60style_s60.cpp
     171                LIBS += -laknicon -laknskins -laknskinsrv -lfontutils -legul
     172        } else {
     173                SOURCES += styles/qs60style_simulated.cpp
     174                RESOURCES += styles/qstyle_s60_simulated.qrc
     175        }
     176} else {
     177        DEFINES += QT_NO_STYLE_S60
     178}
Note: See TracChangeset for help on using the changeset viewer.