From 35d1ba665fa18acd40712adf2cec775c8c281ac3 Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Sun, 19 Jul 2009 14:47:36 +0000 Subject: [PATCH] Sync missing r908463 from Oxygen. svn path=/trunk/KDE/kdebase/workspace/; revision=999259 --- clients/ozone/oxygenbutton.cpp | 36 +++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/clients/ozone/oxygenbutton.cpp b/clients/ozone/oxygenbutton.cpp index c48b757d0f..1148c62fda 100644 --- a/clients/ozone/oxygenbutton.cpp +++ b/clients/ozone/oxygenbutton.cpp @@ -208,11 +208,13 @@ void OxygenButton::paintEvent(QPaintEvent *) dark.setAlpha(120); - if(client_.isActive()) { + if(client_.isActive()) + { helper_.drawSeparator(&painter, QRect(x, titleHeight-1.5, w, 2), color, Qt::Horizontal); } - if (type_ == ButtonMenu) { + if (type_ == ButtonMenu) + { // we paint the mini icon (which is 16 pixels high) int dx = (width() - 16) / 2; int dy = (height() - 16) / 2 - 1; @@ -222,31 +224,47 @@ void OxygenButton::paintEvent(QPaintEvent *) if(client_.maximizeMode() == OxygenClient::MaximizeRestore) + { painter.translate(0,-1); + } QColor bg = helper_.backgroundTopColor(OxygenFactory::blendTitlebarColors()?pal.window().color() :client_.options()->color(KDecorationDefines::ColorTitleBar,client_.isActive())); + // get icon color color = buttonDetailColor(pal); - if(status_ == Oxygen::Hovered || status_ == Oxygen::Pressed) { - if(type_ == ButtonClose) + if (status_ == Oxygen::Hovered || status_ == Oxygen::Pressed) + { + if (type_ == ButtonClose) + { color = KColorScheme(pal.currentColorGroup()).foreground(KColorScheme::NegativeText).color(); + } else + { color = KColorScheme(pal.currentColorGroup()).decoration(KColorScheme::HoverColor).color(); - + } } - QLinearGradient lg = helper_.decoGradient(QRect(4,4,13,13), color); + + // draw button QColor bt = OxygenFactory::blendTitlebarColors()?pal.window().color() :client_.options()->color(KDecorationDefines::ColorButtonBg,client_.isActive()); painter.drawPixmap(0, 0, helper_.windecoButton(bt, status_ == Oxygen::Pressed)); - if (client_.isActive()) { + // draw glow on hover + if (status_ == Oxygen::Hovered) + { + painter.drawPixmap(0, 0, helper_.windecoButtonGlow(color)); + } + + if (client_.isActive()) + { painter.setRenderHints(QPainter::Antialiasing); painter.setBrush(Qt::NoBrush); - painter.setPen(QPen(lg, 2.2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.setPen(QPen(color, 1.4, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); drawIcon(&painter, pal, type_); } - else { + else + { // outlined mode QPixmap pixmap(size()); pixmap.fill(Qt::transparent);