kxmlguifactory.h
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
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   
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 
00139   QWidget *container( const QString &containerName, KXMLGUIClient *client, bool useTagName = false );
00140 
00141   QPtrList<QWidget> containers( const QString &tagName );
00142 
00151   void reset();
00152 
00162   void resetContainer( const QString &containerName, bool useTagName = false );
00163 
00164  signals:
00165   void clientAdded( KXMLGUIClient *client );
00166   void clientRemoved( KXMLGUIClient *client );
00167 
00168  private:
00169 
00170   QWidget *findRecursive( KXMLGUI::ContainerNode *node, bool tag );
00171 
00172   QPtrList<QWidget> findRecursive( KXMLGUI::ContainerNode *node, const QString &tagName );
00173 
00174   void applyActionProperties( const QDomElement &element );
00175   void configureAction( KAction *action, const QDomNamedNodeMap &attributes );
00176   void configureAction( KAction *action, const QDomAttr &attribute );
00177 
00178 protected:
00179   virtual void virtual_hook( int id, void* data );
00180 private:
00181   KXMLGUIFactoryPrivate *d;
00182 };
00183 
00184 #endif
00185 
00186 
 
This file is part of the documentation for kdeui Library Version 3.2.0.