| 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 | |
| 17 | class KXMLGUIBuilderPrivate; |
| 18 | class KXMLGUIClient; |
| 19 | |
| 20 | class QAction; |
| 21 | class QDomElement; |
| 22 | class QWidget; |
| 23 | |
| 24 | /*! |
| 25 | * \class KXMLGUIBuilder |
| 26 | * \inmodule KXmlGui |
| 27 | * |
| 28 | * Implements the creation of the GUI (menubar, menus and toolbars) |
| 29 | * as requested by the GUI factory. |
| 30 | * |
| 31 | * The virtual methods are mostly for historical reasons, there isn't really |
| 32 | * a need to derive from KXMLGUIBuilder anymore. |
| 33 | */ |
| 34 | class KXMLGUI_EXPORT KXMLGUIBuilder |
| 35 | { |
| 36 | public: |
| 37 | /*! |
| 38 | * \brief Constructs a new KXMLGUIBuilder object from \a widget. |
| 39 | */ |
| 40 | explicit KXMLGUIBuilder(QWidget *widget); |
| 41 | /*! |
| 42 | * \brief Destructor. |
| 43 | */ |
| 44 | virtual ~KXMLGUIBuilder(); |
| 45 | |
| 46 | /* \internal */ |
| 47 | KXMLGUIClient *builderClient() const; |
| 48 | /* \internal */ |
| 49 | void setBuilderClient(KXMLGUIClient *client); |
| 50 | /* \internal */ |
| 51 | QWidget *widget(); |
| 52 | |
| 53 | virtual QStringList containerTags() const; |
| 54 | |
| 55 | /*! |
| 56 | * \brief Creates a container (menubar/menu/toolbar/statusbar/separator/...) |
| 57 | * from an \a element at \a index in the XML file. |
| 58 | * |
| 59 | * \a parent The parent for the container. |
| 60 | * |
| 61 | * \a index The index where the container should be inserted |
| 62 | * into the parent container/widget. |
| 63 | * |
| 64 | * \a element The element from the DOM tree describing the |
| 65 | * container (use it to access container specified attributes |
| 66 | * or child elements). |
| 67 | * |
| 68 | * \a containerAction The action created for this container; |
| 69 | * used for e.g. passing to removeContainer. |
| 70 | */ |
| 71 | virtual QWidget *createContainer(QWidget *parent, int index, const QDomElement &element, QAction *&containerAction); |
| 72 | |
| 73 | /*! |
| 74 | * \brief Removes the given \a container. |
| 75 | * |
| 76 | * \a parent The parent for the container. |
| 77 | * |
| 78 | * \a element The element from the DOM tree describing the container |
| 79 | * (use it to access container specified attributes or child elements). |
| 80 | * |
| 81 | * \a containerAction The action created for this container. |
| 82 | */ |
| 83 | virtual void removeContainer(QWidget *container, QWidget *parent, QDomElement &element, QAction *containerAction); |
| 84 | |
| 85 | virtual QStringList customTags() const; |
| 86 | |
| 87 | virtual QAction *createCustomElement(QWidget *parent, int index, const QDomElement &element); |
| 88 | |
| 89 | virtual void finalizeGUI(KXMLGUIClient *client); |
| 90 | |
| 91 | protected: |
| 92 | virtual void virtual_hook(int id, void *data); |
| 93 | |
| 94 | private: |
| 95 | std::unique_ptr<KXMLGUIBuilderPrivate> const d; |
| 96 | }; |
| 97 | |
| 98 | #endif |
| 99 | |