Sync missing r908463 from Oxygen.

svn path=/trunk/KDE/kdebase/workspace/; revision=999259
This commit is contained in:
Lucas Murray 2009-07-19 14:47:36 +00:00
parent 2b82601558
commit 35d1ba665f

View file

@ -208,11 +208,13 @@ void OxygenButton::paintEvent(QPaintEvent *)
dark.setAlpha(120); dark.setAlpha(120);
if(client_.isActive()) { if(client_.isActive())
{
helper_.drawSeparator(&painter, QRect(x, titleHeight-1.5, w, 2), color, Qt::Horizontal); 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) // we paint the mini icon (which is 16 pixels high)
int dx = (width() - 16) / 2; int dx = (width() - 16) / 2;
int dy = (height() - 16) / 2 - 1; int dy = (height() - 16) / 2 - 1;
@ -222,31 +224,47 @@ void OxygenButton::paintEvent(QPaintEvent *)
if(client_.maximizeMode() == OxygenClient::MaximizeRestore) if(client_.maximizeMode() == OxygenClient::MaximizeRestore)
{
painter.translate(0,-1); painter.translate(0,-1);
}
QColor bg = helper_.backgroundTopColor(OxygenFactory::blendTitlebarColors()?pal.window().color() QColor bg = helper_.backgroundTopColor(OxygenFactory::blendTitlebarColors()?pal.window().color()
:client_.options()->color(KDecorationDefines::ColorTitleBar,client_.isActive())); :client_.options()->color(KDecorationDefines::ColorTitleBar,client_.isActive()));
// get icon color
color = buttonDetailColor(pal); color = buttonDetailColor(pal);
if(status_ == Oxygen::Hovered || status_ == Oxygen::Pressed) { if (status_ == Oxygen::Hovered || status_ == Oxygen::Pressed)
if(type_ == ButtonClose) {
if (type_ == ButtonClose)
{
color = KColorScheme(pal.currentColorGroup()).foreground(KColorScheme::NegativeText).color(); 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); else
{
color = KColorScheme(pal.currentColorGroup()).decoration(KColorScheme::HoverColor).color();
}
}
// draw button
QColor bt = OxygenFactory::blendTitlebarColors()?pal.window().color() QColor bt = OxygenFactory::blendTitlebarColors()?pal.window().color()
:client_.options()->color(KDecorationDefines::ColorButtonBg,client_.isActive()); :client_.options()->color(KDecorationDefines::ColorButtonBg,client_.isActive());
painter.drawPixmap(0, 0, helper_.windecoButton(bt, status_ == Oxygen::Pressed)); 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.setRenderHints(QPainter::Antialiasing);
painter.setBrush(Qt::NoBrush); 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_); drawIcon(&painter, pal, type_);
} }
else { else
{
// outlined mode // outlined mode
QPixmap pixmap(size()); QPixmap pixmap(size());
pixmap.fill(Qt::transparent); pixmap.fill(Qt::transparent);