2009-08-22 08:24:06 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2010-05-02 18:34:08 +00:00
|
|
|
// Button.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"
|
|
|
|
|
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
|
|
|
{
|
2010-05-02 18:34:08 +00:00
|
|
|
//_______________________________________________
|
|
|
|
Button::Button(
|
|
|
|
Client &parent,
|
|
|
|
const QString& tip,
|
|
|
|
ButtonType type):
|
|
|
|
KCommonDecorationButton((::ButtonType)type, &parent),
|
2011-02-24 16:37:04 +00:00
|
|
|
_client(parent),
|
|
|
|
_helper( parent.helper() ),
|
|
|
|
_type(type),
|
2011-09-22 20:22:37 +00:00
|
|
|
_status( 0 ),
|
2011-02-24 16:37:04 +00:00
|
|
|
_forceInactive( false ),
|
|
|
|
_glowAnimation( new Animation( 150, this ) ),
|
|
|
|
_glowIntensity(0)
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2010-05-02 18:34:08 +00:00
|
|
|
setAutoFillBackground(false);
|
|
|
|
setAttribute(Qt::WA_NoSystemBackground);
|
|
|
|
|
2011-09-22 20:22:37 +00:00
|
|
|
unsigned int size( _client.configuration().buttonSize() );
|
|
|
|
setFixedSize( size, size );
|
2010-05-02 18:34:08 +00:00
|
|
|
|
|
|
|
setCursor(Qt::ArrowCursor);
|
|
|
|
setToolTip(tip);
|
|
|
|
|
|
|
|
// setup animation
|
2011-02-24 16:37:04 +00:00
|
|
|
_glowAnimation->setStartValue( 0 );
|
|
|
|
_glowAnimation->setEndValue( 1.0 );
|
|
|
|
_glowAnimation->setTargetObject( this );
|
|
|
|
_glowAnimation->setPropertyName( "glowIntensity" );
|
|
|
|
_glowAnimation->setEasingCurve( QEasingCurve::InOutQuad );
|
2010-05-02 18:34:08 +00:00
|
|
|
|
|
|
|
// setup connections
|
|
|
|
reset(0);
|
|
|
|
|
2011-09-22 20:22:37 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//_______________________________________________
|
|
|
|
Button::~Button()
|
|
|
|
{}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//_______________________________________________
|
2010-08-28 19:58:22 +00:00
|
|
|
QColor Button::buttonDetailColor(const QPalette &palette) const
|
2010-05-02 18:34:08 +00:00
|
|
|
{
|
2011-02-24 16:37:04 +00:00
|
|
|
if( _client.glowIsAnimated() && !_forceInactive && !_client.isForcedActive()) return KColorUtils::mix(
|
2010-05-02 18:34:08 +00:00
|
|
|
buttonDetailColor( palette, false ),
|
|
|
|
buttonDetailColor( palette, true ),
|
2011-02-24 16:37:04 +00:00
|
|
|
_client.glowIntensity() );
|
|
|
|
else return buttonDetailColor( palette, isActive() || _client.isForcedActive() );
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-19 21:12:57 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//___________________________________________________
|
|
|
|
bool Button::isActive( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return (!_forceInactive) && _client.isActive(); }
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//___________________________________________________
|
2011-07-18 05:36:44 +00:00
|
|
|
bool Button::buttonAnimationsEnabled( void ) const
|
|
|
|
{ return _client.animationsEnabled() && _client.configuration().buttonAnimationsEnabled(); }
|
2009-10-14 15:36:38 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//___________________________________________________
|
|
|
|
QSize Button::sizeHint() const
|
2010-02-02 21:55:56 +00:00
|
|
|
{
|
2011-02-24 16:37:04 +00:00
|
|
|
unsigned int size( _client.configuration().buttonSize() );
|
2010-05-02 18:34:08 +00:00
|
|
|
return QSize( size, size );
|
|
|
|
}
|
|
|
|
|
|
|
|
//___________________________________________________
|
|
|
|
void Button::reset( unsigned long )
|
2011-07-18 05:36:44 +00:00
|
|
|
{ _glowAnimation->setDuration( _client.configuration().buttonAnimationsDuration() ); }
|
2010-02-02 21:55:56 +00:00
|
|
|
|
2011-06-27 23:09:22 +00:00
|
|
|
//___________________________________________________
|
|
|
|
void Button::paint( QPainter& painter )
|
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-07-05 17:39:25 +00:00
|
|
|
QPalette palette( this->palette() );
|
|
|
|
palette.setCurrentColorGroup( isActive() ? QPalette::Active : QPalette::Inactive);
|
2009-11-19 04:11:21 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
if(
|
2011-02-24 16:37:04 +00:00
|
|
|
_client.compositingActive() &&
|
|
|
|
!( _client.isMaximized() || _type == ButtonItemClose || _type == ButtonItemMenu ) )
|
2010-05-02 18:34:08 +00:00
|
|
|
{ painter.translate( 0, -1 ); }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
// translate buttons down if window maximized
|
2011-02-24 16:37:04 +00:00
|
|
|
if( _client.isMaximized() ) painter.translate( 0, 1 );
|
2009-10-15 16:03:30 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
// base button color
|
2011-04-28 16:09:09 +00:00
|
|
|
QColor base;
|
|
|
|
if( _type == ButtonItemClose && _forceInactive ) base = _client.backgroundPalette( this, palette ).window().color();
|
|
|
|
else if( _type == ButtonItemClose ) base = palette.window().color();
|
|
|
|
else base = palette.button().color();
|
2009-10-08 23:01:35 +00:00
|
|
|
|
2011-04-28 16:09:09 +00:00
|
|
|
// text color
|
2011-02-24 16:37:04 +00:00
|
|
|
QColor color = (_type == ButtonItemClose && _forceInactive ) ?
|
|
|
|
buttonDetailColor( _client.backgroundPalette( this, palette ) ):
|
2010-05-02 18:34:08 +00:00
|
|
|
buttonDetailColor( palette );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-07-05 17:39:25 +00:00
|
|
|
// decide decoration color
|
2011-09-19 13:31:18 +00:00
|
|
|
QColor glow;
|
2011-09-22 20:22:37 +00:00
|
|
|
if( isAnimated() || (_status&Hovered) )
|
2010-05-02 18:34:08 +00:00
|
|
|
{
|
2011-09-19 13:31:18 +00:00
|
|
|
glow = isCloseButton() ?
|
|
|
|
_helper.viewNegativeTextBrush().brush(palette).color():
|
|
|
|
_helper.viewHoverBrush().brush(palette).color();
|
|
|
|
|
|
|
|
if( isAnimated() )
|
|
|
|
{
|
2009-09-16 17:16:55 +00:00
|
|
|
|
2011-09-19 13:31:18 +00:00
|
|
|
color = KColorUtils::mix( color, glow, glowIntensity() );
|
|
|
|
glow = _helper.alphaColor( glow, glowIntensity() );
|
2009-10-08 23:01:35 +00:00
|
|
|
|
2011-09-22 20:22:37 +00:00
|
|
|
} else if( _status&Hovered ) color = glow;
|
2011-09-19 13:31:18 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if( hasDecoration() )
|
|
|
|
{
|
|
|
|
// scale
|
2011-02-24 16:37:04 +00:00
|
|
|
qreal scale( (21.0*_client.configuration().buttonSize())/22.0 );
|
2009-10-08 23:01:35 +00:00
|
|
|
|
2011-09-19 13:31:18 +00:00
|
|
|
// pressed state
|
2011-06-14 16:49:46 +00:00
|
|
|
const bool pressed(
|
2011-09-22 20:22:37 +00:00
|
|
|
(_status&Pressed) ||
|
2011-06-14 16:49:46 +00:00
|
|
|
( _type == ButtonSticky && _client.isOnAllDesktops() ) ||
|
|
|
|
( _type == ButtonAbove && _client.keepAbove() ) ||
|
|
|
|
( _type == ButtonBelow && _client.keepBelow() ) );
|
2010-07-05 17:39:25 +00:00
|
|
|
|
2011-06-14 16:49:46 +00:00
|
|
|
// draw button shape
|
2011-09-19 13:31:18 +00:00
|
|
|
painter.drawPixmap(0, 0, _helper.windecoButton( base, glow, pressed, scale ) );
|
2009-10-08 23:01:35 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
// Icon
|
|
|
|
// for menu button the application icon is used
|
2010-07-05 17:39:25 +00:00
|
|
|
if( isMenuButton() )
|
2010-05-02 18:34:08 +00:00
|
|
|
{
|
2009-10-11 17:13:50 +00:00
|
|
|
|
2011-02-24 16:37:04 +00:00
|
|
|
const QPixmap& pixmap( _client.icon().pixmap( _client.configuration().iconScale() ) );
|
2010-07-05 17:39:25 +00:00
|
|
|
const double offset = 0.5*(width()-pixmap.width() );
|
2010-05-02 18:34:08 +00:00
|
|
|
painter.drawPixmap(offset, offset-1, pixmap );
|
2009-10-14 15:36:38 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
} else {
|
2009-10-14 15:36:38 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
painter.setRenderHints(QPainter::Antialiasing);
|
|
|
|
qreal width( 1.2 );
|
2009-10-14 15:36:38 +00:00
|
|
|
|
2011-04-28 16:09:09 +00:00
|
|
|
// contrast
|
2010-05-02 18:34:08 +00:00
|
|
|
painter.setBrush(Qt::NoBrush);
|
2011-04-28 16:09:09 +00:00
|
|
|
painter.setPen(QPen( _helper.calcLightColor( base ), width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
2010-07-05 17:39:25 +00:00
|
|
|
drawIcon(&painter);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2011-04-28 16:09:09 +00:00
|
|
|
// main
|
2010-05-02 18:34:08 +00:00
|
|
|
painter.translate(0,-1.5);
|
|
|
|
painter.setBrush(Qt::NoBrush);
|
|
|
|
painter.setPen(QPen(color, width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
2010-07-05 17:39:25 +00:00
|
|
|
drawIcon(&painter);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2011-09-19 14:23:29 +00:00
|
|
|
//___________________________________________________
|
|
|
|
void Button::mousePressEvent( QMouseEvent *event )
|
|
|
|
{
|
|
|
|
|
|
|
|
if( _type == ButtonMax || event->button() == Qt::LeftButton )
|
|
|
|
{
|
2011-09-22 20:22:37 +00:00
|
|
|
_status |= Pressed;
|
2011-09-19 14:23:29 +00:00
|
|
|
parentUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
KCommonDecorationButton::mousePressEvent( event );
|
|
|
|
}
|
|
|
|
|
|
|
|
//___________________________________________________
|
|
|
|
void Button::mouseReleaseEvent( QMouseEvent* event )
|
|
|
|
{
|
2012-11-09 12:44:50 +00:00
|
|
|
if (_type != ButtonApplicationMenu)
|
|
|
|
{
|
|
|
|
_status &= ~Pressed;
|
|
|
|
parentUpdate();
|
|
|
|
}
|
2011-09-19 14:23:29 +00:00
|
|
|
|
|
|
|
KCommonDecorationButton::mouseReleaseEvent( event );
|
|
|
|
}
|
|
|
|
|
|
|
|
//___________________________________________________
|
|
|
|
void Button::enterEvent( QEvent *event )
|
|
|
|
{
|
|
|
|
|
|
|
|
KCommonDecorationButton::enterEvent( event );
|
2011-09-22 20:22:37 +00:00
|
|
|
_status |= Hovered;
|
|
|
|
|
2011-09-19 14:23:29 +00:00
|
|
|
if( buttonAnimationsEnabled() )
|
|
|
|
{
|
|
|
|
|
|
|
|
_glowAnimation->setDirection( Animation::Forward );
|
|
|
|
if( !isAnimated() ) _glowAnimation->start();
|
|
|
|
|
|
|
|
} else parentUpdate();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//___________________________________________________
|
|
|
|
void Button::leaveEvent( QEvent *event )
|
|
|
|
{
|
|
|
|
|
|
|
|
KCommonDecorationButton::leaveEvent( event );
|
|
|
|
|
2011-09-22 20:22:37 +00:00
|
|
|
if( _status&Hovered && buttonAnimationsEnabled() )
|
2011-09-19 14:23:29 +00:00
|
|
|
{
|
|
|
|
_glowAnimation->setDirection( Animation::Backward );
|
|
|
|
if( !isAnimated() ) _glowAnimation->start();
|
|
|
|
}
|
|
|
|
|
2011-09-22 20:22:37 +00:00
|
|
|
_status &= ~Hovered;
|
2011-09-19 14:23:29 +00:00
|
|
|
parentUpdate();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//___________________________________________________
|
|
|
|
void Button::resizeEvent( QResizeEvent *event )
|
|
|
|
{
|
|
|
|
|
|
|
|
// resize backing store pixmap
|
|
|
|
if( !_client.compositingActive() )
|
|
|
|
{ _pixmap = QPixmap( event->size() ); }
|
|
|
|
|
|
|
|
// base class implementation
|
|
|
|
KCommonDecorationButton::resizeEvent( event );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//___________________________________________________
|
|
|
|
void Button::paintEvent(QPaintEvent *event)
|
|
|
|
{
|
|
|
|
|
|
|
|
if( _client.hideTitleBar() ) return;
|
2011-09-20 07:09:42 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
do nothing in compositing mode.
|
|
|
|
painting is performed by the parent widget
|
|
|
|
*/
|
2011-09-19 14:23:29 +00:00
|
|
|
if( !_client.compositingActive() )
|
|
|
|
{
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// create painter
|
|
|
|
QPainter painter( &_pixmap );
|
|
|
|
painter.setRenderHints(QPainter::Antialiasing);
|
|
|
|
painter.setClipRect( this->rect().intersected( event->rect() ) );
|
|
|
|
|
|
|
|
// render parent background
|
|
|
|
painter.translate( -geometry().topLeft() );
|
|
|
|
_client.paintBackground( painter );
|
|
|
|
|
|
|
|
// render buttons
|
|
|
|
painter.translate( geometry().topLeft() );
|
|
|
|
paint( painter );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QPainter painter(this);
|
|
|
|
painter.setClipRegion( event->region() );
|
|
|
|
painter.drawPixmap( QPoint(), _pixmap );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//___________________________________________________
|
|
|
|
void Button::parentUpdate( void )
|
|
|
|
{
|
|
|
|
|
|
|
|
if( _client.compositingActive() && parentWidget() ) parentWidget()->update( geometry().adjusted( -1, -1, 1, 1 ) );
|
|
|
|
else this->update();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//___________________________________________________
|
2011-06-28 07:09:31 +00:00
|
|
|
void Button::drawIcon( QPainter* painter )
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
painter->save();
|
|
|
|
painter->setWindow( 0, 0, 22, 22 );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2011-02-24 16:37:04 +00:00
|
|
|
switch(_type)
|
2010-05-02 18:34:08 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
case ButtonSticky:
|
|
|
|
painter->drawPoint(QPointF(10.5,10.5));
|
|
|
|
break;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2012-11-09 12:44:50 +00:00
|
|
|
case ButtonApplicationMenu:
|
|
|
|
painter->drawLine(QPointF(7.5, 7.5), QPointF(13.5, 7.5));
|
|
|
|
painter->drawLine(QPointF(7.5, 10.5), QPointF(13.5, 10.5));
|
|
|
|
painter->drawLine(QPointF(7.5, 13.5), QPointF(13.5, 13.5));
|
|
|
|
break;
|
|
|
|
|
2010-05-02 18:34:08 +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;
|
|
|
|
|
|
|
|
case ButtonMax:
|
2011-02-24 16:37:04 +00:00
|
|
|
switch(_client.maximizeMode())
|
2010-05-02 18:34:08 +00:00
|
|
|
{
|
|
|
|
case Client::MaximizeRestore:
|
|
|
|
case Client::MaximizeVertical:
|
|
|
|
case Client::MaximizeHorizontal:
|
|
|
|
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;
|
|
|
|
|
|
|
|
case Client::MaximizeFull:
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
case ButtonItemClose:
|
|
|
|
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;
|
|
|
|
|
|
|
|
case ButtonAbove:
|
|
|
|
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;
|
|
|
|
|
|
|
|
case ButtonBelow:
|
|
|
|
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;
|
|
|
|
|
|
|
|
case ButtonShade:
|
|
|
|
if (!isChecked())
|
|
|
|
{
|
|
|
|
|
|
|
|
// 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));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 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));
|
2010-07-05 17:39:25 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
painter->restore();
|
|
|
|
return;
|
2009-08-22 08:24:06 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2012-11-09 12:44:50 +00:00
|
|
|
void Button::slotAppMenuHidden()
|
|
|
|
{
|
|
|
|
_status = Normal;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
2009-09-09 00:55:55 +00:00
|
|
|
}
|