1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org> |
4 | SPDX-FileCopyrightText: 1999 David Faure <faure@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef _KPARTS_PARTBASE_H |
10 | #define _KPARTS_PARTBASE_H |
11 | |
12 | #include <kparts/kparts_export.h> |
13 | |
14 | #include <QObject> |
15 | |
16 | #include <KXMLGUIClient> |
17 | #include <memory> |
18 | |
19 | // Internal: |
20 | // As KParts::PartBase is inherited by KParts::Part which also inheriting from QObject, |
21 | // which already has a protected d_ptr member, the macro Q_DECLARE_PRIVATE cannot be used |
22 | // as it references d_ptr without any class qualifier, which is ambiguous then. |
23 | #define KPARTS_DECLARE_PRIVATE(Class) Q_DECLARE_PRIVATE_D(PartBase::d_ptr, Class) |
24 | |
25 | namespace KParts |
26 | { |
27 | class PartBasePrivate; |
28 | |
29 | /** |
30 | * @class PartBase partbase.h <KParts/PartBase> |
31 | * |
32 | * @short Base class for all parts. |
33 | */ |
34 | class KPARTS_EXPORT PartBase : virtual public KXMLGUIClient |
35 | { |
36 | KPARTS_DECLARE_PRIVATE(PartBase) |
37 | |
38 | public: |
39 | /** |
40 | * Constructor. |
41 | */ |
42 | PartBase(); |
43 | |
44 | /** |
45 | * Destructor. |
46 | */ |
47 | ~PartBase() override; |
48 | |
49 | /** |
50 | * Internal method. Called by KParts::Part to specify the parent object for plugin objects. |
51 | * |
52 | * @internal |
53 | */ |
54 | void setPartObject(QObject *object); |
55 | QObject *partObject() const; |
56 | |
57 | protected: |
58 | KPARTS_NO_EXPORT explicit PartBase(PartBasePrivate &dd); |
59 | |
60 | std::unique_ptr<PartBasePrivate> const d_ptr; |
61 | |
62 | private: |
63 | Q_DISABLE_COPY(PartBase) |
64 | }; |
65 | |
66 | } // namespace |
67 | |
68 | #endif |
69 | |