Changeset View
Changeset View
Standalone View
Standalone View
kdecoration/breezebutton.cpp
Show First 20 Lines • Show All 413 Lines • ▼ Show 20 Line(s) | 413 | { | |||
---|---|---|---|---|---|
414 | auto d = qobject_cast<Decoration*>( decoration() ); | 414 | auto d = qobject_cast<Decoration*>( decoration() ); | ||
415 | if( !d ) { | 415 | if( !d ) { | ||
416 | 416 | | |||
417 | return QColor(); | 417 | return QColor(); | ||
418 | 418 | | |||
419 | } | 419 | } | ||
420 | 420 | | |||
421 | auto c = d->client().data(); | 421 | auto c = d->client().data(); | ||
422 | | ||||
423 | QColor redColor( c->color( ColorGroup::Warning, ColorRole::Foreground ) ); | ||||
424 | | ||||
422 | if( isPressed() ) { | 425 | if( isPressed() ) { | ||
423 | 426 | | |||
424 | if( type() == DecorationButtonType::Close ) return c->color( ColorGroup::Warning, ColorRole::Foreground ); | 427 | if( type() == DecorationButtonType::Close ) return redColor.darker(); | ||
425 | else return KColorUtils::mix( d->titleBarColor(), d->fontColor(), 0.3 ); | 428 | else return KColorUtils::mix( d->titleBarColor(), d->fontColor(), 0.3 ); | ||
426 | 429 | | |||
427 | } else if( ( type() == DecorationButtonType::KeepBelow || type() == DecorationButtonType::KeepAbove || type() == DecorationButtonType::Shade ) && isChecked() ) { | 430 | } else if( ( type() == DecorationButtonType::KeepBelow || type() == DecorationButtonType::KeepAbove || type() == DecorationButtonType::Shade ) && isChecked() ) { | ||
428 | 431 | | |||
429 | return d->fontColor(); | 432 | return d->fontColor(); | ||
430 | 433 | | |||
431 | } else if( m_animation->state() == QAbstractAnimation::Running ) { | 434 | } else if( m_animation->state() == QAbstractAnimation::Running ) { | ||
432 | 435 | | |||
433 | if( type() == DecorationButtonType::Close ) | 436 | if( type() == DecorationButtonType::Close ) | ||
434 | { | 437 | { | ||
435 | if( d->internalSettings()->outlineCloseButton() ) | 438 | if( d->internalSettings()->outlineCloseButton() ) | ||
436 | { | 439 | { | ||
437 | 440 | | |||
438 | return KColorUtils::mix( d->fontColor(), c->color( ColorGroup::Warning, ColorRole::Foreground ).lighter(), m_opacity ); | 441 | return c->isActive() ? KColorUtils::mix( redColor, redColor.lighter(), m_opacity ) : KColorUtils::mix( redColor.lighter(), redColor, m_opacity ); | ||
439 | 442 | | |||
440 | } else { | 443 | } else { | ||
441 | 444 | | |||
442 | QColor color( c->color( ColorGroup::Warning, ColorRole::Foreground ).lighter() ); | 445 | QColor color( redColor.lighter() ); | ||
443 | color.setAlpha( color.alpha()*m_opacity ); | 446 | color.setAlpha( color.alpha()*m_opacity ); | ||
444 | return color; | 447 | return color; | ||
445 | 448 | | |||
446 | } | 449 | } | ||
447 | 450 | | |||
448 | } else { | 451 | } else { | ||
449 | 452 | | |||
450 | QColor color( d->fontColor() ); | 453 | QColor color( d->fontColor() ); | ||
451 | color.setAlpha( color.alpha()*m_opacity ); | 454 | color.setAlpha( color.alpha()*m_opacity ); | ||
452 | return color; | 455 | return color; | ||
453 | 456 | | |||
454 | } | 457 | } | ||
455 | 458 | | |||
456 | } else if( isHovered() ) { | 459 | } else if( isHovered() ) { | ||
457 | 460 | | |||
458 | if( type() == DecorationButtonType::Close ) return c->color( ColorGroup::Warning, ColorRole::Foreground ).lighter(); | 461 | if( type() == DecorationButtonType::Close ) return c->isActive() ? redColor.lighter() : redColor; | ||
459 | else return d->fontColor(); | 462 | else return d->fontColor(); | ||
460 | 463 | | |||
461 | } else if( type() == DecorationButtonType::Close && d->internalSettings()->outlineCloseButton() ) { | 464 | } else if( type() == DecorationButtonType::Close && d->internalSettings()->outlineCloseButton() ) { | ||
462 | 465 | | |||
463 | return d->fontColor(); | 466 | return c->isActive() ? redColor : redColor.lighter(); | ||
464 | 467 | | |||
465 | } else { | 468 | } else { | ||
466 | 469 | | |||
467 | return QColor(); | 470 | return QColor(); | ||
468 | 471 | | |||
469 | } | 472 | } | ||
470 | 473 | | |||
471 | } | 474 | } | ||
Show All 24 Lines |