.TH "KXMLGUIFactory" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KXMLGUIFactory \- KXMLGUIFactory, together with \fBKXMLGUIClient\fP objects, can be used to create a GUI of container widgets (like menus, toolbars, etc.) and container items (menu items, toolbar buttons, etc.) from an XML document and action objects.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kxmlguifactory.h>\fP
.PP
Inherits \fBQObject\fP.
.PP
.SS "Public Slots"

.in +1c
.ti -1c
.RI "int \fBconfigureShortcuts\fP (bool bAllowLetterShortcuts=true, bool bSaveSettings=true)"
.br
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBclientAdded\fP (\fBKXMLGUIClient\fP *client)"
.br
.ti -1c
.RI "void \fBclientRemoved\fP (\fBKXMLGUIClient\fP *client)"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKXMLGUIFactory\fP (\fBKXMLGUIBuilder\fP *builder, \fBQObject\fP *\fBparent\fP=0, const char *\fBname\fP=0)"
.br
.ti -1c
.RI "\fB~KXMLGUIFactory\fP ()"
.br
.ti -1c
.RI "void \fBaddClient\fP (\fBKXMLGUIClient\fP *client)"
.br
.ti -1c
.RI "void \fBremoveClient\fP (\fBKXMLGUIClient\fP *client)"
.br
.ti -1c
.RI "void \fBplugActionList\fP (\fBKXMLGUIClient\fP *client, const \fBQString\fP &\fBname\fP, const \fBQPtrList\fP< \fBKAction\fP > &actionList)"
.br
.ti -1c
.RI "void \fBunplugActionList\fP (\fBKXMLGUIClient\fP *client, const \fBQString\fP &\fBname\fP)"
.br
.ti -1c
.RI "\fBQPtrList\fP< \fBKXMLGUIClient\fP > \fBclients\fP () const "
.br
.ti -1c
.RI "\fBQWidget\fP * \fBcontainer\fP (const \fBQString\fP &containerName, \fBKXMLGUIClient\fP *client, bool useTagName=false)"
.br
.ti -1c
.RI "\fBQPtrList\fP< \fBQWidget\fP > \fBcontainers\fP (const \fBQString\fP &tagName)"
.br
.ti -1c
.RI "void \fBreset\fP ()"
.br
.ti -1c
.RI "void \fBresetContainer\fP (const \fBQString\fP &containerName, bool useTagName=false)"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static \fBQString\fP \fBreadConfigFile\fP (const \fBQString\fP &filename, bool never_null, const \fBKInstance\fP *instance=0)"
.br
.ti -1c
.RI "static \fBQString\fP \fBreadConfigFile\fP (const \fBQString\fP &filename, const \fBKInstance\fP *instance=0)"
.br
.ti -1c
.RI "static bool \fBsaveConfigFile\fP (const \fBQDomDocument\fP &doc, const \fBQString\fP &filename, const \fBKInstance\fP *instance=0)"
.br
.ti -1c
.RI "static \fBQString\fP \fBdocumentToXML\fP (const \fBQDomDocument\fP &doc)"
.br
.ti -1c
.RI "static \fBQString\fP \fBelementToXML\fP (const \fBQDomElement\fP &elem)"
.br
.ti -1c
.RI "static void \fBremoveDOMComments\fP (\fBQDomNode\fP &node)"
.br
.ti -1c
.RI "static \fBQDomElement\fP \fBactionPropertiesElement\fP (\fBQDomDocument\fP &doc)"
.br
.ti -1c
.RI "static \fBQDomElement\fP \fBfindActionByName\fP (\fBQDomElement\fP &elem, const \fBQString\fP &sName, bool create)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKXMLGUI::BuildHelper\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
KXMLGUIFactory, together with \fBKXMLGUIClient\fP objects, can be used to create a GUI of container widgets (like menus, toolbars, etc.) and container items (menu items, toolbar buttons, etc.) from an XML document and action objects. 

Each \fBKXMLGUIClient\fP represents a part of the GUI, composed from containers and actions. KXMLGUIFactory takes care of building (with the help of a \fBKXMLGUIBuilder\fP) and merging the GUI from an unlimited number of clients.
.PP
Each client provides XML through a \fBQDomDocument\fP and actions through a \fBKActionCollection\fP . The XML document contains the rules for how to merge the GUI.
.PP
KXMLGUIFactory processes the DOM tree provided by a client and plugs in the client's actions, according to the XML and the merging rules of previously inserted clients. Container widgets are built via a \fBKXMLGUIBuilder\fP , which has to be provided with the KXMLGUIFactory constructor. 
.PP
Definition at line 62 of file kxmlguifactory.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KXMLGUIFactory::KXMLGUIFactory (\fBKXMLGUIBuilder\fP * builder, \fBQObject\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
Constructs a KXMLGUIFactory. 
.PP
The provided \fCbuilder\fP \fBKXMLGUIBuilder\fP will be called for creating and removing container widgets, when clients are added/removed from the GUI.
.PP
Note that the ownership of the given \fBKXMLGUIBuilder\fP object won't be transferred to this KXMLGUIFactory, so you have to take care of deleting it properly. 
.PP
Definition at line 206 of file kxmlguifactory.cpp.
.SS "KXMLGUIFactory::~\fBKXMLGUIFactory\fP ()"
.PP
Destructor. 
.PP
Definition at line 219 of file kxmlguifactory.cpp.
.SH "Member Function Documentation"
.PP 
.SS "void KXMLGUIFactory::removeDOMComments (\fBQDomNode\fP & node)\fC [static]\fP"
.PP
Removes all \fBQDomComment\fP objects from the specified node and all its children. 
.PP
Definition at line 186 of file kxmlguifactory.cpp.
.PP
References QDomNode::isNull(), QDomNode::nextSibling(), QDomNode::nodeType(), and QDomNode::removeChild().
.SS "void KXMLGUIFactory::addClient (\fBKXMLGUIClient\fP * client)"
.PP
Creates the GUI described by the \fBQDomDocument\fP of the client, using the client's actions, and merges it with the previously created GUI. 
.PP
This also means that the order in which clients are added to the factory is relevant; assuming that your application supports plugins, you should first add your application to the factory and then the plugin, so that the plugin's UI is merged into the UI of your application, and not the other way round. 
.PP
Definition at line 224 of file kxmlguifactory.cpp.
.PP
References QString::append(), QDomElement::attribute(), QPtrListIterator::current(), QDomDocument::documentElement(), endl(), kdDebug(), QString::lower(), and KGlobal::staticQString().
.PP
Referenced by KMainWindow::createGUI(), KEditToolbarWidget::save(), and KMainWindow::setStandardToolBarMenuEnabled().
.SS "void KXMLGUIFactory::removeClient (\fBKXMLGUIClient\fP * client)"
.PP
Removes the GUI described by the client, by unplugging all provided actions and removing all owned containers (and storing container state information in the given client). 
.PP
Definition at line 321 of file kxmlguifactory.cpp.
.PP
References QPtrListIterator::current(), QDomDocument::documentElement(), endl(), kdDebug(), and QPtrListIterator::toLast().
.PP
Referenced by KMainWindow::createGUI(), KEditToolbarWidget::save(), and KMainWindow::setStandardToolBarMenuEnabled().
.SS "\fBQPtrList\fP< \fBKXMLGUIClient\fP > KXMLGUIFactory::clients () const"
.PP
Returns a list of all clients currently added to this factory. 
.PP
Definition at line 379 of file kxmlguifactory.cpp.
.SS "\fBQWidget\fP * KXMLGUIFactory::container (const \fBQString\fP & containerName, \fBKXMLGUIClient\fP * client, bool useTagName = \fCfalse\fP)"
.PP
Use this method to get access to a container widget with the name specified with \fCcontainerName\fP and which is owned by the \fCclient\fP. 
.PP
The container name is specified with a 'name' attribute in the XML document.
.PP
This function is particularly useful for getting hold of a popupmenu defined in an XMLUI file. For instance: 
.PP
.nf
 QPopupMenu *popup = static_cast<QPopupMenu*>(factory()->container('my_popup',this));

.fi
.PP
 where \fC'my_popup'\fP is the name of the menu in the XMLUI file, and \fC'this'\fP is XMLGUIClient which owns the popupmenu (e.g. the mainwindow, or the part, or the plugin...)
.PP
\fBParameters:\fP
.RS 4
\fIcontainerName\fP Name of the container widget 
.br
\fIclient\fP Owner of the container widget 
.br
\fIuseTagName\fP Specifies whether to compare the specified name with the name attribute or the tag name.
.RE
.PP
This method may return 0L if no container with the given name exists or is not owned by the client. 
.PP
Definition at line 384 of file kxmlguifactory.cpp.
.PP
Referenced by resetContainer().
.SS "void KXMLGUIFactory::reset ()"
.PP
Use this method to free all memory allocated by the KXMLGUIFactory. 
.PP
This deletes the internal node tree and therefore resets the internal state of the class. Please note that the actual GUI is NOT touched at all, meaning no containers are deleted nor any actions unplugged. That is something you have to do on your own. So use this method only if you know what you are doing :-)
.PP
(also note that this will call KXMLGUIClient::setFactory( 0L ) for all inserted clients) 
.PP
Definition at line 406 of file kxmlguifactory.cpp.
.SS "void KXMLGUIFactory::resetContainer (const \fBQString\fP & containerName, bool useTagName = \fCfalse\fP)"
.PP
Use this method to free all memory allocated by the KXMLGUIFactory for a specific container, including all child containers and actions. 
.PP
This deletes the internal node subtree for the specified container. The actual GUI is not touched, no containers are deleted or any actions unplugged. Use this method only if you know what you are doing :-)
.PP
(also note that this will call KXMLGUIClient::setFactory( 0L ) for all clients of the container) 
.PP
Definition at line 413 of file kxmlguifactory.cpp.
.PP
References container().
.PP
Referenced by KMainWindow::createGUI().
.SS "int KXMLGUIFactory::configureShortcuts (bool bAllowLetterShortcuts = \fCtrue\fP, bool bSaveSettings = \fCtrue\fP)\fC [slot]\fP"
.PP
Show a standard configure shortcut for every action in this factory. 
.PP
This slot can be connected dirrectly to the action to configure shortcuts. This is very simple to do that by adding a single line 
.PP
.nf
 KStdAction::keyBindings( guiFactory(), SLOT( configureShortcuts() ), actionCollection() );

.fi
.PP
.PP
\fBParameters:\fP
.RS 4
\fIbAllowLetterShortcuts\fP Set to false if unmodified alphanumeric keys ('A', '1', etc.) are not permissible shortcuts. 
.br
\fIbSaveSettings\fP if true, the settings will also be saved back to the *uirc file which they were intially read from. 
.RE
.PP
\fBSince:\fP
.RS 4
3.3 
.RE
.PP

.PP
Definition at line 553 of file kxmlguifactory.cpp.
.PP
References KXMLGUIClient::actionCollection(), KKeyDialog::configure(), KKeyDialog::insert(), QString::isEmpty(), QObject::parent(), and KXMLGUIClient::xmlFile().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
