Debian Codegraph @

src/Gui/Inventor/SoToggleSwitch.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /****************************************************************************
3 * *
4 * Copyright (c) 2025 Sayantan Deb <sayantandebin[at]gmail.com> *
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 SO_TOGGLE_SWITCH
25 #define SO_TOGGLE_SWITCH
26
27 #include <FCGlobal.h>
28
29 #include <Inventor/fields/SoSFBool.h>
30 #include <Inventor/nodes/SoSwitch.h>
31
32 #include <FCGlobal.h>
33
34 /**
35 * A switch that can be used to show or hide all child nodes
36 */
37 class GuiExport SoToggleSwitch: public SoSwitch
38 {
39 SO_NODE_HEADER(SoToggleSwitch);
40
41 public:
42 static void initClass();
43 SoToggleSwitch();
44
45 // the switch is on be default
46 SoSFBool on;
47 // toggles the switch state
48 void toggle();
49
50 protected:
51 ~SoToggleSwitch() override = default;
52
53 void notify(SoNotList* notList) override;
54
55 private:
56 using inherited = SoSwitch;
57 };
58
59 #endif /* SO_TOGGLE_SWITCH */