Debian Codegraph @

src/Gui/SoFCColorBarNotifier.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2
3 /***************************************************************************
4 * Copyright (c) 2024 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 #ifndef GUI_SOFCCOLORBARNOTIFIER_H
25 #define GUI_SOFCCOLORBARNOTIFIER_H
26
27 #include <Base/Parameter.h>
28 #include <set>
29
30 namespace Gui
31 {
32
33 class SoFCColorBarBase;
34
35 class GuiExport SoFCColorBarNotifier: public ParameterGrp::ObserverType // NOLINT
36 {
37 public:
38 static SoFCColorBarNotifier& instance();
39 void attach(SoFCColorBarBase* bar);
40 void detach(SoFCColorBarBase* bar);
41 void OnChange(ParameterGrp::SubjectType& caller, ParameterGrp::MessageType reason) override;
42
43 private:
44 SoFCColorBarNotifier();
45 ~SoFCColorBarNotifier() override = default;
46
47 FC_DISABLE_COPY_MOVE(SoFCColorBarNotifier)
48
49 private:
50 std::set<SoFCColorBarBase*> bars;
51 ParameterGrp::handle group;
52 };
53
54 } // namespace Gui
55
56
57 #endif // GUI_SOFCCOLORBARNOTIFIER_H