39 ** |
39 ** |
40 ****************************************************************************/ |
40 ****************************************************************************/ |
41 |
41 |
42 #include "qwindowsstyle.h" |
42 #include "qwindowsstyle.h" |
43 #include "qwindowsstyle_p.h" |
43 #include "qwindowsstyle_p.h" |
44 #include <private/qstylehelper_p.h> |
|
45 |
44 |
46 #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) |
45 #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) |
47 |
46 |
48 #include "qlibrary.h" |
47 #include "qlibrary.h" |
49 #include "qapplication.h" |
48 #include "qapplication.h" |
495 |
495 |
496 case PM_ScrollBarExtent: |
496 case PM_ScrollBarExtent: |
497 { |
497 { |
498 #ifndef Q_OS_WINCE |
498 #ifndef Q_OS_WINCE |
499 NONCLIENTMETRICS ncm; |
499 NONCLIENTMETRICS ncm; |
500 ncm.cbSize = sizeof(NONCLIENTMETRICS); |
500 ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT); |
501 if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)) |
501 if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)) |
502 ret = qMax(ncm.iScrollHeight, ncm.iScrollWidth); |
502 ret = qMax(ncm.iScrollHeight, ncm.iScrollWidth); |
503 else |
503 else |
504 #endif |
504 #endif |
505 ret = QCommonStyle::pixelMetric(pm, opt, widget); |
505 ret = QCommonStyle::pixelMetric(pm, opt, widget); |
1909 if (dis) { |
1909 if (dis) { |
1910 discol = menuitem->palette.text().color(); |
1910 discol = menuitem->palette.text().color(); |
1911 p->setPen(discol); |
1911 p->setPen(discol); |
1912 } |
1912 } |
1913 |
1913 |
1914 int xm = QWindowsStylePrivate::windowsItemFrame + checkcol + QWindowsStylePrivate::windowsItemHMargin; |
1914 int xm = int(QWindowsStylePrivate::windowsItemFrame) + checkcol + int(QWindowsStylePrivate::windowsItemHMargin); |
1915 int xpos = menuitem->rect.x() + xm; |
1915 int xpos = menuitem->rect.x() + xm; |
1916 QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin, |
1916 QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin, |
1917 w - xm - QWindowsStylePrivate::windowsRightBorder - tab + 1, h - 2 * QWindowsStylePrivate::windowsItemVMargin); |
1917 w - xm - QWindowsStylePrivate::windowsRightBorder - tab + 1, h - 2 * QWindowsStylePrivate::windowsItemVMargin); |
1918 QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect); |
1918 QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect); |
1919 QString s = menuitem->text; |
1919 QString s = menuitem->text; |
3103 |
3103 |
3104 copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); |
3104 copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); |
3105 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), |
3105 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), |
3106 ©.palette.brush(QPalette::Button)); |
3106 ©.palette.brush(QPalette::Button)); |
3107 copy.rect.adjust(4, 1, -5, -1); |
3107 copy.rect.adjust(4, 1, -5, -1); |
3108 if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) ) { |
3108 if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) |
|
3109 && proxy()->styleHint(SH_EtchDisabledText, opt, widget) ) |
|
3110 { |
3109 QStyleOptionSpinBox lightCopy = copy; |
3111 QStyleOptionSpinBox lightCopy = copy; |
3110 lightCopy.rect.adjust(1, 1, 1, 1); |
3112 lightCopy.rect.adjust(1, 1, 1, 1); |
3111 lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); |
3113 lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); |
3112 proxy()->drawPrimitive(pe, &lightCopy, p, widget); |
3114 proxy()->drawPrimitive(pe, &lightCopy, p, widget); |
3113 } |
3115 } |
3136 |
3138 |
3137 copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); |
3139 copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); |
3138 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), |
3140 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), |
3139 ©.palette.brush(QPalette::Button)); |
3141 ©.palette.brush(QPalette::Button)); |
3140 copy.rect.adjust(4, 0, -5, -1); |
3142 copy.rect.adjust(4, 0, -5, -1); |
3141 if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) ) { |
3143 if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) |
|
3144 && proxy()->styleHint(SH_EtchDisabledText, opt, widget) ) |
|
3145 { |
3142 QStyleOptionSpinBox lightCopy = copy; |
3146 QStyleOptionSpinBox lightCopy = copy; |
3143 lightCopy.rect.adjust(1, 1, 1, 1); |
3147 lightCopy.rect.adjust(1, 1, 1, 1); |
3144 lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); |
3148 lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); |
3145 proxy()->drawPrimitive(pe, &lightCopy, p, widget); |
3149 proxy()->drawPrimitive(pe, &lightCopy, p, widget); |
3146 } |
3150 } |
3217 w += fmBold.width(mi->text) - fm.width(mi->text); |
3221 w += fmBold.width(mi->text) - fm.width(mi->text); |
3218 } |
3222 } |
3219 |
3223 |
3220 int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column |
3224 int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column |
3221 w += checkcol; |
3225 w += checkcol; |
3222 w += QWindowsStylePrivate::windowsRightBorder + 10; |
3226 w += int(QWindowsStylePrivate::windowsRightBorder) + 10; |
3223 sz.setWidth(w); |
3227 sz.setWidth(w); |
3224 } |
3228 } |
3225 break; |
3229 break; |
3226 #endif // QT_NO_MENU |
3230 #endif // QT_NO_MENU |
3227 #ifndef QT_NO_MENUBAR |
3231 #ifndef QT_NO_MENUBAR |