| 1 |
/*************************************************************************** |
| 2 |
* Copyright (c) 2024 Florian Foinant-Willig <[email protected]> * |
| 3 |
* * |
| 4 |
* This file is part of the FreeCAD CAx development system. * |
| 5 |
* * |
| 6 |
* This library is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Library General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 |
* GNU Library General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Library General Public * |
| 17 |
* License along with this library; see the file COPYING.LIB. If not, * |
| 18 |
* write to the Free Software Foundation, Inc., 59 Temple Place, * |
| 19 |
* Suite 330, Boston, MA 02111-1307, USA * |
| 20 |
* * |
| 21 |
***************************************************************************/ |
| 22 |
|
| 23 |
#ifndef SUPPRESSIBLEEXTENSION_H |
| 24 |
#define SUPPRESSIBLEEXTENSION_H |
| 25 |
|
| 26 |
#include <App/DocumentObject.h> |
| 27 |
#include <App/DocumentObjectExtension.h> |
| 28 |
#include <App/ExtensionPython.h> |
| 29 |
|
| 30 |
namespace App |
| 31 |
{ |
| 32 |
class SuppressibleExtensionPy; |
| 33 |
|
| 34 |
class AppExport SuppressibleExtension: public DocumentObjectExtension |
| 35 |
{ |
| 36 |
EXTENSION_PROPERTY_HEADER_WITH_OVERRIDE(App::SuppressibleExtension); |
| 37 |
using inherited = DocumentObjectExtension; |
| 38 |
|
| 39 |
public: |
| 40 |
/// Constructor |
| 41 |
SuppressibleExtension(); |
| 42 |
~SuppressibleExtension() override; |
| 43 |
|
| 44 |
PyObject* getExtensionPyObject() override; |
| 45 |
|
| 46 |
/// Properties |
| 47 |
PropertyBool Suppressed; |
| 48 |
}; |
| 49 |
|
| 50 |
template<typename ExtensionT> |
| 51 |
class SuppressibleExtensionPythonT: public ExtensionT |
| 52 |
{ |
| 53 |
|
| 54 |
public: |
| 55 |
SuppressibleExtensionPythonT() = default; |
| 56 |
~SuppressibleExtensionPythonT() override = default; |
| 57 |
}; |
| 58 |
|
| 59 |
using SuppressibleExtensionPython = |
| 60 |
ExtensionPythonT<SuppressibleExtensionPythonT<SuppressibleExtension>>; |
| 61 |
|
| 62 |
} // namespace App |
| 63 |
|
| 64 |
#endif // SUPPRESSIBLEEXTENSION_H |