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
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
00182
This file is part of the documentation for kdelibs Version 3.1.0.