Diffstat (limited to 'noncore/styles/flat/flat.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/styles/flat/flat.cpp | 18 |
1 files changed, 11 insertions, 7 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 | |||
@@ -364,44 +364,44 @@ void FlatStyle::drawPushButtonLabel( QPushButton *btn, QPainter *p ) | |||
364 | drawArrow( p, DownArrow, FALSE, | 364 | drawArrow( p, DownArrow, FALSE, |
365 | x+w-dx, y+2, dx-4, h-4, | 365 | x+w-dx, y+2, dx-4, h-4, |
366 | cg, | 366 | cg, |
367 | btn->isEnabled() ); | 367 | btn->isEnabled() ); |
368 | w -= dx; | 368 | w -= dx; |
369 | } | 369 | } |
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 | } |
383 | drawItem( p, x, y, w, h, | 383 | drawItem( p, x, y, w, h, |
384 | AlignCenter | ShowPrefix, | 384 | AlignCenter | ShowPrefix, |
385 | cg, btn->isEnabled(), | 385 | cg, btn->isEnabled(), |
386 | btn->pixmap(), btn->text(), -1, &cg.buttonText() ); | 386 | btn->pixmap(), btn->text(), -1, &cg.buttonText() ); |
387 | 387 | ||
388 | } | 388 | } |
389 | 389 | ||
390 | QRect FlatStyle::comboButtonRect( int x, int y, int w, int h) | 390 | QRect FlatStyle::comboButtonRect( int x, int y, int w, int h) |
391 | { | 391 | { |
392 | return QRect(x+2, y+2, w-4-13, h-4); | 392 | return QRect(x+2, y+2, w-4-13, h-4); |
393 | } | 393 | } |
394 | 394 | ||
395 | 395 | ||
396 | QRect FlatStyle::comboButtonFocusRect( int x, int y, int w, int h) | 396 | QRect FlatStyle::comboButtonFocusRect( int x, int y, int w, int h) |
397 | { | 397 | { |
398 | return QRect(x+2, y+2, w-4-14, h-4); | 398 | return QRect(x+2, y+2, w-4-14, h-4); |
399 | } | 399 | } |
400 | 400 | ||
401 | void FlatStyle::drawComboButton( QPainter *p, int x, int y, int w, int h, | 401 | void FlatStyle::drawComboButton( QPainter *p, int x, int y, int w, int h, |
402 | const QColorGroup &g, bool sunken, | 402 | const QColorGroup &g, bool sunken, |
403 | bool /*editable*/, | 403 | bool /*editable*/, |
404 | bool enabled, | 404 | bool enabled, |
405 | const QBrush * /*fill*/ ) | 405 | const QBrush * /*fill*/ ) |
406 | { | 406 | { |
407 | x++; y++; | 407 | x++; y++; |
@@ -883,47 +883,47 @@ int FlatStyle::extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem* m | |||
883 | w += motifCheckMarkHMargin; // add space to separate the columns | 883 | w += motifCheckMarkHMargin; // add space to separate the columns |
884 | 884 | ||
885 | w += windowsRightBorder; // windows has a strange wide border on the right side | 885 | w += windowsRightBorder; // windows has a strange wide border on the right side |
886 | 886 | ||
887 | return w; | 887 | return w; |
888 | #endif | 888 | #endif |
889 | } | 889 | } |
890 | 890 | ||
891 | /*! \reimp | 891 | /*! \reimp |
892 | */ | 892 | */ |
893 | int FlatStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) | 893 | int FlatStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) |
894 | { | 894 | { |
895 | #ifndef QT_NO_MENUDATA | 895 | #ifndef QT_NO_MENUDATA |
896 | int h = 0; | 896 | int h = 0; |
897 | if ( mi->isSeparator() ) // separator height | 897 | if ( mi->isSeparator() ) // separator height |
898 | h = motifSepHeight; | 898 | h = motifSepHeight; |
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 | } |
912 | 912 | ||
913 | void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, | 913 | void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, |
914 | const QPalette& pal, | 914 | const QPalette& pal, |
915 | bool act, bool enabled, int x, int y, int w, int h) | 915 | bool act, bool enabled, int x, int y, int w, int h) |
916 | { | 916 | { |
917 | #ifndef QT_NO_MENUDATA | 917 | #ifndef QT_NO_MENUDATA |
918 | const QColorGroup & g = pal.active(); | 918 | const QColorGroup & g = pal.active(); |
919 | bool dis = !enabled; | 919 | bool dis = !enabled; |
920 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); | 920 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); |
921 | 921 | ||
922 | if ( checkable ) | 922 | if ( checkable ) |
923 | maxpmw = QMAX( maxpmw, 8 ); // space for the checkmarks | 923 | maxpmw = QMAX( maxpmw, 8 ); // space for the checkmarks |
924 | 924 | ||
925 | int checkcol = maxpmw; | 925 | int checkcol = maxpmw; |
926 | 926 | ||
927 | if ( mi && mi->isSeparator() ) { // draw separator | 927 | if ( mi && mi->isSeparator() ) { // draw separator |
928 | p->setPen( g.dark() ); | 928 | p->setPen( g.dark() ); |
929 | p->drawLine( x, y, x+w, y ); | 929 | p->drawLine( x, y, x+w, y ); |
@@ -945,25 +945,29 @@ void FlatStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int | |||
945 | qDrawShadePanel( p, x, y, checkcol, h, | 945 | qDrawShadePanel( p, x, y, checkcol, h, |
946 | g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); | 946 | g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); |
947 | } | 947 | } |
948 | } else if ( !act ) { | 948 | } else if ( !act ) { |
949 | p->fillRect(x, y, checkcol , h, | 949 | p->fillRect(x, y, checkcol , h, |
950 | g.brush( QColorGroup::Button )); | 950 | g.brush( QColorGroup::Button )); |
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 | } |
964 | QRect cr( x, y, checkcol, h ); | 968 | QRect cr( x, y, checkcol, h ); |
965 | QRect pmr( 0, 0, pixw, pixh ); | 969 | QRect pmr( 0, 0, pixw, pixh ); |
966 | pmr.moveCenter( cr.center() ); | 970 | pmr.moveCenter( cr.center() ); |
967 | p->setPen( itemg.text() ); | 971 | p->setPen( itemg.text() ); |
968 | p->drawPixmap( pmr.topLeft(), pixmap ); | 972 | p->drawPixmap( pmr.topLeft(), pixmap ); |
969 | 973 | ||