kdeui Library API Documentation

kxmlguifactory.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
00003    Copyright (C) 2000 Kurt Granroth <granroth@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 version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef __kxmlguifactory_h__
00021 #define __kxmlguifactory_h__
00022 
00023 #include <qobject.h>
00024 #include <qptrlist.h>
00025 #include <qdom.h>
00026 #include <qvaluelist.h>
00027 
00028 class KAction;
00029 class KXMLGUIFactoryPrivate;
00030 class KXMLGUIClient;
00031 class KXMLGUIBuilder;
00032 class KInstance;
00033 
00034 namespace KXMLGUI
00035 {
00036 struct MergingIndex;
00037 class ContainerNode;
00038 class ContainerClient;
00039 class BuildHelper;
00040 };
00041 
00059 class KXMLGUIFactory : public QObject
00060 {
00061   friend class KXMLGUI::BuildHelper;
00062   Q_OBJECT
00063  public:
00071   KXMLGUIFactory( KXMLGUIBuilder *builder, QObject *parent = 0, const char *name = 0 );
00072 
00076   ~KXMLGUIFactory();
00077 
00078   // XXX move to somewhere else? (Simon)
00079   static QString readConfigFile( const QString &filename, bool never_null, const KInstance *instance = 0 );
00080   static QString readConfigFile( const QString &filename, const KInstance *instance = 0 );
00081   static bool saveConfigFile( const QDomDocument& doc, const QString& filename,
00082                               const KInstance *instance = 0 );
00083 
00084   static QString documentToXML( const QDomDocument& doc );
00085   static QString elementToXML( const QDomElement& elem );
00086 
00090   static void removeDOMComments( QDomNode &node );
00091 
00102   void addClient( KXMLGUIClient *client );
00103 
00109   void removeClient( KXMLGUIClient *client );
00110 
00111   void plugActionList( KXMLGUIClient *client, const QString &name, const QPtrList<KAction> &actionList );
00112   void unplugActionList( KXMLGUIClient *client, const QString &name );
00113 
00117   QPtrList<KXMLGUIClient> clients() const;
00118 
00135   QWidget *container( const QString &containerName, KXMLGUIClient *client, bool useTagName = false );
00136 
00137   QPtrList<QWidget> containers( const QString &tagName );
00138 
00147   void reset();
00148 
00158   void resetContainer( const QString &containerName, bool useTagName = false );
00159 
00160  signals:
00161   void clientAdded( KXMLGUIClient *client );
00162   void clientRemoved( KXMLGUIClient *client );
00163 
00164  private:
00165 
00166   QWidget *findRecursive( KXMLGUI::ContainerNode *node, bool tag );
00167 
00168   QPtrList<QWidget> findRecursive( KXMLGUI::ContainerNode *node, const QString &tagName );
00169 
00170   void applyActionProperties( const QDomElement &element );
00171   void configureAction( KAction *action, const QDomNamedNodeMap &attributes );
00172   void configureAction( KAction *action, const QDomAttr &attribute );
00173 
00174 protected:
00175   virtual void virtual_hook( int id, void* data );
00176 private:
00177   KXMLGUIFactoryPrivate *d;
00178 };
00179 
00180 #endif
00181 /* vim: et sw=4
00182  */
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:02 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001