2009-08-22 08:24:06 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-09-15 07:12:54 +00:00
|
|
|
// oxygenbutton.cpp
|
2009-08-22 08:24:06 +00:00
|
|
|
// -------------------
|
2009-09-09 00:55:55 +00:00
|
|
|
//
|
2009-08-25 04:15:13 +00:00
|
|
|
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
2009-08-24 15:43:15 +00:00
|
|
|
// Copyright (c) 2006, 2007 Riccardo Iaconelli <riccardo@kde.org>
|
|
|
|
// Copyright (c) 2006, 2007 Casper Boemann <cbr@boemann.dk>
|
2009-08-22 08:24:06 +00:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to
|
|
|
|
// deal in the Software without restriction, including without limitation the
|
|
|
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
// sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
2009-09-09 00:55:55 +00:00
|
|
|
// IN THE SOFTWARE.
|
2009-08-22 08:24:06 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-09-16 06:09:31 +00:00
|
|
|
#include "oxygenbutton.h"
|
2009-10-14 15:36:38 +00:00
|
|
|
#include "oxygenbutton.moc"
|
2009-09-16 06:09:31 +00:00
|
|
|
#include "oxygenclient.h"
|
|
|
|
#include "oxygen.h"
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
#include <cmath>
|
|
|
|
|
2009-09-20 07:42:03 +00:00
|
|
|
#include <QtGui/QPainter>
|
|
|
|
#include <QtGui/QPen>
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
#include <KColorUtils>
|
|
|
|
#include <KColorScheme>
|
|
|
|
#include <kcommondecoration.h>
|
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
namespace Oxygen
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
|
|
|
//_______________________________________________
|
2009-10-14 15:36:38 +00:00
|
|
|
OxygenButton::OxygenButton(
|
|
|
|
OxygenClient &parent,
|
|
|
|
const QString& tip,
|
2009-10-15 16:03:30 +00:00
|
|
|
ButtonType type):
|
2009-09-09 00:55:55 +00:00
|
|
|
KCommonDecorationButton((::ButtonType)type, &parent),
|
|
|
|
client_(parent),
|
|
|
|
helper_( parent.helper() ),
|
|
|
|
type_(type),
|
2009-10-14 15:36:38 +00:00
|
|
|
forceInactive_( false ),
|
2009-11-17 21:56:04 +00:00
|
|
|
glowAnimation_( new Animation( 150, this ) ),
|
|
|
|
glowIntensity_(0)
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
|
|
|
setAutoFillBackground(false);
|
2009-08-29 21:37:08 +00:00
|
|
|
setAttribute(Qt::WA_NoSystemBackground);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
|
|
|
unsigned int size( client_.configuration().buttonSize() );
|
|
|
|
setFixedSize( size, size );
|
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
setCursor(Qt::ArrowCursor);
|
|
|
|
setToolTip(tip);
|
2009-09-16 17:09:33 +00:00
|
|
|
|
2009-11-17 21:56:04 +00:00
|
|
|
// setup animation
|
|
|
|
glowAnimation().data()->setStartValue( 0 );
|
|
|
|
glowAnimation().data()->setEndValue( 1.0 );
|
|
|
|
glowAnimation().data()->setTargetObject( this );
|
|
|
|
glowAnimation().data()->setPropertyName( "glowIntensity" );
|
|
|
|
|
|
|
|
// set curve shape. Warning: this is not portable to Qt Kinetic
|
|
|
|
glowAnimation().data()->setCurveShape( Animation::EaseInOutCurve );
|
|
|
|
|
|
|
|
// setup connections
|
|
|
|
connect( glowAnimation().data(), SIGNAL( valueChanged( const QVariant& ) ), SLOT( update( void ) ) );
|
|
|
|
connect( glowAnimation().data(), SIGNAL( finished( void ) ), SLOT( update( void ) ) );
|
2009-11-15 03:24:04 +00:00
|
|
|
reset(0);
|
2009-09-16 17:09:33 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//_______________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenButton::~OxygenButton()
|
2009-08-22 08:24:06 +00:00
|
|
|
{}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//_______________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
QColor OxygenButton::buttonDetailColor(const QPalette &palette)
|
2009-09-19 21:12:57 +00:00
|
|
|
{
|
2009-11-17 21:56:04 +00:00
|
|
|
if( client_.glowIsAnimated() && !forceInactive_ && !client_.isForcedActive()) return KColorUtils::mix(
|
2009-09-19 21:12:57 +00:00
|
|
|
buttonDetailColor( palette, false ),
|
|
|
|
buttonDetailColor( palette, true ),
|
2009-11-17 21:56:04 +00:00
|
|
|
client_.glowIntensity() );
|
2009-11-15 03:24:04 +00:00
|
|
|
else return buttonDetailColor( palette, isActive() || client_.isForcedActive() );
|
2009-09-19 21:12:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//_______________________________________________
|
|
|
|
QColor OxygenButton::buttonDetailColor(const QPalette &palette, bool active)
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-18 21:14:40 +00:00
|
|
|
if( active ) return palette.color(QPalette::Active, QPalette::WindowText);
|
2009-08-22 08:24:06 +00:00
|
|
|
else {
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
// todo: re-implement caching
|
2009-10-18 21:14:40 +00:00
|
|
|
QColor ab = palette.color(QPalette::Active, QPalette::Window);
|
|
|
|
QColor af = palette.color(QPalette::Active, QPalette::WindowText);
|
|
|
|
QColor nb = palette.color(QPalette::Inactive, QPalette::Window);
|
|
|
|
QColor nf = palette.color(QPalette::Inactive, QPalette::WindowText);
|
2009-10-15 16:03:30 +00:00
|
|
|
return reduceContrast(nb, nf, qMax(qreal(2.5), KColorUtils::contrastRatio(ab, KColorUtils::mix(ab, af, 0.4))));
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-19 21:12:57 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-14 15:36:38 +00:00
|
|
|
//___________________________________________________
|
|
|
|
bool OxygenButton::isActive( void ) const
|
|
|
|
{ return (!forceInactive_) && client_.isActive(); }
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//___________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
QSize OxygenButton::sizeHint() const
|
2009-09-09 00:55:55 +00:00
|
|
|
{
|
2009-08-22 08:24:06 +00:00
|
|
|
unsigned int size( client_.configuration().buttonSize() );
|
|
|
|
return QSize( size, size );
|
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//___________________________________________________
|
|
|
|
void OxygenButton::reset( unsigned long )
|
2009-11-17 21:56:04 +00:00
|
|
|
{ glowAnimation().data()->setDuration( client_.configuration().animationsDuration() ); }
|
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//___________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
void OxygenButton::enterEvent(QEvent *e)
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-10-14 15:36:38 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
KCommonDecorationButton::enterEvent(e);
|
2009-09-15 07:12:54 +00:00
|
|
|
if (status_ != Oxygen::Pressed) status_ = Oxygen::Hovered;
|
2009-11-17 21:56:04 +00:00
|
|
|
glowAnimation().data()->setDirection( Animation::Forward );
|
|
|
|
if( !isAnimated() ) glowAnimation().data()->start();
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//___________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
void OxygenButton::leaveEvent(QEvent *e)
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-10-14 15:36:38 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
KCommonDecorationButton::leaveEvent(e);
|
2009-09-16 17:09:33 +00:00
|
|
|
|
2009-09-18 15:03:59 +00:00
|
|
|
if( status_ == Oxygen::Hovered )
|
2009-09-17 03:43:55 +00:00
|
|
|
{
|
2009-11-17 21:56:04 +00:00
|
|
|
glowAnimation().data()->setDirection( Animation::Backward );
|
|
|
|
if( !isAnimated() ) glowAnimation().data()->start();
|
2009-09-17 03:43:55 +00:00
|
|
|
}
|
2009-09-16 17:09:33 +00:00
|
|
|
|
2009-09-17 04:23:38 +00:00
|
|
|
status_ = Oxygen::Normal;
|
2009-10-16 16:25:02 +00:00
|
|
|
update();
|
2009-09-16 17:09:33 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//___________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
void OxygenButton::mousePressEvent(QMouseEvent *e)
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
status_ = Oxygen::Pressed;
|
2009-10-16 16:25:02 +00:00
|
|
|
update();
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
KCommonDecorationButton::mousePressEvent(e);
|
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//___________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
void OxygenButton::mouseReleaseEvent(QMouseEvent *e)
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-10-14 15:36:38 +00:00
|
|
|
|
|
|
|
status_ = ( rect().contains( e->pos() ) ) ? Oxygen::Hovered:Oxygen::Normal;
|
2009-10-16 16:25:02 +00:00
|
|
|
update();
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
KCommonDecorationButton::mouseReleaseEvent(e);
|
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//___________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
void OxygenButton::paintEvent(QPaintEvent *event)
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-11-07 03:33:53 +00:00
|
|
|
if( client_.configuration().hideTitleBar() ) return;
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
QPainter painter(this);
|
|
|
|
painter.setClipRect(this->rect().intersected( event->rect() ) );
|
2009-09-18 01:32:27 +00:00
|
|
|
painter.setRenderHints(QPainter::Antialiasing);
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
QPalette palette = OxygenButton::palette();
|
2009-10-14 15:36:38 +00:00
|
|
|
if( isActive() ) palette.setCurrentColorGroup(QPalette::Active);
|
2009-08-22 08:24:06 +00:00
|
|
|
else palette.setCurrentColorGroup(QPalette::Inactive);
|
2009-10-14 15:36:38 +00:00
|
|
|
QColor color = palette.window().color();
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
if(
|
|
|
|
client_.compositingActive() &&
|
|
|
|
!( client_.isMaximized() || type_ == ButtonItemClose || type_ == ButtonItemMenu ) )
|
|
|
|
{ painter.translate( 0, -1 ); }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-11-19 04:11:21 +00:00
|
|
|
// translate buttons down if window maximized
|
|
|
|
if( client_.isMaximized() ) painter.translate( 0, 1 );
|
|
|
|
|
2009-10-14 15:36:38 +00:00
|
|
|
// base button color
|
2009-10-15 16:03:30 +00:00
|
|
|
QColor bt = ((type_ == ButtonItemClose && forceInactive_ ) ? client_.backgroundPalette( this, palette ):palette).window().color();
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-11-17 21:56:04 +00:00
|
|
|
// button icon and glow color depending on glow intensity
|
2009-10-15 16:03:30 +00:00
|
|
|
color = (type_ == ButtonItemClose && forceInactive_ ) ?
|
|
|
|
buttonDetailColor( client_.backgroundPalette( this, palette ) ):
|
|
|
|
buttonDetailColor( palette );
|
|
|
|
|
|
|
|
QColor glow = (type_ == ButtonClose || type_ == ButtonItemClose ) ?
|
2009-09-16 17:09:33 +00:00
|
|
|
KColorScheme(palette.currentColorGroup()).foreground(KColorScheme::NegativeText).color():
|
|
|
|
KColorScheme(palette.currentColorGroup()).decoration(KColorScheme::HoverColor).color();
|
2009-10-08 23:01:35 +00:00
|
|
|
glow = helper_.calcDarkColor( glow );
|
|
|
|
|
2009-11-17 21:56:04 +00:00
|
|
|
if( isAnimated() ) color = KColorUtils::mix( color, glow, glowIntensity() );
|
2009-09-19 21:12:57 +00:00
|
|
|
else if( status_ == Oxygen::Hovered ) color = glow;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-14 15:36:38 +00:00
|
|
|
// button decoration
|
2009-10-15 16:03:30 +00:00
|
|
|
if( type_ != ButtonMenu && type_ != ButtonItemClose && type_ != ButtonItemMenu )
|
2009-09-16 17:09:33 +00:00
|
|
|
{
|
|
|
|
|
2009-10-14 15:36:38 +00:00
|
|
|
// draw glow on hover
|
2009-11-17 21:56:04 +00:00
|
|
|
if( isAnimated() )
|
2009-10-14 15:36:38 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
// mixed shadow and glow for smooth transition
|
2009-11-17 21:56:04 +00:00
|
|
|
painter.drawPixmap(0, 0, helper_.windecoButtonGlow( KColorUtils::mix( Qt::black, glow, glowIntensity() ), (21.0*client_.configuration().buttonSize())/22));
|
2009-10-14 15:36:38 +00:00
|
|
|
|
|
|
|
} else if( status_ == Oxygen::Hovered ) {
|
|
|
|
|
|
|
|
// glow only
|
|
|
|
painter.drawPixmap(0, 0, helper_.windecoButtonGlow(glow, (21.0*client_.configuration().buttonSize())/22));
|
2009-09-16 17:16:55 +00:00
|
|
|
|
2009-10-14 15:36:38 +00:00
|
|
|
} else {
|
2009-09-16 17:16:55 +00:00
|
|
|
|
2009-10-14 15:36:38 +00:00
|
|
|
// shadow only
|
|
|
|
painter.drawPixmap(0, 0, helper_.windecoButtonGlow(Qt::black, (21.0*client_.configuration().buttonSize())/22));
|
2009-09-16 17:16:55 +00:00
|
|
|
|
2009-10-14 15:36:38 +00:00
|
|
|
}
|
2009-10-08 23:01:35 +00:00
|
|
|
|
2009-10-14 15:36:38 +00:00
|
|
|
// draw button shape
|
|
|
|
bool pressed( (status_ == Oxygen::Pressed) || ( type_ == ButtonSticky && isChecked() ) );
|
|
|
|
painter.drawPixmap(0, 0, helper_.windecoButton(bt, pressed, (21.0*client_.configuration().buttonSize())/22.0 ) );
|
2009-10-08 23:01:35 +00:00
|
|
|
|
2009-09-16 17:09:33 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-14 15:36:38 +00:00
|
|
|
// Icon
|
2009-10-15 16:03:30 +00:00
|
|
|
// for menu button the application icon is used
|
|
|
|
if( type_ == ButtonMenu || type_ == ButtonItemMenu )
|
2009-10-14 15:36:38 +00:00
|
|
|
{
|
2009-10-08 23:01:35 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
const QPixmap& pixmap( client_.icon().pixmap( client_.configuration().iconScale() ) );
|
|
|
|
double offset = 0.5*(width()-pixmap.width() );
|
|
|
|
painter.drawPixmap(offset, offset-1, pixmap );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
} else {
|
2009-10-11 17:13:50 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
painter.setRenderHints(QPainter::Antialiasing);
|
|
|
|
qreal width( 1.2 );
|
2009-10-14 15:36:38 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
painter.setBrush(Qt::NoBrush);
|
|
|
|
painter.setPen(QPen( helper_.calcLightColor( bt ), width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
|
|
|
drawIcon(&painter, palette, type_);
|
2009-10-14 15:36:38 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
painter.translate(0,-1.5);
|
|
|
|
painter.setBrush(Qt::NoBrush);
|
|
|
|
painter.setPen(QPen(color, width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
|
|
|
drawIcon(&painter, palette, type_);
|
2009-10-14 15:36:38 +00:00
|
|
|
|
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//___________________________________________________
|
2009-09-15 07:12:54 +00:00
|
|
|
void OxygenButton::drawIcon(QPainter *painter, QPalette &palette, ButtonType &type)
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
|
|
|
painter->save();
|
2009-08-22 08:24:06 +00:00
|
|
|
painter->setWindow( 0, 0, 22, 22 );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
QPen newPen = painter->pen();
|
|
|
|
switch(type)
|
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
case ButtonSticky:
|
|
|
|
painter->drawPoint(QPointF(10.5,10.5));
|
|
|
|
break;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
case ButtonHelp:
|
|
|
|
painter->translate(1.5, 1.5);
|
|
|
|
painter->drawArc(7,5,4,4,135*16, -180*16);
|
|
|
|
painter->drawArc(9,8,4,4,135*16,45*16);
|
|
|
|
painter->drawPoint(9,12);
|
|
|
|
painter->translate(-1.5, -1.5);
|
|
|
|
break;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
case ButtonMin:
|
|
|
|
painter->drawLine(QPointF( 7.5, 9.5), QPointF(10.5,12.5));
|
|
|
|
painter->drawLine(QPointF(10.5,12.5), QPointF(13.5, 9.5));
|
|
|
|
break;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
case ButtonMax:
|
|
|
|
switch(client_.maximizeMode())
|
|
|
|
{
|
2009-09-15 07:12:54 +00:00
|
|
|
case OxygenClient::MaximizeRestore:
|
|
|
|
case OxygenClient::MaximizeVertical:
|
|
|
|
case OxygenClient::MaximizeHorizontal:
|
2009-08-22 08:24:06 +00:00
|
|
|
painter->drawLine(QPointF( 7.5,11.5), QPointF(10.5, 8.5));
|
|
|
|
painter->drawLine(QPointF(10.5, 8.5), QPointF(13.5,11.5));
|
|
|
|
break;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
case OxygenClient::MaximizeFull:
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
|
|
|
painter->translate(1.5, 1.5);
|
|
|
|
QPoint points[4] = {QPoint(9, 6), QPoint(12, 9), QPoint(9, 12), QPoint(6, 9)};
|
|
|
|
painter->drawPolygon(points, 4);
|
|
|
|
painter->translate(-1.5, -1.5);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
case ButtonItemClose:
|
2009-08-22 08:24:06 +00:00
|
|
|
case ButtonClose:
|
|
|
|
painter->drawLine(QPointF( 7.5,7.5), QPointF(13.5,13.5));
|
|
|
|
painter->drawLine(QPointF(13.5,7.5), QPointF( 7.5,13.5));
|
|
|
|
break;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
case ButtonAbove:
|
|
|
|
if(isChecked()) {
|
|
|
|
QPen newPen = painter->pen();
|
|
|
|
newPen.setColor(KColorScheme(palette.currentColorGroup()).decoration(KColorScheme::HoverColor).color());
|
|
|
|
painter->setPen(newPen);
|
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
painter->drawLine(QPointF( 7.5,14), QPointF(10.5,11));
|
|
|
|
painter->drawLine(QPointF(10.5,11), QPointF(13.5,14));
|
|
|
|
painter->drawLine(QPointF( 7.5,10), QPointF(10.5, 7));
|
|
|
|
painter->drawLine(QPointF(10.5, 7), QPointF(13.5,10));
|
|
|
|
break;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
case ButtonBelow:
|
|
|
|
if(isChecked()) {
|
|
|
|
QPen newPen = painter->pen();
|
|
|
|
newPen.setColor(KColorScheme(palette.currentColorGroup()).decoration(KColorScheme::HoverColor).color());
|
|
|
|
painter->setPen(newPen);
|
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
painter->drawLine(QPointF( 7.5,11), QPointF(10.5,14));
|
|
|
|
painter->drawLine(QPointF(10.5,14), QPointF(13.5,11));
|
|
|
|
painter->drawLine(QPointF( 7.5, 7), QPointF(10.5,10));
|
|
|
|
painter->drawLine(QPointF(10.5,10), QPointF(13.5, 7));
|
|
|
|
break;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
case ButtonShade:
|
2009-09-09 00:55:55 +00:00
|
|
|
if (!isChecked())
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
// shade button
|
|
|
|
painter->drawLine(QPointF( 7.5, 7.5), QPointF(10.5,10.5));
|
|
|
|
painter->drawLine(QPointF(10.5,10.5), QPointF(13.5, 7.5));
|
|
|
|
painter->drawLine(QPointF( 7.5,13.0), QPointF(13.5,13.0));
|
2009-09-09 00:55:55 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
// unshade button
|
|
|
|
painter->drawLine(QPointF( 7.5,10.5), QPointF(10.5, 7.5));
|
|
|
|
painter->drawLine(QPointF(10.5, 7.5), QPointF(13.5,10.5));
|
|
|
|
painter->drawLine(QPointF( 7.5,13.0), QPointF(13.5,13.0));
|
|
|
|
}
|
|
|
|
break;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
painter->restore();
|
|
|
|
return;
|
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
|
|
|
}
|