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 KParts::PartBase |
31 | * \inmodule KParts |
32 | * \inheaderfile KParts/PartBase |
33 | * |
34 | * \brief Base class for all parts. |
35 | */ |
36 | class KPARTS_EXPORT PartBase : virtual public KXMLGUIClient |
37 | { |
38 | KPARTS_DECLARE_PRIVATE(PartBase) |
39 | |
40 | public: |
41 | /*! |
42 | * Constructor. |
43 | */ |
44 | PartBase(); |
45 | |
46 | ~PartBase() override; |
47 | |
48 | /*! |
49 | * Internal method. Called by KParts::Part to specify the parent object for plugin objects. |
50 | * |
51 | * \internal |
52 | */ |
53 | void setPartObject(QObject *object); |
54 | QObject *partObject() const; |
55 | |
56 | protected: |
57 | KPARTS_NO_EXPORT explicit PartBase(PartBasePrivate &dd); |
58 | |
59 | std::unique_ptr<PartBasePrivate> const d_ptr; |
60 | |
61 | private: |
62 | Q_DISABLE_COPY(PartBase) |
63 | }; |
64 | |
65 | } // namespace |
66 | |
67 | #endif |
68 | |