2011-02-24 16:37:04 +00:00
|
|
|
#ifndef oxygenfactory_h
|
|
|
|
#define oxygenfactory_h
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-08-24 16:17:15 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-09-15 07:12:54 +00:00
|
|
|
// oxygen.h
|
2009-08-24 16:17:15 +00:00
|
|
|
// -------------------
|
2009-09-09 00:55:55 +00:00
|
|
|
//
|
2009-08-25 04:15:13 +00:00
|
|
|
// Copyright (c) 2009 Hugo Pereira <hugo.pereira@free.fr>
|
2009-08-22 08:24:06 +00:00
|
|
|
// Copyright (c) 2006, 2007 Riccardo Iaconelli <ruphy@fsfe.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
|
2009-09-09 00:55:55 +00:00
|
|
|
// IN THE SOFTWARE.
|
2009-08-24 16:17:15 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
#include "oxygenconfiguration.h"
|
2012-11-23 09:09:39 +00:00
|
|
|
#include "oxygendecorationdefines.h"
|
2010-05-02 18:50:01 +00:00
|
|
|
#include "oxygendecohelper.h"
|
2009-10-13 01:45:01 +00:00
|
|
|
#include "oxygenshadowcache.h"
|
2009-08-22 08:24:06 +00:00
|
|
|
|
2013-02-26 08:00:51 +00:00
|
|
|
#include <QObject>
|
2012-11-23 09:09:39 +00:00
|
|
|
#include <kdecorationfactory.h>
|
|
|
|
#include <kdeversion.h>
|
|
|
|
|
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 Client;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
enum {
|
2009-10-13 01:45:01 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! this is the top title bar edge
|
|
|
|
TFRAMESIZE = 3,
|
2009-10-13 01:45:01 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
/*!
|
|
|
|
this is the extra title bar top and bottom edges
|
|
|
|
needed to outline active window title bar
|
|
|
|
*/
|
|
|
|
HFRAMESIZE = 4
|
|
|
|
};
|
2009-10-13 01:45:01 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! window decoration factory
|
2013-08-23 07:05:59 +00:00
|
|
|
class Factory: public KDecorationFactory
|
2010-05-02 18:34:08 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
Q_OBJECT
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2012-11-23 09:09:39 +00:00
|
|
|
public:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2012-11-23 09:09:39 +00:00
|
|
|
//! constructor
|
2013-08-23 07:05:59 +00:00
|
|
|
explicit Factory(QObject *parent = nullptr);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! destructor
|
|
|
|
virtual ~Factory();
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! create decoration
|
|
|
|
virtual KDecoration *createDecoration(KDecorationBridge *b);
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! configuration capabilities
|
|
|
|
virtual bool supports( Ability ability ) const;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! true if initialized
|
|
|
|
virtual bool initialized()
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _initialized; }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! helper
|
2010-05-02 18:50:01 +00:00
|
|
|
virtual DecoHelper& helper( void )
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _helper; }
|
2009-10-13 01:45:01 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! shadow cache
|
|
|
|
virtual ShadowCache& shadowCache( void )
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _shadowCache; }
|
2009-10-13 01:45:01 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! shadow cache
|
|
|
|
virtual const ShadowCache& shadowCache( void ) const
|
2011-02-24 16:37:04 +00:00
|
|
|
{ return _shadowCache; }
|
2010-04-25 20:28:02 +00:00
|
|
|
|
2012-11-23 09:09:39 +00:00
|
|
|
//! pointer to configuration
|
|
|
|
typedef QSharedPointer<Configuration> ConfigurationPtr;
|
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! get configuration for a give client
|
2012-11-23 09:09:39 +00:00
|
|
|
virtual ConfigurationPtr configuration( const Client& );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2012-11-23 09:09:39 +00:00
|
|
|
protected:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! read configuration from KConfig
|
2012-11-23 09:09:39 +00:00
|
|
|
void readConfig();
|
2010-04-25 20:28:02 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! initialization
|
|
|
|
void setInitialized( bool value )
|
2011-02-24 16:37:04 +00:00
|
|
|
{ _initialized = value; }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2012-11-23 09:09:39 +00:00
|
|
|
//! exception group name
|
|
|
|
QString exceptionGroupName( int index ) const
|
|
|
|
{
|
|
|
|
QString out;
|
|
|
|
QTextStream( &out ) << "Windeco Exception " << index;
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! initialization flag
|
2011-02-24 16:37:04 +00:00
|
|
|
bool _initialized;
|
2009-10-13 01:45:01 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! helper
|
2011-02-24 16:37:04 +00:00
|
|
|
DecoHelper _helper;
|
2009-10-13 01:45:01 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! shadow cache
|
2011-02-24 16:37:04 +00:00
|
|
|
ShadowCache _shadowCache;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! default configuration
|
2012-11-23 09:09:39 +00:00
|
|
|
ConfigurationPtr _defaultConfiguration;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2012-11-23 09:09:39 +00:00
|
|
|
//! list of exceptiosn
|
|
|
|
QList<ConfigurationPtr> _exceptions;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
};
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-24 06:27:49 +00:00
|
|
|
}
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
#endif
|