.TH "KXMLGUIClient" 3 "28 Jan 2004" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KXMLGUIClient \- A KXMLGUIClient can be used with \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and can be dynamically merged with other KXMLGUIClients.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kxmlguiclient.h>\fP
.PP
Inherited by \fBKDEPrivate::ToolBarHandler\fP, \fBKEditToolbarWidget\fP\fC [virtual]\fP, and \fBKMainWindow\fP\fC [virtual]\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBReverseStateChange\fP { \fBStateNoReverse\fP, \fBStateReverse\fP }"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKXMLGUIClient\fP ()"
.br
.RI "\fIConstructs a KXMLGUIClient which can be used with a \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and which can be dynamically merged with other KXMLGUIClients. \fP"
.ti -1c
.RI "\fBKXMLGUIClient\fP (\fBKXMLGUIClient\fP *parent)"
.br
.RI "\fIConstructs a KXMLGUIClient which can be used with a \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and which can be dynamically merged with other KXMLGUIClients. \fP"
.ti -1c
.RI "virtual \fB~KXMLGUIClient\fP ()"
.br
.RI "\fIDestructs the KXMLGUIClient. \fP"
.ti -1c
.RI "\fBKAction\fP * \fBaction\fP (const  char *name) const "
.br
.RI "\fIRetrieves an action of the client by name. \fP"
.ti -1c
.RI "virtual \fBKAction\fP * \fBaction\fP (const  \fBQDomElement\fP &element) const "
.br
.RI "\fIRetrieves an action for a given \fBQDomElement\fP. \fP"
.ti -1c
.RI "virtual \fBKActionCollection\fP * \fBactionCollection\fP () const "
.br
.RI "\fIRetrieves the entire action collection for the GUI client. \fP"
.ti -1c
.RI "virtual \fBKInstance\fP * \fBinstance\fP () const "
.br
.ti -1c
.RI "virtual \fBQDomDocument\fP \fBdomDocument\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBxmlFile\fP () const "
.br
.RI "\fIThis will return the name of the XML file as set by \fBsetXMLFile\fP(). \fP"
.ti -1c
.RI "virtual \fBQString\fP \fBlocalXMLFile\fP () const "
.br
.ti -1c
.RI "void \fBsetXMLGUIBuildDocument\fP (const  \fBQDomDocument\fP &doc)"
.br
.ti -1c
.RI "\fBQDomDocument\fP \fBxmlguiBuildDocument\fP () const "
.br
.ti -1c
.RI "void \fBsetFactory\fP (\fBKXMLGUIFactory\fP *factory)"
.br
.RI "\fIThis method is called by the \fBKXMLGUIFactory\fP as soon as the client is added to the KXMLGUIFactory's GUI. \fP"
.ti -1c
.RI "\fBKXMLGUIFactory\fP * \fBfactory\fP () const "
.br
.RI "\fIRetrieves a pointer to the \fBKXMLGUIFactory\fP this client is associated with (will return 0L if the client's GUI has not been built by a \fBKXMLGUIFactory\fP. \fP"
.ti -1c
.RI "\fBKXMLGUIClient\fP * \fBparentClient\fP () const "
.br
.RI "\fIKXMLGUIClients can form a simple child/parent object tree. \fP"
.ti -1c
.RI "void \fBinsertChildClient\fP (\fBKXMLGUIClient\fP *child)"
.br
.RI "\fIUse this method to make a client a child client of another client. \fP"
.ti -1c
.RI "void \fBremoveChildClient\fP (\fBKXMLGUIClient\fP *child)"
.br
.RI "\fIRemoves the given \fCchild\fP from the client's children list. \fP"
.ti -1c
.RI "const  \fBQPtrList\fP< \fBKXMLGUIClient\fP > * \fBchildClients\fP ()"
.br
.RI "\fIRetrieves a list of all child clients. \fP"
.ti -1c
.RI "void \fBsetClientBuilder\fP (\fBKXMLGUIBuilder\fP *builder)"
.br
.RI "\fIA client can have an own \fBKXMLGUIBuilder\fP. \fP"
.ti -1c
.RI "\fBKXMLGUIBuilder\fP * \fBclientBuilder\fP () const "
.br
.RI "\fIRetrieves the client's GUI builder or 0L if no client specific builder has been assigned via \fBsetClientBuilder\fP(). \fP"
.ti -1c
.RI "void \fBreloadXML\fP ()"
.br
.RI "\fIForces this client to re-read its XML resource file. \fP"
.ti -1c
.RI "void \fBplugActionList\fP (const  \fBQString\fP &name, const  \fBQPtrList\fP< \fBKAction\fP > &actionList)"
.br
.RI "\fIActionLists are a way for XMLGUI to support dynamic lists of actions. \fP"
.ti -1c
.RI "void \fBunplugActionList\fP (const  \fBQString\fP &name)"
.br
.RI "\fIThe complement of \fBplugActionList\fP() ... \fP"
.ti -1c
.RI "void \fBaddStateActionEnabled\fP (const  \fBQString\fP &state, const  \fBQString\fP &action)"
.br
.ti -1c
.RI "void \fBaddStateActionDisabled\fP (const  \fBQString\fP &state, const  \fBQString\fP &action)"
.br
.ti -1c
.RI "StateChange \fBgetActionsToChangeForState\fP (const  \fBQString\fP &state)"
.br
.ti -1c
.RI "void \fBbeginXMLPlug\fP (\fBQWidget\fP *)"
.br
.RI "\fI\fBSince:\fP
.RS 4
3.1 
.RE
.PP
\fP"
.ti -1c
.RI "void \fBendXMLPlug\fP ()"
.br
.RI "\fI\fBSince:\fP
.RS 4
3.1 
.RE
.PP
\fP"
.ti -1c
.RI "void \fBprepareXMLUnplug\fP (\fBQWidget\fP *)"
.br
.RI "\fI\fBSince:\fP
.RS 4
3.1 
.RE
.PP
\fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "\fBQString\fP \fBfindMostRecentXMLFile\fP (const  \fBQStringList\fP &files, \fBQString\fP &doc)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBsetInstance\fP (\fBKInstance\fP *instance)"
.br
.RI "\fISets the instance (\fBKInstance\fP) for this part. \fP"
.ti -1c
.RI "virtual void \fBsetXMLFile\fP (const  \fBQString\fP &file, bool merge=false, bool setXMLDoc=true)"
.br
.RI "\fISets the name of the rc file containing the XML for the part. \fP"
.ti -1c
.RI "virtual void \fBsetLocalXMLFile\fP (const  \fBQString\fP &file)"
.br
.ti -1c
.RI "virtual void \fBsetXML\fP (const  \fBQString\fP &document, bool merge=false)"
.br
.RI "\fISets the XML for the part. \fP"
.ti -1c
.RI "virtual void \fBsetDOMDocument\fP (const  \fBQDomDocument\fP &document, bool merge=false)"
.br
.RI "\fISets the Document for the part, describing the layout of the GUI. \fP"
.ti -1c
.RI "virtual void \fBconserveMemory\fP ()"
.br
.RI "\fIThis function will attempt to give up some memory after the GUI is built. \fP"
.ti -1c
.RI "virtual void \fBstateChanged\fP (const  \fBQString\fP &newstate, ReverseStateChange reverse=StateNoReverse)"
.br
.RI "\fIActions can collectively be assigned a 'State'. \fP"
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKEditToolbarWidget\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
A KXMLGUIClient can be used with \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and can be dynamically merged with other KXMLGUIClients. Definition at line 41 of file kxmlguiclient.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KXMLGUIClient::KXMLGUIClient ()"
.PP
Constructs a KXMLGUIClient which can be used with a \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and which can be dynamically merged with other KXMLGUIClients. Definition at line 67 of file kxmlguiclient.cpp.
.SS "KXMLGUIClient::KXMLGUIClient (\fBKXMLGUIClient\fP * parent)"
.PP
Constructs a KXMLGUIClient which can be used with a \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and which can be dynamically merged with other KXMLGUIClients. This constructor takes an additional \fCparent\fP argument, which makes the client a child client of the parent.
.PP
Child clients are automatically added to the GUI if the parent is added. Definition at line 72 of file kxmlguiclient.cpp.
.PP
References insertChildClient().
.SS "KXMLGUIClient::~\fBKXMLGUIClient\fP ()\fC [virtual]\fP"
.PP
Destructs the KXMLGUIClient. Definition at line 78 of file kxmlguiclient.cpp.
.PP
References QPtrListIterator::current().
.SH "Member Function Documentation"
.PP 
.SS "\fBKAction\fP * KXMLGUIClient::action (const char * name) const"
.PP
Retrieves an action of the client by name. If not found, it looks in its child clients. This method is provided for convenience, as it uses \fBactionCollection\fP() to get the action object. Definition at line 93 of file kxmlguiclient.cpp.
.PP
References KActionCollection::action(), actionCollection(), QPtrListIterator::current(), and KStdAccel::name().
.PP
Referenced by stateChanged().
.SS "\fBKAction\fP * KXMLGUIClient::action (const \fBQDomElement\fP & element) const\fC [virtual]\fP"
.PP
Retrieves an action for a given \fBQDomElement\fP. The default implementation uses the 'name' attribute to query the action object via the other \fBaction()\fP method. Definition at line 115 of file kxmlguiclient.cpp.
.PP
References KActionCollection::action(), actionCollection(), QDomElement::attribute(), and KGlobal::staticQString().
.SS "\fBKActionCollection\fP * KXMLGUIClient::actionCollection () const\fC [virtual]\fP"
.PP
Retrieves the entire action collection for the GUI client. Reimplemented in \fBKEditToolbarWidget\fP.
.PP
Definition at line 107 of file kxmlguiclient.cpp.
.PP
Referenced by action(), beginXMLPlug(), KMainWindow::createGUI(), endXMLPlug(), KEditToolbarWidget::KEditToolbarWidget(), KMainWindowInterface::KMainWindowInterface(), prepareXMLUnplug(), setDOMDocument(), setInstance(), setXMLFile(), and stateChanged().
.SS "\fBKInstance\fP * KXMLGUIClient::instance () const\fC [virtual]\fP"
.PP
\fBReturns:\fP
.RS 4
The instance (\fBKInstance\fP) for this part. 
.RE
.PP
Definition at line 121 of file kxmlguiclient.cpp.
.PP
Referenced by KMainWindow::createGUI(), KMainWindow::helpMenu(), KEditToolbarWidget::KEditToolbarWidget(), setClientBuilder(), and setXMLFile().
.SS "\fBQDomDocument\fP KXMLGUIClient::domDocument () const\fC [virtual]\fP"
.PP
\fBReturns:\fP
.RS 4
The parsed XML in a \fBQDomDocument\fP, set by \fBsetXMLFile\fP() or \fBsetXML\fP(). This document describes the layout of the GUI. 
.RE
.PP
Definition at line 126 of file kxmlguiclient.cpp.
.PP
Referenced by KXMLGUIFactory::addClient(), KMainWindow::createGUI(), KEditToolbarWidget::KEditToolbarWidget(), and KXMLGUIFactory::removeClient().
.SS "\fBQString\fP KXMLGUIClient::xmlFile () const\fC [virtual]\fP"
.PP
This will return the name of the XML file as set by \fBsetXMLFile\fP(). If \fBsetXML\fP() is used directly, then this will return NULL.
.PP
The filename that this returns is obvious for components as each component has exactly one XML file. In non-components, however, there are usually two: the global file and the local file. This function doesn't really care about that, though. It will always return the last XML file set. This, in almost all cases, will be the local XML file.
.PP
\fBReturns:\fP
.RS 4
The name of the XML file or QString::null 
.RE
.PP
Definition at line 131 of file kxmlguiclient.cpp.
.PP
Referenced by KEditToolbarWidget::KEditToolbarWidget(), reloadXML(), and KEditToolbarWidget::save().
.SS "void KXMLGUIClient::setFactory (\fBKXMLGUIFactory\fP * factory)"
.PP
This method is called by the \fBKXMLGUIFactory\fP as soon as the client is added to the KXMLGUIFactory's GUI. Definition at line 543 of file kxmlguiclient.cpp.
.PP
Referenced by KXMLGUIFactory::addClient(), KEditToolbarWidget::KEditToolbarWidget(), and KXMLGUIFactory::removeClient().
.SS "\fBKXMLGUIFactory\fP * KXMLGUIClient::factory () const"
.PP
Retrieves a pointer to the \fBKXMLGUIFactory\fP this client is associated with (will return 0L if the client's GUI has not been built by a \fBKXMLGUIFactory\fP. Definition at line 548 of file kxmlguiclient.cpp.
.PP
Referenced by KXMLGUIFactory::addClient(), KXMLGUIFactory::removeClient(), KEditToolbarWidget::save(), and KMainWindow::setStandardToolBarMenuEnabled().
.SS "\fBKXMLGUIClient\fP * KXMLGUIClient::parentClient () const"
.PP
KXMLGUIClients can form a simple child/parent object tree. This method returns a pointer to the parent client or 0L if it has no parent client assigned. Definition at line 553 of file kxmlguiclient.cpp.
.SS "void KXMLGUIClient::insertChildClient (\fBKXMLGUIClient\fP * child)"
.PP
Use this method to make a client a child client of another client. Usually you don't need to call this method, as it is called automatically when using the second constructor, which takes a arent argument. Definition at line 558 of file kxmlguiclient.cpp.
.PP
References d.
.PP
Referenced by KXMLGUIClient().
.SS "void KXMLGUIClient::removeChildClient (\fBKXMLGUIClient\fP * child)"
.PP
Removes the given \fCchild\fP from the client's children list. Definition at line 566 of file kxmlguiclient.cpp.
.PP
References d.
.SS "const  \fBQPtrList\fP< \fBKXMLGUIClient\fP > * KXMLGUIClient::childClients ()"
.PP
Retrieves a list of all child clients. Definition at line 581 of file kxmlguiclient.cpp.
.PP
Referenced by KXMLGUIFactory::addClient(), and KXMLGUIFactory::removeClient().
.SS "void KXMLGUIClient::setClientBuilder (\fBKXMLGUIBuilder\fP * builder)"
.PP
A client can have an own \fBKXMLGUIBuilder\fP. Use this method to assign your builder instance to the client (so that the \fBKXMLGUIFactory\fP can use it when building the client's GUI)
.PP
Client specific guibuilders are useful if you want to create custom container widgets for your GUI. Definition at line 586 of file kxmlguiclient.cpp.
.PP
References instance(), and KXMLGUIBuilder::setBuilderInstance().
.SS "\fBKXMLGUIBuilder\fP * KXMLGUIClient::clientBuilder () const"
.PP
Retrieves the client's GUI builder or 0L if no client specific builder has been assigned via \fBsetClientBuilder\fP(). Definition at line 593 of file kxmlguiclient.cpp.
.PP
Referenced by KXMLGUIFactory::addClient(), and KXMLGUIFactory::removeClient().
.SS "void KXMLGUIClient::reloadXML ()"
.PP
Forces this client to re-read its XML resource file. This is intended to be used when you know that the resource file has changed and you will soon be rebuilding the GUI. It has no useful effect with non-KParts GUIs, so don't bother using it unless your app is component based. Definition at line 148 of file kxmlguiclient.cpp.
.PP
References QString::isEmpty(), setXMLFile(), and xmlFile().
.SS "void KXMLGUIClient::plugActionList (const \fBQString\fP & name, const \fBQPtrList\fP< \fBKAction\fP > & actionList)"
.PP
ActionLists are a way for XMLGUI to support dynamic lists of actions. E.g. if you are writing a file manager, and there is a menu file whose contents depend on the mimetype of the file that is selected, then you can achieve this using ActionLists. It works as follows: In your xxxui.rc file ( the one that you set in \fBsetXMLFile\fP() ), you put an  tag. E.g. 
.PP
.nf

   * <kpartgui name="xxx_part" version="1">
   * <MenuBar>
   *   <Menu name="file">
   *     ...  <!-- some useful actions-->
   *     <ActionList name="xxx_file_actionlist" />
   *     ...  <!-- even more useful actions-->
   *   </Menu>
   *   ...
   * </MenuBar>
   * </kpartgui>
   * 
.PP
.PP
This tag will get expanded to a list of actions. In the example above ( a file manager with a dynamic file menu ), you would call 
.PP
.nf
 QPtrList<KAction> file_actions;
 for( ... )
   if( ... )
     file_actions.append( cool_action );
 unplugActionList( 'xxx_file_actionlist' );
 plugActionList( 'xxx_file_actionlist', file_actions );

.PP
every time a file is selected, unselected or ...
.PP
\fBNote:\fP
.RS 4
You should not call createGUI() after calling this function. In fact, that would remove the newly added actionlists again... 
.PP
Forgetting to call \fBunplugActionList()\fP before \fBplugActionList()\fP would leave the previous actions in the menu too.. 
.RE
.PP

.PP
Definition at line 598 of file kxmlguiclient.cpp.
.PP
References KStdAccel::name().
.SS "void KXMLGUIClient::unplugActionList (const \fBQString\fP & name)"
.PP
The complement of \fBplugActionList\fP() ... Definition at line 606 of file kxmlguiclient.cpp.
.PP
References KStdAccel::name().
.SS "void KXMLGUIClient::beginXMLPlug (\fBQWidget\fP *)"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 914 of file kxmlguiclient.cpp.
.PP
References actionCollection(), KActionCollection::beginXMLPlug(), and QPtrListIterator::current().
.PP
Referenced by KXMLGUIFactory::addClient().
.SS "void KXMLGUIClient::endXMLPlug ()"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 922 of file kxmlguiclient.cpp.
.PP
References actionCollection(), QPtrListIterator::current(), and KActionCollection::endXMLPlug().
.PP
Referenced by KXMLGUIFactory::addClient().
.SS "void KXMLGUIClient::prepareXMLUnplug (\fBQWidget\fP *)"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 930 of file kxmlguiclient.cpp.
.PP
References actionCollection(), QPtrListIterator::current(), and KActionCollection::prepareXMLUnplug().
.PP
Referenced by KXMLGUIFactory::removeClient().
.SS "void KXMLGUIClient::setInstance (\fBKInstance\fP * instance)\fC [protected, virtual]\fP"
.PP
Sets the instance (\fBKInstance\fP) for this part. Call this first in the inherited class constructor. (At least before \fBsetXMLFile\fP().) Definition at line 155 of file kxmlguiclient.cpp.
.PP
References actionCollection(), KNotifyClient::instance(), and KActionCollection::setInstance().
.SS "void KXMLGUIClient::setXMLFile (const \fBQString\fP & file, bool merge = false, bool setXMLDoc = true)\fC [protected, virtual]\fP"
.PP
Sets the name of the rc file containing the XML for the part. Call this in the Part-inherited class constructor.
.PP
\fBParameters:\fP
.RS 4
\fIfile\fP Either an absolute path for the file, or simply the filename, which will then be assumed to be installed in the 'data' resource, under a directory named like the instance. 
.br
\fIsetXML\fP Specify whether to call setXML. Default is true. and the DOM document at once. 
.RE
.PP
Definition at line 163 of file kxmlguiclient.cpp.
.PP
References actionCollection(), KInstance::dirs(), KStandardDirs::findAllResources(), QString::fromLatin1(), instance(), QString::isEmpty(), QString::isNull(), setXML(), and KActionCollection::setXMLFile().
.PP
Referenced by KMainWindow::createGUI(), KEditToolbarWidget::KEditToolbarWidget(), reloadXML(), and KEditToolbarWidget::save().
.SS "void KXMLGUIClient::setXML (const \fBQString\fP & document, bool merge = false)\fC [protected, virtual]\fP"
.PP
Sets the XML for the part. Call this in the Part-inherited class constructor if you don't call \fBsetXMLFile\fP(). Definition at line 209 of file kxmlguiclient.cpp.
.PP
References QDomDocument::setContent(), and setDOMDocument().
.PP
Referenced by KEditToolbarWidget::KEditToolbarWidget(), and setXMLFile().
.SS "void KXMLGUIClient::setDOMDocument (const \fBQDomDocument\fP & document, bool merge = false)\fC [protected, virtual]\fP"
.PP
Sets the Document for the part, describing the layout of the GUI. Call this in the Part-inherited class constructor if you don't call \fBsetXMLFile\fP or \fBsetXML\fP . Definition at line 216 of file kxmlguiclient.cpp.
.PP
References actionCollection(), QDomDocument::documentElement(), and KXMLGUIFactory::removeDOMComments().
.PP
Referenced by setXML().
.SS "void KXMLGUIClient::conserveMemory ()\fC [protected, virtual]\fP"
.PP
This function will attempt to give up some memory after the GUI is built. It should never be used in apps where the GUI may be rebuilt at some later time (components, for instance). Definition at line 527 of file kxmlguiclient.cpp.
.PP
Referenced by KMainWindow::createGUI().
.SS "void KXMLGUIClient::stateChanged (const \fBQString\fP & newstate, ReverseStateChange reverse = StateNoReverse)\fC [protected, virtual]\fP"
.PP
Actions can collectively be assigned a 'State'. To accomplish this the respective actions are tagged as  or  in a   group of the XMLfile. During program execution the programmer can call \fBstateChanged()\fP to set actions to a defined state.
.PP
\fBParameters:\fP
.RS 4
\fInewstate\fP Name of a State in the XMLfile. 
.br
\fIreverse\fP If the flag reverse is set to StateReverse, the State is reversed. (actions to be enabled will be disabled and action to be disabled will be enabled) Default is reverse=false. 
.RE
.PP
Definition at line 887 of file kxmlguiclient.cpp.
.PP
References KStdAccel::action(), KActionCollection::action(), action(), and actionCollection().
.PP
Referenced by KMainWindow::slotStateChanged().

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