-rw-r--r-- | noncore/styles/flat/flat.cpp | 10 | ||||
-rw-r--r-- | noncore/styles/fresh/fresh.cpp | 8 | ||||
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 15 | ||||
-rw-r--r-- | noncore/styles/phase/phasestyle.cpp | 14 | ||||
-rw-r--r-- | noncore/styles/theme/othemestyle.cpp | 11 | ||||
-rw-r--r-- | noncore/styles/web/webstyle.cpp | 126 | ||||
-rw-r--r-- | noncore/styles/web/webstyle.h | 2 |
7 files changed, 165 insertions, 21 deletions
diff --git a/noncore/styles/flat/flat.cpp b/noncore/styles/flat/flat.cpp index f3bacf9..c164ecc 100644 --- a/noncore/styles/flat/flat.cpp +++ b/noncore/styles/flat/flat.cpp | |||
@@ -370,13 +370,13 @@ void FlatStyle::drawPushButtonLabel( QPushButton *btn, QPainter *p ) | |||
370 | 370 | ||
371 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) { | 371 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) { |
372 | QIconSet::Mode mode = btn->isEnabled() | 372 | QIconSet::Mode mode = btn->isEnabled() |
373 | ? QIconSet::Normal : QIconSet::Disabled; | 373 | ? QIconSet::Normal : QIconSet::Disabled; |
374 | if ( mode == QIconSet::Normal && btn->hasFocus() ) | 374 | if ( mode == QIconSet::Normal && btn->hasFocus() ) |
375 | mode = QIconSet::Active; | 375 | mode = QIconSet::Active; |
376 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); | 376 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Automatic, mode ); |
377 | int pixw = pixmap.width(); | 377 | int pixw = pixmap.width(); |
378 | int pixh = pixmap.height(); | 378 | int pixh = pixmap.height(); |
379 | p->drawPixmap( x+2, y+h/2-pixh/2, pixmap ); | 379 | p->drawPixmap( x+2, y+h/2-pixh/2, pixmap ); |
380 | x += pixw + 4; | 380 | x += pixw + 4; |
381 | w -= pixw + 4; | 381 | w -= pixw + 4; |
382 | } | 382 | } |
@@ -899,13 +899,13 @@ int FlatStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFo | |||
899 | else if ( mi->pixmap() ) // pixmap height | 899 | else if ( mi->pixmap() ) // pixmap height |
900 | h = mi->pixmap()->height() + 2*motifItemFrame; | 900 | h = mi->pixmap()->height() + 2*motifItemFrame; |
901 | else // text height | 901 | else // text height |
902 | h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; | 902 | h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; |
903 | 903 | ||
904 | if ( !mi->isSeparator() && mi->iconSet() != 0 ) { | 904 | if ( !mi->isSeparator() && mi->iconSet() != 0 ) { |
905 | h = QMAX( h, mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height() + 2*motifItemFrame ); | 905 | h = QMAX( h, mi->iconSet()->pixmap().height() + 2*motifItemFrame ); |
906 | } | 906 | } |
907 | if ( mi->custom() ) | 907 | if ( mi->custom() ) |
908 | h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; | 908 | h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; |
909 | return h; | 909 | return h; |
910 | #endif | 910 | #endif |
911 | } | 911 | } |
@@ -951,13 +951,17 @@ void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int | |||
951 | } | 951 | } |
952 | 952 | ||
953 | if ( mi->iconSet() ) { // draw iconset | 953 | if ( mi->iconSet() ) { // draw iconset |
954 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; | 954 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; |
955 | if (act && !dis ) | 955 | if (act && !dis ) |
956 | mode = QIconSet::Active; | 956 | mode = QIconSet::Active; |
957 | QPixmap pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode ); | 957 | QPixmap pixmap; |
958 | if ( mode == QIconSet::Disabled ) | ||
959 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
960 | else | ||
961 | pixmap = mi->iconSet()->pixmap(); | ||
958 | int pixw = pixmap.width(); | 962 | int pixw = pixmap.width(); |
959 | int pixh = pixmap.height(); | 963 | int pixh = pixmap.height(); |
960 | if ( act && !dis ) { | 964 | if ( act && !dis ) { |
961 | if ( !mi->isChecked() ) | 965 | if ( !mi->isChecked() ) |
962 | qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); | 966 | qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); |
963 | } | 967 | } |
diff --git a/noncore/styles/fresh/fresh.cpp b/noncore/styles/fresh/fresh.cpp index 831b620..856f68b 100644 --- a/noncore/styles/fresh/fresh.cpp +++ b/noncore/styles/fresh/fresh.cpp | |||
@@ -645,13 +645,13 @@ int FreshStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QF | |||
645 | else if ( mi->pixmap() ) // pixmap height | 645 | else if ( mi->pixmap() ) // pixmap height |
646 | h = mi->pixmap()->height() + 2*motifItemFrame; | 646 | h = mi->pixmap()->height() + 2*motifItemFrame; |
647 | else // text height | 647 | else // text height |
648 | h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; | 648 | h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; |
649 | 649 | ||
650 | if ( !mi->isSeparator() && mi->iconSet() != 0 ) { | 650 | if ( !mi->isSeparator() && mi->iconSet() != 0 ) { |
651 | h = QMAX( h, mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height() + 2*motifItemFrame ); | 651 | h = QMAX( h, mi->iconSet()->pixmap().height() + 2*motifItemFrame ); |
652 | } | 652 | } |
653 | if ( mi->custom() ) | 653 | if ( mi->custom() ) |
654 | h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; | 654 | h = QMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; |
655 | return h; | 655 | return h; |
656 | #endif | 656 | #endif |
657 | } | 657 | } |
@@ -699,13 +699,17 @@ void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int | |||
699 | } | 699 | } |
700 | 700 | ||
701 | if ( mi->iconSet() ) { // draw iconset | 701 | if ( mi->iconSet() ) { // draw iconset |
702 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; | 702 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; |
703 | if (act && !dis ) | 703 | if (act && !dis ) |
704 | mode = QIconSet::Active; | 704 | mode = QIconSet::Active; |
705 | QPixmap pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode ); | 705 | QPixmap pixmap; |
706 | if ( mode == QIconSet::Disabled ) | ||
707 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
708 | else | ||
709 | pixmap = mi->iconSet()->pixmap(); | ||
706 | int pixw = pixmap.width(); | 710 | int pixw = pixmap.width(); |
707 | int pixh = pixmap.height(); | 711 | int pixh = pixmap.height(); |
708 | if ( act && !dis ) { | 712 | if ( act && !dis ) { |
709 | if ( !mi->isChecked() ) | 713 | if ( !mi->isChecked() ) |
710 | qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); | 714 | qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); |
711 | } | 715 | } |
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 51814e7..77cf198 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -1300,13 +1300,17 @@ void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) | |||
1300 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) | 1300 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) |
1301 | { | 1301 | { |
1302 | QIconSet::Mode mode = btn->isEnabled() | 1302 | QIconSet::Mode mode = btn->isEnabled() |
1303 | ? QIconSet::Normal : QIconSet::Disabled; | 1303 | ? QIconSet::Normal : QIconSet::Disabled; |
1304 | if ( mode == QIconSet::Normal && btn->hasFocus() ) | 1304 | if ( mode == QIconSet::Normal && btn->hasFocus() ) |
1305 | mode = QIconSet::Active; | 1305 | mode = QIconSet::Active; |
1306 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); | 1306 | QPixmap pixmap; |
1307 | if ( mode == QIconSet::Disabled ) | ||
1308 | pixmap = btn->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
1309 | else | ||
1310 | pixmap = btn->iconSet()->pixmap(); | ||
1307 | int pixw = pixmap.width(); | 1311 | int pixw = pixmap.width(); |
1308 | int pixh = pixmap.height(); | 1312 | int pixh = pixmap.height(); |
1309 | 1313 | ||
1310 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); | 1314 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); |
1311 | x1 += pixw + 8; | 1315 | x1 += pixw + 8; |
1312 | w -= pixw + 8; | 1316 | w -= pixw + 8; |
@@ -2152,13 +2156,17 @@ static const int windowsRightBorder = 12; | |||
2152 | return; | 2156 | return; |
2153 | } | 2157 | } |
2154 | if(mi->iconSet()) { | 2158 | if(mi->iconSet()) { |
2155 | QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; | 2159 | QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; |
2156 | if (!dis) | 2160 | if (!dis) |
2157 | mode = QIconSet::Active; | 2161 | mode = QIconSet::Active; |
2158 | QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode); | 2162 | QPixmap pixmap; |
2163 | if ( mode == QIconSet::Disabled ) | ||
2164 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
2165 | else | ||
2166 | pixmap = mi->iconSet()->pixmap(); | ||
2159 | int pixw = pixmap.width(); | 2167 | int pixw = pixmap.width(); |
2160 | int pixh = pixmap.height(); | 2168 | int pixh = pixmap.height(); |
2161 | QRect cr(x, y, checkcol, h); | 2169 | QRect cr(x, y, checkcol, h); |
2162 | QRect pmr(0, 0, pixw, pixh); | 2170 | QRect pmr(0, 0, pixw, pixh); |
2163 | pmr.moveCenter( cr.center() ); | 2171 | pmr.moveCenter( cr.center() ); |
2164 | p->setPen(itemg.highlightedText()); | 2172 | p->setPen(itemg.highlightedText()); |
@@ -2233,14 +2241,13 @@ int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi, | |||
2233 | 2241 | ||
2234 | int h = 0; | 2242 | int h = 0; |
2235 | if (mi->pixmap()) | 2243 | if (mi->pixmap()) |
2236 | h = mi->pixmap()->height(); | 2244 | h = mi->pixmap()->height(); |
2237 | 2245 | ||
2238 | if (mi->iconSet()) | 2246 | if (mi->iconSet()) |
2239 | h = QMAX(mi->iconSet()-> | 2247 | h = QMAX(mi->iconSet()->pixmap().height(), h); |
2240 | pixmap(QIconSet::Small, QIconSet::Normal).height(), h); | ||
2241 | 2248 | ||
2242 | h = QMAX(fm.height() + 4, h); | 2249 | h = QMAX(fm.height() + 4, h); |
2243 | 2250 | ||
2244 | // we want a minimum size of 18 | 2251 | // we want a minimum size of 18 |
2245 | h = QMAX(h, 18); | 2252 | h = QMAX(h, 18); |
2246 | 2253 | ||
diff --git a/noncore/styles/phase/phasestyle.cpp b/noncore/styles/phase/phasestyle.cpp index 746354e..c2b9de8 100644 --- a/noncore/styles/phase/phasestyle.cpp +++ b/noncore/styles/phase/phasestyle.cpp | |||
@@ -387,13 +387,16 @@ void PhaseStyle::drawPushButtonLabel (QPushButton *button, QPainter *painter) { | |||
387 | state = true; | 387 | state = true; |
388 | } else { | 388 | } else { |
389 | state = false; | 389 | state = false; |
390 | } | 390 | } |
391 | #endif | 391 | #endif |
392 | 392 | ||
393 | pixmap = button->iconSet()->pixmap(QIconSet::Small, mode); | 393 | if ( mode == QIconSet::Disabled ) |
394 | pixmap = button->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
395 | else | ||
396 | pixmap = button->iconSet()->pixmap(); | ||
394 | if (button->text().isEmpty() && !button->pixmap()) { | 397 | if (button->text().isEmpty() && !button->pixmap()) { |
395 | painter->drawPixmap(x+w/2 - pixmap.width()/2, | 398 | painter->drawPixmap(x+w/2 - pixmap.width()/2, |
396 | y+h/2 - pixmap.height()/2, pixmap); | 399 | y+h/2 - pixmap.height()/2, pixmap); |
397 | } else { | 400 | } else { |
398 | painter->drawPixmap(x+4, y+h/2 - pixmap.height()/2, pixmap); | 401 | painter->drawPixmap(x+4, y+h/2 - pixmap.height()/2, pixmap); |
399 | } | 402 | } |
@@ -566,14 +569,13 @@ int PhaseStyle::popupMenuItemHeight ( bool , | |||
566 | }else { | 569 | }else { |
567 | h = QMAX(h, MINICONSIZE+ITEMFRAME*2 ); | 570 | h = QMAX(h, MINICONSIZE+ITEMFRAME*2 ); |
568 | h = QMAX(h, fm.height() | 571 | h = QMAX(h, fm.height() |
569 | + ITEMVMARGIN*2 + ITEMFRAME*2 ); | 572 | + ITEMVMARGIN*2 + ITEMFRAME*2 ); |
570 | } | 573 | } |
571 | if ( mi->iconSet() ) | 574 | if ( mi->iconSet() ) |
572 | h = QMAX(h, mi->iconSet()-> | 575 | h = QMAX(h, mi->iconSet()->pixmap().height() |
573 | pixmap(QIconSet::Small, QIconSet::Normal ).height() | ||
574 | + ITEMFRAME*2 ); | 576 | + ITEMFRAME*2 ); |
575 | } | 577 | } |
576 | 578 | ||
577 | 579 | ||
578 | return h; | 580 | return h; |
579 | } | 581 | } |
@@ -658,13 +660,17 @@ void PhaseStyle::drawPopupMenuItem ( QPainter * p, bool checkable, | |||
658 | QIconSet::Mode mode; | 660 | QIconSet::Mode mode; |
659 | if ( mi->iconSet() && !mi->isChecked() ) { | 661 | if ( mi->iconSet() && !mi->isChecked() ) { |
660 | if ( act ) | 662 | if ( act ) |
661 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; | 663 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; |
662 | else | 664 | else |
663 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; | 665 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; |
664 | QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode ); | 666 | QPixmap pixmap; |
667 | if ( mode == QIconSet::Disabled ) | ||
668 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
669 | else | ||
670 | pixmap = mi->iconSet()->pixmap(); | ||
665 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); | 671 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); |
666 | QRect cr(x, y, maxpmw, h ); | 672 | QRect cr(x, y, maxpmw, h ); |
667 | pmrect.moveCenter( cr.center() ); | 673 | pmrect.moveCenter( cr.center() ); |
668 | p->drawPixmap(pmrect.topLeft(), pixmap); | 674 | p->drawPixmap(pmrect.topLeft(), pixmap); |
669 | } | 675 | } |
670 | 676 | ||
diff --git a/noncore/styles/theme/othemestyle.cpp b/noncore/styles/theme/othemestyle.cpp index 98e7253..106d206 100644 --- a/noncore/styles/theme/othemestyle.cpp +++ b/noncore/styles/theme/othemestyle.cpp | |||
@@ -1180,13 +1180,13 @@ void OThemeStyle::drawPushButtonLabel( QPushButton *btn, QPainter *p ) | |||
1180 | // Next, draw iconset, if any | 1180 | // Next, draw iconset, if any |
1181 | if ( btn->iconSet() && !btn->iconSet() ->isNull() ) { | 1181 | if ( btn->iconSet() && !btn->iconSet() ->isNull() ) { |
1182 | QIconSet::Mode mode = btn->isEnabled() | 1182 | QIconSet::Mode mode = btn->isEnabled() |
1183 | ? QIconSet::Normal : QIconSet::Disabled; | 1183 | ? QIconSet::Normal : QIconSet::Disabled; |
1184 | if ( mode == QIconSet::Normal && btn->hasFocus() ) | 1184 | if ( mode == QIconSet::Normal && btn->hasFocus() ) |
1185 | mode = QIconSet::Active; | 1185 | mode = QIconSet::Active; |
1186 | QPixmap pixmap = btn->iconSet() ->pixmap( QIconSet::Small, mode ); | 1186 | QPixmap pixmap = btn->iconSet() ->pixmap( QIconSet::Automatic, mode ); |
1187 | int pixw = pixmap.width(); | 1187 | int pixw = pixmap.width(); |
1188 | int pixh = pixmap.height(); | 1188 | int pixh = pixmap.height(); |
1189 | 1189 | ||
1190 | p->drawPixmap( x + 6, y + h / 2 - pixh / 2, pixmap ); | 1190 | p->drawPixmap( x + 6, y + h / 2 - pixh / 2, pixmap ); |
1191 | x += pixw + 8; | 1191 | x += pixw + 8; |
1192 | w -= pixw + 8; | 1192 | w -= pixw + 8; |
@@ -1243,14 +1243,13 @@ int OThemeStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem *mi, | |||
1243 | offset + 16; | 1243 | offset + 16; |
1244 | if ( mi->pixmap() ) { | 1244 | if ( mi->pixmap() ) { |
1245 | h2 = mi->pixmap() ->height() + offset; | 1245 | h2 = mi->pixmap() ->height() + offset; |
1246 | h = h2 > h ? h2 : h; | 1246 | h = h2 > h ? h2 : h; |
1247 | } | 1247 | } |
1248 | if ( mi->iconSet() ) { | 1248 | if ( mi->iconSet() ) { |
1249 | h2 = mi->iconSet() -> | 1249 | h2 = mi->iconSet() ->pixmap().height() + offset; |
1250 | pixmap( QIconSet::Small, QIconSet::Normal ).height() + offset; | ||
1251 | h = h2 > h ? h2 : h; | 1250 | h = h2 > h ? h2 : h; |
1252 | } | 1251 | } |
1253 | h2 = fm.height() + offset; | 1252 | h2 = fm.height() + offset; |
1254 | h = h2 > h ? h2 : h; | 1253 | h = h2 > h ? h2 : h; |
1255 | return ( h ); | 1254 | return ( h ); |
1256 | } | 1255 | } |
@@ -1322,13 +1321,17 @@ void OThemeStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, | |||
1322 | if ( !mi ) | 1321 | if ( !mi ) |
1323 | return ; | 1322 | return ; |
1324 | if ( mi->iconSet() ) { | 1323 | if ( mi->iconSet() ) { |
1325 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; | 1324 | QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; |
1326 | if ( act && !dis ) | 1325 | if ( act && !dis ) |
1327 | mode = QIconSet::Active; | 1326 | mode = QIconSet::Active; |
1328 | QPixmap pixmap = mi->iconSet() ->pixmap( QIconSet::Small, mode ); | 1327 | QPixmap pixmap; |
1328 | if ( mode == QIconSet::Disabled ) | ||
1329 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
1330 | else | ||
1331 | pixmap = mi->iconSet()->pixmap(); | ||
1329 | int pixw = pixmap.width(); | 1332 | int pixw = pixmap.width(); |
1330 | int pixh = pixmap.height(); | 1333 | int pixh = pixmap.height(); |
1331 | QRect cr( x, y, checkcol, h ); | 1334 | QRect cr( x, y, checkcol, h ); |
1332 | QRect pmr( 0, 0, pixw, pixh ); | 1335 | QRect pmr( 0, 0, pixw, pixh ); |
1333 | pmr.moveCenter( cr.center() ); | 1336 | pmr.moveCenter( cr.center() ); |
1334 | p->setPen( itemg.text() ); | 1337 | p->setPen( itemg.text() ); |
diff --git a/noncore/styles/web/webstyle.cpp b/noncore/styles/web/webstyle.cpp index cd3cf08..7b58d89 100644 --- a/noncore/styles/web/webstyle.cpp +++ b/noncore/styles/web/webstyle.cpp | |||
@@ -40,12 +40,21 @@ static const int _scrollBarExtent = 12; | |||
40 | 40 | ||
41 | static QFrame * _currentFrame = 0; | 41 | static QFrame * _currentFrame = 0; |
42 | static int _savedFrameLineWidth; | 42 | static int _savedFrameLineWidth; |
43 | static int _savedFrameMidLineWidth; | 43 | static int _savedFrameMidLineWidth; |
44 | static ulong _savedFrameStyle; | 44 | static ulong _savedFrameStyle; |
45 | 45 | ||
46 | static const int ITEMFRAME = 1; // menu stuff | ||
47 | static const int ITEMHMARGIN = 3; | ||
48 | static const int ITEMVMARGIN = 0; | ||
49 | |||
50 | static const int ARROWMARGIN = 6; | ||
51 | static const int RIGHTBORDER = 10; | ||
52 | static const int MINICONSIZE = 12; | ||
53 | |||
54 | |||
46 | static QColor contrastingForeground(const QColor & fg, const QColor & bg) | 55 | static QColor contrastingForeground(const QColor & fg, const QColor & bg) |
47 | { | 56 | { |
48 | int h, s, vbg, vfg; | 57 | int h, s, vbg, vfg; |
49 | 58 | ||
50 | bg.hsv(&h, &s, &vbg); | 59 | bg.hsv(&h, &s, &vbg); |
51 | fg.hsv(&h, &s, &vfg); | 60 | fg.hsv(&h, &s, &vfg); |
@@ -966,25 +975,136 @@ WebStyle::drawSlider | |||
966 | void | 975 | void |
967 | WebStyle::drawPopupMenuItem | 976 | WebStyle::drawPopupMenuItem |
968 | ( | 977 | ( |
969 | QPainter * p, | 978 | QPainter * p, |
970 | bool checkable, | 979 | bool checkable, |
971 | int maxpmw, | 980 | int maxpmw, |
972 | int tab, | 981 | int tabwidth, |
973 | QMenuItem * mi, | 982 | QMenuItem * mi, |
974 | const QPalette & pal, | 983 | const QPalette & pal, |
975 | bool act, | 984 | bool act, |
976 | bool enabled, | 985 | bool enabled, |
977 | int x, | 986 | int x, |
978 | int y, | 987 | int y, |
979 | int w, | 988 | int w, |
980 | int h | 989 | int h |
981 | ) | 990 | ) |
982 | { | 991 | { |
983 | // TODO | 992 | // TODO |
984 | QWindowsStyle::drawPopupMenuItem(p, checkable, maxpmw, tab, mi, pal, act, enabled, x, y, w, h); | 993 | //QWindowsStyle::drawPopupMenuItem(p, checkable, maxpmw, tab, mi, pal, act, enabled, x, y, w, h); |
994 | if ( !mi ) | ||
995 | return; | ||
996 | |||
997 | QRect rect(x, y, w, h ); | ||
998 | int x2, y2; | ||
999 | x2 = rect.right(); | ||
1000 | y2 = rect.bottom(); | ||
1001 | const QColorGroup& g = pal.active(); | ||
1002 | QColorGroup itemg = !enabled ? pal.disabled() : pal.active(); | ||
1003 | |||
1004 | if ( checkable || maxpmw ) maxpmw = QMAX(maxpmw, 20); | ||
1005 | |||
1006 | if (act && enabled ) | ||
1007 | p->fillRect(x, y, w, h, g.highlight() ); | ||
1008 | else | ||
1009 | p->fillRect(x, y, w, h, g.background() ); | ||
1010 | |||
1011 | // draw seperator | ||
1012 | if (mi->isSeparator() ) { | ||
1013 | p->setPen( g.dark() ); | ||
1014 | p->drawLine( x+8, y+1, x+w-8, y+1 ); | ||
1015 | |||
1016 | p->setPen( g.mid() ); | ||
1017 | p->drawLine( x+8, y, x+w-8, y ); | ||
1018 | p->drawPoint(x+w,y+1); | ||
1019 | |||
1020 | p->setPen( g.midlight() ); | ||
1021 | p->drawLine( x+8, y-1, x+w-8, y-1 ); | ||
1022 | p->drawPoint(x+8, y ); | ||
1023 | return; | ||
1024 | } | ||
1025 | |||
1026 | // draw icon | ||
1027 | QIconSet::Mode mode; | ||
1028 | if ( mi->iconSet() && !mi->isChecked() ) { | ||
1029 | if ( act ) | ||
1030 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; | ||
1031 | else | ||
1032 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; | ||
1033 | QPixmap pixmap; | ||
1034 | if ( mode == QIconSet::Disabled ) | ||
1035 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
1036 | else | ||
1037 | pixmap = mi->iconSet()->pixmap(); | ||
1038 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); | ||
1039 | QRect cr(x, y, maxpmw, h ); | ||
1040 | pmrect.moveCenter( cr.center() ); | ||
1041 | p->drawPixmap(pmrect.topLeft(), pixmap); | ||
1042 | } | ||
1043 | |||
1044 | // draw check | ||
1045 | if(mi->isChecked() ) { | ||
1046 | drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); | ||
1047 | } | ||
1048 | |||
1049 | |||
1050 | // draw text | ||
1051 | int xm = maxpmw + 2; | ||
1052 | int xp = x + xm; | ||
1053 | int tw = w -xm - 2; | ||
1054 | |||
1055 | p->setPen( enabled ? ( act ? g.highlightedText() : g.buttonText() ) : | ||
1056 | g.mid() ); | ||
1057 | |||
1058 | |||
1059 | if ( mi->custom() ) { | ||
1060 | p->save(); | ||
1061 | mi->custom()->paint(p, g, act, enabled, | ||
1062 | xp, y+1, tw, h-2 ); | ||
1063 | p->restore(); | ||
1064 | }else { // draw label | ||
1065 | QString text = mi->text(); | ||
1066 | if (!text.isNull() ) { | ||
1067 | int t = text.find('\t'); | ||
1068 | const int tflags = AlignVCenter | DontClip | | ||
1069 | ShowPrefix | SingleLine | | ||
1070 | AlignLeft; | ||
1071 | |||
1072 | if (t >= 0) { | ||
1073 | int tabx = x + w - tabwidth - RIGHTBORDER - | ||
1074 | ITEMHMARGIN - ITEMFRAME; | ||
1075 | p->drawText(tabx, y+ITEMVMARGIN, tabwidth, | ||
1076 | h-2*ITEMVMARGIN, tflags, | ||
1077 | text.mid(t+1) ); | ||
1078 | text = text.left(t ); | ||
1079 | } | ||
1080 | |||
1081 | // draw left label | ||
1082 | p->drawText(xp, y+ITEMVMARGIN, | ||
1083 | tw, h-2*ITEMVMARGIN, | ||
1084 | tflags, text, t); | ||
1085 | }else if ( mi->pixmap() ) { // pixmap as label | ||
1086 | QPixmap pixmap = *mi->pixmap(); | ||
1087 | if ( pixmap.depth() == 1 ) | ||
1088 | p->setBackgroundMode( OpaqueMode ); | ||
1089 | |||
1090 | int dx = ((w-pixmap.width() ) /2 ) + | ||
1091 | ((w - pixmap.width()) %2 ); | ||
1092 | p->drawPixmap(x+dx, y+ITEMFRAME, pixmap ); | ||
1093 | |||
1094 | if ( pixmap.depth() == 1 ) | ||
1095 | p->setBackgroundMode( TransparentMode ); | ||
1096 | } | ||
1097 | } | ||
1098 | |||
1099 | if ( mi->popup() ) { // draw submenu arrow | ||
1100 | int dim = (h-2*ITEMFRAME) / 2; | ||
1101 | drawArrow( p, RightArrow, false, | ||
1102 | x+w-ARROWMARGIN-ITEMFRAME-dim, | ||
1103 | y+h/2-dim/2, dim, dim, g, enabled ); | ||
1104 | } | ||
985 | } | 1105 | } |
986 | 1106 | ||
987 | void | 1107 | void |
988 | WebStyle::drawFocusRect | 1108 | WebStyle::drawFocusRect |
989 | ( | 1109 | ( |
990 | QPainter * p, | 1110 | QPainter * p, |
@@ -1165,13 +1285,13 @@ WebStyle::popupMenuItemHeight(bool, QMenuItem * i, const QFontMetrics & fm) | |||
1165 | } | 1285 | } |
1166 | 1286 | ||
1167 | if (0 != i->iconSet()) | 1287 | if (0 != i->iconSet()) |
1168 | { | 1288 | { |
1169 | h = QMAX | 1289 | h = QMAX |
1170 | ( | 1290 | ( |
1171 | i->iconSet()->pixmap(QIconSet::Small, QIconSet::Normal).height(), | 1291 | i->iconSet()->pixmap().height(), |
1172 | h | 1292 | h |
1173 | ); | 1293 | ); |
1174 | } | 1294 | } |
1175 | 1295 | ||
1176 | h = QMAX(fm.height() + 4, h); | 1296 | h = QMAX(fm.height() + 4, h); |
1177 | 1297 | ||
diff --git a/noncore/styles/web/webstyle.h b/noncore/styles/web/webstyle.h index 83ab784..d6f153b 100644 --- a/noncore/styles/web/webstyle.h +++ b/noncore/styles/web/webstyle.h | |||
@@ -212,13 +212,13 @@ class WebStyle : public QWindowsStyle { | |||
212 | 212 | ||
213 | void drawPopupMenuItem | 213 | void drawPopupMenuItem |
214 | ( | 214 | ( |
215 | QPainter *, | 215 | QPainter *, |
216 | bool checkable, | 216 | bool checkable, |
217 | int maxpmw, | 217 | int maxpmw, |
218 | int tab, | 218 | int tabwidth, |
219 | QMenuItem *, | 219 | QMenuItem *, |
220 | const QPalette &, | 220 | const QPalette &, |
221 | bool act, | 221 | bool act, |
222 | bool enabled, | 222 | bool enabled, |
223 | int x, | 223 | int x, |
224 | int y, | 224 | int y, |