kxmlguiclient.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _KXMLGUICLIENT_H
00020 #define _KXMLGUICLIENT_H
00021
00022 #include <qdom.h>
00023 #include <qptrlist.h>
00024 #include <qmap.h>
00025 #include <qstringlist.h>
00026
00027 class QWidget;
00028 class KAction;
00029 class KActionCollection;
00030 class KInstance;
00031 class KXMLGUIClientPrivate;
00032 class KXMLGUIFactory;
00033 class KXMLGUIBuilder;
00034
00041 class KXMLGUIClient
00042 {
00043 friend class KEditToolbarWidget;
00044 public:
00050 KXMLGUIClient();
00051
00063 KXMLGUIClient( KXMLGUIClient *parent );
00064
00068 virtual ~KXMLGUIClient();
00069
00075 KAction* action( const char* name ) const;
00076
00082 virtual KAction *action( const QDomElement &element ) const;
00083
00087 virtual KActionCollection* actionCollection() const;
00088
00092 virtual KInstance *instance() const;
00093
00099 virtual QDomDocument domDocument() const;
00100
00114 virtual QString xmlFile() const;
00115
00116 virtual QString localXMLFile() const;
00117
00121 void setXMLGUIBuildDocument( const QDomDocument &doc );
00125 QDomDocument xmlguiBuildDocument() const;
00126
00131 void setFactory( KXMLGUIFactory *factory );
00137 KXMLGUIFactory *factory() const;
00138
00144 KXMLGUIClient *parentClient() const;
00145
00152 void insertChildClient( KXMLGUIClient *child );
00153
00157 void removeChildClient( KXMLGUIClient *child );
00158
00162 const QPtrList<KXMLGUIClient> *childClients();
00163
00172 void setClientBuilder( KXMLGUIBuilder *builder );
00173
00178 KXMLGUIBuilder *clientBuilder() const;
00179
00187 void reloadXML();
00188
00229 void plugActionList( const QString &name, const QPtrList<KAction> &actionList );
00230
00234 void unplugActionList( const QString &name );
00235
00236 static QString findMostRecentXMLFile( const QStringList &files, QString &doc );
00237
00238 void addStateActionEnabled(const QString& state, const QString& action);
00239
00240 void addStateActionDisabled(const QString& state, const QString& action);
00241
00242 enum ReverseStateChange { StateNoReverse, StateReverse };
00243 struct StateChange
00244 {
00245 QStringList actionsToEnable;
00246 QStringList actionsToDisable;
00247 };
00248
00249 StateChange getActionsToChangeForState(const QString& state);
00250
00252 void beginXMLPlug( QWidget * );
00254 void endXMLPlug();
00256 void prepareXMLUnplug( QWidget * );
00257
00258 protected:
00263
00264
00271 virtual void setInstance( KInstance *instance );
00272
00286 virtual void setXMLFile( const QString& file, bool merge = false, bool setXMLDoc = true );
00287
00288 virtual void setLocalXMLFile( const QString &file );
00289
00296 virtual void setXML( const QString &document, bool merge = false );
00297
00304 virtual void setDOMDocument( const QDomDocument &document, bool merge = false );
00305
00311 virtual void conserveMemory();
00312
00324 virtual void stateChanged(const QString &newstate, ReverseStateChange reverse = StateNoReverse);
00325
00326
00327
00328
00329 private:
00330 struct DocStruct
00331 {
00332 QString file;
00333 QString data;
00334 };
00335
00336 bool mergeXML( QDomElement &base, const QDomElement &additive,
00337 KActionCollection *actionCollection );
00338
00339 QDomElement findMatchingElement( const QDomElement &base,
00340 const QDomElement &additive );
00341
00342 typedef QMap<QString, QMap<QString, QString> > ActionPropertiesMap;
00343
00344 static ActionPropertiesMap extractActionProperties( const QDomDocument &doc );
00345
00346 static void storeActionProperties( QDomDocument &doc, const ActionPropertiesMap &properties );
00347
00348 static QString findVersionNumber( const QString &_xml );
00349
00350
00351 QMap<QString,StateChange> m_actionsStateMap;
00352
00353 protected:
00354 virtual void virtual_hook( int id, void* data );
00355 private:
00356 KXMLGUIClientPrivate *d;
00357 };
00358
00359 #endif
This file is part of the documentation for kdeui Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 4 22:43:55 2004 by
doxygen 1.3.6-20040222 written by
Dimitri van Heesch, © 1997-2003