buttons
This commit is contained in:
parent
b8a767e3cf
commit
e22573e586
2 changed files with 23 additions and 17 deletions
|
@ -238,25 +238,30 @@ namespace Oxygen
|
|||
buttonDetailColor( _client.backgroundPalette( this, palette ) ):
|
||||
buttonDetailColor( palette );
|
||||
|
||||
// glow color
|
||||
QColor glow = isCloseButton() ?
|
||||
// decide decoration color
|
||||
QColor glow;
|
||||
if( isAnimated() || _status == Oxygen::Hovered )
|
||||
{
|
||||
glow = isCloseButton() ?
|
||||
_helper.viewNegativeTextBrush().brush(palette).color():
|
||||
_helper.viewHoverBrush().brush(palette).color();
|
||||
|
||||
// decide decoration color
|
||||
if( isAnimated() ) color = KColorUtils::mix( color, glow, glowIntensity() );
|
||||
else if( _status == Oxygen::Hovered ) color = glow;
|
||||
if( isAnimated() )
|
||||
{
|
||||
|
||||
color = KColorUtils::mix( color, glow, glowIntensity() );
|
||||
glow = _helper.alphaColor( glow, glowIntensity() );
|
||||
|
||||
} else if( _status == Oxygen::Hovered ) color = glow;
|
||||
|
||||
}
|
||||
|
||||
if( hasDecoration() )
|
||||
{
|
||||
|
||||
// shadow color
|
||||
if( isAnimated() ) shadow = _helper.alphaColor( glow, glowIntensity() );
|
||||
else if( _status == Oxygen::Hovered ) shadow = glow;
|
||||
|
||||
// scale
|
||||
qreal scale( (21.0*_client.configuration().buttonSize())/22.0 );
|
||||
|
||||
// decide on pressed state
|
||||
// pressed state
|
||||
const bool pressed(
|
||||
(_status == Oxygen::Pressed) ||
|
||||
( _type == ButtonSticky && _client.isOnAllDesktops() ) ||
|
||||
|
@ -264,7 +269,7 @@ namespace Oxygen
|
|||
( _type == ButtonBelow && _client.keepBelow() ) );
|
||||
|
||||
// draw button shape
|
||||
painter.drawPixmap(0, 0, _helper.windecoButton( base, shadow, pressed, scale ) );
|
||||
painter.drawPixmap(0, 0, _helper.windecoButton( base, glow, pressed, scale ) );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -66,14 +66,14 @@ namespace Oxygen
|
|||
QPainter p( pixmap );
|
||||
p.setRenderHints(QPainter::Antialiasing);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setWindow( 0, 0, 18, 18 );
|
||||
p.setWindow( 0, 0, 21, 21 );
|
||||
|
||||
// button shadow
|
||||
if( color.isValid() )
|
||||
{
|
||||
p.save();
|
||||
p.translate( 0, -1.2 );
|
||||
drawShadow( p, calcShadowColor( color ), 18 );
|
||||
drawShadow( p, calcShadowColor( color ), 21 );
|
||||
p.restore();
|
||||
}
|
||||
|
||||
|
@ -82,11 +82,12 @@ namespace Oxygen
|
|||
{
|
||||
p.save();
|
||||
p.translate( 0, -1.2 );
|
||||
drawOuterGlow( p, glow, 18 );
|
||||
drawOuterGlow( p, glow, 21 );
|
||||
p.restore();
|
||||
}
|
||||
|
||||
// button slab
|
||||
p.setWindow( 0, 0, 18, 18 );
|
||||
if( color.isValid() )
|
||||
{
|
||||
p.translate( 0, (0.5-0.668) );
|
||||
|
|
Loading…
Reference in a new issue