From 9de10454ff386f8d2b971d6615ea6513196bfe9f Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 5 Aug 2011 07:17:28 +0000 Subject: [PATCH] Additional Asteroid widget style fixups git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1245128 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdeui/kpopupmenu.cpp | 2 +- kstyles/asteroid/asteroid.cpp | 47 +++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/kdeui/kpopupmenu.cpp b/kdeui/kpopupmenu.cpp index c4ef260e7..b6fa2b0d8 100644 --- a/kdeui/kpopupmenu.cpp +++ b/kdeui/kpopupmenu.cpp @@ -90,7 +90,7 @@ void KPopupTitle::paintEvent(TQPaintEvent *) { TQRect r(rect()); TQPainter p(this); - kapp->tqstyle().tqdrawPrimitive(TQStyle::PE_HeaderSection, &p, r, tqpalette().active()); + kapp->tqstyle().tqdrawPrimitive(TQStyle::PE_HeaderSectionMenu, &p, r, tqpalette().active()); if (!miniicon.isNull()) p.drawPixmap(4, (r.height()-miniicon.height())/2, miniicon); diff --git a/kstyles/asteroid/asteroid.cpp b/kstyles/asteroid/asteroid.cpp index ee7830c84..452f5bbb7 100644 --- a/kstyles/asteroid/asteroid.cpp +++ b/kstyles/asteroid/asteroid.cpp @@ -112,7 +112,15 @@ void AsteroidStyle::polish(TQWidget *w) wp.setColor(TQColorGroup::Dark, TQColor(128, 128, 128)); wp.setColor(TQColorGroup::Mid, wp.active().color(TQColorGroup::Button).dark(150)); // Which GUI element(s) does this correspond to? - if ( ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w) /*|| ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w)*/ || ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w) || ::tqqt_cast(w)|| ::tqqt_cast(w)) + bool isProtectedObject = false; + TQObject *curparent = w; + while (curparent) { + if (curparent->inherits("KonqFileTip") || curparent->inherits("AppletItem")) { + isProtectedObject = true; + } + curparent = curparent->tqparent(); + } + if (!isProtectedObject) w->setPalette(wp); if (w->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) { @@ -345,11 +353,46 @@ void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe, break; } + // FIXME + // This appears to do double duty, + // specifically it appears both in popup menu headers + // *and* at the top of tree views! + // The tree views need the stuff that is commented out + // to look correct, but when that is done the popup menus + // look absolutely HORRIBLE. + // How can we tell the two apart? Create PE_HeaderSectionMenu perhaps? case PE_HeaderSection: { p->setPen(cg.shadow()); p->setBrush(cg.background()); p->drawRect(r); + if (sf & Style_On) { + p->setPen(cg.mid()); + p->setBrush(TQBrush(cg.light(),TQt::Dense4Pattern)); + p->drawRect(r); + p->setPen(cg.buttonText()); + } else if (sf & Style_Down) { + p->setPen(cg.mid()); + p->drawRect(r); + p->setPen(cg.buttonText()); + } else { + p->setPen(cg.light()); + p->drawLine(x, y, x2-1, y); + p->drawLine(x, y, x, y2-1); + + p->setPen(cg.mid()); + p->drawLine(x2-1, y2-1, x+1, y2-1); + p->drawLine(x2-1, y2-1, x2-1, y+1); + } + + break; + } + + case PE_HeaderSectionMenu: { + p->setPen(cg.shadow()); + p->setBrush(cg.background()); + p->drawRect(r); + // if (sf & Style_On) { // p->setPen(cg.mid()); // p->setBrush(TQBrush(cg.light(),TQt::Dense4Pattern)); @@ -1014,7 +1057,7 @@ void AsteroidStyle::tqdrawControl(TQ_ControlElement ce, etchedcg.setColor( TQColorGroup::HighlightedText, cg.dark() ); etchedcg.setColor( TQColorGroup::BrightText, cg.dark() ); etchedcg.setColor( TQColorGroup::ButtonText, cg.dark() ); - drawItem( p, tr, tqalignment, cg, enabled, 0, t->text() ); + drawItem( p, tr, tqalignment, etchedcg, enabled, 0, t->text() ); p->setPen(savePen); } else {