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
00079 virtual ~KXMLGUIClient();
00080
00086 QAction* action( const char* name ) const;
00087
00093 virtual QAction *action( const QDomElement &element ) const;
00094
00098 virtual KActionCollection* actionCollection() const;
00099
00103 virtual KComponentData componentData() const;
00104
00110 virtual QDomDocument domDocument() const;
00111
00125 virtual QString xmlFile() const;
00126
00127 virtual QString localXMLFile() const;
00128
00132 void setXMLGUIBuildDocument( const QDomDocument &doc );
00136 QDomDocument xmlguiBuildDocument() const;
00137
00142 void setFactory( KXMLGUIFactory *factory );
00148 KXMLGUIFactory *factory() const;
00149
00155 KXMLGUIClient *parentClient() const;
00156
00163 void insertChildClient( KXMLGUIClient *child );
00164
00168 void removeChildClient( KXMLGUIClient *child );
00169
00173 QList<KXMLGUIClient*> childClients();
00174
00183 void setClientBuilder( KXMLGUIBuilder *builder );
00184
00189 KXMLGUIBuilder *clientBuilder() const;
00190
00198 void reloadXML();
00199
00243 void plugActionList( const QString &name, const QList<QAction*> &actionList );
00244
00252 void unplugActionList( const QString &name );
00253
00254 static QString findMostRecentXMLFile( const QStringList &files, QString &doc );
00255
00256 void addStateActionEnabled(const QString& state, const QString& action);
00257
00258 void addStateActionDisabled(const QString& state, const QString& action);
00259
00260 enum ReverseStateChange { StateNoReverse, StateReverse };
00261 struct StateChange
00262 {
00263 QStringList actionsToEnable;
00264 QStringList actionsToDisable;
00265 };
00266
00267 StateChange getActionsToChangeForState(const QString& state);
00268
00269 void beginXMLPlug( QWidget * );
00270 void endXMLPlug();
00271 void prepareXMLUnplug( QWidget * );
00272
00273 protected:
00278
00279
00286 virtual void setComponentData(const KComponentData &componentData);
00287
00304 virtual void setXMLFile( const QString& file, bool merge = false, bool setXMLDoc = true );
00305
00311 virtual void setLocalXMLFile( const QString &file );
00312
00319 virtual void setXML( const QString &document, bool merge = false );
00320
00327 virtual void setDOMDocument( const QDomDocument &document, bool merge = false );
00328
00340 virtual void stateChanged(const QString &newstate, ReverseStateChange reverse = StateNoReverse);
00341
00342 protected:
00343 virtual void virtual_hook( int id, void* data );
00344
00345 private:
00346 KXMLGUIClientPrivate * const d;
00347 };
00348
00349 #endif