File indexing completed on 2024-06-09 04:26:05
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2000 Simon Hausmann <hausmann@kde.org> 0003 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 #ifndef kxmlguibuilder_h 0008 #define kxmlguibuilder_h 0009 0010 #include <kritawidgetutils_export.h> 0011 0012 class KisKXMLGUIBuilderPrivate; 0013 class KisKXMLGUIClient; 0014 0015 class QAction; 0016 class QDomElement; 0017 class QStringList; 0018 class QWidget; 0019 0020 /** 0021 * Implements the creation of the GUI (menubar, menus and toolbars) 0022 * as requested by the GUI factory. 0023 * 0024 * The virtual methods are mostly for historical reasons, there isn't really 0025 * a need to derive from KisKXMLGUIBuilder anymore. 0026 */ 0027 class KRITAWIDGETUTILS_EXPORT KisKXMLGUIBuilder 0028 { 0029 public: 0030 0031 explicit KisKXMLGUIBuilder(QWidget *widget); 0032 virtual ~KisKXMLGUIBuilder(); 0033 0034 /* @internal */ 0035 KisKXMLGUIClient *builderClient() const; 0036 /* @internal */ 0037 void setBuilderClient(KisKXMLGUIClient *client); 0038 /* @internal */ 0039 QWidget *widget(); 0040 0041 virtual QStringList containerTags() const; 0042 0043 /** 0044 * Creates a container (menubar/menu/toolbar/statusbar/separator/...) 0045 * from an element in the XML file 0046 * 0047 * @param parent The parent for the container 0048 * @param index The index where the container should be inserted 0049 * into the parent container/widget 0050 * @param element The element from the DOM tree describing the 0051 * container (use it to access container specified 0052 * attributes or child elements) 0053 * @param containerAction The action created for this container; used for e.g. passing to removeContainer. 0054 */ 0055 virtual QWidget *createContainer(QWidget *parent, int index, 0056 const QDomElement &element, QAction *&containerAction); 0057 0058 /** 0059 * Removes the given (and previously via createContainer ) 0060 * created container. 0061 * 0062 */ 0063 virtual void removeContainer(QWidget *container, QWidget *parent, 0064 QDomElement &element, QAction *containerAction); 0065 0066 virtual QStringList customTags() const; 0067 0068 virtual QAction *createCustomElement(QWidget *parent, int index, const QDomElement &element); 0069 0070 virtual void removeCustomElement(QWidget *parent, QAction *action); 0071 0072 virtual void finalizeGUI(KisKXMLGUIClient *client); 0073 0074 protected: 0075 virtual void virtual_hook(int id, void *data); 0076 private: 0077 KisKXMLGUIBuilderPrivate *const d; 0078 }; 0079 0080 #endif 0081