KDEUI
kxmlguiclient.h
Go to the documentation of this file.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 <kdeui_export.h>
00023
00024 #include <QtCore/QMap>
00025 #include <QtCore/QStringList>
00026
00027 class QDomDocument;
00028 class QDomElement;
00029 class QWidget;
00030
00031 class QAction;
00032 class KActionCollection;
00033 class KComponentData;
00034 class KXMLGUIClientPrivate;
00035 class KXMLGUIFactory;
00036 class KXMLGUIBuilder;
00037
00038 namespace KDEPrivate { class KEditToolBarWidget; }
00039
00046 class KDEUI_EXPORT KXMLGUIClient
00047 {
00048 friend class KDEPrivate::KEditToolBarWidget;
00049 public:
00055 KXMLGUIClient();
00056
00068 explicit KXMLGUIClient( KXMLGUIClient *parent );
00069
00073 virtual ~KXMLGUIClient();
00074
00080 QAction* action( const char* name ) const;
00081
00087 virtual QAction *action( const QDomElement &element ) const;
00088
00092 virtual KActionCollection* actionCollection() const;
00093
00097 virtual KComponentData componentData() const;
00098
00104 virtual QDomDocument domDocument() const;
00105
00119 virtual QString xmlFile() const;
00120
00121 virtual QString localXMLFile() const;
00122
00126 void setXMLGUIBuildDocument( const QDomDocument &doc );
00130 QDomDocument xmlguiBuildDocument() const;
00131
00136 void setFactory( KXMLGUIFactory *factory );
00142 KXMLGUIFactory *factory() const;
00143
00149 KXMLGUIClient *parentClient() const;
00150
00157 void insertChildClient( KXMLGUIClient *child );
00158
00162 void removeChildClient( KXMLGUIClient *child );
00163
00167 QList<KXMLGUIClient*> childClients();
00168
00177 void setClientBuilder( KXMLGUIBuilder *builder );
00178
00183 KXMLGUIBuilder *clientBuilder() const;
00184
00192 void reloadXML();
00193
00237 void plugActionList( const QString &name, const QList<QAction*> &actionList );
00238
00246 void unplugActionList( const QString &name );
00247
00248 static QString findMostRecentXMLFile( const QStringList &files, QString &doc );
00249
00250 void addStateActionEnabled(const QString& state, const QString& action);
00251
00252 void addStateActionDisabled(const QString& state, const QString& action);
00253
00254 enum ReverseStateChange { StateNoReverse, StateReverse };
00255 struct StateChange
00256 {
00257 QStringList actionsToEnable;
00258 QStringList actionsToDisable;
00259 };
00260
00261 StateChange getActionsToChangeForState(const QString& state);
00262
00263 void beginXMLPlug( QWidget * );
00264 void endXMLPlug();
00265 void prepareXMLUnplug( QWidget * );
00266
00267 protected:
00272
00273
00280 virtual void setComponentData(const KComponentData &componentData);
00281
00298 virtual void setXMLFile( const QString& file, bool merge = false, bool setXMLDoc = true );
00299
00305 virtual void setLocalXMLFile( const QString &file );
00306
00313 virtual void setXML( const QString &document, bool merge = false );
00314
00321 virtual void setDOMDocument( const QDomDocument &document, bool merge = false );
00322
00334 virtual void stateChanged(const QString &newstate, ReverseStateChange reverse = StateNoReverse);
00335
00336 protected:
00337 virtual void virtual_hook( int id, void* data );
00338
00339 private:
00340 KXMLGUIClientPrivate * const d;
00341 };
00342
00343 #endif