summaryrefslogtreecommitdiff
authorzecke <zecke>2004-08-28 21:12:49 (UTC)
committer zecke <zecke>2004-08-28 21:12:49 (UTC)
commit2bc77ab7c6dd7310f95e70d46f4bfc55a84f32cf (patch) (side-by-side diff)
treefc0730cc591fa106c03b7e9ab525a97a34e1fc3b
parent2fa06314f2779b77de9c07c4f9fbd8cb5af8f215 (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/phase/phasestyle.cpp7
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
@@ -643,197 +643,196 @@ void PhaseStyle::drawPopupMenuItem ( QPainter * p, bool checkable,
p->drawPoint(x+8, y );
return;
}
// draw icon
QIconSet::Mode mode;
if ( mi->iconSet() && !mi->isChecked() ) {
if ( act )
mode = enabled ? QIconSet::Active : QIconSet::Disabled;
else
mode = enabled ? QIconSet::Normal : QIconSet::Disabled;
QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode );
QRect pmrect(0, 0, pixmap.width(), pixmap.height() );
QRect cr(x, y, maxpmw, h );
pmrect.moveCenter( cr.center() );
p->drawPixmap(pmrect.topLeft(), pixmap);
}
// draw check
if(mi->isChecked() ) {
drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled );
}
// draw text
int xm = maxpmw + 2;
int xp = x + xm;
int tw = w -xm - 2;
p->setPen( enabled ? ( act ? g.highlightedText() : g.buttonText() ) :
g.mid() );
if ( mi->custom() ) {
p->save();
mi->custom()->paint(p, g, act, enabled,
xp, y+1, tw, h-2 );
p->restore();
}else { // draw label
QString text = mi->text();
if (!text.isNull() ) {
int t = text.find('\t');
const int tflags = AlignVCenter | DontClip |
ShowPrefix | SingleLine |
AlignLeft;
if (t >= 0) {
int tabx = x + w - tabwidth - RIGHTBORDER -
ITEMHMARGIN - ITEMFRAME;
p->drawText(tabx, y+ITEMVMARGIN, tabwidth,
h-2*ITEMVMARGIN, tflags,
text.mid(t+1) );
text = text.left(t );
}
// draw left label
p->drawText(xp, y+ITEMVMARGIN,
tw, h-2*ITEMVMARGIN,
tflags, text, t);
}else if ( mi->pixmap() ) { // pixmap as label
QPixmap pixmap = *mi->pixmap();
if ( pixmap.depth() == 1 )
p->setBackgroundMode( OpaqueMode );
int dx = ((w-pixmap.width() ) /2 ) +
((w - pixmap.width()) %2 );
p->drawPixmap(x+dx, y+ITEMFRAME, pixmap );
if ( pixmap.depth() == 1 )
p->setBackgroundMode( TransparentMode );
}
}
if ( mi->popup() ) { // draw submenu arrow
int dim = (h-2*ITEMFRAME) / 2;
drawArrow( p, RightArrow, false,
x+w-ARROWMARGIN-ITEMFRAME-dim,
y+h/2-dim/2, dim, dim, g, enabled );
}
}
QRect PhaseStyle::comboButtonRect ( int x, int y, int w, int h ) {
return QRect(x+2, y+2, w-4-17, h-5 );
}
void PhaseStyle::drawComboButton( QPainter * p, int x, int y,
int w, int h,
const QColorGroup & g,
bool sunken,
bool editable,
bool,
const QBrush *) {
drawButton(p, x, y, w, h, g,
sunken, &g.brush(QColorGroup::Button ));
+ for ( int n = 0; n < 2; ++n )
+ kColorBitmaps(p, g, w-16+(6*n), y+(h/2)-2,
+ 0, &doodad_mid, &doodad_light, 0, 0, 0 );
- bool odd = (h % 2);
- drawPanel(p, w-15 , y+(h/2)-3, 10, (odd ? 7 : 6 ),
- g, true , 1, sunken ? &g.brush(QColorGroup::Midlight)
- : &g.brush(QColorGroup::Mid) );
if (editable ) {
const int x2 = x+w-1; const int y2 = y+h-1;
p->setPen(g.dark());
p->drawLine(x2+1, y, x2+1, y2);
p->setPen(g.midlight());
p->drawLine(x2+2, y, x2+2, y2-1);
p->setPen(g.button());
p->drawPoint(x2+2, y2);
}
p->setPen(g.buttonText() );
}
void PhaseStyle::drawTab(QPainter* painter, const QTabBar* bar, QTab* tab,
bool selected ) {
bool edge = false;
int x, y, w, h;
QRect r = tab->rect();
r.rect(&x,&y,&w,&h);
const int x2 = x+w-1;
const int y2 = y+h-1;
const QColorGroup &group = bar->colorGroup();
painter->save();
// what position is the tab?
if ((bar->count() == 1 ))
edge = true;
else
edge = false;
switch (QTabBar::Shape(bar->shape())) {
case QTabBar::RoundedAbove:
case QTabBar::TriangularAbove: {
if (!selected) { // shorten
y += 2; h -= 2;
}
if (selected) {
painter->setPen(Qt::NoPen);
painter->fillRect(x+1, y+1, w-1, h-1,
group.brush(QColorGroup::Background));
} else
drawPhaseGradient(painter, QRect(x+1, y+1, w-1, h-2),
group.background().dark(contrast) );
// draw tab
painter->setPen(group.dark());
painter->drawLine(x, y, x, y2-2);
painter->drawLine(x+1, y, x2, y);
painter->drawLine(x2, y+1, x2, y2-2);
painter->setPen(group.mid());
painter->drawLine(x2-1, y+2, x2-1, y2-2);
painter->setPen(group.midlight());
painter->drawLine(x+1, y+1, x2-2, y+1);
if ((selected) || edge) painter->drawLine(x+1, y+2, x+1, y2-2);
// finish off bottom
if (selected) {
painter->setPen(group.dark());
painter->drawPoint(x, y2-1);
painter->drawPoint(x2, y2-1);
painter->setPen(group.midlight());
painter->drawPoint(x, y2);
painter->drawLine(x+1, y2-1, x+1, y2);
painter->drawPoint(x2, y2);
painter->setPen(group.mid());
painter->drawPoint(x2-1, y2-1);
if (edge) {
painter->setPen(group.dark());
painter->drawLine(x, y2-1, x, y2);
painter->setPen(group.midlight());
painter->drawPoint(x+1, y2);
}
} else {
painter->setPen(group.dark());
painter->drawLine(x, y2-1, x2, y2-1);
painter->setPen(group.midlight());
painter->drawLine(x, y2, x2, y2);
if (edge) {
painter->setPen(group.dark());
painter->drawLine(x, y2-1, x, y2);
}
}
break;
}