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