2009-09-15 07:12:54 +00:00
|
|
|
#ifndef oxygenclient_h
|
|
|
|
#define oxygenclient_h
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-08-24 16:14:11 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-09-15 07:12:54 +00:00
|
|
|
// oxygenclient.h
|
2009-08-24 16:14:11 +00:00
|
|
|
// -------------------
|
2009-09-09 00:55:55 +00:00
|
|
|
//
|
2009-08-24 16:14:11 +00:00
|
|
|
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
2009-08-25 04:15:13 +00:00
|
|
|
// Copyright (c) 2003, 2004 David Johnson <david@usermode.org>
|
|
|
|
// Copyright (c) 2006, 2007 Riccardo Iaconelli <ruphy@fsfe.org>
|
2009-08-24 16:14:11 +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-24 16:14:11 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2010-05-02 18:50:01 +00:00
|
|
|
#include "oxygenanimation.h"
|
2009-11-15 03:24:04 +00:00
|
|
|
#include "oxygenclientgroupitemdata.h"
|
2009-09-15 07:12:54 +00:00
|
|
|
#include "oxygenconfiguration.h"
|
2010-05-02 18:50:01 +00:00
|
|
|
#include "oxygendecohelper.h"
|
|
|
|
#include "oxygenfactory.h"
|
2010-05-12 23:34:31 +00:00
|
|
|
#include "oxygenshadowcache.h"
|
2009-12-18 15:20:04 +00:00
|
|
|
#include "oxygentitleanimationdata.h"
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
#include <kcommondecoration.h>
|
2010-02-14 21:59:14 +00:00
|
|
|
#include <QtCore/QBasicTimer>
|
2010-12-20 22:18:52 +00:00
|
|
|
#include <QtCore/QTextStream>
|
2010-02-14 21:59:14 +00:00
|
|
|
#include <QtCore/QTimerEvent>
|
|
|
|
|
2011-04-04 07:42:11 +00:00
|
|
|
#include <X11/Xdefs.h>
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
namespace Oxygen
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
class SizeGrip;
|
|
|
|
class Client : public KCommonDecorationUnstable
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
Q_OBJECT
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-11-17 21:56:04 +00:00
|
|
|
//! declare glow intensity property
|
2009-11-17 22:26:36 +00:00
|
|
|
Q_PROPERTY( qreal glowIntensity READ glowIntensityUnbiased WRITE setGlowIntensity )
|
2009-11-17 21:56:04 +00:00
|
|
|
|
2009-09-04 18:58:40 +00:00
|
|
|
public:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-04 18:58:40 +00:00
|
|
|
//! constructor
|
2010-05-02 18:34:08 +00:00
|
|
|
Client(KDecorationBridge *b, Factory *f);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! destructor
|
2010-05-02 18:34:08 +00:00
|
|
|
virtual ~Client();
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-14 14:37:58 +00:00
|
|
|
//! decoration name
|
2009-08-22 08:24:06 +00:00
|
|
|
virtual QString visibleName() const;
|
2009-10-14 14:37:58 +00:00
|
|
|
|
|
|
|
//! buttons
|
2009-08-22 08:24:06 +00:00
|
|
|
virtual KCommonDecorationButton *createButton(::ButtonType type);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-18 06:54:42 +00:00
|
|
|
//!@name flags
|
|
|
|
//@{
|
|
|
|
|
2009-10-14 14:37:58 +00:00
|
|
|
//! true if decoration has iquired behavior
|
|
|
|
virtual bool decorationBehaviour(DecorationBehaviour behaviour) const;
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! true if window is maximized
|
2009-09-18 06:54:42 +00:00
|
|
|
virtual bool isMaximized( void ) const
|
|
|
|
{ return maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows(); }
|
|
|
|
|
2010-02-14 21:59:14 +00:00
|
|
|
//! true if animations are used
|
2011-07-18 05:36:44 +00:00
|
|
|
bool animationsEnabled( void ) const
|
|
|
|
{ return configuration().animationsEnabled(); }
|
2010-02-14 21:59:14 +00:00
|
|
|
|
2009-11-17 21:56:04 +00:00
|
|
|
//! true if glow is animated
|
|
|
|
bool glowIsAnimated( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _glowAnimation->isRunning(); }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! true when decoration is forced active
|
|
|
|
bool isForcedActive( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _forceActive && clientGroupItems().count() > 1; }
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2009-09-07 17:26:56 +00:00
|
|
|
//! true when separator is to be drawn
|
2009-09-18 01:32:27 +00:00
|
|
|
bool drawSeparator( void ) const
|
|
|
|
{
|
2010-10-03 02:22:56 +00:00
|
|
|
if( configuration().drawTitleOutline() ) return false;
|
|
|
|
switch( configuration().separatorMode() )
|
|
|
|
{
|
|
|
|
case Configuration::SeparatorAlways:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case Configuration::SeparatorActive:
|
|
|
|
return ( glowIsAnimated() || isActive() );
|
|
|
|
|
|
|
|
default:
|
|
|
|
case Configuration::SeparatorNever:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-09-18 01:32:27 +00:00
|
|
|
}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-12-20 22:18:52 +00:00
|
|
|
//! true if titlebar is hidden
|
|
|
|
bool hideTitleBar( void ) const
|
|
|
|
{
|
|
|
|
return
|
|
|
|
configuration().hideTitleBar() &&
|
|
|
|
!isShade() &&
|
|
|
|
clientGroupItems().count() == 1;
|
|
|
|
}
|
|
|
|
|
2009-09-18 06:54:42 +00:00
|
|
|
//@}
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! window shape
|
|
|
|
virtual void updateWindowShape();
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! initialization
|
|
|
|
virtual void init();
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-10 05:13:25 +00:00
|
|
|
// reset
|
|
|
|
virtual void reset( unsigned long changed );
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! return associated configuration
|
2010-05-02 18:34:08 +00:00
|
|
|
const Configuration& configuration( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _configuration; }
|
2009-09-18 06:54:42 +00:00
|
|
|
|
2009-11-17 21:56:04 +00:00
|
|
|
//!@name glow animation
|
|
|
|
//@{
|
|
|
|
|
|
|
|
void setGlowIntensity( qreal value )
|
2010-08-28 02:52:26 +00:00
|
|
|
{
|
2011-02-24 16:37:04 +00:00
|
|
|
if( _glowIntensity == value ) return;
|
|
|
|
_glowIntensity = value;
|
2010-08-28 02:52:26 +00:00
|
|
|
widget()->update();
|
|
|
|
}
|
2009-11-17 21:56:04 +00:00
|
|
|
|
2009-11-17 22:26:36 +00:00
|
|
|
//! unbiased glow intensity
|
|
|
|
qreal glowIntensityUnbiased( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _glowIntensity; }
|
2009-11-17 21:56:04 +00:00
|
|
|
|
2009-11-17 22:26:36 +00:00
|
|
|
//! glow bias
|
|
|
|
static qreal glowBias( void )
|
|
|
|
{ return 0.2; }
|
|
|
|
|
|
|
|
//! true (biased) intensity
|
|
|
|
/*! this is needed to have glow go from either 0.2->1 or 0.8->0 depending on the animation direction */
|
|
|
|
qreal glowIntensity( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _glowAnimation->direction() == Animation::Forward ? _glowIntensity : _glowIntensity-glowBias(); }
|
2009-11-17 22:26:36 +00:00
|
|
|
|
2009-11-17 21:56:04 +00:00
|
|
|
//@}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! helper class
|
2010-05-02 18:50:01 +00:00
|
|
|
DecoHelper& helper( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _factory->helper(); }
|
2009-10-13 01:45:01 +00:00
|
|
|
|
|
|
|
//! helper class
|
2010-05-02 18:34:08 +00:00
|
|
|
ShadowCache& shadowCache( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _factory->shadowCache(); }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-14 14:37:58 +00:00
|
|
|
//!@name metrics and color definitions
|
|
|
|
//@{
|
|
|
|
|
|
|
|
//! dimensions
|
|
|
|
virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const;
|
2009-11-15 07:27:49 +00:00
|
|
|
|
|
|
|
//! get title rect for untabbed window
|
|
|
|
virtual QRect defaultTitleRect( bool active = true ) const;
|
2009-10-14 14:37:58 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
//! get title bounding rect
|
2009-11-15 03:24:04 +00:00
|
|
|
virtual QRect titleBoundingRect( const QFont& font, const QString& caption ) const
|
|
|
|
{ return titleBoundingRect( font, titleRect(), caption ); }
|
2009-10-14 14:37:58 +00:00
|
|
|
|
|
|
|
//! get title bounding rect
|
2009-11-15 03:24:04 +00:00
|
|
|
virtual QRect titleBoundingRect( const QFont&, QRect, const QString& ) const;
|
2009-10-14 14:37:58 +00:00
|
|
|
|
2009-09-09 17:00:13 +00:00
|
|
|
//! palette background
|
|
|
|
QPalette backgroundPalette( const QWidget*, QPalette ) const;
|
|
|
|
|
2009-09-26 04:57:27 +00:00
|
|
|
//! background
|
|
|
|
QColor backgroundColor( const QWidget* widget, QPalette palette ) const
|
2009-11-15 03:24:04 +00:00
|
|
|
{ return backgroundColor( widget, palette, isActive() || isForcedActive() ); }
|
2009-09-26 04:57:27 +00:00
|
|
|
|
|
|
|
//! background
|
|
|
|
QColor backgroundColor( const QWidget*, QPalette, bool ) const;
|
|
|
|
|
2009-10-14 14:37:58 +00:00
|
|
|
//@}
|
|
|
|
|
2010-03-11 15:24:28 +00:00
|
|
|
//! default buttons located on the left
|
|
|
|
virtual QString defaultButtonsLeft() const;
|
|
|
|
|
|
|
|
//! default buttons located on the right
|
|
|
|
virtual QString defaultButtonsRight() const;
|
2009-11-10 23:11:08 +00:00
|
|
|
|
2009-10-17 06:57:17 +00:00
|
|
|
//!@name status change methods (overloaded from KCommonDecorationUnstable)
|
|
|
|
//@{
|
|
|
|
|
|
|
|
//! triggered when window activity is changed
|
|
|
|
virtual void activeChange();
|
|
|
|
|
|
|
|
//! triggered when maximize state changed
|
|
|
|
virtual void maximizeChange();
|
|
|
|
|
|
|
|
//! triggered when window shade is changed
|
|
|
|
virtual void shadeChange();
|
|
|
|
|
|
|
|
//! triggered when window shade is changed
|
|
|
|
virtual void captionChange();
|
|
|
|
|
|
|
|
//@}
|
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! event filter
|
|
|
|
virtual bool eventFilter( QObject*, QEvent* );
|
2009-10-17 06:57:17 +00:00
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! resize event
|
2011-06-28 07:24:02 +00:00
|
|
|
virtual void resizeEvent( QResizeEvent* );
|
2010-07-28 01:07:47 +00:00
|
|
|
|
2011-06-28 07:24:02 +00:00
|
|
|
//! paint background to painter
|
|
|
|
void paintBackground( QPainter& ) const;
|
2011-06-27 23:27:58 +00:00
|
|
|
|
2010-07-24 21:45:25 +00:00
|
|
|
public slots:
|
2010-07-28 01:07:47 +00:00
|
|
|
|
2010-07-24 21:45:25 +00:00
|
|
|
//! triggers widget update in titleRect only
|
2010-07-28 01:07:47 +00:00
|
|
|
/*! one needs to add the title top margin to avoid some clipping glitches */
|
2010-07-24 21:45:25 +00:00
|
|
|
void updateTitleRect( void )
|
2010-07-28 02:23:14 +00:00
|
|
|
{ widget()->update( titleRect().adjusted( 0, -layoutMetric( LM_TitleEdgeTop ), 0, 1 ) ); }
|
2009-10-17 06:57:17 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2010-05-12 23:34:31 +00:00
|
|
|
//! return shadow cache key associated to this client
|
|
|
|
ShadowCache::Key key( void ) const
|
|
|
|
{
|
|
|
|
ShadowCache::Key key;
|
2011-02-02 15:09:56 +00:00
|
|
|
key.active = ( isActive() || isForcedActive() ) && configuration().useOxygenShadows();
|
2010-05-12 23:34:31 +00:00
|
|
|
key.isShade = isShade();
|
|
|
|
key.hasBorder = ( configuration().frameBorder() > Configuration::BorderNone );
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! true when decoration is forced active
|
|
|
|
void setForceActive( bool value )
|
2011-02-24 16:37:04 +00:00
|
|
|
{ _forceActive = value; }
|
2009-11-15 03:24:04 +00:00
|
|
|
|
|
|
|
//!@name event filters
|
|
|
|
//@{
|
|
|
|
|
2009-10-17 06:57:17 +00:00
|
|
|
//! paint
|
|
|
|
virtual void paintEvent( QPaintEvent* );
|
|
|
|
|
2011-06-28 07:24:02 +00:00
|
|
|
//! render full decoration to provided painter
|
|
|
|
virtual void paint( QPainter& );
|
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! mouse press event
|
|
|
|
virtual bool mousePressEvent( QMouseEvent* );
|
|
|
|
|
|
|
|
//! mouse release event
|
|
|
|
virtual bool mouseReleaseEvent( QMouseEvent* );
|
|
|
|
|
|
|
|
//! mouse move event
|
|
|
|
virtual bool mouseMoveEvent( QMouseEvent* );
|
|
|
|
|
|
|
|
//! drag enter event
|
|
|
|
virtual bool dragEnterEvent( QDragEnterEvent* );
|
|
|
|
|
|
|
|
//! drag move event
|
|
|
|
virtual bool dragMoveEvent( QDragMoveEvent* );
|
|
|
|
|
|
|
|
//! drag leave event
|
|
|
|
virtual bool dragLeaveEvent( QDragLeaveEvent* );
|
|
|
|
|
|
|
|
//! drop event
|
|
|
|
virtual bool dropEvent( QDropEvent* );
|
|
|
|
|
2009-11-15 06:28:40 +00:00
|
|
|
//! timer event
|
|
|
|
virtual void timerEvent( QTimerEvent* );
|
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//@}
|
|
|
|
|
2009-10-14 14:37:58 +00:00
|
|
|
//!@name rendering methods (called in paintEvent)
|
|
|
|
//@{
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! window background
|
|
|
|
virtual void renderWindowBackground( QPainter*, const QRect&, const QWidget*, const QPalette& ) const;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-04 18:58:40 +00:00
|
|
|
//! window border
|
|
|
|
// this draws a "blue" border around active window
|
2009-10-15 16:03:30 +00:00
|
|
|
virtual void renderWindowBorder( QPainter*, const QRect&, const QWidget*, const QPalette& ) const;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-18 01:32:27 +00:00
|
|
|
//! separator
|
|
|
|
virtual void renderSeparator( QPainter*, const QRect&, const QWidget*, const QColor& ) const;
|
|
|
|
|
2009-09-04 18:58:40 +00:00
|
|
|
//! title outline
|
|
|
|
virtual void renderTitleOutline( QPainter*, const QRect&, const QPalette& ) const;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-02 02:52:41 +00:00
|
|
|
//! title text
|
2009-11-14 04:19:09 +00:00
|
|
|
/*! second color, if valid, is for contrast pixel */
|
|
|
|
virtual void renderTitleText( QPainter*, const QRect&, const QColor&, const QColor& = QColor() ) const;
|
2009-10-15 16:03:30 +00:00
|
|
|
|
|
|
|
//! title text
|
2009-11-14 04:19:09 +00:00
|
|
|
/*! second color, if valid, is for contrast pixel */
|
2009-12-13 23:24:36 +00:00
|
|
|
virtual void renderTitleText( QPainter*, const QRect&, const QString&, const QColor&, const QColor& = QColor(), bool elide = true ) const;
|
2009-10-02 02:52:41 +00:00
|
|
|
|
2009-12-18 15:20:04 +00:00
|
|
|
//! title text
|
|
|
|
virtual QPixmap renderTitleText( const QRect&, const QString&, const QColor&, bool elide = true ) const;
|
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! GroupItem
|
|
|
|
virtual void renderItem( QPainter*, int, const QPalette& );
|
|
|
|
|
|
|
|
//! tabbing target rect
|
|
|
|
virtual void renderTargetRect( QPainter*, const QPalette& );
|
|
|
|
|
2011-01-27 09:40:48 +00:00
|
|
|
//! render corners
|
|
|
|
virtual void renderCorners( QPainter*, const QRect&, const QPalette& ) const;
|
|
|
|
|
2009-10-14 14:28:37 +00:00
|
|
|
//! render float frame
|
|
|
|
virtual void renderFloatFrame( QPainter*, const QRect&, const QPalette& ) const;
|
|
|
|
|
|
|
|
//! render dots
|
|
|
|
virtual void renderDots( QPainter*, const QRect&, const QColor& ) const;
|
|
|
|
|
2009-10-14 14:37:58 +00:00
|
|
|
//@}
|
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! close tab matching give button
|
2010-05-02 18:34:08 +00:00
|
|
|
virtual bool closeItem( const Button* );
|
2009-11-15 03:24:04 +00:00
|
|
|
|
|
|
|
//! index of item matching point
|
|
|
|
int itemClicked( const QPoint& position, bool between = false ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _itemData.itemAt( position , between ); }
|
2009-11-15 03:24:04 +00:00
|
|
|
|
|
|
|
//! return pixmap corresponding to a given tab, for dragging
|
|
|
|
QPixmap itemDragPixmap( int, const QRect& );
|
|
|
|
|
2009-09-18 01:32:27 +00:00
|
|
|
//! return true when activity change are animated
|
2011-07-18 05:36:44 +00:00
|
|
|
bool shadowAnimationsEnabled( void ) const
|
|
|
|
{ return ( animationsEnabled() && configuration().shadowAnimationsEnabled() && !isPreview() ); }
|
2009-09-18 01:32:27 +00:00
|
|
|
|
2009-10-02 02:52:41 +00:00
|
|
|
//! return true when activity change are animated
|
2011-07-18 05:36:44 +00:00
|
|
|
bool titleAnimationsEnabled( void ) const
|
2009-10-02 02:52:41 +00:00
|
|
|
{
|
2009-10-15 16:03:30 +00:00
|
|
|
return
|
2011-07-18 05:36:44 +00:00
|
|
|
animationsEnabled() &&
|
|
|
|
configuration().titleAnimationsEnabled() &&
|
2009-10-15 16:03:30 +00:00
|
|
|
!configuration().drawTitleOutline() &&
|
2010-12-20 22:18:52 +00:00
|
|
|
!hideTitleBar() &&
|
2009-10-15 16:03:30 +00:00
|
|
|
!isPreview();
|
2009-10-02 02:52:41 +00:00
|
|
|
}
|
|
|
|
|
2010-07-28 01:07:47 +00:00
|
|
|
//! true if some title outline is rendered
|
|
|
|
bool hasTitleOutline( void ) const
|
|
|
|
{
|
|
|
|
return
|
|
|
|
clientGroupItems().count() >= 2 ||
|
2011-02-24 16:37:04 +00:00
|
|
|
_itemData.isAnimated() ||
|
2010-07-28 01:07:47 +00:00
|
|
|
( isActive() && configuration().drawTitleOutline() );
|
|
|
|
}
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! calculate mask
|
|
|
|
QRegion calcMask( void ) const;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! text color
|
2010-08-28 19:58:22 +00:00
|
|
|
QColor titlebarTextColor(const QPalette&) const;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-18 19:47:53 +00:00
|
|
|
//! text color
|
2010-08-28 19:58:22 +00:00
|
|
|
QColor titlebarTextColor(const QPalette& palette, bool active) const
|
|
|
|
{
|
|
|
|
return active ?
|
|
|
|
palette.color(QPalette::Active, QPalette::WindowText):
|
|
|
|
helper().inactiveTitleBarTextColor( palette );
|
|
|
|
}
|
2009-09-18 19:47:53 +00:00
|
|
|
|
2009-11-14 04:19:09 +00:00
|
|
|
//! text color
|
2009-11-15 03:24:04 +00:00
|
|
|
QColor titlebarContrastColor(const QPalette& palette ) const
|
|
|
|
{ return titlebarContrastColor( palette.color( widget()->window()->backgroundRole() ) ); }
|
|
|
|
|
|
|
|
//! text color
|
|
|
|
QColor titlebarContrastColor(const QColor& color ) const
|
|
|
|
{ return helper().calcLightColor( color ); }
|
2009-11-14 04:19:09 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//!@name size grip
|
|
|
|
//@{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! create size grip
|
|
|
|
void createSizeGrip( void );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! delete size grip
|
|
|
|
void deleteSizeGrip( void );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
// size grip
|
|
|
|
bool hasSizeGrip( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return (bool)_sizeGrip; }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! size grip
|
2010-05-02 18:34:08 +00:00
|
|
|
SizeGrip& sizeGrip( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return *_sizeGrip; }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//@}
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2011-04-04 07:42:11 +00:00
|
|
|
//! remove shadow hint
|
|
|
|
void removeShadowHint( void );
|
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
protected slots:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! set target item to -1
|
|
|
|
void clearTargetItem( void );
|
|
|
|
|
|
|
|
//! clear force active flag
|
|
|
|
void clearForceActive( void )
|
|
|
|
{ if( isActive() ) setForceActive( false ); }
|
2010-07-28 01:07:47 +00:00
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! title bounding rects
|
|
|
|
/*! calculate and return title bounding rects in case of tabbed window */
|
|
|
|
void updateItemBoundingRects( bool alsoUpdate = true );
|
|
|
|
|
2010-12-29 10:40:17 +00:00
|
|
|
//! bound one rect to another
|
|
|
|
void boundRectTo( QRect&, const QRect& ) const;
|
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
private:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-10-13 01:45:01 +00:00
|
|
|
//! factory
|
2011-02-24 16:37:04 +00:00
|
|
|
Factory* _factory;
|
2009-10-13 01:45:01 +00:00
|
|
|
|
2011-06-28 07:24:02 +00:00
|
|
|
//! backing store pixmap (when compositing is not active)
|
|
|
|
QPixmap _pixmap;
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! size grip widget
|
2011-02-24 16:37:04 +00:00
|
|
|
SizeGrip* _sizeGrip;
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-10-15 16:03:30 +00:00
|
|
|
//! configuration
|
2011-02-24 16:37:04 +00:00
|
|
|
Configuration _configuration;
|
2009-10-15 16:03:30 +00:00
|
|
|
|
2009-11-17 21:56:04 +00:00
|
|
|
//! glow animation
|
2011-02-24 16:37:04 +00:00
|
|
|
Animation* _glowAnimation;
|
2009-11-17 21:56:04 +00:00
|
|
|
|
2009-12-18 15:20:04 +00:00
|
|
|
//! title animation data
|
2011-02-24 16:37:04 +00:00
|
|
|
TitleAnimationData* _titleAnimationData;
|
2009-09-18 01:32:27 +00:00
|
|
|
|
2009-11-17 21:56:04 +00:00
|
|
|
//! glow intensity
|
2011-02-24 16:37:04 +00:00
|
|
|
qreal _glowIntensity;
|
2009-11-17 21:56:04 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! true when initialized
|
2011-02-24 16:37:04 +00:00
|
|
|
bool _initialized;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
//! true when decoration is forced active
|
2011-02-24 16:37:04 +00:00
|
|
|
bool _forceActive;
|
2009-11-15 03:24:04 +00:00
|
|
|
|
|
|
|
//! mouse button
|
2011-02-24 16:37:04 +00:00
|
|
|
Qt::MouseButton _mouseButton;
|
2009-11-15 03:24:04 +00:00
|
|
|
|
|
|
|
//! tab bounding rects
|
2011-02-24 16:37:04 +00:00
|
|
|
ClientGroupItemDataList _itemData;
|
2009-11-15 03:24:04 +00:00
|
|
|
|
|
|
|
//! index of tab being dragged if any, -1 otherwise
|
2011-02-24 16:37:04 +00:00
|
|
|
int _sourceItem;
|
2009-11-15 03:24:04 +00:00
|
|
|
|
|
|
|
//! drag start point
|
2011-02-24 16:37:04 +00:00
|
|
|
QPoint _dragPoint;
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2009-11-15 06:28:40 +00:00
|
|
|
//! drag start timer.
|
|
|
|
/*!
|
|
|
|
it is needed to activate animations when this was not done via either
|
|
|
|
dragMoveEvent or dragLeaveEvent
|
|
|
|
*/
|
2011-02-24 16:37:04 +00:00
|
|
|
QBasicTimer _dragStartTimer;
|
2009-11-15 06:28:40 +00:00
|
|
|
|
2011-04-04 07:42:11 +00:00
|
|
|
//! shadow atom
|
|
|
|
Atom _shadowAtom;
|
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
};
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
} // namespace Oxygen
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
#endif // EXAMPLECLIENT_H
|