2007-04-29 17:35:43 +00:00
|
|
|
/*****************************************************************
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
|
|
|
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 IN THE SOFTWARE.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
#include "kdecoration.h"
|
2008-05-30 17:47:24 +00:00
|
|
|
#include "kdecoration_p.h"
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include <kdebug.h>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <kglobal.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#if defined Q_WS_X11 && ! defined K_WS_QTONLY
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <fixx11h.h>
|
2007-11-20 16:00:58 +00:00
|
|
|
#include <QX11Info>
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "kdecorationfactory.h"
|
2008-01-26 19:00:14 +00:00
|
|
|
#include "kdecorationbridge.h"
|
2007-11-29 14:11:02 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Extending KDecoration:
|
|
|
|
======================
|
|
|
|
|
|
|
|
If KDecoration will ever need to be extended in a way that'd break binary compatibility
|
|
|
|
(i.e. adding new virtual methods most probably), new class KDecoration2 should be
|
|
|
|
inherited from KDecoration and those methods added there. Code that would depend
|
|
|
|
on the new functionality could then dynamic_cast<> to KDecoration2 to check whether
|
|
|
|
it is available and use it.
|
|
|
|
|
|
|
|
KCommonDecoration would have to be extended the same way, adding KCommonDecoration2
|
|
|
|
inheriting KCommonDecoration and adding the new API matching KDecoration2.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
KDecorationOptions* KDecoration::options_;
|
|
|
|
|
|
|
|
KDecoration::KDecoration( KDecorationBridge* bridge, KDecorationFactory* factory )
|
|
|
|
: bridge_( bridge ),
|
2008-09-23 07:54:28 +00:00
|
|
|
w_( NULL ),
|
2007-04-29 17:35:43 +00:00
|
|
|
factory_( factory )
|
|
|
|
{
|
|
|
|
factory->addDecoration( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
KDecoration::~KDecoration()
|
|
|
|
{
|
|
|
|
factory()->removeDecoration( this );
|
|
|
|
delete w_;
|
|
|
|
}
|
|
|
|
|
|
|
|
const KDecorationOptions* KDecoration::options()
|
|
|
|
{
|
|
|
|
return options_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::createMainWidget( Qt::WFlags flags )
|
|
|
|
{
|
|
|
|
// FRAME check flags?
|
|
|
|
QWidget *w = new QWidget( initialParentWidget(), initialWFlags() | flags );
|
|
|
|
w->setObjectName("decoration widget");
|
|
|
|
w->setAttribute( Qt::WA_PaintOnScreen );
|
2008-08-22 19:24:43 +00:00
|
|
|
if ( options()->showTooltips() )
|
|
|
|
w->setAttribute( Qt::WA_AlwaysShowToolTips );
|
2007-04-29 17:35:43 +00:00
|
|
|
setMainWidget(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::setMainWidget( QWidget* w )
|
|
|
|
{
|
|
|
|
assert( w_ == NULL );
|
|
|
|
w_ = w;
|
|
|
|
w->setMouseTracking( true );
|
|
|
|
widget()->resize( geometry().size());
|
|
|
|
}
|
|
|
|
|
|
|
|
QWidget* KDecoration::initialParentWidget() const
|
|
|
|
{
|
|
|
|
return bridge_->initialParentWidget();
|
|
|
|
}
|
|
|
|
|
|
|
|
Qt::WFlags KDecoration::initialWFlags() const
|
|
|
|
{
|
|
|
|
return bridge_->initialWFlags();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isActive() const
|
|
|
|
{
|
|
|
|
return bridge_->isActive();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isCloseable() const
|
|
|
|
{
|
|
|
|
return bridge_->isCloseable();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isMaximizable() const
|
|
|
|
{
|
|
|
|
return bridge_->isMaximizable();
|
|
|
|
}
|
|
|
|
|
|
|
|
KDecoration::MaximizeMode KDecoration::maximizeMode() const
|
|
|
|
{
|
|
|
|
return bridge_->maximizeMode();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isMinimizable() const
|
|
|
|
{
|
|
|
|
return bridge_->isMinimizable();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::providesContextHelp() const
|
|
|
|
{
|
|
|
|
return bridge_->providesContextHelp();
|
|
|
|
}
|
|
|
|
|
|
|
|
int KDecoration::desktop() const
|
|
|
|
{
|
|
|
|
return bridge_->desktop();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isModal() const
|
|
|
|
{
|
|
|
|
return bridge_->isModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isShadeable() const
|
|
|
|
{
|
|
|
|
return bridge_->isShadeable();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isShade() const
|
|
|
|
{
|
|
|
|
return bridge_->isShade();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isSetShade() const
|
|
|
|
{
|
|
|
|
return bridge_->isSetShade();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::keepAbove() const
|
|
|
|
{
|
|
|
|
return bridge_->keepAbove();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::keepBelow() const
|
|
|
|
{
|
|
|
|
return bridge_->keepBelow();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isMovable() const
|
|
|
|
{
|
|
|
|
return bridge_->isMovable();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isResizable() const
|
|
|
|
{
|
|
|
|
return bridge_->isResizable();
|
|
|
|
}
|
|
|
|
|
|
|
|
NET::WindowType KDecoration::windowType( unsigned long supported_types ) const
|
|
|
|
{ // this one is also duplicated in KDecorationFactory
|
|
|
|
return bridge_->windowType( supported_types );
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon KDecoration::icon() const
|
|
|
|
{
|
|
|
|
return bridge_->icon();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString KDecoration::caption() const
|
|
|
|
{
|
|
|
|
return bridge_->caption();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::processMousePressEvent( QMouseEvent* e )
|
|
|
|
{
|
|
|
|
return bridge_->processMousePressEvent( e );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::showWindowMenu( const QRect &pos )
|
|
|
|
{
|
|
|
|
bridge_->showWindowMenu( pos );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::showWindowMenu( QPoint pos )
|
|
|
|
{
|
|
|
|
bridge_->showWindowMenu( pos );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::performWindowOperation( WindowOperation op )
|
|
|
|
{
|
|
|
|
bridge_->performWindowOperation( op );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::setMask( const QRegion& reg, int mode )
|
|
|
|
{
|
|
|
|
bridge_->setMask( reg, mode );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::clearMask()
|
|
|
|
{
|
|
|
|
bridge_->setMask( QRegion(), 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::isPreview() const
|
|
|
|
{
|
|
|
|
return bridge_->isPreview();
|
|
|
|
}
|
|
|
|
|
|
|
|
QRect KDecoration::geometry() const
|
|
|
|
{
|
|
|
|
return bridge_->geometry();
|
|
|
|
}
|
|
|
|
|
|
|
|
QRect KDecoration::iconGeometry() const
|
|
|
|
{
|
|
|
|
return bridge_->iconGeometry();
|
|
|
|
}
|
|
|
|
|
|
|
|
QRegion KDecoration::unobscuredRegion( const QRegion& r ) const
|
|
|
|
{
|
|
|
|
return bridge_->unobscuredRegion( r );
|
|
|
|
}
|
|
|
|
|
|
|
|
WId KDecoration::windowId() const
|
|
|
|
{
|
|
|
|
return bridge_->windowId();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::closeWindow()
|
|
|
|
{
|
|
|
|
bridge_->closeWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::maximize( Qt::MouseButtons button )
|
|
|
|
{
|
|
|
|
performWindowOperation( options()->operationMaxButtonClick( button ));
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::maximize( MaximizeMode mode )
|
|
|
|
{
|
|
|
|
bridge_->maximize( mode );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::minimize()
|
|
|
|
{
|
|
|
|
bridge_->minimize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::showContextHelp()
|
|
|
|
{
|
|
|
|
bridge_->showContextHelp();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::setDesktop( int desktop )
|
|
|
|
{
|
|
|
|
bridge_->setDesktop( desktop );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::toggleOnAllDesktops()
|
|
|
|
{
|
|
|
|
if( isOnAllDesktops())
|
|
|
|
setDesktop( bridge_->currentDesktop());
|
|
|
|
else
|
|
|
|
setDesktop( NET::OnAllDesktops );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::titlebarDblClickOperation()
|
|
|
|
{
|
|
|
|
bridge_->titlebarDblClickOperation();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::titlebarMouseWheelOperation( int delta )
|
|
|
|
{
|
|
|
|
bridge_->titlebarMouseWheelOperation( delta );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::setShade( bool set )
|
|
|
|
{
|
|
|
|
bridge_->setShade( set );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::setKeepAbove( bool set )
|
|
|
|
{
|
|
|
|
bridge_->setKeepAbove( set );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::setKeepBelow( bool set )
|
|
|
|
{
|
|
|
|
bridge_->setKeepBelow( set );
|
|
|
|
}
|
|
|
|
|
2007-07-26 07:51:16 +00:00
|
|
|
void KDecoration::emitKeepAboveChanged( bool above )
|
|
|
|
{
|
|
|
|
keepAboveChanged( above );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::emitKeepBelowChanged( bool below )
|
|
|
|
{
|
|
|
|
keepBelowChanged( below );
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
bool KDecoration::drawbound( const QRect&, bool )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecoration::windowDocked( Position )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::reset( unsigned long )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::grabXServer()
|
|
|
|
{
|
|
|
|
bridge_->grabXServer( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecoration::ungrabXServer()
|
|
|
|
{
|
|
|
|
bridge_->grabXServer( false );
|
|
|
|
}
|
2007-11-20 16:00:58 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
KDecoration::Position KDecoration::mousePosition( const QPoint& p ) const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
const int range = 16;
|
|
|
|
int bleft, bright, btop, bbottom;
|
|
|
|
borders( bleft, bright, btop, bbottom );
|
|
|
|
btop = qMin( btop, 4 ); // otherwise whole titlebar would have resize cursor
|
|
|
|
|
|
|
|
Position m = PositionCenter;
|
|
|
|
|
|
|
|
if ( ( p.x() > bleft && p.x() < widget()->width() - bright )
|
|
|
|
&& ( p.y() > btop && p.y() < widget()->height() - bbottom ) )
|
|
|
|
return PositionCenter;
|
|
|
|
|
|
|
|
if ( p.y() <= qMax( range, btop ) && p.x() <= qMax( range, bleft ))
|
|
|
|
m = PositionTopLeft;
|
|
|
|
else if ( p.y() >= widget()->height()- qMax( range, bbottom )
|
|
|
|
&& p.x() >= widget()->width()- qMax( range, bright ))
|
|
|
|
m = PositionBottomRight;
|
|
|
|
else if ( p.y() >= widget()->height()- qMax( range, bbottom ) && p.x() <= qMax( range, bleft ))
|
|
|
|
m = PositionBottomLeft;
|
|
|
|
else if ( p.y() <= qMax( range, btop ) && p.x() >= widget()->width()- qMax( range, bright ))
|
|
|
|
m = PositionTopRight;
|
|
|
|
else if ( p.y() <= btop )
|
|
|
|
m = PositionTop;
|
|
|
|
else if ( p.y() >= widget()->height()-bbottom )
|
|
|
|
m = PositionBottom;
|
|
|
|
else if ( p.x() <= bleft )
|
|
|
|
m = PositionLeft;
|
|
|
|
else if ( p.x() >= widget()->width()-bright )
|
|
|
|
m = PositionRight;
|
|
|
|
else
|
|
|
|
m = PositionCenter;
|
|
|
|
return m;
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-10-17 10:30:43 +00:00
|
|
|
|
2008-10-18 08:10:37 +00:00
|
|
|
KDecorationUnstable::KDecorationUnstable( KDecorationBridge* bridge, KDecorationFactory* factory )
|
2008-10-17 10:30:43 +00:00
|
|
|
: KDecoration( bridge, factory )
|
|
|
|
{
|
2008-10-18 08:10:37 +00:00
|
|
|
Q_ASSERT( dynamic_cast< KDecorationBridgeUnstable* >( bridge ));
|
2008-10-17 10:30:43 +00:00
|
|
|
}
|
|
|
|
|
2008-10-18 08:10:37 +00:00
|
|
|
KDecorationUnstable::~KDecorationUnstable()
|
2008-10-17 10:30:43 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-10-18 08:10:37 +00:00
|
|
|
QList<QRect> KDecorationUnstable::shadowQuads( ShadowType type ) const
|
2008-10-17 10:30:43 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED( type );
|
|
|
|
return QList<QRect>();
|
|
|
|
}
|
|
|
|
|
2008-10-19 13:43:16 +00:00
|
|
|
double KDecorationUnstable::shadowOpacity( ShadowType type ) const
|
2008-10-17 10:30:43 +00:00
|
|
|
{
|
|
|
|
if( isActive() && type == ShadowBorderedActive )
|
2008-10-19 13:43:16 +00:00
|
|
|
return 1.0;
|
2008-10-17 10:30:43 +00:00
|
|
|
else if( !isActive() && type == ShadowBorderedInactive )
|
2008-10-19 13:43:16 +00:00
|
|
|
return 1.0;
|
2008-10-17 10:30:43 +00:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2008-10-18 08:10:37 +00:00
|
|
|
double KDecorationUnstable::shadowBrightness( ShadowType type ) const
|
2008-10-17 10:30:43 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED( type );
|
|
|
|
return 1.0;
|
|
|
|
}
|
|
|
|
|
2008-10-18 08:10:37 +00:00
|
|
|
double KDecorationUnstable::shadowSaturation( ShadowType type ) const
|
2008-10-17 10:30:43 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED( type );
|
|
|
|
return 1.0;
|
|
|
|
}
|
|
|
|
|
2008-10-18 08:10:37 +00:00
|
|
|
void KDecorationUnstable::repaintShadow()
|
2008-10-17 10:30:43 +00:00
|
|
|
{
|
2008-10-18 08:10:37 +00:00
|
|
|
static_cast< KDecorationBridgeUnstable* >( bridge_ )->repaintShadow();
|
2008-10-17 10:30:43 +00:00
|
|
|
}
|
|
|
|
|
2008-10-18 08:10:37 +00:00
|
|
|
bool KDecorationUnstable::compositingActive() const
|
2008-10-17 10:30:43 +00:00
|
|
|
{
|
2008-10-18 08:10:37 +00:00
|
|
|
return static_cast< KDecorationBridgeUnstable* >( bridge_ )->compositingActive();
|
2008-10-17 10:30:43 +00:00
|
|
|
}
|
|
|
|
|
2008-10-18 08:10:37 +00:00
|
|
|
bool KDecorationUnstable::shadowsActive() const
|
2008-10-17 10:30:43 +00:00
|
|
|
{
|
2008-10-18 08:10:37 +00:00
|
|
|
return static_cast< KDecorationBridgeUnstable* >( bridge_ )->shadowsActive();
|
2008-10-17 10:30:43 +00:00
|
|
|
}
|
|
|
|
|
2008-10-18 08:10:37 +00:00
|
|
|
double KDecorationUnstable::opacity() const
|
2008-10-17 10:30:43 +00:00
|
|
|
{
|
2008-10-18 08:10:37 +00:00
|
|
|
return static_cast< KDecorationBridgeUnstable* >( bridge_ )->opacity();
|
2008-10-17 10:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
KDecorationOptions::KDecorationOptions()
|
2008-01-29 16:44:41 +00:00
|
|
|
: d( new KDecorationOptionsPrivate )
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
|
|
|
assert( KDecoration::options_ == NULL );
|
|
|
|
KDecoration::options_ = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
KDecorationOptions::~KDecorationOptions()
|
|
|
|
{
|
|
|
|
assert( KDecoration::options_ == this );
|
|
|
|
KDecoration::options_ = NULL;
|
2008-01-29 16:44:41 +00:00
|
|
|
delete d;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2007-07-25 10:28:57 +00:00
|
|
|
QColor KDecorationOptions::color(ColorType type, bool active) const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return(d->colors[type + (active ? 0 : NUM_COLORS)]);
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-07-25 10:28:57 +00:00
|
|
|
QFont KDecorationOptions::font(bool active, bool small) const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
if ( small )
|
|
|
|
return(active ? d->activeFontSmall : d->inactiveFontSmall);
|
|
|
|
else
|
|
|
|
return(active ? d->activeFont : d->inactiveFont);
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-07-25 10:28:57 +00:00
|
|
|
QPalette KDecorationOptions::palette(ColorType type, bool active) const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
int idx = type + (active ? 0 : NUM_COLORS);
|
|
|
|
if(d->pal[idx])
|
|
|
|
return(*d->pal[idx]);
|
2007-04-29 22:38:19 +00:00
|
|
|
#ifdef __GNUC__
|
2007-04-29 17:35:43 +00:00
|
|
|
#warning KDE4 : why construct the palette this way?
|
2007-04-29 22:38:19 +00:00
|
|
|
#endif
|
2008-09-23 07:54:28 +00:00
|
|
|
// TODO: Is this worth 'porting' to Qt4?
|
2007-04-29 17:35:43 +00:00
|
|
|
// d->pal[idx] = new QPalette(Qt::black, d->colors[idx], d->colors[idx].light(150),
|
|
|
|
// d->colors[idx].dark(), d->colors[idx].dark(120),
|
|
|
|
// Qt::black, QApplication::palette().active().
|
|
|
|
// base());
|
|
|
|
d->pal[idx] = new QPalette(d->colors[idx]);
|
|
|
|
return(*d->pal[idx]);
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned long KDecorationOptions::updateSettings( KConfig* config )
|
|
|
|
{
|
|
|
|
return d->updateSettings( config );
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationOptions::customButtonPositions() const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return d->custom_button_positions;
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QString KDecorationOptions::titleButtonsLeft() const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return d->title_buttons_left;
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-11-15 20:08:57 +00:00
|
|
|
QString KDecorationOptions::defaultTitleButtonsLeft()
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-11-29 19:28:07 +00:00
|
|
|
return "MS";
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-11-15 20:08:57 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
QString KDecorationOptions::titleButtonsRight() const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return d->title_buttons_right;
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-11-15 20:08:57 +00:00
|
|
|
QString KDecorationOptions::defaultTitleButtonsRight()
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-11-29 19:28:07 +00:00
|
|
|
return "HIA__X";
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-11-15 20:08:57 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
bool KDecorationOptions::showTooltips() const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return d->show_tooltips;
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
KDecorationOptions::BorderSize KDecorationOptions::preferredBorderSize( KDecorationFactory* factory ) const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
assert( factory != NULL );
|
|
|
|
if( d->cached_border_size == BordersCount ) // invalid
|
|
|
|
d->cached_border_size = d->findPreferredBorderSize( d->border_size,
|
|
|
|
factory->borderSizes());
|
|
|
|
return d->cached_border_size;
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationOptions::moveResizeMaximizedWindows() const
|
2008-01-29 16:44:41 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return d->move_resize_maximized_windows;
|
2008-01-29 16:44:41 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
KDecorationDefines::WindowOperation KDecorationOptions::operationMaxButtonClick( Qt::MouseButtons button ) const
|
|
|
|
{
|
2008-01-29 16:44:41 +00:00
|
|
|
return button == Qt::RightButton? d->opMaxButtonRightClick :
|
|
|
|
button == Qt::MidButton? d->opMaxButtonMiddleClick :
|
|
|
|
d->opMaxButtonLeftClick;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecorationOptions::setOpMaxButtonLeftClick( WindowOperation op )
|
|
|
|
{
|
|
|
|
d->opMaxButtonLeftClick = op;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecorationOptions::setOpMaxButtonRightClick( WindowOperation op )
|
|
|
|
{
|
|
|
|
d->opMaxButtonRightClick = op;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecorationOptions::setOpMaxButtonMiddleClick( WindowOperation op )
|
|
|
|
{
|
|
|
|
d->opMaxButtonMiddleClick = op;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecorationOptions::setBorderSize( BorderSize bs )
|
|
|
|
{
|
|
|
|
d->border_size = bs;
|
|
|
|
d->cached_border_size = BordersCount; // invalid
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecorationOptions::setCustomButtonPositions( bool b )
|
|
|
|
{
|
|
|
|
d->custom_button_positions = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecorationOptions::setTitleButtonsLeft( const QString& b )
|
|
|
|
{
|
|
|
|
d->title_buttons_left = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecorationOptions::setTitleButtonsRight( const QString& b )
|
|
|
|
{
|
|
|
|
d->title_buttons_right = b;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2008-01-29 16:44:41 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "kdecoration.moc"
|