kdeui Library API Documentation

kxmlguifactory.h

00001 // -*- mode: c++; c-basic-offset: 2 -*-
00002 /* This file is part of the KDE libraries
00003    Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
00004    Copyright (C) 2000 Kurt Granroth <granroth@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
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., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef __kxmlguifactory_h__
00022 #define __kxmlguifactory_h__
00023 
00024 #include <qobject.h>
00025 #include <qptrlist.h>
00026 #include <qdom.h>
00027 #include <qvaluelist.h>
00028 
00029 class KAction;
00030 class KXMLGUIFactoryPrivate;
00031 class KXMLGUIClient;
00032 class KXMLGUIBuilder;
00033 class KInstance;
00034 
00035 namespace KXMLGUI
00036 {
00037 struct MergingIndex;
00038 class ContainerNode;
00039 class ContainerClient;
00040 class BuildHelper;
00041 }
00042 
00060 class KXMLGUIFactory : public QObject
00061 {
00062   friend class KXMLGUI::BuildHelper;
00063   Q_OBJECT
00064  public:
00072   KXMLGUIFactory( KXMLGUIBuilder *builder, QObject *parent = 0, const char *name = 0 );
00073 
00077   ~KXMLGUIFactory();
00078 
00079   // XXX move to somewhere else? (Simon)
00080   static QString readConfigFile( const QString &filename, bool never_null, const KInstance *instance = 0 );
00081   static QString readConfigFile( const QString &filename, const KInstance *instance = 0 );
00082   static bool saveConfigFile( const QDomDocument& doc, const QString& filename,
00083                               const KInstance *instance = 0 );
00084 
00085   static QString documentToXML( const QDomDocument& doc );
00086   static QString elementToXML( const QDomElement& elem );
00087 
00091   static void removeDOMComments( QDomNode &node );
00092 
00097   static QDomElement actionPropertiesElement( QDomDocument& doc );
00098 
00104   static QDomElement findActionByName( QDomElement& elem, const QString& sName, bool create );
00105 
00116   void addClient( KXMLGUIClient *client );
00117 
00123   void removeClient( KXMLGUIClient *client );
00124 
00125   void plugActionList( KXMLGUIClient *client, const QString &name, const QPtrList<KAction> &actionList );
00126   void unplugActionList( KXMLGUIClient *client, const QString &name );
00127 
00131   QPtrList<KXMLGUIClient> clients() const;
00132 
00153   QWidget *container( const QString &containerName, KXMLGUIClient *client, bool useTagName = false );
00154 
00155   QPtrList<QWidget> containers( const QString &tagName );
00156 
00165   void reset();
00166 
00176   void resetContainer( const QString &containerName, bool useTagName = false );
00177 
00178  public slots:
00194   int configureShortcuts(bool bAllowLetterShortcuts = true, bool bSaveSettings = true);
00195 
00196  signals:
00197   void clientAdded( KXMLGUIClient *client );
00198   void clientRemoved( KXMLGUIClient *client );
00199 
00200  private:
00201 
00202   QWidget *findRecursive( KXMLGUI::ContainerNode *node, bool tag );
00203 
00204   QPtrList<QWidget> findRecursive( KXMLGUI::ContainerNode *node, const QString &tagName );
00205 
00206   void applyActionProperties( const QDomElement &element );
00207   void configureAction( KAction *action, const QDomNamedNodeMap &attributes );
00208   void configureAction( KAction *action, const QDomAttr &attribute );
00209 
00210 protected:
00211   virtual void virtual_hook( int id, void* data );
00212 private:
00213   KXMLGUIFactoryPrivate *d;
00214 };
00215 
00216 #endif
00217 /* vim: et sw=4
00218  */
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Jul 22 10:16:48 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003