author | zecke <zecke> | 2004-08-28 21:12:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-28 21:12:49 (UTC) |
commit | 2bc77ab7c6dd7310f95e70d46f4bfc55a84f32cf (patch) (unidiff) | |
tree | fc0730cc591fa106c03b7e9ab525a97a34e1fc3b | |
parent | 2fa06314f2779b77de9c07c4f9fbd8cb5af8f215 (diff) | |
download | opie-2bc77ab7c6dd7310f95e70d46f4bfc55a84f32cf.zip opie-2bc77ab7c6dd7310f95e70d46f4bfc55a84f32cf.tar.gz opie-2bc77ab7c6dd7310f95e70d46f4bfc55a84f32cf.tar.bz2 |
Use the bitmap found on the scrollbar as combobox
indicator.
A push effect is missing for that though
-rw-r--r-- | noncore/styles/phase/phasestyle.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/noncore/styles/phase/phasestyle.cpp b/noncore/styles/phase/phasestyle.cpp index fb6411c..139505f 100644 --- a/noncore/styles/phase/phasestyle.cpp +++ b/noncore/styles/phase/phasestyle.cpp | |||
@@ -547,389 +547,388 @@ int PhaseStyle::popupMenuItemHeight ( bool , | |||
547 | if (mi->custom() ) { | 547 | if (mi->custom() ) { |
548 | h = mi->custom()->sizeHint().height(); | 548 | h = mi->custom()->sizeHint().height(); |
549 | if (!mi->custom()->fullSpan() ) | 549 | if (!mi->custom()->fullSpan() ) |
550 | h += ITEMVMARGIN*2 + ITEMFRAME*2; | 550 | h += ITEMVMARGIN*2 + ITEMFRAME*2; |
551 | }else if (mi->isSeparator() ) { | 551 | }else if (mi->isSeparator() ) { |
552 | h = 1; | 552 | h = 1; |
553 | }else { | 553 | }else { |
554 | if ( mi->pixmap() ) { | 554 | if ( mi->pixmap() ) { |
555 | h = QMAX(h, mi->pixmap()->height() + ITEMFRAME*2); | 555 | h = QMAX(h, mi->pixmap()->height() + ITEMFRAME*2); |
556 | }else { | 556 | }else { |
557 | h = QMAX(h, MINICONSIZE+ITEMFRAME*2 ); | 557 | h = QMAX(h, MINICONSIZE+ITEMFRAME*2 ); |
558 | h = QMAX(h, fm.height() | 558 | h = QMAX(h, fm.height() |
559 | + ITEMVMARGIN*2 + ITEMFRAME*2 ); | 559 | + ITEMVMARGIN*2 + ITEMFRAME*2 ); |
560 | } | 560 | } |
561 | if ( mi->iconSet() ) | 561 | if ( mi->iconSet() ) |
562 | h = QMAX(h, mi->iconSet()-> | 562 | h = QMAX(h, mi->iconSet()-> |
563 | pixmap(QIconSet::Small, QIconSet::Normal ).height() | 563 | pixmap(QIconSet::Small, QIconSet::Normal ).height() |
564 | + ITEMFRAME*2 ); | 564 | + ITEMFRAME*2 ); |
565 | } | 565 | } |
566 | 566 | ||
567 | 567 | ||
568 | return h; | 568 | return h; |
569 | } | 569 | } |
570 | 570 | ||
571 | int PhaseStyle::extraPopupMenuItemWidth(bool checkable, int maxpmw, | 571 | int PhaseStyle::extraPopupMenuItemWidth(bool checkable, int maxpmw, |
572 | QMenuItem* mi, const QFontMetrics& ) { | 572 | QMenuItem* mi, const QFontMetrics& ) { |
573 | int w = 0; | 573 | int w = 0; |
574 | if (mi->isSeparator() ) | 574 | if (mi->isSeparator() ) |
575 | return 3; | 575 | return 3; |
576 | 576 | ||
577 | else if ( mi->pixmap() ) | 577 | else if ( mi->pixmap() ) |
578 | w = mi->pixmap()->width(); | 578 | w = mi->pixmap()->width(); |
579 | 579 | ||
580 | if (!mi->text().isNull() && | 580 | if (!mi->text().isNull() && |
581 | mi->text().find('\t' ) >= 0 ) | 581 | mi->text().find('\t' ) >= 0 ) |
582 | w += 12; | 582 | w += 12; |
583 | else if ( mi->popup() ) | 583 | else if ( mi->popup() ) |
584 | w += 2*ARROWMARGIN; | 584 | w += 2*ARROWMARGIN; |
585 | 585 | ||
586 | if ( maxpmw ) | 586 | if ( maxpmw ) |
587 | w += maxpmw +4; | 587 | w += maxpmw +4; |
588 | 588 | ||
589 | 589 | ||
590 | if ( maxpmw > 0 || checkable ) | 590 | if ( maxpmw > 0 || checkable ) |
591 | w += ITEMHMARGIN*2+8; | 591 | w += ITEMHMARGIN*2+8; |
592 | 592 | ||
593 | w += RIGHTBORDER; | 593 | w += RIGHTBORDER; |
594 | return w; | 594 | return w; |
595 | } | 595 | } |
596 | 596 | ||
597 | QSize PhaseStyle::indicatorSize()const { | 597 | QSize PhaseStyle::indicatorSize()const { |
598 | return QSize( 11, 11 ); | 598 | return QSize( 11, 11 ); |
599 | } | 599 | } |
600 | 600 | ||
601 | QSize PhaseStyle::exclusiveIndicatorSize()const { | 601 | QSize PhaseStyle::exclusiveIndicatorSize()const { |
602 | return QSize( 11, 11 ); | 602 | return QSize( 11, 11 ); |
603 | } | 603 | } |
604 | 604 | ||
605 | void PhaseStyle::getButtonShift( int &x, int &y ) { | 605 | void PhaseStyle::getButtonShift( int &x, int &y ) { |
606 | x++; | 606 | x++; |
607 | y++; | 607 | y++; |
608 | } | 608 | } |
609 | 609 | ||
610 | void PhaseStyle::drawPopupMenuItem ( QPainter * p, bool checkable, | 610 | void PhaseStyle::drawPopupMenuItem ( QPainter * p, bool checkable, |
611 | int maxpmw,int tabwidth, | 611 | int maxpmw,int tabwidth, |
612 | QMenuItem * mi, const QPalette & pal, | 612 | QMenuItem * mi, const QPalette & pal, |
613 | bool act, bool enabled, int x, | 613 | bool act, bool enabled, int x, |
614 | int y, int w, int h ) { | 614 | int y, int w, int h ) { |
615 | if ( !mi ) | 615 | if ( !mi ) |
616 | return; | 616 | return; |
617 | 617 | ||
618 | QRect rect(x, y, w, h ); | 618 | QRect rect(x, y, w, h ); |
619 | int x2, y2; | 619 | int x2, y2; |
620 | x2 = rect.right(); | 620 | x2 = rect.right(); |
621 | y2 = rect.bottom(); | 621 | y2 = rect.bottom(); |
622 | const QColorGroup& g = pal.active(); | 622 | const QColorGroup& g = pal.active(); |
623 | QColorGroup itemg = !enabled ? pal.disabled() : pal.active(); | 623 | QColorGroup itemg = !enabled ? pal.disabled() : pal.active(); |
624 | 624 | ||
625 | if ( checkable || maxpmw ) maxpmw = QMAX(maxpmw, 20); | 625 | if ( checkable || maxpmw ) maxpmw = QMAX(maxpmw, 20); |
626 | 626 | ||
627 | if (act && enabled ) | 627 | if (act && enabled ) |
628 | p->fillRect(x, y, w, h, g.highlight() ); | 628 | p->fillRect(x, y, w, h, g.highlight() ); |
629 | else | 629 | else |
630 | p->fillRect(x, y, w, h, g.background() ); | 630 | p->fillRect(x, y, w, h, g.background() ); |
631 | 631 | ||
632 | // draw seperator | 632 | // draw seperator |
633 | if (mi->isSeparator() ) { | 633 | if (mi->isSeparator() ) { |
634 | p->setPen( g.dark() ); | 634 | p->setPen( g.dark() ); |
635 | p->drawLine( x+8, y+1, x+w-8, y+1 ); | 635 | p->drawLine( x+8, y+1, x+w-8, y+1 ); |
636 | 636 | ||
637 | p->setPen( g.mid() ); | 637 | p->setPen( g.mid() ); |
638 | p->drawLine( x+8, y, x+w-8, y ); | 638 | p->drawLine( x+8, y, x+w-8, y ); |
639 | p->drawPoint(x+w,y+1); | 639 | p->drawPoint(x+w,y+1); |
640 | 640 | ||
641 | p->setPen( g.midlight() ); | 641 | p->setPen( g.midlight() ); |
642 | p->drawLine( x+8, y-1, x+w-8, y-1 ); | 642 | p->drawLine( x+8, y-1, x+w-8, y-1 ); |
643 | p->drawPoint(x+8, y ); | 643 | p->drawPoint(x+8, y ); |
644 | return; | 644 | return; |
645 | } | 645 | } |
646 | 646 | ||
647 | // draw icon | 647 | // draw icon |
648 | QIconSet::Mode mode; | 648 | QIconSet::Mode mode; |
649 | if ( mi->iconSet() && !mi->isChecked() ) { | 649 | if ( mi->iconSet() && !mi->isChecked() ) { |
650 | if ( act ) | 650 | if ( act ) |
651 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; | 651 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; |
652 | else | 652 | else |
653 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; | 653 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; |
654 | QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode ); | 654 | QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode ); |
655 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); | 655 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); |
656 | QRect cr(x, y, maxpmw, h ); | 656 | QRect cr(x, y, maxpmw, h ); |
657 | pmrect.moveCenter( cr.center() ); | 657 | pmrect.moveCenter( cr.center() ); |
658 | p->drawPixmap(pmrect.topLeft(), pixmap); | 658 | p->drawPixmap(pmrect.topLeft(), pixmap); |
659 | } | 659 | } |
660 | 660 | ||
661 | // draw check | 661 | // draw check |
662 | if(mi->isChecked() ) { | 662 | if(mi->isChecked() ) { |
663 | drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); | 663 | drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); |
664 | } | 664 | } |
665 | 665 | ||
666 | 666 | ||
667 | // draw text | 667 | // draw text |
668 | int xm = maxpmw + 2; | 668 | int xm = maxpmw + 2; |
669 | int xp = x + xm; | 669 | int xp = x + xm; |
670 | int tw = w -xm - 2; | 670 | int tw = w -xm - 2; |
671 | 671 | ||
672 | p->setPen( enabled ? ( act ? g.highlightedText() : g.buttonText() ) : | 672 | p->setPen( enabled ? ( act ? g.highlightedText() : g.buttonText() ) : |
673 | g.mid() ); | 673 | g.mid() ); |
674 | 674 | ||
675 | 675 | ||
676 | if ( mi->custom() ) { | 676 | if ( mi->custom() ) { |
677 | p->save(); | 677 | p->save(); |
678 | mi->custom()->paint(p, g, act, enabled, | 678 | mi->custom()->paint(p, g, act, enabled, |
679 | xp, y+1, tw, h-2 ); | 679 | xp, y+1, tw, h-2 ); |
680 | p->restore(); | 680 | p->restore(); |
681 | }else { // draw label | 681 | }else { // draw label |
682 | QString text = mi->text(); | 682 | QString text = mi->text(); |
683 | if (!text.isNull() ) { | 683 | if (!text.isNull() ) { |
684 | int t = text.find('\t'); | 684 | int t = text.find('\t'); |
685 | const int tflags = AlignVCenter | DontClip | | 685 | const int tflags = AlignVCenter | DontClip | |
686 | ShowPrefix | SingleLine | | 686 | ShowPrefix | SingleLine | |
687 | AlignLeft; | 687 | AlignLeft; |
688 | 688 | ||
689 | if (t >= 0) { | 689 | if (t >= 0) { |
690 | int tabx = x + w - tabwidth - RIGHTBORDER - | 690 | int tabx = x + w - tabwidth - RIGHTBORDER - |
691 | ITEMHMARGIN - ITEMFRAME; | 691 | ITEMHMARGIN - ITEMFRAME; |
692 | p->drawText(tabx, y+ITEMVMARGIN, tabwidth, | 692 | p->drawText(tabx, y+ITEMVMARGIN, tabwidth, |
693 | h-2*ITEMVMARGIN, tflags, | 693 | h-2*ITEMVMARGIN, tflags, |
694 | text.mid(t+1) ); | 694 | text.mid(t+1) ); |
695 | text = text.left(t ); | 695 | text = text.left(t ); |
696 | } | 696 | } |
697 | 697 | ||
698 | // draw left label | 698 | // draw left label |
699 | p->drawText(xp, y+ITEMVMARGIN, | 699 | p->drawText(xp, y+ITEMVMARGIN, |
700 | tw, h-2*ITEMVMARGIN, | 700 | tw, h-2*ITEMVMARGIN, |
701 | tflags, text, t); | 701 | tflags, text, t); |
702 | }else if ( mi->pixmap() ) { // pixmap as label | 702 | }else if ( mi->pixmap() ) { // pixmap as label |
703 | QPixmap pixmap = *mi->pixmap(); | 703 | QPixmap pixmap = *mi->pixmap(); |
704 | if ( pixmap.depth() == 1 ) | 704 | if ( pixmap.depth() == 1 ) |
705 | p->setBackgroundMode( OpaqueMode ); | 705 | p->setBackgroundMode( OpaqueMode ); |
706 | 706 | ||
707 | int dx = ((w-pixmap.width() ) /2 ) + | 707 | int dx = ((w-pixmap.width() ) /2 ) + |
708 | ((w - pixmap.width()) %2 ); | 708 | ((w - pixmap.width()) %2 ); |
709 | p->drawPixmap(x+dx, y+ITEMFRAME, pixmap ); | 709 | p->drawPixmap(x+dx, y+ITEMFRAME, pixmap ); |
710 | 710 | ||
711 | if ( pixmap.depth() == 1 ) | 711 | if ( pixmap.depth() == 1 ) |
712 | p->setBackgroundMode( TransparentMode ); | 712 | p->setBackgroundMode( TransparentMode ); |
713 | } | 713 | } |
714 | } | 714 | } |
715 | 715 | ||
716 | if ( mi->popup() ) { // draw submenu arrow | 716 | if ( mi->popup() ) { // draw submenu arrow |
717 | int dim = (h-2*ITEMFRAME) / 2; | 717 | int dim = (h-2*ITEMFRAME) / 2; |
718 | drawArrow( p, RightArrow, false, | 718 | drawArrow( p, RightArrow, false, |
719 | x+w-ARROWMARGIN-ITEMFRAME-dim, | 719 | x+w-ARROWMARGIN-ITEMFRAME-dim, |
720 | y+h/2-dim/2, dim, dim, g, enabled ); | 720 | y+h/2-dim/2, dim, dim, g, enabled ); |
721 | } | 721 | } |
722 | } | 722 | } |
723 | 723 | ||
724 | 724 | ||
725 | QRect PhaseStyle::comboButtonRect ( int x, int y, int w, int h ) { | 725 | QRect PhaseStyle::comboButtonRect ( int x, int y, int w, int h ) { |
726 | return QRect(x+2, y+2, w-4-17, h-5 ); | 726 | return QRect(x+2, y+2, w-4-17, h-5 ); |
727 | } | 727 | } |
728 | 728 | ||
729 | void PhaseStyle::drawComboButton( QPainter * p, int x, int y, | 729 | void PhaseStyle::drawComboButton( QPainter * p, int x, int y, |
730 | int w, int h, | 730 | int w, int h, |
731 | const QColorGroup & g, | 731 | const QColorGroup & g, |
732 | bool sunken, | 732 | bool sunken, |
733 | bool editable, | 733 | bool editable, |
734 | bool, | 734 | bool, |
735 | const QBrush *) { | 735 | const QBrush *) { |
736 | drawButton(p, x, y, w, h, g, | 736 | drawButton(p, x, y, w, h, g, |
737 | sunken, &g.brush(QColorGroup::Button )); | 737 | sunken, &g.brush(QColorGroup::Button )); |
738 | 738 | ||
739 | for ( int n = 0; n < 2; ++n ) | ||
740 | kColorBitmaps(p, g, w-16+(6*n), y+(h/2)-2, | ||
741 | 0, &doodad_mid, &doodad_light, 0, 0, 0 ); | ||
739 | 742 | ||
740 | bool odd = (h % 2); | ||
741 | drawPanel(p, w-15 , y+(h/2)-3, 10, (odd ? 7 : 6 ), | ||
742 | g, true , 1, sunken ? &g.brush(QColorGroup::Midlight) | ||
743 | : &g.brush(QColorGroup::Mid) ); | ||
744 | 743 | ||
745 | if (editable ) { | 744 | if (editable ) { |
746 | const int x2 = x+w-1; const int y2 = y+h-1; | 745 | const int x2 = x+w-1; const int y2 = y+h-1; |
747 | p->setPen(g.dark()); | 746 | p->setPen(g.dark()); |
748 | p->drawLine(x2+1, y, x2+1, y2); | 747 | p->drawLine(x2+1, y, x2+1, y2); |
749 | p->setPen(g.midlight()); | 748 | p->setPen(g.midlight()); |
750 | p->drawLine(x2+2, y, x2+2, y2-1); | 749 | p->drawLine(x2+2, y, x2+2, y2-1); |
751 | p->setPen(g.button()); | 750 | p->setPen(g.button()); |
752 | p->drawPoint(x2+2, y2); | 751 | p->drawPoint(x2+2, y2); |
753 | } | 752 | } |
754 | 753 | ||
755 | p->setPen(g.buttonText() ); | 754 | p->setPen(g.buttonText() ); |
756 | } | 755 | } |
757 | 756 | ||
758 | 757 | ||
759 | void PhaseStyle::drawTab(QPainter* painter, const QTabBar* bar, QTab* tab, | 758 | void PhaseStyle::drawTab(QPainter* painter, const QTabBar* bar, QTab* tab, |
760 | bool selected ) { | 759 | bool selected ) { |
761 | bool edge = false; | 760 | bool edge = false; |
762 | int x, y, w, h; | 761 | int x, y, w, h; |
763 | QRect r = tab->rect(); | 762 | QRect r = tab->rect(); |
764 | r.rect(&x,&y,&w,&h); | 763 | r.rect(&x,&y,&w,&h); |
765 | const int x2 = x+w-1; | 764 | const int x2 = x+w-1; |
766 | const int y2 = y+h-1; | 765 | const int y2 = y+h-1; |
767 | const QColorGroup &group = bar->colorGroup(); | 766 | const QColorGroup &group = bar->colorGroup(); |
768 | 767 | ||
769 | 768 | ||
770 | painter->save(); | 769 | painter->save(); |
771 | 770 | ||
772 | // what position is the tab? | 771 | // what position is the tab? |
773 | if ((bar->count() == 1 )) | 772 | if ((bar->count() == 1 )) |
774 | edge = true; | 773 | edge = true; |
775 | else | 774 | else |
776 | edge = false; | 775 | edge = false; |
777 | 776 | ||
778 | switch (QTabBar::Shape(bar->shape())) { | 777 | switch (QTabBar::Shape(bar->shape())) { |
779 | case QTabBar::RoundedAbove: | 778 | case QTabBar::RoundedAbove: |
780 | case QTabBar::TriangularAbove: { | 779 | case QTabBar::TriangularAbove: { |
781 | if (!selected) { // shorten | 780 | if (!selected) { // shorten |
782 | y += 2; h -= 2; | 781 | y += 2; h -= 2; |
783 | } | 782 | } |
784 | if (selected) { | 783 | if (selected) { |
785 | painter->setPen(Qt::NoPen); | 784 | painter->setPen(Qt::NoPen); |
786 | painter->fillRect(x+1, y+1, w-1, h-1, | 785 | painter->fillRect(x+1, y+1, w-1, h-1, |
787 | group.brush(QColorGroup::Background)); | 786 | group.brush(QColorGroup::Background)); |
788 | } else | 787 | } else |
789 | drawPhaseGradient(painter, QRect(x+1, y+1, w-1, h-2), | 788 | drawPhaseGradient(painter, QRect(x+1, y+1, w-1, h-2), |
790 | group.background().dark(contrast) ); | 789 | group.background().dark(contrast) ); |
791 | 790 | ||
792 | 791 | ||
793 | // draw tab | 792 | // draw tab |
794 | painter->setPen(group.dark()); | 793 | painter->setPen(group.dark()); |
795 | painter->drawLine(x, y, x, y2-2); | 794 | painter->drawLine(x, y, x, y2-2); |
796 | painter->drawLine(x+1, y, x2, y); | 795 | painter->drawLine(x+1, y, x2, y); |
797 | painter->drawLine(x2, y+1, x2, y2-2); | 796 | painter->drawLine(x2, y+1, x2, y2-2); |
798 | 797 | ||
799 | painter->setPen(group.mid()); | 798 | painter->setPen(group.mid()); |
800 | painter->drawLine(x2-1, y+2, x2-1, y2-2); | 799 | painter->drawLine(x2-1, y+2, x2-1, y2-2); |
801 | 800 | ||
802 | painter->setPen(group.midlight()); | 801 | painter->setPen(group.midlight()); |
803 | painter->drawLine(x+1, y+1, x2-2, y+1); | 802 | painter->drawLine(x+1, y+1, x2-2, y+1); |
804 | if ((selected) || edge) painter->drawLine(x+1, y+2, x+1, y2-2); | 803 | if ((selected) || edge) painter->drawLine(x+1, y+2, x+1, y2-2); |
805 | 804 | ||
806 | // finish off bottom | 805 | // finish off bottom |
807 | if (selected) { | 806 | if (selected) { |
808 | painter->setPen(group.dark()); | 807 | painter->setPen(group.dark()); |
809 | painter->drawPoint(x, y2-1); | 808 | painter->drawPoint(x, y2-1); |
810 | painter->drawPoint(x2, y2-1); | 809 | painter->drawPoint(x2, y2-1); |
811 | 810 | ||
812 | painter->setPen(group.midlight()); | 811 | painter->setPen(group.midlight()); |
813 | painter->drawPoint(x, y2); | 812 | painter->drawPoint(x, y2); |
814 | painter->drawLine(x+1, y2-1, x+1, y2); | 813 | painter->drawLine(x+1, y2-1, x+1, y2); |
815 | painter->drawPoint(x2, y2); | 814 | painter->drawPoint(x2, y2); |
816 | 815 | ||
817 | painter->setPen(group.mid()); | 816 | painter->setPen(group.mid()); |
818 | painter->drawPoint(x2-1, y2-1); | 817 | painter->drawPoint(x2-1, y2-1); |
819 | 818 | ||
820 | if (edge) { | 819 | if (edge) { |
821 | painter->setPen(group.dark()); | 820 | painter->setPen(group.dark()); |
822 | painter->drawLine(x, y2-1, x, y2); | 821 | painter->drawLine(x, y2-1, x, y2); |
823 | painter->setPen(group.midlight()); | 822 | painter->setPen(group.midlight()); |
824 | painter->drawPoint(x+1, y2); | 823 | painter->drawPoint(x+1, y2); |
825 | } | 824 | } |
826 | } else { | 825 | } else { |
827 | painter->setPen(group.dark()); | 826 | painter->setPen(group.dark()); |
828 | painter->drawLine(x, y2-1, x2, y2-1); | 827 | painter->drawLine(x, y2-1, x2, y2-1); |
829 | 828 | ||
830 | painter->setPen(group.midlight()); | 829 | painter->setPen(group.midlight()); |
831 | painter->drawLine(x, y2, x2, y2); | 830 | painter->drawLine(x, y2, x2, y2); |
832 | 831 | ||
833 | if (edge) { | 832 | if (edge) { |
834 | painter->setPen(group.dark()); | 833 | painter->setPen(group.dark()); |
835 | painter->drawLine(x, y2-1, x, y2); | 834 | painter->drawLine(x, y2-1, x, y2); |
836 | } | 835 | } |
837 | } | 836 | } |
838 | break; | 837 | break; |
839 | } | 838 | } |
840 | case QTabBar::RoundedBelow: | 839 | case QTabBar::RoundedBelow: |
841 | case QTabBar::TriangularBelow: { | 840 | case QTabBar::TriangularBelow: { |
842 | painter->setBrush( group.background().dark(contrast)); | 841 | painter->setBrush( group.background().dark(contrast)); |
843 | painter->setPen(Qt::NoPen); | 842 | painter->setPen(Qt::NoPen); |
844 | painter->fillRect(x+1, y+1, w-1, h-1, painter->brush()); | 843 | painter->fillRect(x+1, y+1, w-1, h-1, painter->brush()); |
845 | 844 | ||
846 | // draw tab | 845 | // draw tab |
847 | painter->setPen(group.dark()); | 846 | painter->setPen(group.dark()); |
848 | painter->drawLine(x, y+1, x, y2); | 847 | painter->drawLine(x, y+1, x, y2); |
849 | painter->drawLine(x+1, y2, x2, y2); | 848 | painter->drawLine(x+1, y2, x2, y2); |
850 | painter->drawLine(x2, y+1, x2, y2-1); | 849 | painter->drawLine(x2, y+1, x2, y2-1); |
851 | 850 | ||
852 | painter->setPen(group.mid()); | 851 | painter->setPen(group.mid()); |
853 | painter->drawLine(x2-1, y+1, x2-1, y2-1); | 852 | painter->drawLine(x2-1, y+1, x2-1, y2-1); |
854 | painter->drawLine(x+2, y2-1, x2-1, y2-1); | 853 | painter->drawLine(x+2, y2-1, x2-1, y2-1); |
855 | painter->drawPoint(x, y); | 854 | painter->drawPoint(x, y); |
856 | painter->drawPoint(x2, y); | 855 | painter->drawPoint(x2, y); |
857 | 856 | ||
858 | if ((selected) || edge) { | 857 | if ((selected) || edge) { |
859 | painter->setPen(group.midlight()); | 858 | painter->setPen(group.midlight()); |
860 | painter->drawLine(x+1, y+1, x+1, y2-2); | 859 | painter->drawLine(x+1, y+1, x+1, y2-2); |
861 | } | 860 | } |
862 | 861 | ||
863 | // finish off top | 862 | // finish off top |
864 | if (selected) { | 863 | if (selected) { |
865 | if (edge) { | 864 | if (edge) { |
866 | painter->setPen(group.dark()); | 865 | painter->setPen(group.dark()); |
867 | painter->drawPoint(x, y); | 866 | painter->drawPoint(x, y); |
868 | painter->setPen(group.midlight()); | 867 | painter->setPen(group.midlight()); |
869 | painter->drawPoint(x+1, y); | 868 | painter->drawPoint(x+1, y); |
870 | } | 869 | } |
871 | } else { | 870 | } else { |
872 | painter->setPen(group.dark()); | 871 | painter->setPen(group.dark()); |
873 | painter->drawLine(x, y+1, x2, y+1); | 872 | painter->drawLine(x, y+1, x2, y+1); |
874 | 873 | ||
875 | painter->setPen(group.mid()); | 874 | painter->setPen(group.mid()); |
876 | painter->drawLine(x, y, x2, y); | 875 | painter->drawLine(x, y, x2, y); |
877 | 876 | ||
878 | if (edge) { | 877 | if (edge) { |
879 | painter->setPen(group.dark()); | 878 | painter->setPen(group.dark()); |
880 | painter->drawPoint(x, y); | 879 | painter->drawPoint(x, y); |
881 | } | 880 | } |
882 | } | 881 | } |
883 | break; | 882 | break; |
884 | } | 883 | } |
885 | } | 884 | } |
886 | 885 | ||
887 | painter->restore(); | 886 | painter->restore(); |
888 | } | 887 | } |
889 | 888 | ||
890 | void PhaseStyle::drawTabMask( QPainter* p, const QTabBar*, QTab* tab, | 889 | void PhaseStyle::drawTabMask( QPainter* p, const QTabBar*, QTab* tab, |
891 | bool ) { | 890 | bool ) { |
892 | p->fillRect(tab->rect(), Qt::color1); | 891 | p->fillRect(tab->rect(), Qt::color1); |
893 | } | 892 | } |
894 | 893 | ||
895 | void PhaseStyle::drawToolButton(QPainter * p, int x, int y, | 894 | void PhaseStyle::drawToolButton(QPainter * p, int x, int y, |
896 | int w, int h, const QColorGroup & g, | 895 | int w, int h, const QColorGroup & g, |
897 | bool sunken, | 896 | bool sunken, |
898 | const QBrush * fill ) { | 897 | const QBrush * fill ) { |
899 | QRect r(x, y, w, h ); | 898 | QRect r(x, y, w, h ); |
900 | p->fillRect(r, g.background()); | 899 | p->fillRect(r, g.background()); |
901 | 900 | ||
902 | drawPanel(p, x, y, w, h, g, sunken, 1, | 901 | drawPanel(p, x, y, w, h, g, sunken, 1, |
903 | fill ? fill : &g.brush(QColorGroup::Button) ); | 902 | fill ? fill : &g.brush(QColorGroup::Button) ); |
904 | 903 | ||
905 | 904 | ||
906 | p->setPen(g.text() ); | 905 | p->setPen(g.text() ); |
907 | } | 906 | } |
908 | 907 | ||
909 | 908 | ||
910 | /* | 909 | /* |
911 | * LGPLv2 Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org> | 910 | * LGPLv2 Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org> |
912 | * | 911 | * |
913 | * ../web/webstyle.cpp | 912 | * ../web/webstyle.cpp |
914 | */ | 913 | */ |
915 | void PhaseStyle::scrollBarMetrics(const QScrollBar* sb, int& sliderMin, | 914 | void PhaseStyle::scrollBarMetrics(const QScrollBar* sb, int& sliderMin, |
916 | int& sliderMax, int &sliderLength, | 915 | int& sliderMax, int &sliderLength, |
917 | int& buttonDim ) { | 916 | int& buttonDim ) { |
918 | int maxlen; | 917 | int maxlen; |
919 | bool horizontal = sb->orientation() == QScrollBar::Horizontal; | 918 | bool horizontal = sb->orientation() == QScrollBar::Horizontal; |
920 | int len = (horizontal) ? sb->width() : sb->height(); | 919 | int len = (horizontal) ? sb->width() : sb->height(); |
921 | int extent = (horizontal) ? sb->height() : sb->width(); | 920 | int extent = (horizontal) ? sb->height() : sb->width(); |
922 | 921 | ||
923 | if (len > (extent - 1) * 2) | 922 | if (len > (extent - 1) * 2) |
924 | buttonDim = extent; | 923 | buttonDim = extent; |
925 | else | 924 | else |
926 | buttonDim = len / 2 - 1; | 925 | buttonDim = len / 2 - 1; |
927 | 926 | ||
928 | if (horizontal) | 927 | if (horizontal) |
929 | sliderMin = buttonDim * 2; | 928 | sliderMin = buttonDim * 2; |
930 | else | 929 | else |
931 | sliderMin = 1; | 930 | sliderMin = 1; |
932 | 931 | ||
933 | maxlen = len - buttonDim * 2 - 1; | 932 | maxlen = len - buttonDim * 2 - 1; |
934 | int div = QMAX(1, (sb->maxValue() - sb->minValue() + sb->pageStep() ) ); | 933 | int div = QMAX(1, (sb->maxValue() - sb->minValue() + sb->pageStep() ) ); |
935 | 934 | ||