1/*****************************************************************
2This file is part of the KDE project.
3
4Copyright (C) 1999, 2000 Daniel M. Duley <mosfet@kde.org>
5Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
6
7Permission is hereby granted, free of charge, to any person obtaining a
8copy of this software and associated documentation files (the "Software"),
9to deal in the Software without restriction, including without limitation
10the rights to use, copy, modify, merge, publish, distribute, sublicense,
11and/or sell copies of the Software, and to permit persons to whom the
12Software is furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in
15all copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23DEALINGS IN THE SOFTWARE.
24******************************************************************/
25
26#ifndef KDECORATION_PLUGINS_H
27#define KDECORATION_PLUGINS_H
28
29//
30// This header file is internal. I mean it.
31//
32
33// This private header is used by KWin core.
34
35#include <QWidget>
36#include <ksharedconfig.h>
37
38#include "kdecoration.h"
39
40class KLibrary;
41class KDecoration;
42class KDecorationBridge;
43class KDecorationFactory;
44
45class KWIN_EXPORT KDecorationPlugins
46 : public KDecorationProvides
47{
48public:
49 explicit KDecorationPlugins(const KSharedConfigPtr &cfg);
50 virtual ~KDecorationPlugins();
51 /** Whether the plugin with @p name can be loaded
52 * if @p loadedLib is passed, the library is NOT unloaded and freed
53 * what is now your resposibility (intended for and used by below loadPlugin mainly) */
54 bool canLoad(QString name, KLibrary ** loadedLib = 0);
55 bool loadPlugin(QString name);
56 void destroyPreviousPlugin();
57 KDecorationFactory* factory();
58 const KDecorationFactory* factory() const;
59 KDecoration* createDecoration(KDecorationBridge*);
60 QString currentPlugin();
61 bool reset(unsigned long changed); // returns true if decorations need to be recreated
62protected:
63 virtual void error(const QString& error_msg);
64 QString defaultPlugin; // FRAME normalne protected?
65private:
66 KDecorationFactory*(*create_ptr)();
67 KLibrary *library;
68 KDecorationFactory* fact;
69 KLibrary *old_library;
70 KDecorationFactory* old_fact;
71 QString pluginStr;
72 KSharedConfigPtr config;
73};
74
75/*
76
77 Plugins API:
78 KDecorationFactory* create_factory(); - called once after loading
79 int decoration_version(); - called once after loading
80
81*/
82
83/** @} */
84
85#endif
86