1
/*****************************************************************
2
This file is part of the KDE project.
4
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
6
Permission is hereby granted, free of charge, to any person obtaining a
7
copy of this software and associated documentation files (the "Software"),
8
to deal in the Software without restriction, including without limitation
9
the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
and/or sell copies of the Software, and to permit persons to whom the
11
Software is furnished to do so, subject to the following conditions:
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
DEALINGS IN THE SOFTWARE.
23
******************************************************************/
25
#ifndef KDECORATIONFACTORY_H
26
#define KDECORATIONFACTORY_H
28
#include "kdecoration.h"
30
/** @addtogroup kdecoration */
34
class KDecorationBridge;
35
class KDecorationFactoryPrivate;
37
class KWIN_EXPORT KDecorationFactory
38
: public KDecorationDefines
42
* Constructor. Called after loading the decoration plugin. All global
43
* initialization of the plugin should be done in the factory constructor.
47
* Destructor. Called before unloading the decoration plugin. All global
48
* cleanup of the plugin should be done in the factory destructor.
50
virtual ~KDecorationFactory();
52
* This function must be reimplemented to create decoration objects.
53
* The argument should be passed to the KDecoration constructor, the second
54
* KDecoration argument should be this factory object.
56
virtual KDecoration* createDecoration(KDecorationBridge* bridge) = 0;
58
* This function is called when the configuration settings changed.
59
* The argument specifies what has changed, using the SettingXXX masks.
60
* It should be determined whether the decorations need to be completely
61
* remade, in which case true should be returned, or whether only e.g.
62
* a repaint will be sufficient, in which case false should be returned,
63
* and resetDecorations() can be called to reset all decoration objects.
64
* Note that true should be returned only when really necessary.
66
virtual bool reset(unsigned long changed); // returns true if the decoration needs to be recreated
69
* Reimplement this function if your decoration supports more border sizes than
70
* the default one (BorderNormal). The returned list must contain all supported
71
* sizes, ordered from the smallest to the largest one. By default, only
72
* BorderNormal is returned.
74
virtual QList< BorderSize > borderSizes() const;
76
virtual bool supports(Ability ability) const = 0;
78
virtual void checkRequirements(KDecorationProvides* provides);
80
* Returns the KDecorationOptions object, which is used to access
81
* configuration settings for the decoration.
83
const KDecorationOptions* options(); // convenience
85
* Returns true if the given decoration object still exists. This is necessary
86
* e.g. when calling KDecoration::showWindowMenu(), which may cause the decoration
87
* to be destroyed. Note that this function is reliable only if called immediately
90
bool exists(const KDecoration* deco) const;
94
void addDecoration(KDecoration*);
98
void removeDecoration(KDecoration*);
101
* Convenience function that calls KDecoration::reset() for all decoration
104
void resetDecorations(unsigned long changed); // convenience
106
* This function has the same functionality like KDecoration::windowType().
107
* It can be used in createDecoration() to return different KDecoration
108
* inherited classes depending on the window type, as at that time
109
* KDecoration::windowType() is not available yet. The additional argument
110
* is the one passed to createDecoration().
112
NET::WindowType windowType(unsigned long supported_types, KDecorationBridge* bridge) const;
114
QList< KDecoration* > _decorations;
115
KDecorationFactoryPrivate* d;
119
* @warning THIS CLASS IS UNSTABLE!
120
* Keep all decoration class names in sync. E.g. KDecorationFactory2 and KDecoration2.
122
class KWIN_EXPORT KDecorationFactoryUnstable
123
: public KDecorationFactory
127
inline const KDecorationOptions* KDecorationFactory::options()
129
return KDecoration::options();