tdeui
kxmlguifactory.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __kxmlguifactory_h__
00022 #define __kxmlguifactory_h__
00023
00024 #include <tqobject.h>
00025 #include <tqptrlist.h>
00026 #include <tqdom.h>
00027 #include <tqvaluelist.h>
00028
00029 #include <tdelibs_export.h>
00030
00031 class TDEAction;
00032 class KXMLGUIFactoryPrivate;
00033 class KXMLGUIClient;
00034 class KXMLGUIBuilder;
00035 class TDEInstance;
00036
00037 namespace KXMLGUI
00038 {
00039 struct MergingIndex;
00040 struct ContainerNode;
00041 struct ContainerClient;
00042 class BuildHelper;
00043 }
00044
00062 class TDEUI_EXPORT KXMLGUIFactory : public TQObject
00063 {
00064 friend class KXMLGUI::BuildHelper;
00065 Q_OBJECT
00066 public:
00074 KXMLGUIFactory( KXMLGUIBuilder *builder, TQObject *parent = 0, const char *name = 0 );
00075
00079 ~KXMLGUIFactory();
00080
00081
00082 static TQString readConfigFile( const TQString &filename, bool never_null, const TDEInstance *instance = 0 );
00083 static TQString readConfigFile( const TQString &filename, const TDEInstance *instance = 0 );
00084 static bool saveConfigFile( const TQDomDocument& doc, const TQString& filename,
00085 const TDEInstance *instance = 0 );
00086
00087 static TQString documentToXML( const TQDomDocument& doc );
00088 static TQString elementToXML( const TQDomElement& elem );
00089
00093 static void removeDOMComments( TQDomNode &node );
00094
00099 static TQDomElement actionPropertiesElement( TQDomDocument& doc );
00100
00106 static TQDomElement findActionByName( TQDomElement& elem, const TQString& sName, bool create );
00107
00118 void addClient( KXMLGUIClient *client );
00119
00125 void removeClient( KXMLGUIClient *client );
00126
00127 void plugActionList( KXMLGUIClient *client, const TQString &name, const TQPtrList<TDEAction> &actionList );
00128 void unplugActionList( KXMLGUIClient *client, const TQString &name );
00129
00133 TQPtrList<KXMLGUIClient> clients() const;
00134
00155 TQWidget *container( const TQString &containerName, KXMLGUIClient *client, bool useTagName = false );
00156
00157 TQPtrList<TQWidget> containers( const TQString &tagName );
00158
00167 void reset();
00168
00178 void resetContainer( const TQString &containerName, bool useTagName = false );
00179
00180 public slots:
00196 int configureShortcuts(bool bAllowLetterShortcuts = true, bool bSaveSettings = true);
00197
00198 signals:
00199 void clientAdded( KXMLGUIClient *client );
00200 void clientRemoved( KXMLGUIClient *client );
00201
00202 private:
00203
00204 TQWidget *findRecursive( KXMLGUI::ContainerNode *node, bool tag );
00205
00206 TQPtrList<TQWidget> findRecursive( KXMLGUI::ContainerNode *node, const TQString &tagName );
00207
00208 void applyActionProperties( const TQDomElement &element );
00209 void configureAction( TDEAction *action, const TQDomNamedNodeMap &attributes );
00210 void configureAction( TDEAction *action, const TQDomAttr &attribute );
00211
00212 protected:
00213 virtual void virtual_hook( int id, void* data );
00214 private:
00215 KXMLGUIFactoryPrivate *d;
00216 };
00217
00218 #endif
00219
00220