• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
KXMLGUIFactory Class Reference

#include <kxmlguifactory.h>

Inherits TQObject.

Public Slots

int configureShortcuts (bool bAllowLetterShortcuts=true, bool bSaveSettings=true)
 

Signals

void clientAdded (KXMLGUIClient *client)
 
void clientRemoved (KXMLGUIClient *client)
 

Public Member Functions

 KXMLGUIFactory (KXMLGUIBuilder *builder, TQObject *parent=0, const char *name=0)
 
 ~KXMLGUIFactory ()
 
void addClient (KXMLGUIClient *client)
 
void removeClient (KXMLGUIClient *client)
 
void plugActionList (KXMLGUIClient *client, const TQString &name, const TQPtrList< TDEAction > &actionList)
 
void unplugActionList (KXMLGUIClient *client, const TQString &name)
 
TQPtrList< KXMLGUIClient > clients () const
 
TQWidget * container (const TQString &containerName, KXMLGUIClient *client, bool useTagName=false)
 
TQPtrList< TQWidget > containers (const TQString &tagName)
 
void reset ()
 
void resetContainer (const TQString &containerName, bool useTagName=false)
 

Static Public Member Functions

static TQString readConfigFile (const TQString &filename, bool never_null, const TDEInstance *instance=0)
 
static TQString readConfigFile (const TQString &filename, const TDEInstance *instance=0)
 
static bool saveConfigFile (const TQDomDocument &doc, const TQString &filename, const TDEInstance *instance=0)
 
static TQString documentToXML (const TQDomDocument &doc)
 
static TQString elementToXML (const TQDomElement &elem)
 
static void removeDOMComments (TQDomNode &node)
 
static TQDomElement actionPropertiesElement (TQDomDocument &doc)
 
static TQDomElement findActionByName (TQDomElement &elem, const TQString &sName, bool create)
 

Protected Member Functions

virtual void virtual_hook (int id, void *data)
 

Friends

class KXMLGUI::BuildHelper
 

Detailed Description

KXMLGUIFactory, together with KXMLGUIClient 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 KXMLGUIClient represents a part of the GUI, composed from containers and actions. KXMLGUIFactory takes care of building (with the help of a KXMLGUIBuilder) and merging the GUI from an unlimited number of clients.

Each client provides XML through a TQDomDocument and actions through a TDEActionCollection . The XML document contains the rules for how to merge the GUI.

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 KXMLGUIBuilder , which has to be provided with the KXMLGUIFactory constructor.

Definition at line 61 of file kxmlguifactory.h.

Constructor & Destructor Documentation

◆ KXMLGUIFactory()

KXMLGUIFactory::KXMLGUIFactory ( KXMLGUIBuilder *  builder,
TQObject *  parent = 0,
const char *  name = 0 
)

Constructs a KXMLGUIFactory.

The provided builder KXMLGUIBuilder will be called for creating and removing container widgets, when clients are added/removed from the GUI.

Note that the ownership of the given KXMLGUIBuilder object won't be transferred to this KXMLGUIFactory, so you have to take care of deleting it properly.

Definition at line 206 of file kxmlguifactory.cpp.

◆ ~KXMLGUIFactory()

KXMLGUIFactory::~KXMLGUIFactory ( )

Destructor.

Definition at line 219 of file kxmlguifactory.cpp.

Member Function Documentation

◆ actionPropertiesElement()

TQDomElement KXMLGUIFactory::actionPropertiesElement ( TQDomDocument &  doc)
static

Find or create the ActionProperties element, used when saving custom action properties

Definition at line 567 of file kxmlguifactory.cpp.

◆ addClient()

void KXMLGUIFactory::addClient ( KXMLGUIClient *  client)

Creates the GUI described by the TQDomDocument of the client, using the client's actions, and merges it with the previously created GUI.

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.

Definition at line 224 of file kxmlguifactory.cpp.

◆ clients()

TQPtrList< KXMLGUIClient > KXMLGUIFactory::clients ( ) const

Returns a list of all clients currently added to this factory.

Definition at line 379 of file kxmlguifactory.cpp.

◆ configureShortcuts

int KXMLGUIFactory::configureShortcuts ( bool  bAllowLetterShortcuts = true,
bool  bSaveSettings = true 
)
slot

Show a standard configure shortcut for every action in this factory.

This slot can be connected dirrectly to the action to configure shortcuts. This is very simple to do that by adding a single line

KStdAction::keyBindings( guiFactory(), TQ_SLOT( configureShortcuts() ), actionCollection() );
KXMLGUIFactory::configureShortcuts
int configureShortcuts(bool bAllowLetterShortcuts=true, bool bSaveSettings=true)
Show a standard configure shortcut for every action in this factory.
Definition: kxmlguifactory.cpp:553
KStdAction::keyBindings
TDEAction * keyBindings(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name)
Display the configure key bindings dialog.
Definition: kstdaction.cpp:298
Parameters
bAllowLetterShortcutsSet to false if unmodified alphanumeric keys ('A', '1', etc.) are not permissible shortcuts.
bSaveSettingsif true, the settings will also be saved back to the *uirc file which they were intially read from.
Since
3.3

Definition at line 553 of file kxmlguifactory.cpp.

◆ container()

TQWidget * KXMLGUIFactory::container ( const TQString &  containerName,
KXMLGUIClient *  client,
bool  useTagName = false 
)

Use this method to get access to a container widget with the name specified with containerName and which is owned by the client.

The container name is specified with a "name" attribute in the XML document.

This function is particularly useful for getting hold of a popupmenu defined in an XMLUI file. For instance:

TQPopupMenu *popup = static_cast<TQPopupMenu*>(factory()->container("my_popup",this));

where "my_popup" is the name of the menu in the XMLUI file, and "this" is XMLGUIClient which owns the popupmenu (e.g. the mainwindow, or the part, or the plugin...)

Parameters
containerNameName of the container widget
clientOwner of the container widget
useTagNameSpecifies whether to compare the specified name with the name attribute or the tag name.

This method may return 0L if no container with the given name exists or is not owned by the client.

Definition at line 384 of file kxmlguifactory.cpp.

◆ containers()

TQPtrList< TQWidget > KXMLGUIFactory::containers ( const TQString &  tagName)

Definition at line 401 of file kxmlguifactory.cpp.

◆ documentToXML()

TQString KXMLGUIFactory::documentToXML ( const TQDomDocument &  doc)
static

Definition at line 168 of file kxmlguifactory.cpp.

◆ elementToXML()

TQString KXMLGUIFactory::elementToXML ( const TQDomElement &  elem)
static

Definition at line 177 of file kxmlguifactory.cpp.

◆ findActionByName()

TQDomElement KXMLGUIFactory::findActionByName ( TQDomElement &  elem,
const TQString &  sName,
bool  create 
)
static

Find or create the element for a given action, by name. Used when saving custom action properties

Definition at line 589 of file kxmlguifactory.cpp.

◆ plugActionList()

void KXMLGUIFactory::plugActionList ( KXMLGUIClient *  client,
const TQString &  name,
const TQPtrList< TDEAction > &  actionList 
)

Definition at line 470 of file kxmlguifactory.cpp.

◆ readConfigFile() [1/2]

TQString KXMLGUIFactory::readConfigFile ( const TQString &  filename,
bool  never_null,
const TDEInstance *  instance = 0 
)
static

Definition at line 104 of file kxmlguifactory.cpp.

◆ readConfigFile() [2/2]

TQString KXMLGUIFactory::readConfigFile ( const TQString &  filename,
const TDEInstance *  instance = 0 
)
static

Definition at line 99 of file kxmlguifactory.cpp.

◆ removeClient()

void KXMLGUIFactory::removeClient ( KXMLGUIClient *  client)

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)

Definition at line 321 of file kxmlguifactory.cpp.

◆ removeDOMComments()

void KXMLGUIFactory::removeDOMComments ( TQDomNode &  node)
static

Removes all TQDomComment objects from the specified node and all its children.

Definition at line 186 of file kxmlguifactory.cpp.

◆ reset()

void KXMLGUIFactory::reset ( )

Use this method to free all memory allocated by the KXMLGUIFactory.

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 :-)

(also note that this will call KXMLGUIClient::setFactory( 0L ) for all inserted clients)

Definition at line 406 of file kxmlguifactory.cpp.

◆ resetContainer()

void KXMLGUIFactory::resetContainer ( const TQString &  containerName,
bool  useTagName = false 
)

Use this method to free all memory allocated by the KXMLGUIFactory for a specific container, including all child containers and actions.

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 :-)

(also note that this will call KXMLGUIClient::setFactory( 0L ) for all clients of the container)

Definition at line 413 of file kxmlguifactory.cpp.

◆ saveConfigFile()

bool KXMLGUIFactory::saveConfigFile ( const TQDomDocument &  doc,
const TQString &  filename,
const TDEInstance *  instance = 0 
)
static

Definition at line 142 of file kxmlguifactory.cpp.

◆ unplugActionList()

void KXMLGUIFactory::unplugActionList ( KXMLGUIClient *  client,
const TQString &  name 
)

Definition at line 485 of file kxmlguifactory.cpp.

◆ virtual_hook()

void KXMLGUIFactory::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 608 of file kxmlguifactory.cpp.

Friends And Related Function Documentation

◆ KXMLGUI::BuildHelper

friend class KXMLGUI::BuildHelper
friend

Definition at line 63 of file kxmlguifactory.h.


The documentation for this class was generated from the following files:
  • kxmlguifactory.h
  • kxmlguifactory.cpp

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.