Add ability to add keep above/keep below buttons to the titlebar. To enable, you need to modify oxygenclient.cpp yourself for now.

svn path=/trunk/KDE/kdebase/workspace/; revision=759107
This commit is contained in:
Teemu Rytilahti 2008-01-10 01:09:02 +00:00
parent 0d0d2a1dc0
commit eefef6df1c
4 changed files with 38 additions and 0 deletions

View file

@ -132,6 +132,8 @@ bool OxygenFactory::supports( Ability ability ) const
case AbilityButtonMinimize:
case AbilityButtonMaximize:
case AbilityButtonClose:
case AbilityButtonAboveOthers:
case AbilityButtonBelowOthers:
case AbilityButtonSpacer:
return true;
// no colors supported at this time

View file

@ -46,6 +46,8 @@ enum ButtonType {
ButtonClose,
ButtonMenu,
ButtonSticky,
ButtonAbove,
ButtonBelow,
ButtonTypeCount
};
Q_DECLARE_FLAGS(ButtonTypes, ButtonType)

View file

@ -27,6 +27,7 @@
#include <math.h>
#include <QPainterPath>
#include <QPainter>
#include <QPen>
#include <QBitmap>
#include <kdecoration.h>
@ -233,6 +234,30 @@ void OxygenButton::paintEvent(QPaintEvent *)
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:
if(isChecked()) {
QPen newPen = painter.pen();
newPen.setColor(KColorScheme(pal.currentColorGroup()).decoration(KColorScheme::HoverColor).color());
painter.setPen(newPen);
}
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:
if(isChecked()) {
QPen newPen = painter.pen();
newPen.setColor(KColorScheme(pal.currentColorGroup()).decoration(KColorScheme::HoverColor).color());
painter.setPen(newPen);
}
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;
default:
break;
}

View file

@ -190,6 +190,15 @@ KCommonDecorationButton *OxygenClient::createButton(::ButtonType type)
case CloseButton:
return new OxygenButton(*this, i18n("Close"), ButtonClose);
/*
case AboveButton:
return new OxygenButton(*this, i18n("Keep above others"), ButtonAbove);
case BelowButton:
return new OxygenButton(*this, i18n("Keep below others"), ButtonBelow);
*/
/*
case OnAllDesktopsButton:
return new OxygenButton(*this, i18n("All Desktops"), ButtonSticky);