kxmlguifactory.h
// -*- mode: c++; c-basic-offset: 2 -*-
/* This file is part of the KDE libraries
Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
Copyright (C) 2000 Kurt Granroth <granroth@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kxmlguifactory_h__
#define __kxmlguifactory_h__
#include <qobject.h>
#include <qptrlist.h>
#include <qdom.h>
#include <qvaluelist.h>
#include <kdelibs_export.h>
class KAction;
class KXMLGUIFactoryPrivate;
class KXMLGUIClient;
class KXMLGUIBuilder;
class KInstance;
namespace KXMLGUI
{
struct MergingIndex;
struct ContainerNode;
struct ContainerClient;
class BuildHelper;
}
class KDEUI_EXPORT KXMLGUIFactory : public QObject
{
friend class KXMLGUI::BuildHelper;
Q_OBJECT
public:
KXMLGUIFactory( KXMLGUIBuilder *builder, QObject *parent = 0, const char *name = 0 );
~KXMLGUIFactory();
// XXX move to somewhere else? (Simon)
static QString readConfigFile( const QString &filename, bool never_null, const KInstance *instance = 0 );
static QString readConfigFile( const QString &filename, const KInstance *instance = 0 );
static bool saveConfigFile( const QDomDocument& doc, const QString& filename,
const KInstance *instance = 0 );
static QString documentToXML( const QDomDocument& doc );
static QString elementToXML( const QDomElement& elem );
static void removeDOMComments( QDomNode &node );
static QDomElement actionPropertiesElement( QDomDocument& doc );
static QDomElement findActionByName( QDomElement& elem, const QString& sName, bool create );
void addClient( KXMLGUIClient *client );
void removeClient( KXMLGUIClient *client );
void plugActionList( KXMLGUIClient *client, const QString &name, const QPtrList<KAction> &actionList );
void unplugActionList( KXMLGUIClient *client, const QString &name );
QPtrList<KXMLGUIClient> clients() const;
QWidget *container( const QString &containerName, KXMLGUIClient *client, bool useTagName = false );
QPtrList<QWidget> containers( const QString &tagName );
void reset();
void resetContainer( const QString &containerName, bool useTagName = false );
public slots:
int configureShortcuts(bool bAllowLetterShortcuts = true, bool bSaveSettings = true);
signals:
void clientAdded( KXMLGUIClient *client );
void clientRemoved( KXMLGUIClient *client );
private:
QWidget *findRecursive( KXMLGUI::ContainerNode *node, bool tag );
QPtrList<QWidget> findRecursive( KXMLGUI::ContainerNode *node, const QString &tagName );
void applyActionProperties( const QDomElement &element );
void configureAction( KAction *action, const QDomNamedNodeMap &attributes );
void configureAction( KAction *action, const QDomAttr &attribute );
protected:
virtual void virtual_hook( int id, void* data );
private:
KXMLGUIFactoryPrivate *d;
};
#endif
/* vim: et sw=4
*/
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:43
KXMLGUIBuilder
Abstract interface for a "GUI builder", used by the GUIFactory This interface is implemented by KMain...
Definition: kxmlguibuilder.h:39
KInstance
KXMLGUIFactory
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets...
Definition: kxmlguifactory.h:62
KAction
Class to encapsulate user-driven action or event.
Definition: kaction.h:202

KDE Home | KDE Accessibility Home | Description of Access Keys