KXmlGui

kxmlguibuilder.h
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 2000 Simon Hausmann <[email protected]>
4  SPDX-FileCopyrightText: 2000 David Faure <[email protected]>
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 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  */
33 class KXMLGUI_EXPORT KXMLGUIBuilder
34 {
35 public:
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 #if KXMLGUI_BUILD_DEPRECATED_SINCE(5, 0)
74  // KF6 TODO: REMOVE
75  /// @internal
76  /// @deprecated Since 5.0, do not use
77  KXMLGUI_DEPRECATED_VERSION(5, 0, "Do not use")
78  virtual void removeCustomElement(QWidget *parent, QAction *action);
79 #endif
80 
81  virtual void finalizeGUI(KXMLGUIClient *client);
82 
83 protected:
84  virtual void virtual_hook(int id, void *data);
85 
86 private:
87  std::unique_ptr<KXMLGUIBuilderPrivate> const d;
88 };
89 
90 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Sep 26 2023 04:02:38 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.