KXmlGui

kxmlguibuilder.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2000 Simon Hausmann <hausmann@kde.org>
4 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef kxmlguibuilder_h
10#define kxmlguibuilder_h
11
12#include <kxmlgui_export.h>
13#include <memory>
14
15#include <QStringList>
16
17class KXMLGUIBuilderPrivate;
18class KXMLGUIClient;
19
20class QAction;
21class QDomElement;
22class QWidget;
23
24/**
25 * @class KXMLGUIBuilder kxmlguibuilder.h KXMLGUIBuilder
26 *
27 * Implements the creation of the GUI (menubar, menus and toolbars)
28 * as requested by the GUI factory.
29 *
30 * The virtual methods are mostly for historical reasons, there isn't really
31 * a need to derive from KXMLGUIBuilder anymore.
32 */
33class KXMLGUI_EXPORT KXMLGUIBuilder
34{
35public:
36 explicit KXMLGUIBuilder(QWidget *widget);
37 virtual ~KXMLGUIBuilder();
38
39 /* @internal */
40 KXMLGUIClient *builderClient() const;
41 /* @internal */
42 void setBuilderClient(KXMLGUIClient *client);
43 /* @internal */
44 QWidget *widget();
45
46 virtual QStringList containerTags() const;
47
48 /**
49 * Creates a container (menubar/menu/toolbar/statusbar/separator/...)
50 * from an element in the XML file
51 *
52 * @param parent The parent for the container
53 * @param index The index where the container should be inserted
54 * into the parent container/widget
55 * @param element The element from the DOM tree describing the
56 * container (use it to access container specified
57 * attributes or child elements)
58 * @param action The action created for this container; used for e.g. passing to removeContainer.
59 */
60 virtual QWidget *createContainer(QWidget *parent, int index, const QDomElement &element, QAction *&containerAction);
61
62 /**
63 * Removes the given (and previously via createContainer )
64 * created container.
65 *
66 */
67 virtual void removeContainer(QWidget *container, QWidget *parent, QDomElement &element, QAction *containerAction);
68
69 virtual QStringList customTags() const;
70
71 virtual QAction *createCustomElement(QWidget *parent, int index, const QDomElement &element);
72
73 virtual void finalizeGUI(KXMLGUIClient *client);
74
75protected:
76 virtual void virtual_hook(int id, void *data);
77
78private:
79 std::unique_ptr<KXMLGUIBuilderPrivate> const d;
80};
81
82#endif
Implements the creation of the GUI (menubar, menus and toolbars) as requested by the GUI factory.
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document,...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.