Debian Codegraph @

src/Gui/WorkbenchManipulator.cpp

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 #include "WorkbenchManipulator.h"
26
27 using namespace Gui;
28
29 std::set<WorkbenchManipulator::Ptr> WorkbenchManipulator::manipulators; // NOLINT
30
31 void WorkbenchManipulator::installManipulator(const WorkbenchManipulator::Ptr& ptr)
32 {
33 manipulators.insert(ptr);
34 }
35
36 void WorkbenchManipulator::removeManipulator(const WorkbenchManipulator::Ptr& ptr)
37 {
38 auto it = manipulators.find(ptr);
39 if (it != manipulators.end()) {
40 manipulators.erase(it);
41 }
42 }
43
44 void WorkbenchManipulator::removeAll()
45 {
46 manipulators.clear();
47 }
48
49 std::set<WorkbenchManipulator::Ptr> WorkbenchManipulator::getManipulators()
50 {
51 return manipulators;
52 }
53
54 void WorkbenchManipulator::changeMenuBar(MenuItem* menuBar)
55 {
56 for (auto& it : manipulators) {
57 it->modifyMenuBar(menuBar);
58 }
59 }
60
61 void WorkbenchManipulator::changeContextMenu(const char* recipient, MenuItem* menuBar)
62 {
63 for (auto& it : manipulators) {
64 it->modifyContextMenu(recipient, menuBar);
65 }
66 }
67
68 void WorkbenchManipulator::changeToolBars(ToolBarItem* toolBar)
69 {
70 for (auto& it : manipulators) {
71 it->modifyToolBars(toolBar);
72 }
73 }
74
75 void WorkbenchManipulator::changeDockWindows(DockWindowItems* dockWindow)
76 {
77 for (auto& it : manipulators) {
78 it->modifyDockWindows(dockWindow);
79 }
80 }
81
82 void WorkbenchManipulator::modifyMenuBar([[maybe_unused]] MenuItem* menuBar)
83 {}
84
85 void WorkbenchManipulator::modifyContextMenu(
86 [[maybe_unused]] const char* recipient,
87 [[maybe_unused]] MenuItem* menuBar
88 )
89 {}
90
91 void WorkbenchManipulator::modifyToolBars([[maybe_unused]] ToolBarItem* toolBar)
92 {}
93
94 void WorkbenchManipulator::modifyDockWindows([[maybe_unused]] DockWindowItems* dockWindow)
95 {}