plugin.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org> 00003 (C) 1999 David Faure <faure@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef PLUGIN_H 00021 #define PLUGIN_H 00022 00023 #include <tqobject.h> 00024 #include <kaction.h> 00025 #include <kxmlguiclient.h> 00026 00027 class KInstance; 00028 00029 namespace KParts 00030 { 00031 00049 class KPARTS_EXPORT Plugin : public TQObject, virtual public KXMLGUIClient 00050 { 00051 Q_OBJECT 00052 public: 00056 struct PluginInfo 00057 { 00058 TQString m_relXMLFileName; 00059 TQString m_absXMLFileName; 00060 TQDomDocument m_document; 00061 }; 00062 00066 Plugin( TQObject* parent = 0, const char* name = 0 ); 00070 virtual ~Plugin(); 00071 00075 virtual TQString xmlFile() const; 00076 00080 virtual TQString localXMLFile() const; 00081 00089 static void loadPlugins( TQObject *parent, const KInstance * instance ); 00090 00098 static void loadPlugins( TQObject *parent, const TQValueList<PluginInfo> &pluginInfos ); 00099 00107 static void loadPlugins( TQObject *parent, const TQValueList<PluginInfo> &pluginInfos, const KInstance * instance ); 00108 00143 static void loadPlugins( TQObject *parent, KXMLGUIClient* parentGUIClient, KInstance* instance, bool enableNewPluginsByDefault = true ); 00144 00151 static TQPtrList<Plugin> pluginObjects( TQObject *parent ); 00152 00153 protected: 00159 static TQValueList<Plugin::PluginInfo> pluginInfos( const KInstance * instance ); 00160 00165 static Plugin* loadPlugin( TQObject * parent, const char* libname ); 00166 00167 virtual void setInstance( KInstance *instance ); 00168 00169 private: 00170 static bool hasPlugin( TQObject* parent, const TQString& library ); 00171 class PluginPrivate; 00172 PluginPrivate *d; 00173 }; 00174 00175 } 00176 00177 #endif