Debian Codegraph @

src/Gui/WorkbenchManipulatorPython.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2
3 /***************************************************************************
4 * Copyright (c) 2023 Werner Mayer <wmayer[at]users.sourceforge.net> *
5 * *
6 * This file is part of FreeCAD. *
7 * *
8 * FreeCAD is free software: you can redistribute it and/or modify it *
9 * under the terms of the GNU Lesser General Public License as *
10 * published by the Free Software Foundation, either version 2.1 of the *
11 * License, or (at your option) any later version. *
12 * *
13 * FreeCAD is distributed in the hope that it will be useful, but *
14 * WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with FreeCAD. If not, see *
20 * <https://www.gnu.org/licenses/>. *
21 * *
22 **************************************************************************/
23
24
25 #ifndef GUI_WORKBENCHMANIPULATOR_PYTHON_H
26 #define GUI_WORKBENCHMANIPULATOR_PYTHON_H
27
28 #include <Gui/WorkbenchManipulator.h>
29 #include <CXX/Objects.hxx>
30
31 namespace Gui
32 {
33
34 /**
35 * The WorkbenchManipulatorPython class accepts an instance of a Python class
36 * that is supposed to implement any of the virtual functions.
37 * @author Werner Mayer
38 */
39 class GuiExport WorkbenchManipulatorPython: public WorkbenchManipulator
40 {
41 public:
42 static void installManipulator(const Py::Object& obj);
43 static void removeManipulator(const Py::Object& obj);
44 explicit WorkbenchManipulatorPython(const Py::Object& obj);
45 ~WorkbenchManipulatorPython() override;
46
47 protected:
48 /*!
49 * \brief modifyMenuBar
50 * Method to manipulate the menu structure of a workbench.
51 */
52 void modifyMenuBar(MenuItem* menuBar) override;
53 /*!
54 * \brief modifyContextMenu
55 * Method to manipulate the contextmenu structure of a workbench.
56 */
57 void modifyContextMenu(const char* recipient, MenuItem* menuBar) override;
58 /*!
59 * \brief modifyToolBars
60 * Method to manipulate the toolbar structure of a workbench
61 */
62 void modifyToolBars(ToolBarItem* toolBar) override;
63 /*!
64 * \brief modifyDockWindows
65 * Method to manipulate the dock window structure of a workbench
66 */
67 void modifyDockWindows(DockWindowItems* dockWindow) override;
68
69 public:
70 WorkbenchManipulatorPython(const WorkbenchManipulatorPython&) = delete;
71 WorkbenchManipulatorPython(WorkbenchManipulatorPython&&) = delete;
72 WorkbenchManipulatorPython& operator=(const WorkbenchManipulatorPython&) = delete;
73 WorkbenchManipulatorPython& operator=(WorkbenchManipulatorPython&&) = delete;
74
75 private:
76 void tryModifyMenuBar(MenuItem* menuBar);
77 void tryModifyMenuBar(const Py::Dict& dict, MenuItem* menuBar);
78 void tryModifyContextMenu(const char* recipient, MenuItem* menuBar);
79 void tryModifyContextMenu(const Py::Dict& dict, MenuItem* menuBar);
80 void tryModifyToolBar(ToolBarItem* toolBar);
81 void tryModifyToolBar(const Py::Dict& dict, ToolBarItem* toolBar);
82 void tryModifyDockWindows(DockWindowItems* menuBar);
83 void tryModifyDockWindows(const Py::Dict& dict, DockWindowItems* dockWindow);
84
85 private:
86 Py::Object object;
87 };
88
89 } // namespace Gui
90
91
92 #endif // GUI_WORKBENCHMANIPULATOR_PYTHON_H