summaryrefslogtreecommitdiff
path: root/noncore/styles/fresh/fresh.cpp
Unidiff
Diffstat (limited to 'noncore/styles/fresh/fresh.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/fresh/fresh.cpp18
1 files changed, 11 insertions, 7 deletions
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
@@ -138,26 +138,26 @@ void FreshStyle::drawButtonMask ( QPainter * p, int x, int y, int w, int h )
138} 138}
139 139
140void FreshStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h, 140void FreshStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h,
141 const QColorGroup &g, bool sunken, const QBrush* fill ) 141 const QColorGroup &g, bool sunken, const QBrush* fill )
142{ 142{
143 drawButton( p, x, y, w, h, g, sunken, fill ); 143 drawButton( p, x, y, w, h, g, sunken, fill );
144} 144}
145 145
146QRect FreshStyle::comboButtonRect( int x, int y, int w, int h) 146QRect FreshStyle::comboButtonRect( int x, int y, int w, int h)
147{ 147{
148 return QRect(x+1, y+1, w-2-14, h-2); 148 return QRect(x+1, y+1, w-2-14, h-2);
149} 149}
150 150
151 151
152QRect FreshStyle::comboButtonFocusRect( int x, int y, int w, int h) 152QRect FreshStyle::comboButtonFocusRect( int x, int y, int w, int h)
153{ 153{
154 return QRect(x+2, y+2, w-4-14, h-4); 154 return QRect(x+2, y+2, w-4-14, h-4);
155} 155}
156 156
157void FreshStyle::drawComboButton( QPainter *p, int x, int y, int w, int h, 157void FreshStyle::drawComboButton( QPainter *p, int x, int y, int w, int h,
158 const QColorGroup &g, bool sunken, 158 const QColorGroup &g, bool sunken,
159 bool /*editable*/, 159 bool /*editable*/,
160 bool enabled, 160 bool enabled,
161 const QBrush *fill ) 161 const QBrush *fill )
162{ 162{
163 drawBevelButton( p, x, y, w, h, g, FALSE, fill ); 163 drawBevelButton( p, x, y, w, h, g, FALSE, fill );
@@ -519,25 +519,25 @@ void FreshStyle::drawTab( QPainter *p, const QTabBar *tb, QTab *t, bool selected
519 p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 ); 519 p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 );
520 p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-2), 520 p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-2),
521 tb->colorGroup().brush( QColorGroup::Background )); 521 tb->colorGroup().brush( QColorGroup::Background ));
522 } else { 522 } else {
523 r.setRect( r.left() + 2, r.top() + 2, 523 r.setRect( r.left() + 2, r.top() + 2,
524 r.width() - 4, r.height() - 2 ); 524 r.width() - 4, r.height() - 2 );
525 p->setPen( tb->colorGroup().button() ); 525 p->setPen( tb->colorGroup().button() );
526 p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 ); 526 p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 );
527 p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-3), 527 p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-3),
528 tb->colorGroup().brush( QColorGroup::Button )); 528 tb->colorGroup().brush( QColorGroup::Button ));
529 529
530 //do shading; will not work for pixmap brushes 530 //do shading; will not work for pixmap brushes
531 QColor bg = tb->colorGroup().button(); 531 QColor bg = tb->colorGroup().button();
532 // int h,s,v; 532 // int h,s,v;
533 // bg.hsv( &h, &s, &v ); 533 // bg.hsv( &h, &s, &v );
534 int n = r.height()/2; 534 int n = r.height()/2;
535 int dark = 100; 535 int dark = 100;
536 for ( int i = 1; i < n; i++ ) { 536 for ( int i = 1; i < n; i++ ) {
537 dark = (dark * (100+(i*15)/n) )/100; 537 dark = (dark * (100+(i*15)/n) )/100;
538 p->setPen( bg.dark( dark ) ); 538 p->setPen( bg.dark( dark ) );
539 int y = r.bottom()-n+i; 539 int y = r.bottom()-n+i;
540 int x1 = r.left()+1; 540 int x1 = r.left()+1;
541 int x2 = r.right()-1; 541 int x2 = r.right()-1;
542 p->drawLine( x1, y, x2, y ); 542 p->drawLine( x1, y, x2, y );
543 } 543 }
@@ -629,47 +629,47 @@ int FreshStyle::extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*
629 w += motifCheckMarkHMargin; // add space to separate the columns 629 w += motifCheckMarkHMargin; // add space to separate the columns
630 630
631 w += windowsRightBorder; // windows has a strange wide border on the right side 631 w += windowsRightBorder; // windows has a strange wide border on the right side
632 632
633 return w; 633 return w;
634#endif 634#endif
635} 635}
636 636
637/*! \reimp 637/*! \reimp
638*/ 638*/
639int FreshStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm ) 639int FreshStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem* mi, const QFontMetrics& fm )
640{ 640{
641#ifndef QT_NO_MENUDATA 641#ifndef QT_NO_MENUDATA
642 int h = 0; 642 int h = 0;
643 if ( mi->isSeparator() ) // separator height 643 if ( mi->isSeparator() ) // separator height
644 h = motifSepHeight; 644 h = motifSepHeight;
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}
658 658
659void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, 659void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi,
660 const QPalette& pal, 660 const QPalette& pal,
661 bool act, bool enabled, int x, int y, int w, int h) 661 bool act, bool enabled, int x, int y, int w, int h)
662{ 662{
663#ifndef QT_NO_MENUDATA 663#ifndef QT_NO_MENUDATA
664 const QColorGroup & g = pal.active(); 664 const QColorGroup & g = pal.active();
665 bool dis = !enabled; 665 bool dis = !enabled;
666 QColorGroup itemg = dis ? pal.disabled() : pal.active(); 666 QColorGroup itemg = dis ? pal.disabled() : pal.active();
667 667
668 if ( checkable ) 668 if ( checkable )
669 maxpmw = QMAX( maxpmw, 8 ); // space for the checkmarks 669 maxpmw = QMAX( maxpmw, 8 ); // space for the checkmarks
670 670
671 int checkcol = maxpmw; 671 int checkcol = maxpmw;
672 672
673 if ( mi && mi->isSeparator() ) { // draw separator 673 if ( mi && mi->isSeparator() ) { // draw separator
674 p->setPen( g.dark() ); 674 p->setPen( g.dark() );
675 p->drawLine( x, y, x+w, y ); 675 p->drawLine( x, y, x+w, y );
@@ -693,25 +693,29 @@ void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int
693 qDrawShadePanel( p, x, y, checkcol, h, 693 qDrawShadePanel( p, x, y, checkcol, h,
694 g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); 694 g, TRUE, 1, &g.brush( QColorGroup::Midlight ) );
695 } 695 }
696 } else if ( !act ) { 696 } else if ( !act ) {
697 p->fillRect(x, y, checkcol , h, 697 p->fillRect(x, y, checkcol , h,
698 g.brush( QColorGroup::Button )); 698 g.brush( QColorGroup::Button ));
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 }
712 QRect cr( x, y, checkcol, h ); 716 QRect cr( x, y, checkcol, h );
713 QRect pmr( 0, 0, pixw, pixh ); 717 QRect pmr( 0, 0, pixw, pixh );
714 pmr.moveCenter( cr.center() ); 718 pmr.moveCenter( cr.center() );
715 p->setPen( itemg.text() ); 719 p->setPen( itemg.text() );
716 p->drawPixmap( pmr.topLeft(), pixmap ); 720 p->drawPixmap( pmr.topLeft(), pixmap );
717 721